Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,26 +21,18 @@ class BasicAgent:
|
|
| 21 |
)
|
| 22 |
self.agent = CodeAgent(
|
| 23 |
model = model,
|
| 24 |
-
tools=[GoogleSearchTool(), WikipediaSearchTool() ],
|
| 25 |
add_base_tools=True, # Add any additional base tools
|
| 26 |
max_steps=15,
|
| 27 |
planning_interval=3 # Enable planning every 3 steps
|
| 28 |
)
|
| 29 |
-
|
| 30 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 31 |
-
|
| 32 |
-
response = await asyncio.to_thread(
|
| 33 |
-
self.agent.run,
|
| 34 |
-
question=question
|
| 35 |
-
)
|
| 36 |
|
| 37 |
-
# Ensure response is a string, fixing the integer error
|
| 38 |
-
response = str(response)
|
| 39 |
-
if response is None:
|
| 40 |
-
print(f"No answer found.")
|
| 41 |
|
| 42 |
-
print(f"Agent returning fixed answer: {
|
| 43 |
-
return
|
| 44 |
|
| 45 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 46 |
"""
|
|
|
|
| 21 |
)
|
| 22 |
self.agent = CodeAgent(
|
| 23 |
model = model,
|
| 24 |
+
tools=[DuckDuckGoSearchTool(), GoogleSearchTool(), WikipediaSearchTool() ],
|
| 25 |
add_base_tools=True, # Add any additional base tools
|
| 26 |
max_steps=15,
|
| 27 |
planning_interval=3 # Enable planning every 3 steps
|
| 28 |
)
|
| 29 |
+
def __call__(self, question: str) -> str:
|
| 30 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 31 |
+
fixed_answer = self.agent.run(question)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 35 |
+
return fixed_answer
|
| 36 |
|
| 37 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 38 |
"""
|