from smolagents import Tool | |
from rest_clients.open_weather_client import OpenWeatherClient | |
class WeatherInfoTool(Tool): | |
name = "weather_info" | |
description = "Fetches real weather information for a given location using OpenWeatherMap." | |
inputs = { | |
"location": { | |
"type": "string", | |
"description": "The location to get weather information for." | |
} | |
} | |
output_type = "string" | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self.weather_client = OpenWeatherClient() | |
def forward(self, location: str): | |
return self.weather_client.get_weather(location) |