This repository contains a Full-Stack Generative AI application built with Streamlit and LangChain. It allows users to upload any PDF document and chat with it in real-time using a Local Vector Database (ChromaDB).
The system implements the Retrieval-Augmented Generation (RAG) architecture to completely eliminate LLM hallucinations by grounding the AI's answers strictly on the provided documents.
- Dual LLM Support: Easily toggle between Premium OpenAI (
gpt-4o-mini) and Free Open-Source models (via HuggingFace). - Persistent Local Memory: Chat history is maintained seamlessly within the Streamlit session state.
- Dynamic Chunking: Employs
RecursiveCharacterTextSplitterfor semantic document chunking. - Local Vector Store: Uses ChromaDB embedded locally, requiring zero cloud database setup.
graph TD
A[User Uploads PDF] -->|PyPDFLoader| B(Document Processor)
B -->|Recursive Chunking| C(Text Chunks)
C -->|Embeddings| D[(ChromaDB Vector Store)]
E[User Asks Question] -->|Semantic Search| D
D -->|Top-K Relevant Chunks| F[LangChain RAG Chain]
E --> F
F -->|Context + Prompt| G((LLM - OpenAI / HuggingFace))
G -->|Grounded Answer| H[Streamlit Chat UI]
Clone the repository and install the dependencies:
git clone https://github.com/karidasd/Advanced-RAG-System.git
cd Advanced-RAG-System
pip install -r requirements.txtCopy the environment template and insert your API keys:
cp .env.example .envAdd your keys inside .env:
OPENAI_API_KEY=sk-...
HUGGINGFACEHUB_API_TOKEN=hf_...Launch the Streamlit web server:
streamlit run app.pyOpen your browser at http://localhost:8501 to use the chatbot!
AI & Data Science Instructor / PhD Candidate
