daniela-veloz/adventure_weather_assistant
π€οΈ 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
- User Input β Streamlit chat interface
- Rate Check β Validate user can make request
- Agent Processing β LLM determines need for function calls
- Parallel API Calls β Weather + Events data fetched simultaneously
- AI Response β LLM generates personalized recommendations
- 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
- Clone the repository
git clone git@github.com:daniela-veloz/adventure_weather_assistant.git
cd adventure_weather_assistant- Install dependencies
pip install -r requirements.txt- Environment Configuration Create a
.envfile with your API keys:
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- Run the application
streamlit run app.py- 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
