A powerful Retrieval-Augmented Generation (RAG) based Question Answering Bot built using:
- LangChain
- Ollama (Local LLM)
- ChromaDB
- Gradio
This project allows users to upload documents (PDF, TXT, Excel, etc.), create embeddings, store them in a vector database, and ask context-aware questions using a local LLM.
- ✅ Local LLM support using Ollama
- ✅ RAG-based Question Answering
- ✅ PDF ingestion and chunking
- ✅ Excel file formatting and ingestion
- ✅ ChromaDB vector storage
- ✅ HuggingFace embeddings
- ✅ Gradio web interface
- ✅ Modular project architecture
- ✅ Persistent vector database
- ✅ Unit testing support
RAG-QA-Bot-Using-LangChain/
│
├── app.py # Main Gradio app entry point
├── config.py # Central config (model names, paths, etc.)
├── requirements.txt # Dependencies
├── .env # API keys (if any, keep secret)
├── .gitignore
│
├── src/ # Core logic
│ │
│ ├── chains/ # LangChain pipelines
│ │ └── qa_chain.py
│ │
│ ├── embeddings/ # Embedding models
│ │ └── embedding_model.py
│ │
│ ├── ingestion/ # Data loading & chunking
│ │ ├── loader.py
│ │ ├── chunker.py
│ │ ├── excel_loader.py # Format Excel for ingestion
│ │ └── upload_ingest.py # Upload and ingest files
│ │
│ ├── llm/ # LLM setup (Ollama)
│ │ └── ollama_client.py
│ │
│ ├── prompts/ # Prompt templates
│ │ └── qa_prompt.py
│ │
│ ├── vectorstore/ # ChromaDB setup
│ │ └── chroma_store.py
│ │
│ └── utils/ # Helpers
│ └── logger.py
│
├── data/ # Input documents
│ ├── raw/
│ └── processed/
│
├── db/ # ChromaDB persistent storage
│ └── chroma/
│
└── tests/ # Unit tests
├── __init__.py
├── test_chunk.py
├── test_embedding.py
├── test_llm.py
├── test_loader.py
├── test_qa.py
└── test_vectorstore.py
git clone https://github.com/your-username/RAG-QA-Bot-Using-LangChain.git
cd RAG-QA-Bot-Using-LangChain
Windows
py --3.11 -m venv .venv # Use python 3.11
.venv\Scripts\activate
Linux / Mac
python3.11 -m venv .venv
source .venv/bin/activate
pip install -r requirements.tx
Pull a model:
ollama pull llama3:8b # Chat Model
ollama pull qwen3-embedding:0.6b # Embedding Model
Place your documents inside
data/raw/. Supported formats: PDF, TXT, Excel, docx, etc.
Run ingestion script python scripts/ingest.py.
This will:
- Load documents
- Split into chunks
- Generate embeddings
- Store vectors in ChromaDB
Embeddings are stored locally inside db/chroma/. This folder contains:
- Vector embeddings
- ChromaDB metadata
- SQLite database
- Search indexes
python app.py
Gradio UI will start locally:
http://127.0.0.1:7860
Documents
↓
Loader
↓
Chunking
↓
Embeddings
↓
ChromaDB
↓
Retriever
↓
Ollama LLM
↓
Answer
Run all tests:
pytest
Run individual test:
py -m tests.test_llm
py -m tests.test_loader
py -m tests.test_chunk
py -m tests.test_embedding
py -m tests.test_vectorstore
py -m tests.test_qa