Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import requests
|
|
| 5 |
import inspect
|
| 6 |
import pandas as pd
|
| 7 |
from smolagents import (
|
| 8 |
-
|
| 9 |
LiteLLMModel,
|
| 10 |
DuckDuckGoSearchTool,
|
| 11 |
WikipediaSearchTool,
|
|
@@ -42,12 +42,13 @@ class BasicAgent:
|
|
| 42 |
PythonInterpreterTool(),
|
| 43 |
get_current_date_time,
|
| 44 |
]
|
| 45 |
-
self.agent =
|
| 46 |
tools=self.tools,
|
| 47 |
model=self.model,
|
| 48 |
-
max_steps=
|
|
|
|
| 49 |
)
|
| 50 |
-
print("BasicAgent ready with Groq Llama-3.3-70B.")
|
| 51 |
|
| 52 |
def __call__(self, question: str) -> str:
|
| 53 |
print(f"Agent received question: {question[:80]}...")
|
|
@@ -105,7 +106,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 105 |
except Exception as e:
|
| 106 |
print(f"Error on task {task_id}: {e}")
|
| 107 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"ERROR: {e}"})
|
| 108 |
-
time.sleep(
|
| 109 |
if not answers_payload:
|
| 110 |
return "No answers.", pd.DataFrame(results_log)
|
| 111 |
submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
|
|
|
|
| 5 |
import inspect
|
| 6 |
import pandas as pd
|
| 7 |
from smolagents import (
|
| 8 |
+
CodeAgent,
|
| 9 |
LiteLLMModel,
|
| 10 |
DuckDuckGoSearchTool,
|
| 11 |
WikipediaSearchTool,
|
|
|
|
| 42 |
PythonInterpreterTool(),
|
| 43 |
get_current_date_time,
|
| 44 |
]
|
| 45 |
+
self.agent = CodeAgent(
|
| 46 |
tools=self.tools,
|
| 47 |
model=self.model,
|
| 48 |
+
max_steps=8,
|
| 49 |
+
additional_authorized_imports=["datetime", "re", "json", "math", "collections"],
|
| 50 |
)
|
| 51 |
+
print("BasicAgent ready with Groq Llama-3.3-70B (CodeAgent).")
|
| 52 |
|
| 53 |
def __call__(self, question: str) -> str:
|
| 54 |
print(f"Agent received question: {question[:80]}...")
|
|
|
|
| 106 |
except Exception as e:
|
| 107 |
print(f"Error on task {task_id}: {e}")
|
| 108 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"ERROR: {e}"})
|
| 109 |
+
time.sleep(2)
|
| 110 |
if not answers_payload:
|
| 111 |
return "No answers.", pd.DataFrame(results_log)
|
| 112 |
submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
|