An intelligent RAG (Retrieval-Augmented Generation) system that lets you upload any PDF and have a conversation with it. Ask questions in natural language, get accurate answers with source citations from your document.
Upload PDF β Extract Text β Chunk β Embed β Store in Vector DB β Ask Questions β Get Answers with Sources
PDF is loaded using PyMuPDF, split into 1000-character chunks with 200-character overlap using RecursiveCharacterTextSplitter, converted to 1536-dimensional vectors using OpenAI Embeddings, and stored in ChromaDB for fast similarity search. When a user asks a question, the 4 most relevant chunks are retrieved and sent along with the question to GPT-4o-mini, which generates a grounded answer with page-level citations. The entire UI is built with Streamlit.
- Upload any PDF and chat with it instantly
- Answers cite exact pages and passages used
- Persistent vector store β no re-processing on reload
- Clean Streamlit web interface
- Source transparency β see which chunks were used for each answer
- Orchestration: LangChain (LCEL β LangChain Expression Language)
- LLM: OpenAI GPT-4o-mini
- Embeddings: OpenAI text-embedding-ada-002
- Vector Database: ChromaDB (local)
- PDF Processing: PyMuPDF (fitz)
- Frontend: Streamlit
- Language: Python 3.10+
git clone https://github.com/VdKPr/DocVision-AI.git
cd DocVision-AI
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
Create a .env file in the project root:
OPENAI_API_KEY=your-openai-api-key-here
Get your key from: https://platform.openai.com/api-keys
streamlit run docvision.py
App opens at http://localhost:8501
DocVision-AI/
βββ docvision.py # Main application
βββ requirements.txt # Python dependencies
βββ .env # API key (not tracked by git)
βββ .gitignore # Git ignore rules
βββ README.md # This file
- Load β PyMuPDF extracts text from each page of the uploaded PDF
- Chunk β Text is split into 1000-character pieces with 200-character overlap to preserve context across boundaries
- Embed β OpenAI Embeddings converts each chunk into a 1536-dimensional vector that captures semantic meaning
- Store β ChromaDB indexes these vectors locally for fast cosine similarity search
- Retrieve β When you ask a question, it gets embedded too, and the 4 most similar chunks are found
- Generate β GPT-4o-mini receives your question + the retrieved chunks and produces a grounded answer with citations
- Multimodal RAG β understand images, charts, and diagrams inside PDFs using CLIP + GPT-4o vision
- Multi-document support β upload and query across multiple PDFs simultaneously
- Chat history β maintain conversation context across questions
- Local LLM support via Ollama (Llama 3) for fully offline, privacy-preserving usage
- Evaluation metrics β RAGAS-based retrieval and generation quality scoring
- Deploy to Streamlit Cloud with public demo URL
This project was built as part of my transition into Multimodal AI Engineering, combining my background in physics-informed machine learning (M.Tech thesis at IIT Bombay) with modern GenAI tools and frameworks.