Evaluate retrieval separately from generation with recall@k and reciprocal rank for one query.
Required APIdef retrieval_metrics(relevant, retrieved, k):
return {'recall_at_k': ..., 'mrr': ...}BehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
retrieval_metrics(['a', 'b'], ['b', 'x', 'a'], 3)retrieval evidence is measurable before generation
retrieval_metrics(['a', 'b'], ['x', 'a'], 1)recall@k and rank answer different questions
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.