Weather Tools
enhancedtoolkits.weather.EnhancedWeatherTools ¶
EnhancedWeatherTools(timeout: int = 30, base_url: Optional[str] = None, add_instructions: bool = True, **kwargs)
Bases: StrictToolkit
Enhanced Weather Tools v1.0
A comprehensive toolkit for weather data including: - Current weather conditions - Weather forecasts - Temperature data - Weather descriptions - Support for multiple languages
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout | int | Request timeout in seconds | 30 |
base_url | Optional[str] | Custom base URL for the weather API (default: wttr.in) | None |
add_instructions | bool | Whether to add usage instructions | True |
Source code in src/enhancedtoolkits/weather.py
Functions¶
fetch_current_weather_conditions ¶
Get current weather conditions for a location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location | str | Location name or coordinates | required |
language | str | Language code (default: en) | 'en' |
Returns:
Type | Description |
---|---|
str | JSON string containing current weather data |
Raises:
Type | Description |
---|---|
WeatherError | If weather data retrieval fails |
Source code in src/enhancedtoolkits/weather.py
fetch_weather_forecast ¶
Get weather forecast for a location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location | str | Location name or coordinates | required |
days | int | Number of days for forecast (1-7) | 3 |
language | str | Language code (default: en) | 'en' |
Returns:
Type | Description |
---|---|
str | JSON string containing weather forecast |
Raises:
Type | Description |
---|---|
WeatherError | If weather data retrieval fails |
Source code in src/enhancedtoolkits/weather.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
fetch_temperature_data ¶
Get temperature data for a location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location | str | Location name or coordinates | required |
language | str | Language code (default: en) | 'en' |
Returns:
Type | Description |
---|---|
str | JSON string containing temperature data |
Raises:
Type | Description |
---|---|
WeatherError | If weather data retrieval fails |
Source code in src/enhancedtoolkits/weather.py
fetch_weather_text_description ¶
Get weather description for a location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location | str | Location name or coordinates | required |
language | str | Language code (default: en) | 'en' |
Returns:
Type | Description |
---|---|
str | JSON string containing weather description |
Raises:
Type | Description |
---|---|
WeatherError | If weather data retrieval fails |
Source code in src/enhancedtoolkits/weather.py
get_llm_usage_instructions staticmethod
¶
Returns detailed instructions for LLMs on how to use each tool in EnhancedWeatherTools. Each instruction includes the method name, description, parameters, types, and example values.