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.
More selected work
Continue exploring the portfolio case studies.
