DTStudios commited on
Commit
383c4d5
·
verified ·
1 Parent(s): a9a10ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -26,11 +26,11 @@ def __init__(self, max_results=10, **kwargs):
26
  self.ddgs = DDGS(**kwargs)
27
 
28
  def forward(self, query: str) -> str:
29
- results = self.ddgs.text(query, max_results=self.max_results)
30
- if len(results) == 0:
31
- raise Exception("No results found! Try a less restrictive/shorter query.")
32
- postprocessed_results = [f"[{result['title']}]({result['href']})\n{result['body']}" for result in results]
33
- return "## Search Results\n\n" + "\n\n".join(postprocessed_results)
34
 
35
  @tool
36
  def get_current_time_in_timezone(timezone: str) -> str:
 
26
  self.ddgs = DDGS(**kwargs)
27
 
28
  def forward(self, query: str) -> str:
29
+ results = self.ddgs.text(query, max_results=self.max_results)
30
+ if len(results) == 0:
31
+ raise Exception("No results found! Try a less restrictive/shorter query.")
32
+ postprocessed_results = [f"[{result['title']}]({result['href']})\n{result['body']}" for result in results]
33
+ return "## Search Results\n\n" + "\n\n".join(postprocessed_results)
34
 
35
  @tool
36
  def get_current_time_in_timezone(timezone: str) -> str: