Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
final_answer = FinalAnswerTool()
|
38 |
model = HfApiModel(
|
39 |
max_tokens=2096,
|
@@ -51,7 +65,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,
|
|
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
|
37 |
+
@tool
|
38 |
+
def calculator(parameter_1: float, parameter_2: float) -> float | int:
|
39 |
+
"""A tool with which you can add two arbitary float values.
|
40 |
+
Args:
|
41 |
+
parameter_1: a float value that represnets the first value.
|
42 |
+
parameter_2: a float value that represents the second value.
|
43 |
+
"""
|
44 |
+
try:
|
45 |
+
output = parameter_1 + parameter_2
|
46 |
+
return f"The output value of the calculation for {parameter_1} and {parameter_2} is: {output}"
|
47 |
+
except Exception as e:
|
48 |
+
return f"Error in the calcualtion for {parameter_1} and {parameter_2}: {str(e)}"
|
49 |
+
|
50 |
+
|
51 |
final_answer = FinalAnswerTool()
|
52 |
model = HfApiModel(
|
53 |
max_tokens=2096,
|
|
|
65 |
|
66 |
agent = CodeAgent(
|
67 |
model=model,
|
68 |
+
tools=[final_answer, get_current_time_in_timezone, DuckDuckGoSearchTool, calculator], ## add your tools here (don't remove final answer)
|
69 |
max_steps=6,
|
70 |
verbosity_level=1,
|
71 |
grammar=None,
|