RAG-002RAG · Findinglayaeval.DocumentRelevance

Document Relevance

Is this one document useful for the question?

QUESTIONParis hotels?Paris hotel pricesONE DOCUMENTUseful for the question
Simulation state:
When it passes

This page helps.

Threshold satisfied: evaluation score >= 3.0.

When it fails

This page is unrelated.

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

SDK Specification

ParameterValueDescription
ClassDocumentRelevancePython evaluator class in layaeval
Required Fields"query", "document"Arguments expected in the call signature
Default Threshold>= 3.0Passes when quality score is at or above this value
CategoryRAG EvaluationFinding (Did search bring back the right pages?)

Python Example

pip install layaeval
document-relevance.py
1from layaeval import DocumentRelevance
2
3metric = DocumentRelevance(threshold=3.0) # passes at or above 3.0
4
5res = metric(
6 query="What is the capital of France?",
7 document="Paris is the capital of France.",
8)
9
10print(res.passed, res.value, res.confidence)

Related RAG Checks

Other checks in Finding

View all 42 checks →