Skip to main content
Pinecone Docs
current

Search documentation

Type to search this documentation.

Evaluate an answer

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.

curl
PINECONE_API_KEY="YOUR_API_KEY"

curl https://prod-1-data.ke.pinecone.io/assistant/evaluation/metrics/alignment \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Pinecone-Api-Version: 2026-04" \
  -d '{
    "question": "What are the capital cities of France, England and Spain?",
    "answer": "Paris is the capital city of France and Barcelona of Spain",
    "ground_truth_answer": "Paris is the capital city of France, London of England and Madrid of Spain"
}'

POST /evaluation/metrics/alignment

200
{
  "metrics": {
    "correctness": 123,
    "completeness": 123,
    "alignment": 123
  },
  "reasoning": {
    "evaluated_facts": [
      {
        "fact": null,
        "entailment": null
      }
    ]
  },
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}
422
{
  "message": "<string>"
}
500
{
  "message": "<string>"
}
Api-Keystringrequired

An API Key is required to call Pinecone APIs. Get yours from the console.

X-Pinecone-Api-Versionstringrequired

Required date-based version header

Typestring
Default2026-04

The request body for the alignment evaluation.

questionstringrequired

The question for which the answer was generated.

Example: What is the capital city of Spain?

Typestring
answerstringrequired

The generated answer.

Example: Barcelona.

Typestring
ground_truth_answerstringrequired

The ground truth answer to the question.

Example: Madrid.

Typestring

200 — The evaluation metrics and reasoning for the generated answer.

The response for the alignment evaluation.

metricsobjectrequired

The metrics returned for the alignment evaluation.

Typeobject
Show child attributes
correctnessnumberrequired

The precision of the generated answer.

Typenumber
completenessnumberrequired

The recall of the generated answer.

Typenumber
alignmentnumberrequired

The harmonic mean of correctness and completeness.

Typenumber
reasoningobjectrequired

The reasoning behind the alignment evaluation.

Typeobject
Show child attributes
evaluated_factsobject[]required

The facts that were evaluated.

Typeobject[]
Show child attributes
factobjectrequired

A fact

Typeobject
Show child attributes
contentstringrequired

The content of the fact.

Typestring
entailmentstringrequired

The entailment of a fact.

Typestring
usageobjectrequired

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

Typeobject
Show child attributes
prompt_tokensintegerrequired

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.

Typeinteger
completion_tokensintegerrequired

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.

Typeinteger
total_tokensintegerrequired

The total number of tokens used across both requests and responses. This value equals the sum of prompt_tokens and completion_tokens.

Typeinteger
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu