# Response Correctness RAG Metric

**Objective**: This metric measures how accurate and factually grounded the entire response is, as compared to the expected response (ground truth).

**Parameters:** `Prompt`, `Response` ,`Expected Response`&#x20;

**Interpretation**: Higher score indicates the model response was correct for the prompt. Failed result indicates the response is not factually correct compared to the expected response.

<figure><img src="/files/k3HHp8N10e1LB1NtNy6g" alt=""><figcaption></figcaption></figure>

**Code Execution:**

```python
metrics=[
    {"name": "Response Correctness", "config": {"model": "gpt-4o-mini", "provider": "openai"}, "column_name": "your-column-identifier", "schema_mapping": schema_mapping}
]
```

The "schema\_mapping" variable needs to be defined first and is a pre-requisite for evaluation runs. Learn how to set this variable [here](/ragaai-catalyst/concepts/running-ragaai-evals/executing-evaluations.md).

**Example**:

* Prompt: Who was the first person to walk on the moon and when did it happen?
* Expected Response (Ground Truth): The first person to walk on the moon was Neil Armstrong, and it happened on July 20, 1969.
* Response: The first person to walk on the moon was Buzz Aldrin, and it happened on July 20, 1970.
* *Metric Output*: {‘score’: 0, ‘reason’: ‘Neil Armstrong is the first person to walk on moon on July 20, 1969.’}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/rag-metrics/response-correctness.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
