State inheritance #4694
markobogoevski-dev
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. I'm trying to develop a system where I would reuse nodes for various graph workflows. For example a node EmailHandler. I want to be able to define this node to accept as input a BaseState containing metadata state fields, however during runtime pass in an inherited State object from this BaseState per scenario (Example, for scenario 1 using some Scenario1State and for scenario 2 using Scenario2State, both states inheriting from BaseState). I know that through TypedDict this is not possible, but it also seems not possible with Pydantic models. I build the graph using the Scenario1State but if I pass a dictionary with keys only contained in the Scenario1State and not in the BaseState, those keys are not accessible in the node. How do I design the EmailHandler node to accept multiple types of states but expose same functionalities with optional branching logic per scenario?
Beta Was this translation helpful? Give feedback.
All reactions