Skip to content

refactor!: Make user_prompt required in LLM#11152

Merged
julian-risch merged 1 commit intomainfrom
llm-user-prompt-required
Apr 20, 2026
Merged

refactor!: Make user_prompt required in LLM#11152
julian-risch merged 1 commit intomainfrom
llm-user-prompt-required

Conversation

@sjrl
Copy link
Copy Markdown
Contributor

@sjrl sjrl commented Apr 20, 2026

Related Issues

Proposed Changes:

Came about from a discussion with @julian-risch about making the LLM component more reliable when scheduled in a pipeline. We decided to go forward with the breaking change because it's a relatively new component. We do acknowledge this means that it won't be possible to just run this component with a messages input but from what we understand the desired pathway for platform use is to use the user_prompt.

The LLM component now requires user_prompt to be provided at initialization and it must contain at least one Jinja2 template variable (e.g. {{ variable_name }}). This ensures the component always exposes at least one required input socket, which is necessary for correct pipeline scheduling.

  • required_variables now defaults to "*" (all variables in user_prompt are required), and passing an empty list raises a ValueError.

How did you test it?

New tests and updated old ones

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@sjrl sjrl self-assigned this Apr 20, 2026
@sjrl sjrl requested a review from a team as a code owner April 20, 2026 12:06
@sjrl sjrl requested review from anakin87 and removed request for a team April 20, 2026 12:06
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
haystack-docs Ignored Ignored Apr 20, 2026 0:06am

Request Review

@sjrl sjrl requested a review from julian-risch April 20, 2026 12:06
@github-actions github-actions Bot added the type:documentation Improvements on the docs label Apr 20, 2026
Copy link
Copy Markdown
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Looking at dc-pipeline-templates, required_variables isn't set in all pipelines, for example a quick search found https://github.com/deepset-ai/dc-pipeline-templates/pull/338/changes#diff-a5088c42299eda596ed218f47073d35f457cfd204e60e4475eed668511defb14R264

@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 24665547890

Warning

No base build found for commit 9e1dcb8 on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 92.857%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 17177
Covered Lines: 15950
Line Coverage: 92.86%
Coverage Strength: 0.93 hits per line

💛 - Coveralls

@sjrl
Copy link
Copy Markdown
Contributor Author

sjrl commented Apr 20, 2026

Looks good to me! Looking at dc-pipeline-templates, required_variables isn't set in all pipelines, for example a quick search found https://github.com/deepset-ai/dc-pipeline-templates/pull/338/changes#diff-a5088c42299eda596ed218f47073d35f457cfd204e60e4475eed668511defb14R264

Just fixed it a few min ago https://github.com/deepset-ai/dc-pipeline-templates/pull/354#pullrequestreview-4139750934

@sjrl sjrl added this to the 2.28.0 milestone Apr 20, 2026
@sjrl sjrl enabled auto-merge (squash) April 20, 2026 12:12
@julian-risch julian-risch disabled auto-merge April 20, 2026 12:20
@julian-risch julian-risch merged commit 0dd8806 into main Apr 20, 2026
24 checks passed
@julian-risch julian-risch deleted the llm-user-prompt-required branch April 20, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants