RAG-011RAG · Answer qualitylayaeval.FactualCorrectness
Factual Correctness
Does the answer match the known correct answer?
Simulation state:
When it passes
Matches the answer key.
Threshold satisfied: evaluation score >= 3.0.
When it fails
One fact differs.
Violation detected: execution flagged for human review or fallback routing.
SDK Specification
| Parameter | Value | Description |
|---|---|---|
| Class | FactualCorrectness | Python evaluator class in layaeval |
| Required Fields | "query", "response", "ground_truth" | Arguments expected in the call signature |
| Default Threshold | >= 3.0 | Passes when quality score is at or above this value |
| Category | RAG Evaluation | Answer quality (Is the reply on topic, complete and correct?) |
Python Example
factual-correctness.py
1from layaeval import FactualCorrectness23metric = FactualCorrectness(threshold=3.0) # passes at or above 3.045res = metric(6 query="What is the capital of France?",7 response="Paris is the capital of France.",8 ground_truth="Paris",9)1011print(res.passed, res.value, res.confidence)
Related RAG Checks