> For the complete documentation index, see [llms.txt](https://docs.layerlens.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerlens.ai/more-in-this-section-6/score-retrieval.md).

# Recipe: score retrieval quality

Recipe — score retrieval quality. Pointer to the SDK rag\_assessment sample.

Canonical sample: [`samples/cowork/rag_assessment.py`](https://github.com/layerlens/stratix-python/blob/main/samples/cowork/rag_assessment.py) — covers retrieval-stage and generation-stage scoring separately.

## Pattern

Capture retrieval span output (chunk IDs returned) alongside ground-truth chunk IDs in your trace input. Build a custom judge that scores retrieval quality (groundedness, ordering, coverage) on its own.

For deterministic precision\@k or recall\@k computation, score with a custom scorer via `client.scorers.create(name=, description=, model_id=, prompt=)`.

## See also

* [Use case: RAG evaluation](/4.1-general-use-cases/rag-evaluation.md)
* [Concept: Scorers](/8.-evaluate-score-the-outputs/scorers-1.md)
