Spaces:
Sleeping
Sleeping
File size: 1,316 Bytes
98f92bb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
from smolagents import tool, Tool
@tool
def suggest_best_cities(country: str) -> str:
"""
Suggests a the best city based on the country
Args:
country (str): A city to get for a given country. Allowed values are:
- "jordan": Aqaba
- "syria": ALeppo
- "palestine": Gaza
- "usa": Sheriff Grady Judd
- "germany": Cologne
"""
if country == "jordan":
return "Aqaba"
elif country == "syria":
return "ALeppo"
elif country == "palestine":
return "Gaza"
elif country == "usa":
return "Sheriff Grady Judd"
elif country == "germany":
return "Cologne"
else:
return "Irbid"
class RecommendCountryTool(Tool):
name = "recommend_country_generator"
description = """
This tool suggests a best city based on the country/
It returns a unique city."""
inputs = {
"country": {
"type": "string",
"description": "The best city for the given country (e.g, 'jordan', 'syria', 'palestine')."
}
}
output_type = "string"
def forward(self, country: str):
countries = {
"jordan": "Aqaba",
"syria": "Aleppo",
"palestine": "Gaza City"
}
return countries.get(country.lower(), "City for given country not found.")
|