ageraustine commited on
Commit
baac347
·
verified ·
1 Parent(s): 5ac433a

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +3 -3
agent.py CHANGED
@@ -15,7 +15,7 @@ class ReActAgent:
15
  Initializes the agent with default tools, OpenAI LLM, and an empty history.
16
  """
17
  self.tools = [TavilySearchResults(max_results=1)]
18
- self.prompt = hub.pull("hwchase17/react")
19
  self.llm = OpenAI()
20
  agent = self.create_agent()
21
  self.agent_executor = AgentExecutor(agent=agent, tools=self.tools, verbose=verbose)
@@ -27,10 +27,10 @@ class ReActAgent:
27
  agent = create_react_agent(self.llm, self.tools, self.prompt)
28
  return agent
29
 
30
- def run(self, question,history=[], verbose=True):
31
  """
32
  Executes the agent with the provided question, verbosity option, and updates history.
33
  """
34
- answer = self.agent_executor.invoke({"input": question})
35
  return answer
36
 
 
15
  Initializes the agent with default tools, OpenAI LLM, and an empty history.
16
  """
17
  self.tools = [TavilySearchResults(max_results=1)]
18
+ self.prompt = hub.pull("hwchase17/react-chat")
19
  self.llm = OpenAI()
20
  agent = self.create_agent()
21
  self.agent_executor = AgentExecutor(agent=agent, tools=self.tools, verbose=verbose)
 
27
  agent = create_react_agent(self.llm, self.tools, self.prompt)
28
  return agent
29
 
30
+ def run(self, question,history="", verbose=True):
31
  """
32
  Executes the agent with the provided question, verbosity option, and updates history.
33
  """
34
+ answer = self.agent_executor.invoke({"input": question, "chat_history": history})
35
  return answer
36