cedomin commited on
Commit
5816bab
·
verified ·
1 Parent(s): 633d161

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -1
app.py CHANGED
@@ -9,6 +9,22 @@ 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
@@ -16,6 +32,14 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
16
  arg1: the first argument
17
  arg2: the second argument
18
  """
 
 
 
 
 
 
 
 
19
  return "What magic will you build ?"
20
 
21
  @tool
@@ -55,7 +79,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def DuckDuckSearch(arg1: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 search information in the web
15
+ Args:
16
+ arg1: A string representing the word about we want to make the search in the web
17
+ """
18
+ try:
19
+ # Get the search
20
+ text = DuckDuckGoSearchTool(arg1)
21
+ return f"The text about {arg1} is: {text}"
22
+ except Exception as e:
23
+ return f"Error fetching the search '{arg1}': {str(e)}"
24
+
25
+
26
+
27
+ @tool
28
  def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
29
  #Keep this format for the description / args / args description but feel free to modify the tool
30
  """A tool that does nothing yet
 
32
  arg1: the first argument
33
  arg2: the second argument
34
  """
35
+ try:
36
+ # Create timezone object
37
+ tz = pytz.timezone(timezone)
38
+ # Get current time in that timezone
39
+ local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
40
+ return f"The current local time in {timezone} is: {local_time}"
41
+ except Exception as e:
42
+ return f"Error fetching time for timezone '{timezone}': {str(e)}"
43
  return "What magic will you build ?"
44
 
45
  @tool
 
79
 
80
  agent = CodeAgent(
81
  model=model,
82
+ tools=[final_answer, get_current_time_in_timezone, DuckDuckSearch], ## add your tools here (don't remove final answer)
83
  max_steps=6,
84
  verbosity_level=1,
85
  grammar=None,