Agent Wealth HubFree public resources
中文 EN العربية

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

  1. Prepare question, gold relevant chunk links, and reference answer per item, including multi-document synthesis cases. [rag-eval]
  2. Use the notebook’s evaluate_retrieval(...) for precision, recall, F1, and MRR; run evaluate_end_to_end(...) separately. [rag-eval]
  3. 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

Permissions

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

https://github.com/anthropics/anthropic-cookbook/blob/9c1e493ddd2b82df399d2a61b9c806c539e18be6/capabilities/retrieval_augmented_generation/guide.ipynb

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

Related resources