CoolFace
Apppublic

daniela-veloz/adventure_weather_assistant

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

🌀️ Adventure Weather Assistant

An intelligent activity planning assistant that combines real-time weather data with local event information to suggest personalized activities. Built with Streamlit and powered by OpenAI GPT-4o-mini.

🌐 Live Demo

Try it now: https://huggingface.co/spaces/daniela-veloz/adventure_weather_assistant

πŸš€ Features

  • β€”πŸŒ¦οΈ Real-time Weather Integration: 7-day weather forecasts from WeatherAPI
  • β€”πŸŽ­ Event Discovery: Live events from TicketMaster and Google Places
  • β€”πŸ€– AI-Powered Recommendations: Intelligent activity suggestions based on weather conditions
  • β€”πŸ’¬ Conversational Interface: Natural chat interface with conversation memory
  • β€”πŸ›‘οΈ Rate Limiting: Fair usage controls (10/hour, 25/day per IP)
  • β€”πŸŒ Web Interface: Modern Streamlit-based chat interface

πŸŽ“ GEN-AI Skills Showcased

This project demonstrates cutting-edge Generative AI techniques and serves as a comprehensive learning platform for modern LLM application development, covering essential patterns used in production AI systems:

πŸ€– Advanced LLM Integration

  • β€”OpenAI GPT-4o-mini: Production-grade language model integration with sophisticated prompt engineering
  • β€”Function Calling: Automatic tool selection and execution based on natural language queries
  • β€”Conversational AI: Multi-turn dialogue management with context preservation
  • β€”Intelligent Decision Making: LLM autonomously decides when and how to fetch external data

πŸ”§ Function Calling & Tool Orchestration

  • β€”Dynamic Function Registry: Runtime function mapping enabling extensible AI agent capabilities
  • β€”Multi-Tool Coordination: Seamless orchestration of weather APIs, event services, and location data
  • β€”Parameter Extraction: Intelligent parsing of user intent to extract function arguments
  • β€”Conditional Tool Use: LLM determines optimal tool combinations based on query context
  • β€”Error Recovery: Graceful handling of API failures with fallback strategies

🧠 AI Agent Architecture

  • β€”Agent-Based Design: Autonomous AI agent that can reason, plan, and execute complex tasks
  • β€”State Management: Persistent conversation memory across multiple interactions
  • β€”Context Awareness: Understanding of user preferences and conversation history
  • β€”Iterative Processing: Multi-step workflows with feedback loops and self-correction

🎯 Advanced Prompt Engineering

  • β€”System Prompt Design: Carefully crafted instructions defining AI personality and behavior
  • β€”Function Call Guidance: Prompts that encourage optimal tool usage patterns
  • β€”Chain-of-Thought: Structured reasoning processes for complex decision making
  • β€”Context Injection: Dynamic prompt augmentation with real-time data
  • β€”Response Formatting: Structured output generation for consistent user experience

πŸ“Š Real-World AI Applications

  • β€”Multi-Modal Data Fusion: Intelligent combination of weather, event, and location data
  • β€”Ranking & Recommendation: AI-powered scoring and prioritization of activities
  • β€”Parallel Processing: Concurrent API orchestration for optimal performance
  • β€”Real-Time Intelligence: Live data integration with immediate AI-powered insights
  • β€”Personalization: Adaptive recommendations based on user context and preferences

πŸ—οΈ Production AI Patterns

  • β€”Modular AI Architecture: Clean separation between AI logic, data services, and UI
  • β€”Scalable Design: Service layer abstraction enabling easy expansion of AI capabilities
  • β€”Rate Limiting: Production-ready API management and cost control
  • β€”Error Handling: Robust failure management preserving user experience
  • β€”Monitoring & Observability: Usage tracking and system health monitoring

πŸš€ Modern AI Deployment

  • β€”Web-Based AI Interface: Streamlit integration for accessible AI applications
  • β€”API Integration: Seamless connection to multiple external services
  • β€”Environment Management: Secure configuration and credential handling
  • β€”Containerization: Docker-ready deployment for cloud platforms
  • β€”Real-Time Processing: Immediate AI responses with live data integration

This project provides a practical foundation for understanding how to build, deploy, and maintain AI-powered applications in real-world scenarios, demonstrating the full spectrum of Generative AI capabilities from basic chat interfaces to sophisticated multi-tool AI agents.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          Adventure Weather Assistant                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Streamlit     β”‚    β”‚                  Backend Services                        β”‚
β”‚   Frontend      β”‚    β”‚                                                          β”‚
β”‚                 β”‚    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚    β”‚  β”‚ Activity        β”‚    β”‚        LLM Client            β”‚ β”‚
β”‚  β”‚ Chat UI  │◄──┼────┼──► Adventure      │◄────     (OpenAI GPT-4o-mini)     β”‚ β”‚
β”‚  β”‚          β”‚   β”‚    β”‚  β”‚ Agent           β”‚    β”‚   - Function Calling         β”‚ β”‚
β”‚  β”‚ Rate     β”‚   β”‚    β”‚  β”‚                 β”‚    β”‚   - Conversation Memory      β”‚ β”‚
β”‚  β”‚ Limiter  β”‚   β”‚    β”‚  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚    β”‚   - Error Handling           β”‚ β”‚
β”‚  β”‚          β”‚   β”‚    β”‚  β”‚ β”‚ Function    β”‚ β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚  β”‚ Usage    β”‚   β”‚    β”‚  β”‚ β”‚ Registry    β”‚ β”‚                                     β”‚
β”‚  β”‚ Stats    β”‚   β”‚    β”‚  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚                                     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                            β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚                   β”‚                   β”‚
                        β–Ό                   β–Ό                   β–Ό
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚ Weather Service β”‚ β”‚ Event Service   β”‚ β”‚   Rate Limiter  β”‚
            β”‚                 β”‚ β”‚ Aggregator      β”‚ β”‚                 β”‚
            β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚                 β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
            β”‚ β”‚ WeatherAPI  β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ IP Extractorβ”‚ β”‚
            β”‚ β”‚ Integration β”‚ β”‚ β”‚ β”‚ TicketMasterβ”‚ β”‚ β”‚ β”‚             β”‚ β”‚
            β”‚ β”‚             β”‚ β”‚ β”‚ β”‚   Service   β”‚ β”‚ β”‚ β”‚ File-based  β”‚ β”‚
            β”‚ β”‚ - Current   β”‚ β”‚ β”‚ β”‚             β”‚ β”‚ β”‚ β”‚ Tracking    β”‚ β”‚
            β”‚ β”‚   Weather   β”‚ β”‚ β”‚ β”‚ Google      β”‚ β”‚ β”‚ β”‚             β”‚ β”‚
            β”‚ β”‚ - 7-day     β”‚ β”‚ β”‚ β”‚ Places      β”‚ β”‚ β”‚ β”‚ Hourly &    β”‚ β”‚
            β”‚ β”‚   Forecast  β”‚ β”‚ β”‚ β”‚ Service     β”‚ β”‚ β”‚ β”‚ Daily       β”‚ β”‚
            β”‚ β”‚             β”‚ β”‚ β”‚ β”‚             β”‚ β”‚ β”‚ β”‚ Limits      β”‚ β”‚
            β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ Parallel    β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ Processing  β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚ β”‚ & Ranking   β”‚ β”‚
                                β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

                            External APIs
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   OpenAI    β”‚ β”‚ WeatherAPI  β”‚ β”‚TicketMaster β”‚ β”‚Google Placesβ”‚
    β”‚     API     β”‚ β”‚     API     β”‚ β”‚     API     β”‚ β”‚     API     β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Core Components

Frontend Layer

  • β€”Streamlit App (app.py): Web interface with chat UI, rate limiting display, and usage stats
  • β€”Rate Limiting: IP-based request tracking with visual feedback

Business Logic Layer

  • β€”ActivityAdventureAgent: Main orchestrator with function calling and conversation management
  • β€”LLMClient: Enhanced OpenAI client with function calling, error recovery, and conversation history
  • β€”Function Registry: Maps LLM function calls to actual service methods

Service Layer

  • β€”WeatherService: WeatherAPI integration for current conditions and 7-day forecasts
  • β€”EventServiceAggregator: Multi-source event discovery with parallel processing
  • β€”TicketMasterService: Live entertainment events from TicketMaster Discovery API
  • β€”GooglePlacesService: Event venues and local attractions from Google Places API
  • β€”RateLimiter: IP-based rate limiting with hourly/daily limits

Data Flow

  1. 1.User Input β†’ Streamlit chat interface
  2. 2.Rate Check β†’ Validate user can make request
  3. 3.Agent Processing β†’ LLM determines need for function calls
  4. 4.Parallel API Calls β†’ Weather + Events data fetched simultaneously
  5. 5.AI Response β†’ LLM generates personalized recommendations
  6. 6.Display β†’ Formatted response with events, weather, and activities

πŸ› οΈ Installation

Prerequisites

  • β€”Python 3.8+
  • β€”API Keys for:
  • β€”OpenAI (GPT-4o-mini)
  • β€”WeatherAPI
  • β€”TicketMaster Discovery API
  • β€”Google Places API

Setup

  1. 1.Clone the repository
bash
   git clone git@github.com:daniela-veloz/adventure_weather_assistant.git
   cd adventure_weather_assistant
  1. 1.Install dependencies
bash
   pip install -r requirements.txt
  1. 1.Environment Configuration Create a .env file with your API keys:
env
   OPENAI_API_KEY=your_openai_api_key
   WEATHER_API_KEY=your_weatherapi_key
   TICKETMASTER_API_KEY=your_ticketmaster_api_key
   GOOGLE_PLACES_API_KEY=your_google_places_api_key
  1. 1.Run the application
bash
   streamlit run app.py
  1. 1.Access the app Open your browser to http://localhost:8501

🎯 Usage

Basic Queries

  • β€”"What should I do in Seattle today?"
  • β€”"Find outdoor activities in San Francisco"
  • β€”"What events are happening in Austin this weekend?"
  • β€”"Give me indoor activities for a rainy day in London"

Advanced Features

  • β€”Conversation Memory: Follow-up questions remember previous context
  • β€”Weather-Aware: Suggestions adapt to current and forecasted conditions
  • β€”Multi-day Planning: Ask about "next week" for 7-day recommendations
  • β€”Event Integration: Real-time events with dates, venues, and ticket links

🚦 Rate Limits

To ensure fair usage:

  • β€”Hourly: 10 requests per hour per IP
  • β€”Daily: 25 requests per day per IP
  • β€”No Cooldown: Immediate follow-up questions allowed

Rate limit status is displayed in the sidebar with real-time usage statistics.

πŸ“ Project Structure

adventure_weather_assistant/
β”œβ”€β”€ app.py                          # Main Streamlit application
β”œβ”€β”€ backend/                        # Backend services package
β”‚   β”œβ”€β”€ __init__.py                 # Package initialization
β”‚   β”œβ”€β”€ activity_adventure_agent.py # Main conversational agent
β”‚   β”œβ”€β”€ llm_client.py              # Enhanced OpenAI client
β”‚   β”œβ”€β”€ weather_service.py         # Weather API integration
β”‚   β”œβ”€β”€ event_service.py           # Abstract event service base
β”‚   β”œβ”€β”€ ticketmaster_service.py    # TicketMaster API client
β”‚   β”œβ”€β”€ google_places_service.py   # Google Places API client
β”‚   β”œβ”€β”€ event_service_aggregator.py # Multi-source event aggregation
β”‚   β”œβ”€β”€ rate_limiter.py            # IP-based rate limiting
β”‚   └── ip_extractor.py            # Client IP extraction
β”œβ”€β”€ simple_app.py                  # Alternative Flask interface
β”œβ”€β”€ streamlit_app.py               # Standalone Streamlit version
β”œβ”€β”€ adventure_weather_assistant.ipynb # Original notebook (reference)
β”œβ”€β”€ CLAUDE.md                      # Development documentation
└── README.md                      # This file

πŸ”Œ API Integrations

OpenAI GPT-4o-mini

  • β€”Function Calling: Automatic weather and event data retrieval
  • β€”Conversation Memory: Multi-turn conversation support
  • β€”Error Recovery: Graceful handling of API failures

WeatherAPI

  • β€”Current Conditions: Real-time weather data
  • β€”7-Day Forecasts: Extended weather planning
  • β€”Global Coverage: Weather for cities worldwide

TicketMaster Discovery API

  • β€”Live Events: Concerts, sports, theater, and more
  • β€”Event Details: Dates, venues, ticket links
  • β€”Location-based: Events near specified cities

Google Places API

  • β€”Venue Discovery: Entertainment venues and attractions
  • β€”Location Details: Addresses, ratings, and information
  • β€”Activity Suggestions: Local points of interest

πŸ›‘οΈ Security & Privacy

  • β€”IP-based Rate Limiting: Prevents abuse without user registration
  • β€”Environment Variables: Secure API key management
  • β€”No Personal Data Storage: Conversations are not persisted
  • β€”Error Handling: Graceful failures without exposing sensitive information