alisamak commited on
Commit
f95afc7
·
verified ·
1 Parent(s): e37dc1b

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +9 -6
tools.py CHANGED
@@ -61,8 +61,10 @@ web_search_tool = WebSearchTool()
61
  @tool
62
  def search_web(query: str) -> str:
63
  """
64
- Use a robust DuckDuckGo HTML scraper with retries.
65
- Returns top search snippets, useful for open-ended or numeric queries.
 
 
66
  """
67
  print(f"🛠️ search_web called with: {query}")
68
  return web_search_tool.search(query)
@@ -85,8 +87,9 @@ def extract_number_from_text(text: str) -> str:
85
  @tool
86
  def search_and_extract_number(query: str) -> str:
87
  """
88
- Search the web and extract the most relevant number from the results.
89
- Perfect for numeric questions like counts, years, etc.
 
90
  """
91
  print(f"🛠️ search_and_extract_number called with: {query}")
92
  raw = web_search_tool.search(query)
@@ -340,8 +343,8 @@ all_tools = [
340
  search_and_extract_number,
341
  search_web,
342
  extract_number_from_text,
343
- search_duckduckgo,
344
- search_wikipedia,
345
  search_youtube_transcript,
346
  reverse_sentence,
347
  solve_chess_position,
 
61
  @tool
62
  def search_web(query: str) -> str:
63
  """
64
+ Perform a full web search using DuckDuckGo HTML scraping.
65
+ Returns multiple top results as text snippets.
66
+ Use this when Wikipedia or standard search is not enough or fails to return numeric/statistical data.
67
+ Example: "How many albums did Mercedes Sosa release between 2000 and 2009?"
68
  """
69
  print(f"🛠️ search_web called with: {query}")
70
  return web_search_tool.search(query)
 
87
  @tool
88
  def search_and_extract_number(query: str) -> str:
89
  """
90
+ Search the web and extract a number from the top results.
91
+ Best for questions like: 'How many X did Y do?' or 'What year was Z?'
92
+ Example: "Mercedes Sosa studio albums 2000–2009"
93
  """
94
  print(f"🛠️ search_and_extract_number called with: {query}")
95
  raw = web_search_tool.search(query)
 
343
  search_and_extract_number,
344
  search_web,
345
  extract_number_from_text,
346
+ # search_duckduckgo,
347
+ # search_wikipedia,
348
  search_youtube_transcript,
349
  reverse_sentence,
350
  solve_chess_position,