mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 00:23:25 +00:00
Docs: Fix deprecated initialize agent in ainetwork (#30355)
## Description - Replaced `initialize_agent`, `AgentType` usage in ainetwork integration - Updated usage example to `create_react_agent` in langgraph ## Issue - #29277 ## Dependencies - N/A ## Twitter handler - I don't use Twitter
This commit is contained in:
parent
73c04f4707
commit
65b16d3200
@ -130,16 +130,11 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain.agents import AgentType, initialize_agent\n",
|
||||
"from langchain_openai import ChatOpenAI\n",
|
||||
"from langgraph.prebuilt import create_react_agent\n",
|
||||
"\n",
|
||||
"llm = ChatOpenAI(temperature=0)\n",
|
||||
"agent = initialize_agent(\n",
|
||||
" tools=tools,\n",
|
||||
" llm=llm,\n",
|
||||
" verbose=True,\n",
|
||||
" agent=AgentType.OPENAI_FUNCTIONS,\n",
|
||||
")"
|
||||
"agent = create_react_agent(model=llm, tools=tools)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -199,8 +194,10 @@
|
||||
],
|
||||
"source": [
|
||||
"print(\n",
|
||||
" agent.run(\n",
|
||||
" f\"Create an app in the AINetwork Blockchain database with the name {appName}\"\n",
|
||||
" agent.invoke(\n",
|
||||
" {\n",
|
||||
" \"messages\": f\"Create an app in the AINetwork Blockchain database with the name {appName}\"\n",
|
||||
" }\n",
|
||||
" )\n",
|
||||
")"
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user