Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ from dotenv import load_dotenv
|
|
| 5 |
from langchain_core.tools import Tool
|
| 6 |
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
| 7 |
from langchain_core.messages import HumanMessage, AIMessage
|
| 8 |
-
from langchain.agents import
|
| 9 |
from langchain_groq import ChatGroq
|
| 10 |
|
| 11 |
load_dotenv()
|
|
@@ -54,7 +54,7 @@ async def get_agent_executor():
|
|
| 54 |
("human", "{input}"),
|
| 55 |
MessagesPlaceholder(variable_name="agent_scratchpad"),
|
| 56 |
])
|
| 57 |
-
agent =
|
| 58 |
_agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=False, handle_parsing_errors=True, max_iterations=5)
|
| 59 |
return _agent_executor
|
| 60 |
|
|
|
|
| 5 |
from langchain_core.tools import Tool
|
| 6 |
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
| 7 |
from langchain_core.messages import HumanMessage, AIMessage
|
| 8 |
+
from langchain.agents import AgentExecutor, create_tool_calling_agent
|
| 9 |
from langchain_groq import ChatGroq
|
| 10 |
|
| 11 |
load_dotenv()
|
|
|
|
| 54 |
("human", "{input}"),
|
| 55 |
MessagesPlaceholder(variable_name="agent_scratchpad"),
|
| 56 |
])
|
| 57 |
+
agent = create_tool_calling_agent(llm=model, tools=tools, prompt=prompt)
|
| 58 |
_agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=False, handle_parsing_errors=True, max_iterations=5)
|
| 59 |
return _agent_executor
|
| 60 |
|