Update app.py
Browse files
app.py
CHANGED
|
@@ -33,19 +33,6 @@ 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 |
-
# Create a new custom tool
|
| 37 |
-
@tool
|
| 38 |
-
def get_country_info(country: str) -> str:
|
| 39 |
-
"""Fetches basic information about a country using REST Countries API.
|
| 40 |
-
Args:
|
| 41 |
-
country: Name of the country (e.g., 'Italy').
|
| 42 |
-
"""
|
| 43 |
-
try:
|
| 44 |
-
response = requests.get(f"https://restcountries.com/v3.1/name/{country}")
|
| 45 |
-
data = response.json()[0]
|
| 46 |
-
return f"{data['name']['common']} is in {data['region']}. Capital: {data['capital'][0]}. Population: {data['population']}."
|
| 47 |
-
except Exception as e:
|
| 48 |
-
return f"Failed to fetch country info: {str(e)}"
|
| 49 |
|
| 50 |
final_answer = FinalAnswerTool()
|
| 51 |
duckduckgo_tool = DuckDuckGoSearchTool()
|
|
@@ -69,7 +56,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 69 |
|
| 70 |
agent = CodeAgent(
|
| 71 |
model=model,
|
| 72 |
-
tools=[final_answer, duckduckgo_tool,
|
| 73 |
max_steps=6,
|
| 74 |
verbosity_level=1,
|
| 75 |
grammar=None,
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
duckduckgo_tool = DuckDuckGoSearchTool()
|
|
|
|
| 56 |
|
| 57 |
agent = CodeAgent(
|
| 58 |
model=model,
|
| 59 |
+
tools=[final_answer, duckduckgo_tool, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
| 60 |
max_steps=6,
|
| 61 |
verbosity_level=1,
|
| 62 |
grammar=None,
|