Build a mini RAG
Instrument the café FAQ retriever
Page 6 adds signals that distinguish bad input from component failure in the five-document café FAQ retriever.
1Learn the idea
Read
Emit stage signals
Instrument the five-document café FAQ retriever so a run records enough structure to debug offline: counts, latency if relevant, pass/fail of retrieval hit rate, citation correctness, supported-answer rate, abstention accuracy, and a stable stage name. Redact secrets and raw credentials from every event.
Read
Emit and assert
tests=[{'q':'open weekdays','want':'hours'},{'q':'wifi card','want':'wifi'},{'q':'parking','want':None}]
print({'cases':len(tests),'required_hit_rate':1.0,'required_abstention':1.0})
Expected evidence: stage evidence for observability. Prefer JSON or structured text you can grep in CI over prose logs for build-mini-rag.
Read
Lock signals with a regression test
Turn one historical failure—especially retrieval miss or ungrounded fluent answer—into a test that fails if the signal disappears for the café FAQ retriever. Observability without a failing test is optional decoration; observability with a test is part of the build-mini-rag artifact.
Read
Lab notebook: signal schema
Draft a three-field event for the café FAQ retriever: stage, ok, and one domain field derived from retrieval hit rate, citation correctness, supported-answer rate, abstention accuracy. Add fixture_id or docs_version when content can change. Explicitly list fields that must never appear (tokens, passwords, raw prompts) because prompt injection inside a stored FAQ note treated as instructions is in scope for this lab.
Wire one assertion that fails if the café FAQ retriever event is missing after a run. Observability that cannot fail a test will not survive contact with a busy build-mini-rag repository.
Read
Worked judgment
Imagine a teammate opens only your event stream after a bad deploy. Could they tell whether café notes: hours, wifi, pets, allergens, parking was wrong, whether retrieval miss or ungrounded fluent answer returned, or whether prompt injection inside a stored FAQ note treated as instructions slipped through? If not, rename fields until those three stories are distinguishable.
Read
Why this stage matters for the café FAQ retriever
At the testing and observability stage for build-mini-rag, the job is narrower than finishing a product demo. You are creating one progressive evidence piece about café notes: hours, wifi, pets, allergens, parking that later pages inherit without redefining success. Keep that fixture small enough to inspect by hand, keep outputs copy-pasteable as text, and refuse to narrate this baseline as if it were a production SLA: always-answer-from-largest-document heuristic.
For this page specifically, success looks like a structured event schema locked by a test while still centering the user decision to answer a café question only when a relevant local note is retrieved and cite its ID. If you cannot point to a file, command, or assertion that proves that for the café FAQ retriever, stay on this page instead of advancing.
Go deeper
Before you start
Why this matters
Write the single log line or metric event that would tell you whether a bad result came from input vs implementation for the café FAQ retriever. If your line could not tell them apart, redesign it before coding.
In the wild
See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.
Related lessons
Check your understanding
Page assessment
Answer from memory. Completion is saved from this evidence, not from opening the next page.
All responses are required.