Grounded RAG PDF Q&A

A retrieval system built to say "I don't know" and proven to do it

Upload PDFs, ask questions, get answers that cite the document and the page they came from. Ask something the documents do not answer and it returns one exact sentence:

I couldn't find this in the documents.

That refusal is the product. Anyone can wire an embedding model to a language model. Making the thing shut up when it should is the engineering.

Three gates do it. A best-chunk relevance score below 0.55a returns the refusal without calling the model at all, which is deterministic, free, and unit-tested with a stub that fails the test if the model is ever invoked. A grounded prompt tells the model that a source mentioning a topic is not a source answering the question. And a normalizer rewrites any refusal-shaped reply to the exact contract string, because models drift.

Citations cannot be faked either. Retrieved chunks arrive numbered with their document and page, and the markers are mapped back afterwards. Out-of-range markers get discarded, so the model cannot invent a source it was never shown.

The golden set passes 17/17a, and 15 more tests run offline with no API key. The case worth quoting asks about stock options. The documents do discuss 401(k) vesting, so related content comes back. It still refuses.

Sources

  • the project's own README, checked 2026-08-28

What this does not do

  • Text PDFs only. There is no OCR, so scanned documents are out of scope.
  • Roughly ten requests a minute on the free tier.
  • The hosted vector store is shared and ephemeral.
  • Auth, queues, reranking, streaming, and conversational memory were deliberately not built. It is a portfolio demo engineered properly, not a production system.