> For the complete documentation index, see [llms.txt](https://docs.raga.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/additional-metrics/evaluation/correctness.md).

# Correctness

**Objective**: This metric checks the correctness of your LLM response compared Is the submission is factually accurate and free from errors to the expected response

**Parameters:**

`data:`

* `prompt` (str): The prompt for the response.
* `response` (str): The actual response to be evaluated.
* `expected_response` (str): The expected response for comparison.
* `context` (str): The ground truth for comparison.

`arguments:`

* `model` (str, optional): The model to be used for evaluation (default is "gpt-3.5-turbo").
* `threshold` (float, optional): The threshold for correctness score (default is 0.5).

**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.

```python
# Add tests with custom data
evaluator.add_test(
    test_names=["correctness_test"],
    data={
        "prompt" : "Explain the concept of photosynthesis.",
        "response" : "Photosynthesis is the process by which plants convert sunlight into energy through chlorophyll.",
        "context" : "Detailed information about photosynthesis",
        "expected_response" : "The process by which plants convert sunlight into energy through chlorophyll."
    },
    arguments={"model": "gpt-4", "threshold": 0.6},
).run()

evaluator.print_results()
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/additional-metrics/evaluation/correctness.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
