DTStudios commited on
Commit
8f417e0
·
verified ·
1 Parent(s): 1afcba5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -28,8 +28,11 @@ def __init__(self, max_results=10, **kwargs):
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
 
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 = [
33
+ f"[{result['title']}]({result['href']})\n{result['body']}"
34
+ for result in results
35
+ ]
36
  return "## Search Results\n\n" + "\n\n".join(postprocessed_results)
37
 
38
  @tool