Update app.py
Browse filesadd operational tools
app.py
CHANGED
@@ -18,6 +18,33 @@ 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.
|
@@ -55,7 +82,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
55 |
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
-
tools=[final_answer, get_current_time_in_timezone, web_search, image_generation_tool], ## 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 sum_op(arg1:int, arg2:int)-> int:
|
23 |
+
"""A tool that sum two values and return the result
|
24 |
+
Args:
|
25 |
+
arg1: the first argument
|
26 |
+
arg2: the second argument
|
27 |
+
"""
|
28 |
+
return arg1 + arg2
|
29 |
+
|
30 |
+
@tool
|
31 |
+
def subtract_op(arg1:int, arg2:int)-> int:
|
32 |
+
"""A tool that compute the difference between two values and return the result
|
33 |
+
Args:
|
34 |
+
arg1: the first argument
|
35 |
+
arg2: the second argument
|
36 |
+
"""
|
37 |
+
return arg1 - arg2
|
38 |
+
|
39 |
+
@tool
|
40 |
+
def multiply_op(arg1:int, arg2:int)-> int:
|
41 |
+
"""A tool that compute the product between two values and return the result
|
42 |
+
Args:
|
43 |
+
arg1: the first argument
|
44 |
+
arg2: the second argument
|
45 |
+
"""
|
46 |
+
return arg1 * arg2
|
47 |
+
|
48 |
@tool
|
49 |
def get_current_time_in_timezone(timezone: str) -> str:
|
50 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
82 |
|
83 |
agent = CodeAgent(
|
84 |
model=model,
|
85 |
+
tools=[final_answer, get_current_time_in_timezone, web_search, image_generation_tool, sum_op, subtract_op, multiply_op], ## add your tools here (don't remove final answer)
|
86 |
max_steps=6,
|
87 |
verbosity_level=1,
|
88 |
grammar=None,
|