Proposal to make input variables to PromptBuilder
and ChatPromptBuilder
required by default
#8903
Labels
P2
Medium priority, add to the next sprint if no P1 available
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
, andOutputAdpater
we require all Jinja2 variables defined in their templates to run. But for thePromptBuilder
, andChatPromptBuilder
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
.This can lead to unexpected responses from a branch of the pipeline that wasn't meant to trigger from the users perspective. Ie you could end up with two answers from two branches in a pipeline even though a user only expected one to occur.
Describe the solution you'd like
I'd like to propose changing the default behavior of the PromptBuilder and ChatPromptBuilder to require all input variables rather than having them be optional by default. This would be a breaking change but one that I think is more intuitive to users and would be inline with how our
ConditionalRouter
andOutputAdapter
work.Describe alternatives you've considered
Leave as is and just add a warning to PromptBuilder and ChatPromptBuilder. See #8901
Additional context
@ju-gu and I have run into this multiple times when building pipelines for clients.
The text was updated successfully, but these errors were encountered: