Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Weather tool provides current weather, forecasts, and air quality data using various weather APIs.

Installation

pip install "praisonai[tools]"

Environment Variables

export OPENWEATHER_API_KEY=your_api_key
# Or
export WEATHERAPI_KEY=your_api_key

Quick Start

from praisonai_tools import WeatherTool

# Initialize
weather = WeatherTool()

# Get weather
result = weather.get_weather("London")
print(result)

Usage with Agent

from praisonaiagents import Agent
from praisonai_tools import WeatherTool

agent = Agent(
    name="WeatherBot",
    instructions="You provide weather information.",
    tools=[WeatherTool()]
)

response = agent.chat("What's the weather in New York?")
print(response)

Available Methods

get_weather(location)

Get current weather.
from praisonai_tools import WeatherTool

weather = WeatherTool()
result = weather.get_weather("San Francisco")

get_forecast(location, days=3)

Get weather forecast.
forecast = weather.get_forecast("Tokyo", days=5)

get_air_quality(location)

Get air quality index.
aqi = weather.get_air_quality("Beijing")

Common Errors

ErrorCauseSolution
API key not configuredMissing keySet environment variable
City not foundInvalid locationCheck city name