evgeniypark commited on
Commit
c07c327
·
verified ·
1 Parent(s): 43e3852

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -16,9 +16,15 @@ class BasicAgent:
16
  self.agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=InferenceClientModel())
17
  def __call__(self, question: str) -> str:
18
  print(f"Agent received question (first 50 chars): {question[:50]}...")
19
- agent_answer = self.agent.run(question)
20
- print(f"Agent returning fixed answer: {fixed_answer}")
21
- return fixed_answer
 
 
 
 
 
 
22
 
23
  def run_and_submit_all( profile: gr.OAuthProfile | None):
24
  """
 
16
  self.agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=InferenceClientModel())
17
  def __call__(self, question: str) -> str:
18
  print(f"Agent received question (first 50 chars): {question[:50]}...")
19
+ agent_answer = self.agent.run(f"There is GAIA test level 1 <question>{question}</question>. Provide the most possible answer inside <answer></answer> tag")
20
+
21
+ print(f"Agent returning answer: {agent_answer}")
22
+ pattern = re.compile(r"<answer>(.*?)</answer>", re.DOTALL | re.IGNORECASE)
23
+
24
+ if many:
25
+ return pattern.findall(text) # list[str]
26
+ m = pattern.search(text)
27
+ return m.group(1) if m else agent_answer
28
 
29
  def run_and_submit_all( profile: gr.OAuthProfile | None):
30
  """