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:
Yeonseolee 2025-03-20 04:20:21 +09:00 committed by GitHub
parent 73c04f4707
commit 65b16d3200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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",
")"
]