-
Notifications
You must be signed in to change notification settings - Fork 33
fix(langchain/createAgent): various code updates after HITL changes #673
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR updates the createAgent
API in documentation to align with recent HITL (Human-in-the-Loop) changes. The changes standardize import paths, parameter names, and configuration options across Python and JavaScript examples.
- Updates import paths to import middleware from the root "langchain" package instead of "langchain/middleware"
- Changes
tool_configs
parameter tointerrupt_on
in Python andtoolConfigs
tointerruptOn
in JavaScript - Standardizes the use of
systemPrompt
parameter in JavaScript examples
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/oss/langchain/middleware.mdx | Updates middleware import paths, parameter names (tool_configs → interrupt_on, toolConfigs → interruptOn), and systemPrompt usage across multiple code examples |
src/oss/langchain/agents.mdx | Updates middleware import path to use root "langchain" package |
HumanInTheLoopRequest, | ||
humanInTheLoopMiddleware, | ||
} from "langchain"; | ||
import { createAgent } from "langchain"; |
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.
The createAgent
import is duplicated. It's already imported on line 596-601 in the same import block. Remove this duplicate import statement.
import { createAgent } from "langchain"; |
Copilot uses AI. Check for mistakes.
const result = await agent.invoke( | ||
{ | ||
messages: [ | ||
new HumanMessage( | ||
"Write to greeting.txt with the content 'Hello, world!'" | ||
), | ||
], | ||
}, | ||
config | ||
); |
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.
The new
keyword is missing when creating the HumanMessage instance. This is inconsistent with other examples in the file and will cause a runtime error.
Copilot uses AI. Check for mistakes.
Preview ID generated: preview-cbagen-1759026889-ddde1c1 |
Preview ID generated: preview-cbagen-1759028230-c924c95 |
middleware=[ | ||
HumanInTheLoopMiddleware( | ||
tool_configs={ | ||
interrupt_on={ |
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 have a different PR for HIL
Various code updates after last week:
interrupt_on
instead oftool_configs
systemPrompt
everywhere in JScc @sydney-runkle @eyurtsev