Skip to content

feat: Weather Assistant Phase 2 - Function calling for weather lookups #289

@Orinks

Description

@Orinks

Summary

Add function calling (tool use) to the Weather Assistant so the AI can actively fetch weather data during conversation instead of relying only on pre-loaded context.

Tools to Implement

get_current_weather(location: str)

  • Look up current conditions for a given location
  • Return temperature, conditions, humidity, wind, etc.
  • Use the app's existing weather API client

get_forecast(location: str)

  • Get multi-day forecast for a location
  • Return period names, temperatures, conditions

get_alerts(location: str)

  • Check active weather alerts for a location
  • Return alert titles, severity, description

Implementation Notes

  • Use OpenAI's function calling / tool use format via OpenRouter
  • Functions should use the app's existing WeatherService and API clients
  • Handle tool calls in the response loop: call function → send result back → get final response
  • Announce final response via Prism (already integrated)
  • Graceful error handling if location not found or API fails
  • Keep the existing pre-loaded weather context as baseline; tools supplement it

Branch

Work on feature/weather-chat branch.

Key Files

  • src/accessiweather/ui/dialogs/weather_assistant_dialog.py — add tool definitions and handling
  • src/accessiweather/weather_service.py — existing service to leverage
  • src/accessiweather/weather_gov_api_client/ — existing API client

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions