schrilax commited on
Commit
2e77ed1
·
verified ·
1 Parent(s): 8c5c24b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -18,6 +18,26 @@ def my_custom_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.
@@ -35,6 +55,12 @@ def get_current_time_in_timezone(timezone: str) -> str:
35
 
36
 
37
  final_answer = FinalAnswerTool()
 
 
 
 
 
 
38
 
39
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
40
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
@@ -55,7 +81,7 @@ with open("prompts.yaml", 'r') as stream:
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,
 
18
  """
19
  return "What magic will you build ?"
20
 
21
+ @tool
22
+ def add(a: str, b: str) -> str:
23
+ """Add two integers."""
24
+ return str(int(a) + int(b))
25
+
26
+ @tool
27
+ def subtract(a: str, b: str) -> str:
28
+ """Subtract two integers."""
29
+ return str(int(a) - int(b))
30
+
31
+ @tool
32
+ def multiply(a: str, b: str) -> str:
33
+ """Multiply two integers."""
34
+ return str(int(a) * int(b))
35
+
36
+ @tool
37
+ def divide(a: str, b: str) -> str:
38
+ """Divide two integers."""
39
+ return str(float(a) / float(b))
40
+
41
  @tool
42
  def get_current_time_in_timezone(timezone: str) -> str:
43
  """A tool that fetches the current local time in a specified timezone.
 
55
 
56
 
57
  final_answer = FinalAnswerTool()
58
+ duck_duck_go_tool = DuckDuckGoSearchTool()
59
+ get_time_zone = get_current_time_in_timezone()
60
+ add_tool = add()
61
+ subtract_tool = subtract()
62
+ multiply_tool = multiply()
63
+ divide_tool = divide()
64
 
65
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
66
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
 
81
 
82
  agent = CodeAgent(
83
  model=model,
84
+ tools=[add_tool, subtract_tool, multiply_tool, divide_tool, duck_duck_go_tool, final_answer], ## add your tools here (don't remove final answer)
85
  max_steps=6,
86
  verbosity_level=1,
87
  grammar=None,