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

# Score predictions vs ground truth (stateless)

> Compute quality metrics (Precision@K, Recall@K, F1@K, F2@K) for precomputed predictions vs ground truth, with NO retriever, namespace, or persistence. Each item's `predicted` and `ground_truth` are treated as SETS. Send a single pair (`predicted` + `ground_truth`) or an `items` batch. Returns per-item scores and the macro-average across items. Auth only (no X-Namespace). This is the stateless counterpart to the retriever-scoped evaluation runs — use it to dogfood F1/F2 on extraction/generation benchmarks.



## OpenAPI

````yaml post /v1/evaluations/score
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security:
  - BearerAuth: []
paths:
  /v1/evaluations/score:
    post:
      tags:
        - Retriever Evaluations
      summary: Score predictions vs ground truth (stateless)
      description: >-
        Compute quality metrics (Precision@K, Recall@K, F1@K, F2@K) for
        precomputed predictions vs ground truth, with NO retriever, namespace,
        or persistence. Each item's `predicted` and `ground_truth` are treated
        as SETS. Send a single pair (`predicted` + `ground_truth`) or an `items`
        batch. Returns per-item scores and the macro-average across items. Auth
        only (no X-Namespace). This is the stateless counterpart to the
        retriever-scoped evaluation runs — use it to dogfood F1/F2 on
        extraction/generation benchmarks.
      operationId: score_predictions_v1_evaluations_score_post
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScorePredictionsRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScorePredictionsResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    ScorePredictionsRequest:
      properties:
        predicted:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Predicted
          description: 'Single-pair form: predicted terms/ids. Pair with ground_truth.'
        ground_truth:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Ground Truth
          description: 'Single-pair form: ground-truth terms/ids. Pair with predicted.'
        items:
          anyOf:
            - items:
                $ref: '#/components/schemas/ScoreItem'
              type: array
            - type: 'null'
          title: Items
          description: 'Batch form: a list of {predicted, ground_truth} pairs.'
        metrics:
          items:
            type: string
          type: array
          title: Metrics
          description: 'Metrics to compute. Allowed: precision, recall, f1, f2.'
        k:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: K
          description: 'Cutoff: score only the first k predicted items. Default: all.'
      additionalProperties: false
      type: object
      title: ScorePredictionsRequest
      description: >-
        Score precomputed predictions vs ground truth, statelessly.


        Send EITHER a single pair (``predicted`` + ``ground_truth``) or an
        ``items``

        batch (score many predictions in one call — the shape a benchmark of N

        predictions wants). Exactly one form is required.
    ScorePredictionsResponse:
      properties:
        metrics:
          items:
            type: string
          type: array
          title: Metrics
          description: Metrics computed, in request order.
        k:
          anyOf:
            - type: integer
            - type: 'null'
          title: K
          description: Cutoff applied, if any.
        count:
          type: integer
          title: Count
          description: Number of items scored.
        per_item:
          items:
            additionalProperties:
              type: number
            type: object
          type: array
          title: Per Item
          description: 'Each item''s {metric: value} in [0.0, 1.0].'
        aggregate:
          additionalProperties:
            type: number
          type: object
          title: Aggregate
          description: Macro-average (mean over items) of each metric.
      type: object
      required:
        - metrics
        - count
        - per_item
        - aggregate
      title: ScorePredictionsResponse
      description: Per-item and aggregate (macro-mean) scores.
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ScoreItem:
      properties:
        predicted:
          items:
            type: string
          type: array
          title: Predicted
          description: Predicted terms or ids (treated as a set).
        ground_truth:
          items:
            type: string
          type: array
          title: Ground Truth
          description: Ground-truth terms or ids (treated as a set).
      additionalProperties: false
      type: object
      title: ScoreItem
      description: |-
        One prediction to score: predicted terms/ids vs the ground truth.

        Both are treated as SETS (the underlying metrics are set-membership), so
        duplicates do not change the score.
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Mixpeek API key, sent as `Authorization: Bearer mxp_sk_...`. Create one
        in Studio under Settings → API Keys, or with an admin key via `POST
        /v1/organizations/users/{user_email}/api-keys`. A missing header returns
        403; an invalid or revoked key returns 401.

````