Ollama PDF RAG¶
Chat with your PDFs locally using Ollama and LangChain
Welcome to the documentation for Ollama PDF RAG โ a powerful, privacy-first application that lets you have conversations with your PDF documents using local language models.

๐ Why Ollama PDF RAG?¶
| Feature | Benefit |
|---|---|
| ๐ 100% Local | Your data never leaves your machine |
| ๐ Two UIs | Modern Next.js app OR classic Streamlit |
| ๐ Multi-PDF Support | Query across multiple documents |
| ๐ง Smart Retrieval | Multi-query expansion for better results |
| โก Fast API | FastAPI backend for production use |
| ๐ฏ Thinking Models | Special support for qwen3, deepseek-r1 |
๐๏ธ Architecture Overview¶
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ USER INTERFACE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Next.js (Modern UI) โ Streamlit (Classic) โ
โ localhost:3000 โ localhost:8501 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FastAPI Backend โ
โ localhost:8001 โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโค
โ PDF Upload โ RAG Query โ Models โ Health โ
โ /api/v1/ โ /api/v1/ โ /api/v1/ โ /health โ
โ pdfs โ query โ models โ โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ ChromaDB โ โ Ollama โ โ SQLite โ
โ (Vectors) โ โ (LLM) โ โ (Metadata) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
๐ Quick Start¶
# 1. Clone and install
git clone https://github.com/tonykipkemboi/ollama_pdf_rag.git
cd ollama_pdf_rag
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# 2. Install Ollama models
ollama pull llama3.2
ollama pull nomic-embed-text
# 3. Start the app (Next.js UI + FastAPI)
./start_all.sh
# Or manually:
# python run_api.py &
# cd web-ui && pnpm dev
# 4. Open http://localhost:3000
๐ธ Screenshots¶
Next.js Modern Interface¶

Streamlit Classic Interface¶

๐ Documentation¶
| Section | Description |
|---|---|
| Installation | Full setup guide |
| Quick Start | Get running in 5 minutes |
| PDF Processing | How documents are processed |
| RAG Pipeline | Understanding retrieval |
| Chat Interface | Using the UIs |
| API Reference | Backend API docs |
| Contributing | How to contribute |
๐ง Key Features¶
PDF Selection & Chat¶
- โ๏ธ Checkbox Selection: Select PDFs before chatting
- ๐ Question Classification: Auto-detects if you need documents
- ๐ฌ General Chat: Works without documents too
- ๐ Multi-PDF: Query across multiple documents
RAG Pipeline¶
- ๐ Multi-Query Retrieval: Generates alternative queries
- ๐งฉ Smart Chunking: 7500 char chunks with 100 overlap
- ๐ฏ Source Citations: Every answer includes sources
- ๐ง Chain-of-Thought: Thinking models show reasoning
Developer Experience¶
- ๐ Type Safe: Full TypeScript frontend
- ๐งช Tested: Python tests with pytest
- ๐ CI/CD: GitHub Actions for tests
- ๐ Documented: MkDocs with full API reference
๐ Project Status¶
๐ค Community¶
- ๐ Report a Bug
- ๐ก Request a Feature
- ๐ค Contribute
- โญ Star on GitHub
๐ License¶
This project is open source under the MIT License.