Skip to content

feat!: Update PromptBuilder and ChatPromptBuilder to set required_variables="*" by default#11344

Merged
sjrl merged 5 commits into
v3from
no-all-default-input-comps
May 20, 2026
Merged

feat!: Update PromptBuilder and ChatPromptBuilder to set required_variables="*" by default#11344
sjrl merged 5 commits into
v3from
no-all-default-input-comps

Conversation

@sjrl
Copy link
Copy Markdown
Contributor

@sjrl sjrl commented May 20, 2026

Related Issues

  • fixes #issue-number

Proposed Changes:

After discussions with @julian-risch we believe its best to avoid components that have all optional inputs by default since this can often lead to seemingly unintuitive pipeline execution logic. It's what recently caused unexpected behaviors when we made the LLM and Agent component have all optional inputs for a short period of time.

So as part of this effort we thought it would be good to change the default behavior of PromptBuilder and ChatPromptBuilder to match ConditionalRouter in the sense that all jinja2 variables are required by default, but the user can still opt-in to make some optional.

I decided to minimize the breaking change by just changing the default value of required_variables.

How did you test it?

Updated existing tests

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.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 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 Preview May 20, 2026 10:00am

Request Review

@sjrl sjrl changed the base branch from main to v3 May 20, 2026 08:09
@sjrl sjrl added this to the 3.0 milestone May 20, 2026
@github-actions github-actions Bot added the type:documentation Improvements on the docs label May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/builders
  chat_prompt_builder.py
  prompt_builder.py
Project Total  

This report was generated by python-coverage-comment-action

@sjrl sjrl self-assigned this May 20, 2026
@sjrl sjrl marked this pull request as ready for review May 20, 2026 10:00
@sjrl sjrl requested review from a team as code owners May 20, 2026 10:00
@sjrl sjrl requested review from julian-risch and removed request for a team May 20, 2026 10:00
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. In particular, the level of detail in the migration guide with multiple options listed is great.

@sjrl sjrl merged commit c8f75f1 into v3 May 20, 2026
26 of 28 checks passed
@sjrl sjrl deleted the no-all-default-input-comps branch May 20, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants