Is your feature request related to a problem? Please describe.
Most of our components require some (or all) inputs during runtime. For our components whose inputs are based on Jinja2 templates (e.g. ConditionalRouter, OutputAdpater, PromptBuilder, and ChatPromptBuilder) we differ on how we treat whether all Jinja2 variables are required or are optional by default. For example, the components ConditionalRouter, and OutputAdpater we require all Jinja2 variables defined in their templates to run. But for the PromptBuilder, and ChatPromptBuilder we set all Jinja2 variables as optional by default.
This optionality has caused "intended" but usually unexpected behavior (from the perspective of the user) when running pipelines with multiple branches where each branch may contain a (Chat)PromptBuilder + (Chat)Generator. Specifically, if no required variables are set in the prompt builder then that component will always trigger even if it's along a branch that has been turned "off" by a previous ConditionalRouter.
Describe the solution you'd like
To help make users aware of this behavior @julian-risch and I agreed that adding a warning to the init method of the PromptBuilder and ChatPromptBuilder when 1) Jinja2 variables are present in the template and 2) required_variables=None makes sense.
This way users can be better aware that these components can still trigger even if they receive no input.
Additional context
@ju-gu and I have run into this multiple times when building pipelines for clients.
Is your feature request related to a problem? Please describe.
Most of our components require some (or all) inputs during runtime. For our components whose inputs are based on Jinja2 templates (e.g.
ConditionalRouter,OutputAdpater,PromptBuilder, andChatPromptBuilder) we differ on how we treat whether all Jinja2 variables are required or are optional by default. For example, the componentsConditionalRouter, andOutputAdpaterwe require all Jinja2 variables defined in their templates to run. But for thePromptBuilder, andChatPromptBuilderwe set all Jinja2 variables as optional by default.This optionality has caused "intended" but usually unexpected behavior (from the perspective of the user) when running pipelines with multiple branches where each branch may contain a (Chat)PromptBuilder + (Chat)Generator. Specifically, if no required variables are set in the prompt builder then that component will always trigger even if it's along a branch that has been turned "off" by a previous
ConditionalRouter.Describe the solution you'd like
To help make users aware of this behavior @julian-risch and I agreed that adding a warning to the init method of the
PromptBuilderandChatPromptBuilderwhen 1) Jinja2 variables are present in the template and 2)required_variables=Nonemakes sense.This way users can be better aware that these components can still trigger even if they receive no input.
Additional context
@ju-gu and I have run into this multiple times when building pipelines for clients.