Generative AI · Planned
Document Q&A with RAG and an evaluation suite
A retrieval-augmented question-answering service over real PDF documents, with cited answers and an evaluation suite that runs in CI on every change.
Planned project. This page describes the goal, the approach, and how the system will be evaluated. Code, a live demo, and results will be published here once it is built.
Goal
Answer questions about a collection of real PDF documents, such as policy manuals or public reports, and cite the exact passages each answer comes from. The point is not the chat interface. It is being able to show, with numbers, how often retrieval finds the right passage and how often the answer stays faithful to it.
Planned approach
- Ingestion. Parse PDFs into text and tables, split them into chunks that keep headings and table headers attached, and store embeddings in PostgreSQL with pgvector.
- Retrieval. Embed the question, retrieve the top passages, and compare plain vector search with a hybrid of keyword and vector search.
- Generation. Send the retrieved passages to an LLM with instructions to answer only from them and to cite each passage it used. If nothing relevant is found, the service says so instead of guessing.
- Serving. A FastAPI service with a small React interface that shows each answer next to its sources.
Evaluation plan
- A labelled question set written from the documents, with the passage that answers each question.
- Retrieval quality: recall@k and mean reciprocal rank, measured before any prompt tuning. The method is described in evaluating RAG retrieval with recall@k and MRR.
- Answer quality: faithfulness to the retrieved passages and correct refusals when the answer is not in the documents.
- Cost and latency per question, tracked alongside quality.
- Regression tests in CI with Promptfoo, as in testing prompt regressions in GitHub Actions, so a change that lowers quality fails the build.
Definition of done
A public repository, a live demo, a results table in the README, and a “where it fails” section listing the question types the system still gets wrong.