Final_Assignment_Template / src /tools /weater_info_tool.py
tommaso1288's picture
First commit - code refactoring
cdf8921
raw
history blame contribute delete
658 Bytes
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)