Commit 75467574 by tinywell

chore: Update agent.py to fix prompt handling and remove unused import

parent 9a5edb67
......@@ -3,7 +3,7 @@ from typing import Any, List, Sequence, Union
from langchain_core.prompts import PromptTemplate
from langchain.agents import AgentExecutor, create_tool_calling_agent,create_structured_chat_agent
from langchain.tools import BaseTool
from langgraph.prebuilt import create_react_agent
# from langgraph.prebuilt import create_react_agent
from langchain_core.language_models import BaseLanguageModel
......@@ -115,11 +115,10 @@ class Agent:
self.prompt = prompt
if not prompt:
agent = create_react_agent(llm, tools,debug=verbose)
self.agent_executor = agent
else:
agent = create_chart_agent(llm, tools, prompt, **args)
self.agent_executor = AgentExecutor(agent=agent,tools=tools,verbose=verbose)
raise ValueError("PromptTemplate is required")
agent = create_chart_agent(llm, tools, prompt, **args)
self.agent_executor = AgentExecutor(agent=agent,tools=tools,verbose=verbose)
def exec(self, prompt_args: dict = {}, stream: bool = False):
# if stream:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment