ameglei-external commited on
Commit
3c71b5b
·
verified ·
1 Parent(s): 23b5e1c

Fix argument and doc string for search tool

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -83,18 +83,18 @@ class BasicAgent:
83
 
84
  def search_tool(self, question: str, max_length: int = 2048) -> str:
85
  """
86
- Use DuckDuckGo’s Instant Answer API to fetch a direct answer.
87
 
88
  Args:
89
- query: The question to ask.
90
  max_length: Max chars to return.
91
  Returns:
92
- Instant answer text, or a fallback message.
93
  """
94
  print(f"Calling search tool with: {question}, max_lentgh: {max_length}")
95
  with DDGS() as ddgs:
96
- hits = list(ddgs.text("What is the current temperature in Chisinau?", max_results=5))
97
- print("Got", hits)
98
  ans = "\n".join((r.get("body") or r.get("snippet", "") for r in hits))
99
 
100
  if not ans:
 
83
 
84
  def search_tool(self, question: str, max_length: int = 2048) -> str:
85
  """
86
+ Use DuckDuckGo’s API to fetch a direct answer.
87
 
88
  Args:
89
+ question: The question to ask.
90
  max_length: Max chars to return.
91
  Returns:
92
+ Answer text, or a fallback message.
93
  """
94
  print(f"Calling search tool with: {question}, max_lentgh: {max_length}")
95
  with DDGS() as ddgs:
96
+ hits = list(ddgs.text(question, max_results=5))
97
+ print("Got from DDGS:", hits)
98
  ans = "\n".join((r.get("body") or r.get("snippet", "") for r in hits))
99
 
100
  if not ans: