LamiaYT commited on
Commit
8fd14e4
·
1 Parent(s): cfa154c

Deploy GAIA agent

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -31,12 +31,20 @@ def web_search_tool(query: str) -> str:
31
  String containing search results
32
  """
33
  try:
34
- search_tool = DuckDuckGoSearchTool()
35
- results = search_tool(query)
36
- return str(results)
 
 
 
 
 
 
 
 
 
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
  """