BasicChatbot-AliA / custom_tools.py
AliA1997
Added custom_tools.py file
98f92bb
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.")