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.
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
{
"metrics": {
"correctness": 123,
"completeness": 123,
"alignment": 123
},
"reasoning": {
"evaluated_facts": [
{
"fact": null,
"entailment": null
}
]
},
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}{
"message": "<string>"
}{
"message": "<string>"
}Authorizations
Section titled “Authorizations”Api-KeystringrequiredAn API Key is required to call Pinecone APIs. Get yours from the console.
Headers
Section titled “Headers”X-Pinecone-Api-VersionstringrequiredRequired date-based version header
The request body for the alignment evaluation.
questionstringrequiredThe question for which the answer was generated.
Example: What is the capital city of Spain?
answerstringrequiredThe generated answer.
Example: Barcelona.
ground_truth_answerstringrequiredThe ground truth answer to the question.
Example: Madrid.
Response
Section titled “Response”200 — The evaluation metrics and reasoning for the generated answer.
The response for the alignment evaluation.
metricsobjectrequiredThe metrics returned for the alignment evaluation.
Show child attributes
correctnessnumberrequiredThe precision of the generated answer.
completenessnumberrequiredThe recall of the generated answer.
alignmentnumberrequiredThe harmonic mean of correctness and completeness.
reasoningobjectrequiredThe reasoning behind the alignment evaluation.
Show child attributes
evaluated_factsobject[]requiredThe facts that were evaluated.
Show child attributes
factobjectrequiredA fact
Show child attributes
contentstringrequiredThe content of the fact.
entailmentstringrequiredThe entailment of a fact.
usageobjectrequiredContains 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).
Show child attributes
prompt_tokensintegerrequiredThe 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_tokensintegerrequiredThe 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_tokensintegerrequiredThe total number of tokens used across both requests and responses. This value equals the sum of prompt_tokens and completion_tokens.