> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corti.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Evaluate Document Completeness

> Calculates how much of the information in the reference document is contained in the candidate document.

The API splits each section of the reference document into sentences.
Each sentence becomes one claim.
A language model compares each claim with the candidate document and gives a verdict.
Each claim contains the evidence from the candidate document. A `not_applicable` claim contains no evidence.

You can add annotations to the sentences of the reference document in `referenceAnnotations`.
To get the segmented sentences, use the Segment Document operation (`POST /tools/evaluations/text/documents/segment`) with the same `language` and `referenceDocument`.
When you send annotations, the response contains `annotationSlices`.

This operation uses a language model. It uses credits.




## OpenAPI

````yaml /api-reference/auto-generated-openapi.yml post /tools/evaluations/text/documents/completeness
openapi: 3.0.0
info:
  title: Corti API
  version: 2.0.0
servers:
  - url: https://api.{environment}.corti.app/v2/
    variables:
      environment:
        default: eu
        enum:
          - us
          - eu
security:
  - AuthorizationHeader:
      - bearer
tags:
  - name: Interactions
  - name: Recordings
  - name: Transcripts
  - name: Facts
  - name: Codes
  - name: FHIR
  - name: Languages
  - name: Guided Documents
  - name: Guided Templates
  - name: Guided Sections
  - name: Documents (Classic)
  - name: Templates (Classic)
  - name: Evaluations
paths:
  /tools/evaluations/text/documents/completeness:
    post:
      tags:
        - Evaluations
      summary: Evaluate Document Completeness
      description: >
        Calculates how much of the information in the reference document is
        contained in the candidate document.


        The API splits each section of the reference document into sentences.

        Each sentence becomes one claim.

        A language model compares each claim with the candidate document and
        gives a verdict.

        Each claim contains the evidence from the candidate document. A
        `not_applicable` claim contains no evidence.


        You can add annotations to the sentences of the reference document in
        `referenceAnnotations`.

        To get the segmented sentences, use the Segment Document operation
        (`POST /tools/evaluations/text/documents/segment`) with the same
        `language` and `referenceDocument`.

        When you send annotations, the response contains `annotationSlices`.


        This operation uses a language model. It uses credits.
      operationId: evaluations_documents_completeness
      parameters:
        - $ref: '#/components/parameters/Tenant-Name'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EvaluationCompletenessRequest'
      responses:
        '200':
          description: >-
            The scores and a list of claims, each claim corresponding to one
            sentence from the reference document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EvaluationCompletenessResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/EvaluationForbidden'
        '429':
          $ref: '#/components/responses/EvaluationTooManyRequests'
        '500':
          $ref: '#/components/responses/EvaluationInternalError'
        '502':
          $ref: '#/components/responses/EvaluationBadGateway'
components:
  parameters:
    Tenant-Name:
      name: Tenant-Name
      in: header
      description: >-
        Identifies a distinct entity within Corti's multi-tenant system. Ensures
        correct routing and authentication of the request.
      required: true
      example: base
      schema:
        type: string
        description: >-
          Identifies a distinct entity within Corti's multi-tenant system.
          Ensures correct routing and authentication of the request.
        example: base
  schemas:
    EvaluationCompletenessRequest:
      type: object
      required:
        - language
        - candidateDocument
        - referenceDocument
      properties:
        language:
          $ref: '#/components/schemas/EvaluationLanguage'
        candidateDocument:
          $ref: '#/components/schemas/EvaluationDocument'
        referenceDocument:
          $ref: '#/components/schemas/EvaluationDocument'
        referenceAnnotations:
          type: array
          description: >
            Annotations on the sentences of the reference document.

            Get the spans from the Segment Document operation.

            The API ignores an annotation that does not have the same
            `sectionId`, `start`, `end` and `text` as a sentence.

            The `annotation_coverage` slice shows how many sentences have an
            annotation.
          items:
            $ref: '#/components/schemas/EvaluationDocumentSpanAnnotation'
    EvaluationCompletenessResponse:
      allOf:
        - $ref: '#/components/schemas/EvaluationScores'
        - type: object
          required:
            - claims
          properties:
            claims:
              type: array
              items:
                allOf:
                  - $ref: '#/components/schemas/EvaluationClaim'
                  - type: object
                    required:
                      - referenceDocumentSpan
                      - candidateDocumentEvidence
                    properties:
                      referenceDocumentSpan:
                        $ref: '#/components/schemas/EvaluationDocumentSpan'
                      candidateDocumentEvidence:
                        type: array
                        items:
                          $ref: '#/components/schemas/EvaluationDocumentSpan'
            annotationSlices:
              type: array
              description: >-
                The scores for groups of annotated sentences. The response
                contains this field only when the request contains
                `referenceAnnotations`.
              items:
                $ref: '#/components/schemas/EvaluationSliceScore'
    EvaluationLanguage:
      type: string
      description: |
        The language of the documents, as a BCP-47 language tag.
        For example `en` or `en-US`.
      example: en
    EvaluationDocument:
      type: object
      description: >
        A document. Each key is a section ID. Each value is the text of that
        section.

        Section IDs must not be empty.


        The API processes the sections in the order of the request.

        The spans and claims in the response are in the order of the sections in
        the request, and then in the order in the text.
      minProperties: 1
      additionalProperties:
        type: string
      example:
        subjective: Patient reports right knee pain for two weeks.
        plan: Follow-up in one week.
    EvaluationDocumentSpanAnnotation:
      allOf:
        - $ref: '#/components/schemas/EvaluationDocumentSpan'
        - type: object
          required:
            - importance
            - alignment
            - categories
          properties:
            importance:
              type: integer
              minimum: 1
              maximum: 5
              description: >-
                The importance of the sentence. 1 is the lowest and 5 is the
                highest.
            alignment:
              type: string
              description: >
                How much of the information in the sentence the transcript
                contains. The transcript is the source of the reference
                document.

                - `aligned`: The transcript contains the information.

                - `inferred`: You can infer the information from the transcript.

                - `unaligned`: The transcript does not contain the information.
              enum:
                - aligned
                - inferred
                - unaligned
            categories:
              type: array
              minItems: 1
              description: The categories of the sentence. You select the category names.
              items:
                type: string
    EvaluationScores:
      type: object
      required:
        - score
        - strictScore
        - looseScore
        - evaluationConfigHash
        - usageInfo
      properties:
        score:
          type: number
          format: double
          minimum: 0
          maximum: 1
          description: >
            The mean value of the verdicts. A `grounded` verdict is 1, a
            `partial` verdict is 0.5 and an `ungrounded` verdict is 0.

            When all claims are `not_applicable`, the score is 1.
        strictScore:
          type: number
          format: double
          minimum: 0
          maximum: 1
          description: The same as `score`, but a `partial` verdict is 0.
        looseScore:
          type: number
          format: double
          minimum: 0
          maximum: 1
          description: The same as `score`, but a `partial` verdict is 1.
        evaluationConfigHash:
          type: string
          description: >
            A SHA-256 hash of the evaluation configuration: the language model,
            the prompt and the parameters of the language model.

            The hash does not include the content of the request.

            Compare scores only when they have the same hash.
          example: >-
            sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
        usageInfo:
          $ref: '#/components/schemas/CommonUsageInfo'
    EvaluationClaim:
      type: object
      required:
        - verdict
      properties:
        verdict:
          $ref: '#/components/schemas/EvaluationVerdict'
        reason:
          type: string
          description: The language model's reasoning for the verdict.
    EvaluationDocumentSpan:
      type: object
      description: >
        A sentence in a section of a document.

        `start` and `end` are character offsets in the text of the section. The
        API counts Unicode code points.

        `start` is inclusive. `end` is exclusive.
      required:
        - start
        - end
        - text
        - sectionId
      properties:
        start:
          type: integer
          minimum: 0
          description: The offset of the first character of the sentence.
        end:
          type: integer
          minimum: 0
          description: The offset after the last character of the sentence.
        text:
          type: string
          minLength: 1
          description: >-
            The text of the sentence. The text has no whitespace at the start or
            at the end.
        sectionId:
          type: string
          minLength: 1
          description: The section ID in the document.
    EvaluationSliceScore:
      type: object
      required:
        - name
        - value
      properties:
        name:
          type: string
          description: >
            The name of the slice:

            - `importance/{1..5}`: The score of the sentences with that
            importance.

            - `alignment/{value}`: The score of the sentences with that
            alignment.

            - `category/{name}`: The score of the sentences with that category.

            - `importance_weighted`: The mean score of the sentences. The
            importance of each sentence is its weight.

            - `annotation_coverage`: The fraction of sentences that have an
            annotation.


            The response does not contain a slice when all its sentences are
            `not_applicable`.
          example: importance_weighted
        value:
          type: number
          format: double
          minimum: 0
          maximum: 1
        reason:
          type: string
          description: The sentences that the LLM used to calculate the value.
    ErrorResponse:
      type: object
      required:
        - requestid
        - status
        - type
        - detail
      properties:
        requestid:
          type: string
        status:
          type: integer
        type:
          type: string
        detail:
          type: string
        validationErrors:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
    CommonUsageInfo:
      type: object
      description: Credits consumed for this request.
      required:
        - creditsConsumed
      properties:
        creditsConsumed:
          type: number
    EvaluationVerdict:
      type: string
      description: >
        The verdict given by the language model for a claim.

        - `grounded`: The evidence supports the claim.

        - `partial`: The evidence supports a part of the claim.

        - `ungrounded`: The evidence does not support the claim.

        - `not_applicable`: The claim is a section heading or text that has no
        clinical content. The scores do not include this claim.
      enum:
        - grounded
        - partial
        - ungrounded
        - not_applicable
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationForbidden:
      description: The access token does not have the scope for evaluations.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationTooManyRequests:
      description: >-
        The API has too many evaluation requests. Wait. Then send the request
        again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationInternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationBadGateway:
      description: The API could not complete the evaluation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    AuthorizationHeader:
      type: http
      description: Input your token
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.