Map the data flow and distinguish answerable, uncertain and out-of-scope questions.
Understand the method
Imagine maintaining a team document assistant. People repeatedly ask about lodging limits or broken computers. The goal is to locate current rules with evidence people can inspect. A useful answer needs relevant sources, the right audience, necessary conditions and traceable citations.
Do not start with a vector database. Separate ingestion—reading, cleaning, chunking and storing sources—from answering—filtering, retrieval, context assembly, generation and review. A different model cannot supply a missing policy. Locate failures in individual steps.
The lab has six current rules, one archived rule and 12 questions. These are original fictional materials for reproducible experiments. First inspect evidence manually, then run retrieval without a model, and finally connect a real local model if available. Each stage has its own observable output.
Download and extract the lab, then read README.txt. documents.json contains evidence, questions.json contains review cases, and rag_lab.py is the complete standard-library program. Keep these files together: data is resolved relative to the script.
Write boundaries for scope, missing conditions and archived sources. Require another person to reproduce retrieval from the same files. Model wording can vary, so also record the model name, original response and human judgment instead of a success screenshot alone.
Complete Python code, seven records, 12 cases and instructions. Extract and read README first. Retrieval requires no model account. The corpus is Chinese in both editions for reproducibility.
Download lab ZIP- 1Scope
- 2Prepare
- 3Retrieve
- 4Generate
Included material
Lab folder: README.txt, documents.json, questions.json, rag_lab.py. Check: python3 --version Requires Python 3.10+. Install Python from its official documentation if the command is unavailable.
Work through the steps
- Extract the lab and check that all four files are together.
- Choose one answerable case and one insufficient-evidence case and predict behavior.
- Draw question → filter → retrieval → evidence → model → review; name each input and output.
Worked example
Question: What is the intern lodging cap? Audience: intern. Needed rule: allowance. P2 requires prior approval but specifies no cap. Acceptable: explain the gap and cite P2. Failure: reuse the permanent-staff cap from P1.
Your exercise
Write a one-page brief: users, corpus, three boundaries, and separate retrieval/generation deliverables. Revisit it at delivery.
Check before delivery
- Identify the fictional corpus and the exact model-call stage.
- Continue the retrieval track without a local model.
Finish the exercise, then view the reference
Retrieval delivers candidates, scores and a report. Generation adds real responses and human review. Without the latter, deliver a retrieval prototype rather than a deployed answering system.
An original course with teaching exercises. Reading records, practice outcomes and independent certification are distinct.