Case studies
AUTO Case study 05 Platform write-up

Document Intelligence: Retrieval-Augmented Generation Over Large PDF Collections

Built a RAG platform that turns large PDF collections into a queryable knowledge base — semantic retrieval over PostgreSQL and pgvector, page-level citations behind every generated claim, and structured report export to Word and PDF.

M1
Page-level

Citation tracking

M2
RAG

Retrieval-augmented generation

M3
pgvector

Semantic search at scale

M4
Multilingual

Including right-to-left scripts

01Challenge

Organisations sitting on hundreds or thousands of PDFs generally cannot search them in any useful way:

  1. Collections run to hundreds of documents, far too many to read manually under any deadline
  2. Keyword search misses anything phrased differently to the query; full-text search returns whole documents when the answer was one paragraph
  3. Every generated claim needed a verifiable, page-level citation back to its source document
  4. Separate workspaces needed genuine data isolation, with no cross-workspace retrieval
  5. Document sets spanned multiple languages, including right-to-left scripts, without a separate pipeline per language
  6. Output had to leave the system as Word and PDF documents, not as chat transcripts

02Solution

I designed and built a two-pipeline RAG system (ingestion runs once per document, query runs per question), so re-indexing and model changes stay independent of each other:

S1

Layout-Aware Ingestion

PDF extraction that preserves multi-column layouts and tables, with chunk boundaries tuned so splits do not land mid-table or mid-clause.

S2

Vector Search & Retrieval

Chunks are embedded and stored in PostgreSQL with pgvector, retrieved by semantic similarity with reranking applied before anything reaches the model.

S3

Citation-Preserving Generation

Page provenance is attached at ingestion and carried through retrieval, so citations are a property of the pipeline rather than something the model is asked to produce.

S4

Structured Report Output

LlamaIndex orchestrates GPT-4 to produce a fixed report shape rather than free-form answers, making results comparable across queries.

S5

Workspace Isolation

Multi-tenant by design: each workspace has its own document set and index, with retrieval scoped so nothing crosses the boundary.

S6

Export & Distribution

Reports export to Word and PDF with formatting and citations intact, ready to circulate without reformatting.

03Results

The platform turns an unsearchable document pile into a system that answers questions with evidence attached:

Hours → minutes

Query hundreds of documents and receive a structured report in minutes

Verifiable output

Every claim links back to a specific page in a specific source document

Model-portable

Generation routed through a LiteLLM proxy, so swapping models is a config change

Multilingual

One pipeline handles document sets spanning several languages and scripts

04Stack

Frontend

  • React

Backend

  • FastAPI
  • Python

AI & ML

  • GPT-4
  • LlamaIndex
  • Haystack 2.x
  • LiteLLM

Database & Infrastructure

  • PostgreSQL
  • pgvector
  • Docker

Next

Need something like this? Tell me what you are trying to do.