-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When Using Multiple States, Changing the Input State of a Node can Affect the State Fields Received by the Routing Function #2504
Comments
@ahmed33033 great question -- that's because the state type annotation (input schema) in the node function acts as a "filter" -- currently you use def subtract_expenses(state: PersonState) -> OverallState:
... hope this helps! |
Thank you so much for the quick reply! Sorry, I think I didn't highlight the issue clearly. You're absolutely right about the input state acting as a filer. But, the issue is mainly centered around the routing function 1 - Node The issue is somehow "fixed" by changing the input state of |
Hm ya this does feel surprising. The -100 is overwriting the state wholesale rather than being passed to the reducer (1000 - 900), despite the reducer of |
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
(Derived from Discussion Post #2197 , please see discussion post for detailed description)
The Console Output line that is inaccurate:
How does
money
have a value of -100? In the methodpay_salary
, themoney
attribute is set to 1000. Then, in thesubtract_expenses
method, I subtract 100 from it. So, themoney
attribute should have a value of 900, not -100.The line that is causing the weird output (after debugging)
How is it causing the issue?
When I change the inputted state from
PurchasesState
toOverallState
, it works as expected, i.e. the output printed in the routing functioncheck_if_poor
is:What's my question?
Why does changing the type of the inputted state in the function
subtract_expenses
lead me to receive different values for themoney
attribute in the routing functioncheck_if_poor
?Thanks in advance!
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: