AI Projects

Advanced RAG Pipeline for Multi-PDF Question Answering

End-to-end Retrieval-Augmented Generation pipeline that processes multiple PDFs, stores semantic embeddings in ChromaDB, and generates grounded answers with citations, confidence scores, summaries, and query history.

GitHub

product.case-study

Advanced RAG Pipeline for Multi-PDF Question Answering product preview

Document Scope

Multi-PDF

Embedding Model

all-MiniLM-L6-v2

Vector Storage

Persistent ChromaDB

Retrieval

Filtered Top-K

The challenge

01

A multi-document RAG pipeline built with LangChain, SentenceTransformers, ChromaDB, and Groq Llama 3.1. It recursively loads PDFs, preserves source metadata, splits content into overlapping chunks, generates local embeddings, performs filtered semantic retrieval, and produces context-grounded answers with page references and supporting evidence.

What I built

02

Each PDF is loaded page by page using LangChain document loaders, enriched with source filename and file-type metadata, and split into overlapping chunks using RecursiveCharacterTextSplitter for more reliable retrieval.

Recruiter Executive Summary

Application type

AI Projects

01 · Overview

Product context and engineering scope.

The goals, operating context, and technical decisions behind this case study.

Built an end-to-end RAG pipeline that recursively discovers and processes multiple PDF documents from a local directory, allowing users to ask questions across a combined document knowledge base.

01

Each PDF is loaded page by page using LangChain document loaders, enriched with source filename and file-type metadata, and split into overlapping chunks using RecursiveCharacterTextSplitter for more reliable retrieval.

02

The pipeline generates local semantic embeddings with the all-MiniLM-L6-v2 SentenceTransformer model and stores both embeddings and document metadata in a persistent ChromaDB collection.

03

A configurable retrieval layer converts user queries into embeddings and supports top-k search, maximum-distance filtering, similarity-score thresholds, and optional source-file filtering.

04

Groq-hosted Llama 3.1 generates concise answers using only retrieved document context. The advanced pipeline also returns citations, page references, source previews, confidence scores, optional summaries, and conversational query history.

02 · Capabilities

Capabilities designed around real user needs.

The product features and system behaviors delivered by this project.

01

Recursive Multi-PDF Ingestion

Automatically scans nested directories for PDF files and loads every page into a unified document collection for cross-document question answering.

02

Metadata Preservation

Preserves source filenames, file types, page information, document indexes, and content length throughout ingestion, chunking, storage, and retrieval.

03

Recursive Text Chunking

Uses overlapping recursive character splitting with configurable chunk size and overlap to create retrieval-friendly document segments.

04

Local SentenceTransformer Embeddings

Generates document and query embeddings locally using the all-MiniLM-L6-v2 model, reducing dependence on external embedding APIs.

05

Persistent ChromaDB Storage

Stores embeddings, text chunks, unique IDs, and metadata in a persistent ChromaDB collection that remains available across notebook sessions.

06

Configurable Semantic Retrieval

Supports top-k retrieval, maximum-distance filtering, similarity-score thresholds, and optional source-document filters for more precise context selection.

07

Similarity Scoring

Converts ChromaDB distance values into bounded similarity scores so retrieved documents can be ranked and filtered using an intuitive confidence measure.

08

Grounded Groq Generation

Uses Groq-hosted Llama 3.1 through LangChain to generate concise answers based only on the retrieved PDF context.

09

Source Citations & Page References

Returns source filenames, page numbers, similarity scores, and short context previews so generated answers can be traced back to supporting evidence.

10

Confidence-Aware Responses

Calculates a response confidence value from the highest retrieved similarity score and returns a fallback response when no relevant context passes the threshold.

11

Optional Answer Summarization

Can generate a concise two-sentence summary of the final answer using the same Groq-hosted language model.

12

Conversational Query History

Stores previous questions, answers, sources, and summaries during the session to support conversational tracking and follow-up analysis.

13

Streaming Simulation

Includes an optional streaming-style output mode that progressively displays prompt content before final answer generation.

03 · Decisions

Constraints translated into engineering decisions.

The problems that shaped the product and the responses used to address them.

01

The constraint

Maintaining source traceability across multiple PDFs and overlapping text chunks

Engineering decision

Preserved source filenames, page information, file types, document indexes, and content length in each LangChain document and stored the metadata alongside every ChromaDB vector.

02

The constraint

Preventing weak or irrelevant retrieval results from reaching the language model

Engineering decision

Added top-k configuration, maximum-distance filtering, similarity-score thresholds, and source-file filtering before constructing the final LLM context.

03

The constraint

Producing grounded answers instead of unsupported model responses

Engineering decision

Restricted the generation prompt to retrieved document context and returned an explicit no-context response when no document passed the configured retrieval criteria.

04

The constraint

Keeping document embeddings available across repeated notebook sessions

Engineering decision

Used ChromaDB PersistentClient with a disk-based collection so indexed chunks and embeddings remain available without rebuilding the entire vector store.

05

The constraint

Making retrieval quality understandable to users

Engineering decision

Returned similarity scores, confidence values, source previews, filenames, page references, and ranked retrieval results alongside the generated answer.

04 · Technology

Technology and tools

The complete technology stack utilized in this project, organized by engineering area.

Python
LangChain
ChromaDB
SentenceTransformers
all-MiniLM-L6-v2
Hugging Face
Groq
Llama 3.1
PyPDFLoader
RecursiveCharacterTextSplitter
NumPy
Scikit-learn
RAG
Vector Embeddings
Semantic Search
Jupyter Notebook

Engineering Portfolio

Building practical AI products from model output to production experience.

Looking to engineer AI-assisted workflows, production web applications, or scalable backend infrastructure?