---
title: "Evaluate an answer"
method: POST
path: "/evaluation/metrics/alignment"
tags: ["Metrics"]
---

# Evaluate an answer

`POST /evaluation/metrics/alignment`

Evaluate the correctness and completeness of a response from an assistant or a RAG system. The correctness and completeness are evaluated based on the precision and recall of the generated answer with respect to the ground truth answer facts. Alignment is the harmonic mean of correctness and completeness.

For guidance and examples, see [Evaluate answers](https://docs.pinecone.io/guides/assistant/evaluate-answers).

## Headers

- `X-Pinecone-Api-Version` string, required

## Request body

- AssistantEvaluationAlignmentRequest — The request for the alignment evaluation.
  - `question` string, required — The question for which the answer was generated.
  - `answer` string, required — The generated answer.
  - `ground_truth_answer` string, required — The ground truth answer to the question.

## Response `200`

The evaluation metrics and reasoning for the generated answer.

- AssistantEvaluationAlignmentResponse — The response for the alignment evaluation.
  - `metrics` AssistantEvaluationMetrics, required — The metrics returned for the alignment evaluation.
    - `correctness` number, required — The precision of the generated answer.
    - `completeness` number, required — The recall of the generated answer.
    - `alignment` number, required — The harmonic mean of correctness and completeness.
  - `reasoning` AssistantEvaluationReasoning, required — The reasoning behind the alignment evaluation.
    - `evaluated_facts` AssistantEvaluationEvaluatedFact[], required — The facts that were evaluated.
      - `fact` AssistantEvaluationFact, required — A fact
        - `content` string, required — The content of the fact.
      - `entailment` string, required — The entailment of a fact.
  - `usage` AssistantEvaluationTokenCounts, required — Contains the token usage details for LLM interactions, including tokens used in requests (`prompt_tokens`), tokens used in responses (`completion_tokens`), and the total number of tokens (`total_tokens`).
    - `prompt_tokens` integer, required — The number of tokens used in two requests to the LLM. The first request includes the question, generated answer, and ground truth answer. The second request includes these details plus the generated facts from the first response.
    - `completion_tokens` integer, required — The number of tokens used in two responses from the LLM. The first response contains the generated facts, and the second response contains the evaluation metrics.
    - `total_tokens` integer, required — The total number of tokens used across both requests and responses. This value equals the sum of `prompt_tokens` and `completion_tokens`.

## Other responses

- `422` — Validation error.
- `500` — Internal server error.

---

[API](https://skmtc.net/pinecone/apis/pinecone-api.md) · [All operations](https://skmtc.net/pinecone/apis/pinecone-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pinecone/pinecone-api/revisions/35876583485d/schema)
