Skip to content

About

RAG document Q&A: PDF ingestion, recursive chunking, FAISS vector search, LangChain LCEL prompt chains, GPT-4o-mini answers with page-level citations. Streamlit UI + SQLite query logging.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 

Repository files navigation

πŸ“„ DocVision AI: Chat with Your Documents

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.

How It Works

Upload PDF β†’ Extract Text β†’ Chunk β†’ Embed β†’ Store in Vector DB β†’ Ask Questions β†’ Get Answers with Sources

Architecture

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.

Features

  • 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

Tech Stack

  • 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+

Quick Start

1. Clone the repo

git clone https://github.com/VdKPr/DocVision-AI.git
cd DocVision-AI

2. Create virtual environment

python -m venv venv
venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Set up API key

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

5. Run the app

streamlit run docvision.py

App opens at http://localhost:8501

Project Structure

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

How RAG Works (for the curious)

  1. Load β€” PyMuPDF extracts text from each page of the uploaded PDF
  2. Chunk β€” Text is split into 1000-character pieces with 200-character overlap to preserve context across boundaries
  3. Embed β€” OpenAI Embeddings converts each chunk into a 1536-dimensional vector that captures semantic meaning
  4. Store β€” ChromaDB indexes these vectors locally for fast cosine similarity search
  5. Retrieve β€” When you ask a question, it gets embedded too, and the 4 most similar chunks are found
  6. Generate β€” GPT-4o-mini receives your question + the retrieved chunks and produces a grounded answer with citations

Roadmap

  • 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

Built With

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.

About

RAG document Q&A: PDF ingestion, recursive chunking, FAISS vector search, LangChain LCEL prompt chains, GPT-4o-mini answers with page-level citations. Streamlit UI + SQLite query logging.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors