Skip to content

Routing function does not appear to work with custom state #1146

Answered by vbarda
fedshyvana asked this question in Q&A
Discussion options

You must be logged in to vote

@fedshyvana the issue is that you're trying to access the value for status key but it's never actually set. TypedDict doesn't support defaults, so the assignment in the state schema won't work. so you need to either pass status when invoking / streaming from the graph (i.e. pass status as part of the initial state the graph receives) or a node in the graph needs to send an update for status key before it's accessed by a subsequent node

so in your example, you can verify that it works by changing input to

inputs = {"messages": [
                            ("user", 
                            "What is 1 + 1 = 2?")], "status": "my_status"}

hope this helps!

Replies: 1 comment 1 reply

Comment options

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

Answer selected by fedshyvana
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