Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,6 +50,22 @@ def get_weather(city: str) -> dict:
|
|
| 50 |
else:
|
| 51 |
return {"Error": "Unable to fetch weather data."}
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
@tool
|
| 54 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 55 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -87,7 +103,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 87 |
|
| 88 |
agent = CodeAgent(
|
| 89 |
model=model,
|
| 90 |
-
tools=[final_answer, get_weather], ## add your tools here (don't remove final answer)
|
| 91 |
max_steps=6,
|
| 92 |
verbosity_level=1,
|
| 93 |
grammar=None,
|
|
|
|
| 50 |
else:
|
| 51 |
return {"Error": "Unable to fetch weather data."}
|
| 52 |
|
| 53 |
+
@tool
|
| 54 |
+
def multiply_integers(a: int, b: int) -> str:
|
| 55 |
+
"""
|
| 56 |
+
A tool that multiplies two integers and returns the result as a string.
|
| 57 |
+
|
| 58 |
+
Args:
|
| 59 |
+
a (int): The first integer.
|
| 60 |
+
b (int): The second integer.
|
| 61 |
+
|
| 62 |
+
Returns:
|
| 63 |
+
str: A string describing the multiplication result.
|
| 64 |
+
"""
|
| 65 |
+
result = a * b
|
| 66 |
+
return f"The result of multiplying {a} by {b} is {result}."
|
| 67 |
+
|
| 68 |
+
|
| 69 |
@tool
|
| 70 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 71 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 103 |
|
| 104 |
agent = CodeAgent(
|
| 105 |
model=model,
|
| 106 |
+
tools=[final_answer, get_weather, multiply_integers], ## add your tools here (don't remove final answer)
|
| 107 |
max_steps=6,
|
| 108 |
verbosity_level=1,
|
| 109 |
grammar=None,
|