Exercise 06 — RAG Hardening¶
Timebox: 45-60 minutes
Goal¶
Take the naive RAG app in rag_app.py and make it feel production-shaped.
Work in¶
rag_app.py
Tasks¶
- Add retries around the generation step.
- Return source citations in the answer.
- Refuse when the retrieved context is not strong enough.
- Add basic logging for prompt, latency, and selected documents.
- Add a tiny eval set once the main path works.
Done when¶
- The answer includes citations
- Weak retrieval does not produce confident hallucinations
- The script captures enough signals to debug failures later