FMontay commited on
Commit
6835644
·
verified ·
1 Parent(s): 42f91b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -7,18 +7,18 @@ from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
10
- search = DuckDuckGoSearchTool()
11
-
12
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
13
  @tool
14
- def get_web_result(query:str)-> str: #it's import to specify the return type
15
  #Keep this format for the description / args / args description but feel free to modify the tool
16
  """Search the web using DuckDuckGo and gets top results as text.
17
  Args:
18
  query: the search query to look up on the web
 
19
  """
20
  try:
21
- return search(query)
 
22
  except Exception as e:
23
  return f"{e}"
24
 
 
7
 
8
  from Gradio_UI import GradioUI
9
 
 
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def get_web_result(query:str, max_results:int=5)-> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
  """Search the web using DuckDuckGo and gets top results as text.
15
  Args:
16
  query: the search query to look up on the web
17
+ max_results: integer that gives the top N results
18
  """
19
  try:
20
+ search_tool = DuckDuckGoSearchTool(max_results=max_results)
21
+ return search_tool.forward(query)
22
  except Exception as e:
23
  return f"{e}"
24