Update ConditionalRouter.run
method to check the rendered output matches the defined output_type
#8445
Labels
ConditionalRouter.run
method to check the rendered output matches the defined output_type
#8445
I really like the
ConditionalRouter
since it enables a lot of agentic type use cases. However, it can be a little difficult to use since it relies on good knowledge of Jinja2 syntax and I have found in practice it's very easy to make mistakes and errors. So to partially help this process I think it would be great if we could add a check to the run method.For example, I'd like the
ConditionalRouter.run
method to check that the output from the selected condition actually matches the specified type inoutput_type
. For example,Instead of still returning streams with the wrong output type it'd be great if the Conditional Router could throw an error (or at the very least a warning) if the output
[1, 2, 3]
doesn't match the output type. This would make debugging a lot easier since it identifies this issue early on and not later down the road when this output eventually causes an error downstream in some other component I've connected it to.The text was updated successfully, but these errors were encountered: