cubukcum commited on
Commit
c02dd1a
·
verified ·
1 Parent(s): 2cac4b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -9,17 +9,20 @@ 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 web_search(question:str)-> 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
  """A tool that searches web
15
  Args:
16
- question: question to search web
17
  """
18
  try:
19
- result = DuckDuckGoSearchTool(question)
20
- return result
 
 
 
21
  except Exception as e:
22
  return f"Error web search: {str(e)}"
 
23
  @tool
24
  def get_current_time_in_timezone(timezone: str) -> str:
25
  """A tool that fetches the current local time in a specified timezone.
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def web_search(question: str) -> str:
 
13
  """A tool that searches web
14
  Args:
15
+ question: question to search web
16
  """
17
  try:
18
+ # Create an instance of the search tool
19
+ search_tool = DuckDuckGoSearchTool()
20
+ # Use the tool to search (the method name might vary)
21
+ result = search_tool.search(question) # or search_tool(question)
22
+ return str(result)
23
  except Exception as e:
24
  return f"Error web search: {str(e)}"
25
+
26
  @tool
27
  def get_current_time_in_timezone(timezone: str) -> str:
28
  """A tool that fetches the current local time in a specified timezone.