-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(langchain): fix state in wrapToolCall and wrapModelCall #9306
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
Conversation
|
libs/langchain/src/agents/middleware/tests/modelCallLimit.test.ts
Outdated
Show resolved
Hide resolved
libs/langchain/src/agents/middleware/tests/modelCallLimit.test.ts
Outdated
Show resolved
Hide resolved
libs/langchain/src/agents/middleware/tests/modelCallLimit.test.ts
Outdated
Show resolved
Hide resolved
|
|
||
| #agentNode: AgentNode<any, AnyAnnotationRoot>; | ||
|
|
||
| #stateManager = new StateManager(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the #stateManager properly persist in checkpointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it needs to. It is just s small helper class to help merge the state between 4 nodes into a single agent state, e.g. if you change state in beforeModel it makes sure that afterModel gets these updates.
wrapToolCallandwrapModelCalldo not properly retain the state of the middleware. This patch fixes these issues and adds test coverage to ensure we don't regress.