How pavithrav2005/flight-and-weather-assistant works
The product is a Streamlit flight-and-weather chatbot backed by a FastAPI API. A user prompt is analyzed, resolved into tool calls, executed against flight/weather capabilities, and assembled into a chat response; direct flight endpoints also combine flight status with airport weather. The README documents chat history and theme support, but sampled source does not establish their persistence or implementation details. Edges follow the shown backend wiring and imports; Streamlit-to-API is documented in the README.
Main entry points: main.py FastAPI app · chatbot.py Chat orchestration · openweather.py Weather provider · routes API routes
Components 28
User interface
- Streamlit app
streamlit_app.py
API and orchestration
- FastAPI app
app/main.py - API routes
app/routes - Chat endpoint
app/routes/chat.py - Flight endpoint
app/routes/flight.py - Health endpoint
app/routes/health.py - MCP endpoint
app/routes/mcp.py
Chat and tools
- Chat orchestration
app/services/chatbot.py - Prompt analysis
app/services/prompt_analyzer.py - Tool executor
app/mcp/executor.py - Tool registry
app/mcp/registry.py - Flight and weather tools
app/mcp/tools.py - Chat models
app/models/chat.py
Flight and weather data
- Flight information
app/services/flight_info.py - Flight data provider
app/services/aviationstack.py - Weather provider
app/services/openweather.py - Flight models
app/models/flight.py - Weather models
app/models/weather.py
Runtime support
- In-memory cache
app/services/cache.py - External service base
app/services/base.py - Settings
app/core/config.py - Request context
app/core/context.py - Structured logging
app/core/logging.py - Application errors
app/core/exceptions.py
Other components
- User
- NVIDIA NIM
- Aviationstack
- OpenWeather
Connections 37
- User → Streamlit app: submits query
README.md - Streamlit app → FastAPI app: HTTP requests
README.md - FastAPI app → API routes: mounts routes
app/main.py - API routes → Chat endpoint: includes
app/routes/__init__.py - API routes → Flight endpoint: includes
app/routes/__init__.py - API routes → Health endpoint: includes
app/routes/__init__.py - API routes → MCP endpoint: includes
app/routes/__init__.py - Chat endpoint → Chat orchestration: handles prompt
app/routes/chat.py - Flight endpoint → Flight information: requests flight data
app/routes/flight.py - Chat orchestration → Prompt analysis: analyzes prompt
app/services/chatbot.py - Prompt analysis → NVIDIA NIM: requests analysis
app/services/prompt_analyzer.py - Chat orchestration → Tool executor: executes tool calls
app/services/chatbot.py - Tool executor → Tool registry: looks up tool
app/mcp/executor.py - FastAPI app → Tool registry: registers tools
app/main.py - FastAPI app → Flight and weather tools: registers tools
app/main.py - Flight and weather tools → Flight information: calls flight service
app/mcp/tools.py - Flight and weather tools → Weather provider: calls weather service
app/mcp/tools.py - Flight information → Flight data provider: gets flight status
app/services/flight_info.py - Flight information → Weather provider: gets airport weather
app/services/flight_info.py - Flight data provider → Aviationstack: requests flight data
app/services/aviationstack.py - Weather provider → OpenWeather: requests weather
app/services/openweather.py - Flight data provider → In-memory cache: reads and writes
app/services/aviationstack.py - Weather provider → In-memory cache: uses cache
app/services/openweather.py - Flight information → In-memory cache: reads and writes
app/services/flight_info.py - Flight data provider → Flight models: parses responses
app/services/aviationstack.py - Weather provider → Weather models: returns weather model
app/services/openweather.py - Chat orchestration → Chat models: builds response
app/services/chatbot.py - Chat orchestration → Flight models: validates tool results
app/services/chatbot.py - Chat orchestration → Weather models: uses weather results
app/services/chatbot.py - Flight data provider → External service base: extends
app/services/aviationstack.py - Weather provider → External service base: extends
app/services/openweather.py - Prompt analysis → External service base: extends
app/services/prompt_analyzer.py - FastAPI app → Settings: loads settings
app/main.py - FastAPI app → Structured logging: configures logging
app/main.py - FastAPI app → Request context: sets request ID
app/main.py - FastAPI app → Application errors: handles errors
app/main.py - Structured logging → Request context: reads request ID
app/core/logging.py