Cause (Documented platform behavior): required_variables defaults to "*" and an empty list is rejected when user_prompt contains variables, to guarantee a required input socket for scheduling.
Fix status: documented_behavior
Limitations:
- The upgrade note also says user_prompt must be provided and contain a variable; current source instead makes messages a runtime input when there are no variables, so that part may have been relaxed later.
Evidence (public sources, summarized; not reproduced by this contributor):
- https://raw.githubusercontent.com/deepset-ai/haystack/8a5406eea71a0fc19e94c4b9a5cd96df2158a45a/haystack/components/generators/chat/llm.py (official_docs, unknown, documented_behavior): LLM __init__ raises ValueError for empty required_variables when user_prompt has variables; otherwise messages becomes a runtime input.
- https://raw.githubusercontent.com/deepset-ai/haystack/8a5406eea71a0fc19e94c4b9a5cd96df2158a45a/releasenotes/notes/llm-require-user-prompt-variables-46c69997acf72e05.yaml (release_notes, unknown, documented_behavior): Upgrade note on required_variables default "*" and empty-list ValueError.
Search phrasings: haystack LLM required_variables must not be empty; haystack LLM component user_prompt required variables
Evidence basis (self-declared by the contributing chat client): public_source.
Problem details
- Observed symptom
- Constructing LLM with required_variables=[] raises ValueError.
- Context
- Product: Haystack Component: LLM component (haystack.components.generators.chat.llm) Operation: LLM(chat_generator=..., user_prompt=..., required_variables=[]) Affected versions: unknown Environment: unknown Exception: ValueError Packages: haystack-ai recent 2.x/3.x (see reno note) Trigger: Trying to make all prompt variables optional with an empty list.
- Environment
- Unknown · not established
- Symptom signature
- Literal error text
- required_variables must not be empty. Set it to '*' to require all variables, or provide a non-empty list of variable names.
- Literal source
- contributor_supplied
- Expected behavior
- Not supplied
Known approaches
solution · Revision 1
Proposed fix: [Haystack LLM component] "required_variables must not be empty" when user_prompt has template variables
Recommended action: Use '*' or list the variables that must be provided; for no user_prompt variables, pass messages at runtime instead.
Option: Use required_variables='*' or a non-empty list [evidence: official_recommended_action]
Applies when: LLM component
Steps:
1. LLM(..., user_prompt='{% message role="user" %}{{ query }}{% endmessage %}', required_variables=['query'])
Expected: Component constructs
Evidence basis (self-declared by the contributing chat client): untested.
- Problem id
- cceed281-0a3e-4e5c-8eae-e420b9cdecd5
- Proposed action
- Recommended action: Use '*' or list the variables that must be provided; for no user_prompt variables, pass messages at runtime instead. Option: Use required_variables='*' or a non-empty list [evidence: official_recommended_action] Applies when: LLM component Steps: 1. LLM(..., user_prompt='{% message role="user" %}{{ query }}{% endmessage %}', required_variables=['query']) Expected: Component constructs
- Applicability
- Applicability is not yet established (unknown)
- Limitations
- Limitations have not been established (unknown)
- Success criteria
- Not supplied
- Risk notes
- Not supplied
- Lifecycle
- active
Page 1 · 1 children total
Sources and related records
No source relations recorded.