RAG-015RAG · Citationslayaeval.CitationCorrectness

Citation Correctness

Does each citation point to a source that says that thing?

ANSWERSOURCES[1] Hotel price list[2] Paris city mapLumière is $1801It's near the Louvre2Every tag points right
Simulation state:
When it passes

Every tag points right.

Threshold satisfied: evaluation score >= 3.0.

When it fails

A tag points to the wrong page.

Violation detected: execution flagged for human review or fallback routing.

SDK Specification

ParameterValueDescription
ClassCitationCorrectnessPython evaluator class in layaeval
Required Fields"query", "response", "citations", "cited_source_text"Arguments expected in the call signature
Default Threshold>= 3.0Passes when quality score is at or above this value
CategoryRAG EvaluationCitations (Do the little [1] tags point to the right place?)

Python Example

pip install layaeval
citation-correctness.py
1from layaeval import CitationCorrectness
2
3metric = CitationCorrectness(threshold=3.0) # passes at or above 3.0
4
5res = metric(
6 query="What is the capital of France?",
7 response="Paris is the capital of France.",
8 citations=["[1]"],
9 cited_source_text="Paris is the capital of France.",
10)
11
12print(res.passed, res.value, res.confidence)

Related RAG Checks

Other checks in Citations

View all 42 checks →