Lab 12: Contextual Retrieval Upgrade
Difficulty: Intermediate · Estimated time: ~3–5 hours
Objective
Upgrade a baseline RAG system to contextual retrieval:
- heading-aware chunking
- context strings per chunk
- measurable improvements with RAGAS
Requirements
- Keep a baseline run (classic chunking)
- Add contextual chunks (doc title + section path + source)
- Evaluate both using the same question set
Deliverables
chunking_baseline.pyandchunking_contextual.pyeval_questions.jsonl(at least 30 questions)results.mdwith RAGAS deltas