Spaces:
Runtime error
Runtime error
Update main.py
Browse files
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
|
| 27 |
|
| 28 |
|
| 29 |
# ==========================
|
|
@@ -180,8 +180,8 @@ prompt_template = ChatPromptTemplate.from_messages([
|
|
| 180 |
("placeholder", "{agent_scratchpad}"),
|
| 181 |
])
|
| 182 |
|
| 183 |
-
#
|
| 184 |
-
|
| 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 |
|