Spaces:
Runtime error
Runtime error
Deploy GAIA agent
Browse files
app.py
CHANGED
@@ -31,12 +31,20 @@ def web_search_tool(query: str) -> str:
|
|
31 |
String containing search results
|
32 |
"""
|
33 |
try:
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
except Exception as e:
|
38 |
return f"Search failed: {str(e)}"
|
39 |
-
|
40 |
@tool
|
41 |
def calculator_tool(expression: str) -> str:
|
42 |
"""
|
|
|
31 |
String containing search results
|
32 |
"""
|
33 |
try:
|
34 |
+
# Use duckduckgo_search directly instead of SmolaAgent's wrapper
|
35 |
+
from duckduckgo_search import DDGS
|
36 |
+
|
37 |
+
results = []
|
38 |
+
with DDGS() as ddgs:
|
39 |
+
for r in ddgs.text(query, max_results=3):
|
40 |
+
results.append(f"Title: {r['title']}\nURL: {r['href']}\nSnippet: {r['body']}")
|
41 |
+
|
42 |
+
if not results:
|
43 |
+
return "No search results found."
|
44 |
+
|
45 |
+
return "\n\n".join(results)
|
46 |
except Exception as e:
|
47 |
return f"Search failed: {str(e)}"
|
|
|
48 |
@tool
|
49 |
def calculator_tool(expression: str) -> str:
|
50 |
"""
|