ageraustine commited on
Commit
c759b04
·
verified ·
1 Parent(s): bcd7685

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +3 -3
agent.py CHANGED
@@ -17,6 +17,8 @@ class ReActAgent:
17
  self.tools = [TavilySearchResults(max_results=1)]
18
  self.prompt = hub.pull("hwchase17/react")
19
  self.llm = OpenAI()
 
 
20
 
21
  def create_agent(self):
22
  """
@@ -29,8 +31,6 @@ class ReActAgent:
29
  """
30
  Executes the agent with the provided question, verbosity option, and updates history.
31
  """
32
- agent = self.create_agent()
33
- agent_executor = AgentExecutor(agent=agent, tools=self.tools, verbose=verbose)
34
- answer = agent_executor.invoke({"input": question})
35
  return answer
36
 
 
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)
22
 
23
  def create_agent(self):
24
  """
 
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