How cmwaseemyousef/foodiespot-reservation-ai works
Project type and purpose
• This is a full-stack demo application called “FoodieSpot AI Reservation Agent.”
• Frontend: Streamlit chat UI (app.py)
• Backend: FastAPI service exposing an /agent endpoint (backend.py)
• Purpose: Accept natural-language queries, extract intent (mocked rule-based LLM), query a static dataset (restaurants.json), and return booking or recommendation responses.
File structure
• Top-level files:
• app.py – Streamlit frontend
• backend.py – FastAPI backend
• restaurants.json – static data store
• requirements.txt – Python dependencies
• Supporting docs (prompts, assumptions, business strategy) are outside core runtime.
• No separate “src” or “lib” folders: all code is in the root.
• No containerization or infra scripts—deployment via Uvicorn and Streamlit CLI.
README for additional insights
• Frontend/back-end split is explicitly described.
• Architecture section calls out tool-calling approach and how to swap in a real LLM by replacing call_llm().
• Screenshots and user-journey images outline end-to-end flow.
• Future enhancements mention external LLM services, cancel/modify flows, notifications.
a. Main components
• User / Browser
• Streamlit UI (app.py)
• FastAPI Backend (backend.py)
• Intent-Extraction Module (call_llm rule-based stub or real LLM)
• Data Store (restaurants.json)
• (Optional) External LLM Service (OpenAI/HuggingFace)
b. Relationships & interactions
1. User interacts with Streamlit UI.
2. UI sends HTTP POST to the FastAPI /agent endpoint.
3. Backend receives chat history and user message.
4. Backend invokes call_llm() to parse intent into JSON.
– If swapped out, this becomes an API call to an external LLM service.
5. Backend processes intent: queries restaurants.json for matches.
6. Backend constructs a response and returns JSON to UI.
7. UI renders the assistant’s reply in the chat.
c. Architectural patterns & principles
• Separation of concerns: UI vs. API vs. data
• Tool-calling architecture: backend orchestrates LLM calls + domain logic
• Plug-and-play integration: intent extractor is encapsulated for easy swapping
d. Key technologies & frameworks
• Streamlit (Python) for frontend
• FastAPI + Uvicorn for backend
• Python standard libraries & JSON for data handling
• Optional: OpenAI/Hugging Face API for real LLM integration
Detail without over-engineering
• Every runtime artifact (app.py, backend.py, restaurants.json, call_llm stub).
• Mock vs. future real LLM flow.
• Do not include documentation files or business_strategy.md—focus on runtime/system elements.