Update app.py
Browse files
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 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
"""
|