alanchen1115 commited on
Commit
f1f56dd
·
verified ·
1 Parent(s): ec42477

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -23,7 +23,7 @@ import uvicorn
23
  from langchain_core.prompts import ChatPromptTemplate
24
  from langchain_core.tools import tool
25
  from langchain_google_genai import ChatGoogleGenerativeAI
26
- from langchain.agents import create_tool_calling_agent, AgentExecutor
27
 
28
 
29
  # ==========================
@@ -180,8 +180,8 @@ prompt_template = ChatPromptTemplate.from_messages([
180
  ("placeholder", "{agent_scratchpad}"),
181
  ])
182
 
183
- # 建立代理人
184
- agent = create_tool_calling_agent(llm, tools, prompt_template)
185
  agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
186
 
187
 
 
23
  from langchain_core.prompts import ChatPromptTemplate
24
  from langchain_core.tools import tool
25
  from langchain_google_genai import ChatGoogleGenerativeAI
26
+ from langchain.agents import create_react_agent, AgentExecutor
27
 
28
 
29
  # ==========================
 
180
  ("placeholder", "{agent_scratchpad}"),
181
  ])
182
 
183
+ # 建立代理人,使用 create_react_agent
184
+ react_agent = create_react_agent(llm, tools, prompt_template)
185
  agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
186
 
187