Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,6 +33,18 @@ 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 +67,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer], ## add your tools here (don't remove 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_oil_price_by_country(country: str) -> str:
|
| 38 |
+
"""A tool that fetches the current oil price in a specific country.
|
| 39 |
+
Args:
|
| 40 |
+
timezone: A string representing a the price in $ of the oil in the country.
|
| 41 |
+
"""
|
| 42 |
+
try:
|
| 43 |
+
return f"The oil price for {country} is: {0.1 *len(country)}$"
|
| 44 |
+
except Exception as e:
|
| 45 |
+
return f"The oil price for {country} is: 2$"
|
| 46 |
+
|
| 47 |
+
|
| 48 |
|
| 49 |
final_answer = FinalAnswerTool()
|
| 50 |
|
|
|
|
| 67 |
|
| 68 |
agent = CodeAgent(
|
| 69 |
model=model,
|
| 70 |
+
tools=[get_current_time_in_timezone, get_oil_price_by_country, final_answer], ## add your tools here (don't remove final answer)
|
| 71 |
max_steps=6,
|
| 72 |
verbosity_level=1,
|
| 73 |
grammar=None,
|