Skip to content
Discussion options

You must be logged in to vote

You would need to adjust the schema for the structured output to return multiple values and also set up conditional edges (i.e. route_after_prediction) to return multiple values (I am assuming in your case you would want to run the nodes you route to via multiple routes in parallel)

  • For structured output w/ multiple values, you can do something like this:
class Router(TypedDict):
    route: list[Literal["weather", "sql", "other"]]

model = ChatOpenAI(model_name="gpt-4o-mini")
model.with_structured_output(Router).invoke("what is the weather in SF and show me 3 countries with highest sales?")
# {'route': ['weather', 'sql']}
  • For conditional edges w/ multiple return values see this how-to …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cocoza4
Comment options

Answer selected by cocoza4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants