Back to catalog / Agent evaluation
Measure RAG retrieval and final-answer quality separately
Use questions with gold source labels to compute retrieval Precision/Recall/MRR separately from end-to-end accuracy.
Goal
Identify whether a regression or improvement comes from retrieval or answer synthesis.
Steps
- Prepare question, gold relevant chunk links, and reference answer per item, including multi-document synthesis cases. [rag-eval]
- Use the notebook’s
evaluate_retrieval(...)for precision, recall, F1, and MRR; runevaluate_end_to_end(...)separately. [rag-eval] - Write method results to separate CSV/JSON with fixed data/model versions and compare both retrieval and answer metrics. [rag-eval]
How to verify
Baseline and improved scores/per-item details are reproducible; retrieval and answer failures can be distinguished.
Troubleshooting
If answers are correct but MRR is low, inspect labels/equivalent sources; if recall is high but accuracy low, inspect synthesis and abstention.
Permissions
Prerequisites
- Python, Anthropic/Voyage API credentials, a labeled document-chunk set, and a local evaluation environment.
Permissions
- Use a redacted evaluation set without unapproved customer questions or documents.
Limitations
Synthetic questions and model scoring can be biased; pair scores with human spot checks and avoid optimizing a single retrieval metric.
Pinned upstream source
- Repository
- anthropics/anthropic-cookbook
- File path
- capabilities/retrieval_augmented_generation/guide.ipynb
- Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT
Main topic
Take a coding Agent change from context to verification