Update app.py
Browse files
app.py
CHANGED
@@ -33,6 +33,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
final_answer = FinalAnswerTool()
|
38 |
|
@@ -55,7 +69,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
55 |
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
-
tools=[final_answer],
|
59 |
max_steps=6,
|
60 |
verbosity_level=1,
|
61 |
grammar=None,
|
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
+
@tool
|
37 |
+
def get_bmi(height -> float, weight -> float) -> float:
|
38 |
+
"""A tool that calculate user's bmi.
|
39 |
+
Args:
|
40 |
+
height: A float representing user's height, unit of height is cm.
|
41 |
+
weight: A float representing user's weight, unit of weifht is kg.
|
42 |
+
"""
|
43 |
+
try:
|
44 |
+
# Create bmi object
|
45 |
+
bmi = weight/(height/100)^2
|
46 |
+
return f"The user's bmi when height is {height} cm, weight is {weight} kg, is: {bmi}"
|
47 |
+
except Exception as e:
|
48 |
+
return f"Error calculating with bmi: {str(e)}"
|
49 |
+
|
50 |
|
51 |
final_answer = FinalAnswerTool()
|
52 |
|
|
|
69 |
|
70 |
agent = CodeAgent(
|
71 |
model=model,
|
72 |
+
tools=[final_answer], get_bmi,
|
73 |
max_steps=6,
|
74 |
verbosity_level=1,
|
75 |
grammar=None,
|