How zooll51/cocktail-advisor works
Project Type & Core Purpose
• This is a Python full-stack application built to provide cocktail recommendations by integrating Large Language Models (OpenAI GPT), Retrieval-Augmented Generation (via LangChain and FAISS), and a chat interface. It incorporates both a FastAPI backend for the RESTful API and a Gradio-based chat UI.
Key Components
a. Frontend Interface:
• Gradio Chat Interface (user input and output for cocktail queries).
b. Backend API:
• FastAPI Server providing endpoints like /chat and API documentation (/docs).
• This backend orchestrates incoming requests and forwards them to other components.
c. RAG and LLM Integration:
• Module for Retrieval-Augmented Generation (indicated by “app/rag.py”).
• Integration with LangChain to manage LLM interactions.
• OpenAI GPT is the underlying language model used for generating responses.
d. Data Processing/Loading:
• The “data_loader” module (app/data_loader.py) which likely handles reading and processing the cocktail dataset.
• The “data” directory, where the cocktail dataset (final_cocktails.csv) is stored.
e. External Services & Databases:
• FAISS Vector Database (used for similarity searches).
• OpenAI’s API (for GPT requests).
• These external services should be depicted as separate components that the backend interacts with.
Relationships and Data Flow
• From FastAPI, illustrate the routing: queries are processed and passed to the RAG module.
• The RAG module (app/rag.py) should point to both:
• The FAISS vector database for similarity searches of cocktail data.
• OpenAI’s GPT model for generating natural language responses.
• That the backend is the central hub coordinating between the user interface, data processing, vector database, and the language model.
Architectural Patterns & Design Principles
• The project follows a modular design where its components are separated by functionality (API, Chat UI, Data Loading, RAG handling).
• Client-server separation (frontend vs backend).
• Use of a retrieval-based augmentation pattern where user queries are enriched by searching a vector database before querying the language model.
Technology Specifics
• Specific libraries: FastAPI (backend server), Gradio (frontend chat interface), FAISS (vector similarity search), LangChain (LLM orchestration), and OpenAI GPT (language model).
• Mention auxiliary libraries (Pandas, NumPy, python-dotenv) where necessary to indicate data processing and configuration.