forked from langchain-ai/langchain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace
initialize_agent
with create_react_agent
for LangGraph co…
…mpatibility - Updated code to use `create_react_agent` instead of the deprecated `initialize_agent`. - Removed explicit `AgentType` parameters as they are implicitly supported by `create_react_agent`. - Replaced `verbose=True` with `debug=True` for detailed logging. Partially addresses langchain-ai#29277
- Loading branch information
1 parent
9eb10a9
commit e90ea8a
Showing
18 changed files
with
165 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,8 @@ | |
}, | ||
"outputs": [], | ||
"source": [ | ||
"from langchain.agents import AgentType, initialize_agent, load_tools\n", | ||
"from langgraph.prebuilt import create_react_agent\n", | ||
"from langchain.agents import load_tools\n", | ||
"from langchain_openai import OpenAI\n", | ||
"\n", | ||
"llm = OpenAI(temperature=0)\n", | ||
|
@@ -74,8 +75,10 @@ | |
" function_name=\"testFunction1\",\n", | ||
")\n", | ||
"\n", | ||
"agent = initialize_agent(\n", | ||
" tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True\n", | ||
"agent = create_react_agent(\n", | ||
" model=llm,\n", | ||
" tools=tools,\n", | ||
" debug=True\n", | ||
")\n", | ||
"\n", | ||
"agent.run(\"Send an email to [email protected] saying hello world.\")" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.