An AI-powered Document Question Answering System using Retrieval-Augmented Generation (RAG) that runs entirely locally via Ollama.
Users upload documents (PDF, DOCX, TXT), ask natural language questions, and get accurate context-aware answers grounded in document content.
Upload → Parse & Extract Text → Store in Memory → User Asks Question
↓
Retrieve relevant document context from store
↓
Augment LLM prompt with retrieved context
↓
Generate answer using local Ollama LLM (qwen2.5:1.5b)
This implements Full-Context RAG (context stuffing):
- Retrieval — Parsed document text retrieved from in-memory store
- Augmentation — Full document context injected into LLM prompt
- Generation — Local LLM generates answers strictly from provided context
Optimized for small-to-medium documents where full context fits within LLM context window (32k tokens). No vector DB needed for this scale.
- RAG Architecture: Retrieval-Augmented Generation with full-context stuffing
- Multi-Format Parsing: PDF (
pypdf), DOCX (python-docx), TXT (multi-encoding: utf-8/latin-1/cp1252/utf-16) - Local LLM: Runs on Ollama
qwen2.5:1.5b— no API keys, no cloud, fully private - Xbox Theme UI: Flat matte black and green interface
- Upload Limit: Max 2 files per session, auto-clears previous context
- Low Temperature (0.2): Enforced factual, context-bound answers
- Python 3.10+
- Ollama — Install from ollama.com and start it
- Model:
ollama pull qwen2.5:1.5b
cd folder_ask
pip install -r requirements.txt
python app.pyOpen http://127.0.0.1:5000.
python -m unittest test_app.py