How jolual2747/rag-architecture works
Project type and purpose
• From the README and file tree, this is a full-stack RAG (Retrieval Augmented Generation) prototype for document-based Q&A and chatbots.
• Purpose: ingest documents, compute embeddings, store them in a vector database, retrieve relevant passages at query time, and generate answers via a generative LLM. Two frontends (Gradio and Streamlit) expose the Q&A/chatbot functionality.
File structure
• Top level
• assets/ (demo GIF)
• data/
– unprocessed, processed (CSV/TSV), embeddings folders, and a Chroma SQLite file
• notebooks/ (exploratory data prep, embedding creation, RAG prototyping)
• src/frontend/
– gradio_app.py, st_app.py, templates and utils
• Makefile, pyproject.toml (build scripts, dependencies)
• No separate “backend” folder: the core pipeline lives in notebooks and is invoked by each frontend.
• Vector DB persistence & file-based embeddings indicate a file-system–based data layer rather than a service.
README insights
• Describes RAG concepts, Langchain + OpenAI embeddings, vector DB (Chroma), and two UX surfaces: chatbot and Streamlit document Q&A.
• Build instructions for Gradio (make build_gradio_app) and Streamlit (make build_streamlit_app).
Main components & their interactions (
a. Data Ingestion & Processing
• Raw documents (PDF, CSV) → preprocessing scripts (notebooks/utils.py) → cleaned data (data/processed/*.csv/tsv)
b. Embedding Generation
• Cleaned text → OpenAI Embeddings API → embeddings files + Chroma SQLite database (data/data_embeddings/)
c. Vector Database
• Chroma (on‐disk SQLite) storing vectors + metadata; provides similarity search
d. Retrieval Layer
• Langchain Retriever configured to query Chroma
e. Generative LLM
• OpenAI Chat/Completion API that takes retrieved passages + prompt template → generates answer
f. Frontend Applications
• Gradio app (src/frontend/gradio_app.py)
• Streamlit app (src/frontend/st_app.py)
– both call into the same RAG pipeline: retrieve + generate
External Services
• OpenAI Embeddings API
• OpenAI Chat/Completion API
Architectural patterns & design principles
• Pipeline pattern: sequential stages (ingest → embed → store → retrieve → generate → serve)
• Separation of concerns: data layer, embedding service, vector DB, retrieval, generation, UI layers
• Reusability: notebooks for prototyping; utils for shared code; two interchangeable frontend wrappers