JoseferEins commited on
Commit
6943645
·
verified ·
1 Parent(s): 9a8c112

Update app.py

Browse files

Test: added a first search tool...

Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -7,6 +7,9 @@ from tools.final_answer import FinalAnswerTool
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 my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
@@ -18,6 +21,15 @@ def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
20
 
 
 
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
@@ -51,7 +63,7 @@ with open("prompts.yaml", 'r') as stream:
51
 
52
  agent = CodeAgent(
53
  model=model,
54
- tools=[final_answer], ## add your tools here (don't remove final answer)
55
  max_steps=6,
56
  verbosity_level=1,
57
  grammar=None,
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
+
11
+
12
+
13
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
14
  @tool
15
  def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
 
21
  """
22
  return "What magic will you build ?"
23
 
24
+ @tool
25
+ def web_search(query:str)-> str:
26
+ #Keep this format for the description / args / args description but feel free to modify the tool
27
+ """Performs a duckduckgo web search based on the query, then returns the top search results
28
+ Args:
29
+ query: the search query to perform
30
+ """
31
+ return DuckDuckGoSearchTool(query)
32
+
33
  @tool
34
  def get_current_time_in_timezone(timezone: str) -> str:
35
  """A tool that fetches the current local time in a specified timezone.
 
63
 
64
  agent = CodeAgent(
65
  model=model,
66
+ tools=[final_answer, web_search], ## add your tools here (don't remove final answer)
67
  max_steps=6,
68
  verbosity_level=1,
69
  grammar=None,