> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Correctness

> Learn how to use the correctness test

## Definition

The correctness test evaluates the overall correctness of the generated answer. This metric is based on the Ragas [aspect critique](https://docs.ragas.io/en/stable/concepts/metrics/available_metrics/general_purpose/#aspect-critic) for correctness.

## Taxonomy

* **Task types**: LLM.
* **Availability**: development (Continuously evaluate your models and datasets as you iterate on their versions.)
  and monitoring (Monitor a model in production, measure its health, check for drifts and set up alerts.).

## Why it matters

* Correctness ensures that your LLM generates responses that are accurate and free from errors.
* This metric helps identify when your model produces incorrect information, logical fallacies, or misleading content.
* It's fundamental for applications where accuracy is critical, such as educational tools, fact-checking systems, or professional assistance applications.

## Required columns

To compute this metric, your dataset must contain the following columns:

* **Input**: The question or prompt given to the LLM
* **Outputs**: The generated answer/response from your LLM

> [!NOTE]
>
> This metric relies on an LLM evaluator judging your submission. On Openlayer,
> you can configure the underlying LLM used to compute it. Check out the
> [OpenAI](https://docs.openlayer.com/integrations/openai.md#openai-llm-evaluator) or
> [Anthropic](https://docs.openlayer.com/integrations/anthropic.md#anthropic-llm-evaluator) integration
> guides for details.

## Test configuration examples

If you are writing a `tests.json`, here are a few valid configurations for the correctness test:

```json Development theme={null}
[
  {
    "name": "Correctness above 0.8",
    "description": "Ensure that generated responses are correct with a score above 0.8",
    "type": "performance",
    "subtype": "metricThreshold",
    "thresholds": [
      {
        "insightName": "metrics",
        "measurement": "correctness",
        "operator": ">",
        "value": 0.8
      }
    ],
    "subpopulationFilters": null,
    "mode": "development",
    "usesValidationDataset": true,
    "usesTrainingDataset": false,
    "usesMlModel": true,
    "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
  }
]
```

```json Monitoring theme={null}
[
  {
    "name": "Correctness above 0.8",
    "description": "Ensure that generated responses are correct with a score above 0.8",
    "type": "performance",
    "subtype": "metricThreshold",
    "thresholds": [
      {
        "insightName": "metrics",
        "measurement": "correctness",
        "operator": ">",
        "value": 0.8
      }
    ],
    "subpopulationFilters": null,
    "mode": "monitoring",
    "usesProductionData": true,
    "evaluationWindow": 3600,
    "delayWindow": 0,
    "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
  }
]
```

## Related

* [Ragas integration](https://docs.openlayer.com/integrations/ragas.md) - Learn more about Ragas metrics.
* [Answer correctness test](https://docs.openlayer.com/tests/catalog/answer-correctness.md) - Measure factual accuracy against ground truth.
* [Coherence test](https://docs.openlayer.com/tests/catalog/coherence.md) - Evaluate logical consistency of responses.
* [Faithfulness test](https://docs.openlayer.com/tests/catalog/faithfulness.md) - Evaluate consistency with provided context.
* [Aggregate metrics](https://docs.openlayer.com/tests/performance/aggregate-metrics) - Overview of all available metrics.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.