ValentinGuigon commited on
Commit
a1ea9d0
·
verified ·
1 Parent(s): ac5bd5f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -20
app.py CHANGED
@@ -8,28 +8,15 @@ from tools.final_answer import FinalAnswerTool
8
  from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
- # Edit: now updated to conduct a web search
12
-
13
  @tool
14
- def web_search(query: str) -> str:
15
- """A tool that conducts a web search using DuckDuckGo
 
16
  Args:
17
- query: A string representing a valid query for a web search.
18
- Returns:
19
- A string containing the search results or an error message.
20
  """
21
- try:
22
- # Initialize the DuckDuckGo search tool
23
- search_tool = DuckDuckGoSearchTool()
24
-
25
- # Perform the search using the forward method
26
- results = search_tool.forward(query)
27
-
28
- # Return the formatted results
29
- return f"results"
30
-
31
- except Exception as e:
32
- return f"Error performing web search: {str(e)}"
33
 
34
  @tool
35
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -68,7 +55,7 @@ with open("prompts.yaml", 'r') as stream:
68
 
69
  agent = CodeAgent(
70
  model=model,
71
- tools=[final_answer, web_search, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
72
  max_steps=6,
73
  verbosity_level=1,
74
  grammar=None,
 
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_custom_tool(arg1:str, arg2:int)-> 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 does nothing yet
15
  Args:
16
+ arg1: the first argument
17
+ arg2: the second argument
 
18
  """
19
+ return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
 
55
 
56
  agent = CodeAgent(
57
  model=model,
58
+ tools=[final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,