Spaces:
Sleeping
Sleeping
Addd function to add two ints
Browse files
app.py
CHANGED
|
@@ -34,6 +34,21 @@ 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 |
|
| 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:
|
|
@@ -55,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
|
| 37 |
+
@tool
|
| 38 |
+
def add_two_numbers(a: int, b: int) -> int:
|
| 39 |
+
"""
|
| 40 |
+
Returns the sum of two integers.
|
| 41 |
+
|
| 42 |
+
Args:
|
| 43 |
+
a: First integer.
|
| 44 |
+
b: Second integer.
|
| 45 |
+
|
| 46 |
+
Returns:
|
| 47 |
+
The sum of a and b.
|
| 48 |
+
"""
|
| 49 |
+
return a + b
|
| 50 |
+
|
| 51 |
+
|
| 52 |
final_answer = FinalAnswerTool()
|
| 53 |
|
| 54 |
# 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:
|
|
|
|
| 70 |
|
| 71 |
agent = CodeAgent(
|
| 72 |
model=model,
|
| 73 |
+
tools=[get_current_time_in_timezone, add_two_numbers, final_answer], ## add your tools here (don't remove final answer)
|
| 74 |
max_steps=6,
|
| 75 |
verbosity_level=1,
|
| 76 |
grammar=None,
|