mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 08:33:49 +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": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from langchain.agents import AgentType, initialize_agent\n",
|
|
||||||
"from langchain_openai import ChatOpenAI\n",
|
"from langchain_openai import ChatOpenAI\n",
|
||||||
|
"from langgraph.prebuilt import create_react_agent\n",
|
||||||
"\n",
|
"\n",
|
||||||
"llm = ChatOpenAI(temperature=0)\n",
|
"llm = ChatOpenAI(temperature=0)\n",
|
||||||
"agent = initialize_agent(\n",
|
"agent = create_react_agent(model=llm, tools=tools)"
|
||||||
" tools=tools,\n",
|
|
||||||
" llm=llm,\n",
|
|
||||||
" verbose=True,\n",
|
|
||||||
" agent=AgentType.OPENAI_FUNCTIONS,\n",
|
|
||||||
")"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -199,8 +194,10 @@
|
|||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"print(\n",
|
"print(\n",
|
||||||
" agent.run(\n",
|
" agent.invoke(\n",
|
||||||
" f\"Create an app in the AINetwork Blockchain database with the name {appName}\"\n",
|
" {\n",
|
||||||
|
" \"messages\": f\"Create an app in the AINetwork Blockchain database with the name {appName}\"\n",
|
||||||
|
" }\n",
|
||||||
" )\n",
|
" )\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user