v3

latestOpenAPI 3.0.02026-08-081996601.2 MB
Factual Consistency Evaluation

Evaluate factual consistency

Evaluates the factual consistency of a generated text (like a summary) against source documents. The evaluation determines how accurately the generated text reflects the information in the source documents. This helps identify potential hallucinations or misrepresentations.

Use this endpoint to validate generated content against trusted source materials, such as in legal, healthcare, scientific publishing, and enterprise knowledge systems.

The request body includes the following parameters:

  • model_parameters: Optional. The evaluation model to use. Supported values are hhem_v2.3 (the default) and hhem_v2.2.
  • generated_text: The output text you want to evaluate, such as a model-generated summary, answer, or response.
  • source_texts: An array of source documents or passages used to verify the accuracy of the generated text.
  • language: The ISO 639-3 code representing the language of the provided texts (eng for English, fra for French).

Example request

This example evaluates whether a generated statement about the Eiffel Tower is factually accurate based on two reference documents.

{
  "generated_text": "The Eiffel Tower is located in Berlin.",
  "source_texts": [
    "The Eiffel Tower is a famous landmark located in Paris, France.",
    "It was built in 1889 and remains one of the most visited monuments in the world."
  ],
  "language": "eng"
}

Example response

The response includes a factual consistency score and probability estimates.

{
  "score": 0.23,
  "p_consistent": 0.12,
  "p_inconsistent": 0.88
}
  • score: A normalized value between 0.0 and 1.0 that reflects the overall factual alignment between the generated text and the source texts. Higher scores indicate stronger consistency.
  • p_consistent: The estimated probability that the generated text is factually consistent with the sources.
  • p_inconsistent: The estimated probability that the generated text contains factual inaccuracies relative to the source documents.
post/v2/evaluate_factual_consistency

Headers

Request-Timeoutinteger

The platform makes a best effort to complete the request in the specified seconds, or it times out.

Request-Timeout-Millisinteger

The platform makes a best effort to complete the request in the specified milliseconds, or it times out.

Request body

generated_textstring required

The generated text (e.g., summary or answer) to evaluate for factual consistency.

source_textsstring[] required

The source documents or text snippets against which to evaluate factual consistency.

Example request

{
  "model_parameters": {
    "model_name": "hhem_v2.3"
  }
}

Response

The factual consistency evaluation results.

scorenumber double required

A prediction score from HHEM, greater than 0 and less than 1. The score monotonically indicates the likelihood of hallucinations.