Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,10 +17,16 @@ class BasicAgent:
|
|
17 |
print("BasicAgent initialized.")
|
18 |
def __call__(self, question: str) -> str:
|
19 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
25 |
"""
|
26 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
|
|
17 |
print("BasicAgent initialized.")
|
18 |
def __call__(self, question: str) -> str:
|
19 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
20 |
+
try:
|
21 |
+
model = model=HfApiModel() )
|
22 |
+
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model, add_base_tools=True)
|
23 |
+
agent_response = agent.run(question)
|
24 |
+
except Exception as e:
|
25 |
+
print(f"Error running agent: {e}")
|
26 |
+
return f"AGENT ERROR: {e}"
|
27 |
+
|
28 |
+
print(f"Agent returning answer: {agent_response}")
|
29 |
+
return agent_response
|
30 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
31 |
"""
|
32 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|