P7: A RAG app with an eval set

: the board shows a client sending a command and a server looking the answer up in what it stores. A RAG app is the same shape. A question goes in, a store is searched, and an answer comes back. This project adds one more step: a score that says whether the answer was right.
Asha Rao (a made-up learner, so every number below is a teaching value unless it says it was measured) builds a help bot for a made-up train-ticket app called TicketKart. She types a question and the bot answers from the app’s help pages. It looks good in the demo. A friend asks, “Can I pay with cash?” The bot answers about UPI and says nothing about cash. A second friend asks, “Can I book a bus ticket?” The bot answers about train tickets, as if the question was about trains.
Asha cannot tell if the bot is getting better or worse when she changes it. She has only three questions she tried by hand. A hiring engineer who reads “built a RAG app” cannot check the claim either.
By the end of this lesson you will be able to build a small RAG app, write an eval set for it, change it one step at a time, and show before and after numbers that a stranger can rerun.
The history (optional)
Cyril Cleverdon ran the Cranfield experiments at the College of Aeronautics in Cranfield, England, in the 1960s. The test collection that came out of them holds about 1,400 papers on aerodynamics and 225 questions. A person had judged which papers answered which question. With one fixed set of questions, two search systems could be compared by a number. The Stanford book “Introduction to Information Retrieval” calls it the pioneering test collection. Nothing later in this lesson depends on these facts.
Before you start. RAG (Retrieval-Augmented Generation) showed the RAG pipeline: cut documents into chunks, find the chunks nearest the question, and paste them into the prompt. RAG Over Your Own Notes built that over real notes, scored chunks with BM25 (a word-matching score where a rare word counts for more), and graded it with a golden set. Retrieval that finds the right page: advanced RAG gave you hit@k and MRR, the numbers for how high the right chunk ranks. P6: A model you can defend gave you the habit of scoring on rows the model never learned from. A repo a stranger can judge in two minutes gave you the page a stranger reads in two minutes.
flowchart LR
Q["question"] --> R["search 20 sections"]
R -->|"top score"| G{"score above the threshold?"}
G -->|"no"| N["Not in the help centre"]
G -->|"yes"| A["quote the best sentences + [source]"]
A --> E["eval set: right section? right fact? right refusal?"]
N --> E