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

# Generate or complete metric configuration with AI

> Two modes, selected by the request body:

- **Spec mode** (provide `specificationIds`): generates 1-3 metric configurations per
  specification, optionally creating the metrics automatically.
- **Completion mode** ("Complete With AI", provide `name` + `description` + `evaluationType`):
  completes a single metric the user is authoring. The name/description/evaluationType/tags
  are the source of truth; only the judge prompt, evaluation params, and evaluator model are
  generated. `specificationIds` may carry at most one id as optional context.

See [Metrics](https://docs.galtea.ai/concepts/metric).




## OpenAPI

````yaml https://api.galtea.ai/openapi.json post /metrics/generate-config
openapi: 3.0.0
info:
  version: 1.0.0
  title: Product Management Service API
  description: API documentation for Product Management Service
  contact:
    name: Galtea AI
servers:
  - url: https://api.galtea.ai
security:
  - bearerAuth: []
tags: []
externalDocs:
  description: Galtea Platform Documentation
  url: https://docs.galtea.ai
paths:
  /metrics/generate-config:
    post:
      tags:
        - metrics
      summary: Generate or complete metric configuration with AI
      description: >
        Two modes, selected by the request body:


        - **Spec mode** (provide `specificationIds`): generates 1-3 metric
        configurations per
          specification, optionally creating the metrics automatically.
        - **Completion mode** ("Complete With AI", provide `name` +
        `description` + `evaluationType`):
          completes a single metric the user is authoring. The name/description/evaluationType/tags
          are the source of truth; only the judge prompt, evaluation params, and evaluator model are
          generated. `specificationIds` may carry at most one id as optional context.

        See [Metrics](https://docs.galtea.ai/concepts/metric).
      operationId: generateMetricConfig
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                specificationIds:
                  type: array
                  example:
                    - spec_123
                    - spec_456
                  items:
                    type: string
                  description: >-
                    Spec mode - IDs of the specifications to generate metrics
                    for. Completion mode - at most one id used as context.
                automaticCreation:
                  type: boolean
                  description: >-
                    Spec mode only - when true, creates metrics from generated
                    config
                  example: false
                maxMetricsPerSpecification:
                  type: integer
                  description: >-
                    Spec mode only - maximum number of metrics to generate per
                    specification
                isOnboarding:
                  type: boolean
                  description: Spec mode only - whether this is an onboarding flow
                  example: false
                name:
                  type: string
                  description: >-
                    Completion mode - the user-authored metric name (source of
                    truth)
                description:
                  type: string
                  description: >-
                    Completion mode - the user-authored metric description (the
                    criteria to evaluate)
                evaluationType:
                  type: string
                  enum:
                    - PARTIAL_PROMPT
                    - HUMAN_EVALUATION
                  description: >-
                    Completion mode - PARTIAL_PROMPT (binary LLM judge) or
                    HUMAN_EVALUATION (0-100 annotator guidelines)
                tags:
                  type: array
                  items:
                    type: string
                  description: >-
                    Completion mode - user-provided tags (source of truth,
                    optional)
                productId:
                  type: string
                  description: Completion mode - optional product id for additional context
      responses:
        '200':
          description: Metric configuration generated successfully
          content:
            application/json:
              schema:
                type: object
                description: Generated metric configuration suggestion
        '201':
          description: Metrics created from generated configuration
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Metric'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    Metric:
      type: object
      properties:
        id:
          type: string
          example: metric_123
        metricGroupId:
          type: string
          readOnly: true
          example: metric_123
          description: >-
            Identifier shared by every metric in the same revision family.
            Server-managed — derived from `parentMetricId` on create (or
            generated for roots). Cannot be set by the caller.
        parentMetricId:
          type: string
          nullable: true
          example: metric_122
          description: >-
            Id of the direct parent metric. On create, providing this value
            turns the new metric into a revision: it joins the parent's family
            and (if the parent is active) flips the parent to legacy. Omit or
            null to create a root metric in a fresh group. On responses, this is
            the recorded parent edge (null for roots).
        organizationId:
          type: string
          nullable: true
          example: org_123
        userId:
          type: string
          nullable: true
          example: user_123
        name:
          type: string
          example: Accuracy
        evaluationParams:
          type: array
          items:
            type: string
          example:
            - input
            - actualOutput
            - expectedOutput
          description: >-
            Ordered list of inference-result fields the evaluator needs (e.g.
            input, actualOutput, expectedOutput, retrievalContext). Determines
            which data the evaluation engine extracts from each inference
            result.
        source:
          type: string
          enum:
            - SELF_HOSTED
            - FULL_PROMPT
            - PARTIAL_PROMPT
            - HUMAN_EVALUATION
            - GEVAL
            - DEEPEVAL
            - DETERMINISTIC
          nullable: true
          example: PARTIAL_PROMPT
          description: >-
            Evaluation method for the metric. `FULL_PROMPT` is deprecated for
            creation — `POST /metrics` rejects it with a 400. Use
            `PARTIAL_PROMPT` for new AI Evaluation metrics. The value remains in
            the enum because existing FULL_PROMPT metrics are still returned by
            reads and filters.
        judgePrompt:
          type: string
          nullable: true
          example: Evaluate the accuracy of the response
        tags:
          type: array
          items:
            type: string
          example:
            - accuracy
            - quality
        description:
          type: string
          nullable: true
          example: Measures the accuracy of responses
        documentationUrl:
          type: string
          nullable: true
          example: https://docs.example.com/metrics/accuracy
        evaluatorModelName:
          type: string
          nullable: true
          example: GPT-4
        areEvalParamsTop:
          type: boolean
          nullable: true
          description: >-
            When true, evaluationParams are injected at the top level of the
            evaluator prompt instead of nested inside the conversation context.
        isBeingOptimized:
          type: boolean
          readOnly: true
          description: Whether the metric is currently being optimized.
        specificationIds:
          type: array
          items:
            type: string
          example:
            - spec_123
        userGroupIds:
          type: array
          items:
            type: string
          example:
            - ug_123
        createdAt:
          type: string
          format: date-time
        legacyAt:
          type: string
          format: date-time
          nullable: true
        disabledAt:
          type: string
          format: date-time
          nullable: true
    Error:
      type: object
      properties:
        error:
          type: string
          example: Error type
        message:
          type: string
          example: Error message description
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authorization. Pass your API key in the Authorization header as
        a Bearer token. Both new (`gsk_*`) and legacy (`gsk-`) API keys are
        accepted, e.g. `Authorization: Bearer gsk_...` or `Authorization: Bearer
        gsk-...`.

````