Amigo Evaluations API

The Evaluations API from Amigo — 4 operation(s) for evaluations.

OpenAPI Specification

amigo-evaluations-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Amigo Account Evaluations API
  version: 0.1.0
servers:
- url: https://api.amigo.ai
- url: https://internal-api.amigo.ai
- url: https://api-eu-central-1.amigo.ai
- url: https://api-ap-southeast-2.amigo.ai
- url: https://api-ca-central-1.amigo.ai
security:
- Bearer-Authorization: []
  Bearer-Authorization-Organization: []
  Basic: []
tags:
- name: Evaluations
paths:
  /v1/{workspace_id}/production-eval-definitions:
    post:
      tags:
      - Evaluations
      summary: Create Production Eval Definition
      operationId: create-production-eval-definition
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProductionEvalDefinitionRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductionEvalDefinition'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
    get:
      tags:
      - Evaluations
      summary: List Production Eval Definitions
      operationId: list-production-eval-definitions
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: service_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Service Id
      - name: active
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Active
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          exclusiveMinimum: 0
          default: 10
          title: Limit
      - name: continuation_token
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Continuation Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse_ProductionEvalDefinition_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/{workspace_id}/production-eval-definitions/{definition_id}:
    get:
      tags:
      - Evaluations
      summary: Get Production Eval Definition
      operationId: get-production-eval-definition
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: definition_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Definition Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductionEvalDefinition'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    patch:
      tags:
      - Evaluations
      summary: Update Production Eval Definition
      operationId: update-production-eval-definition
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: definition_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Definition Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateProductionEvalDefinitionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductionEvalDefinition'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Evaluations
      summary: Delete Production Eval Definition
      operationId: delete-production-eval-definition
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: definition_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Definition Id
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/{workspace_id}/calls/{conversation_id}/evaluate:
    post:
      tags:
      - Evaluations
      summary: Evaluate Call
      description: 'Run the workspace''s active eval definitions against one completed call and

        persist the verdicts. Synchronous (the caller waits on the judge); the eager

        post-call trigger is a separate change.'
      operationId: evaluate-call
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Conversation Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallEvalResultsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/{workspace_id}/calls/{conversation_id}/eval-results:
    get:
      tags:
      - Evaluations
      summary: Get Call Eval Results
      operationId: get-call-eval-results
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Conversation Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallEvalResultsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
    UpdateProductionEvalDefinitionRequest:
      properties:
        service_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Service Id
        eval_key:
          anyOf:
          - type: string
            maxLength: 128
            minLength: 1
          - type: 'null'
          title: Eval Key
        eval_type:
          anyOf:
          - type: string
            enum:
            - assertion
            - metric
          - type: 'null'
          title: Eval Type
        assertion_kind:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Assertion Kind
        metric_key:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Metric Key
        expected:
          title: Expected
        params:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Params
        active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Active
      type: object
      title: UpdateProductionEvalDefinitionRequest
    ProductionEvalDefinition:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        workspace_id:
          type: string
          format: uuid
          title: Workspace Id
        service_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Service Id
        eval_key:
          type: string
          maxLength: 128
          title: Eval Key
        eval_type:
          type: string
          enum:
          - assertion
          - metric
          title: Eval Type
        assertion_kind:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Assertion Kind
        metric_key:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Metric Key
        expected:
          title: Expected
        params:
          additionalProperties: true
          type: object
          title: Params
        active:
          type: boolean
          title: Active
          default: true
        created_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Created At
        updated_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Updated At
      type: object
      required:
      - workspace_id
      - eval_key
      - eval_type
      title: ProductionEvalDefinition
      description: 'An eval (assertion or metric-eval) that runs against a workspace''s live

        calls — the production analogue of a sim case''s ``evals``. ``service_id``

        None applies to every service in the workspace. ``expected`` is JSON: a

        phrase string for assertions, or a ``{gte|lte|equals|...}`` threshold for

        metric-evals.'
    CallEvalResult:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        workspace_id:
          type: string
          format: uuid
          title: Workspace Id
        service_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Service Id
        conversation_id:
          type: string
          format: uuid
          title: Conversation Id
        call_sid:
          anyOf:
          - type: string
          - type: 'null'
          title: Call Sid
        eval_key:
          type: string
          maxLength: 128
          title: Eval Key
        eval_type:
          type: string
          enum:
          - assertion
          - metric
          title: Eval Type
        assertion_kind:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Assertion Kind
        metric_key:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Metric Key
        status:
          type: string
          enum:
          - passed
          - failed
          - pending
          - skipped
          - error
          title: Status
        passed:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Passed
        score:
          anyOf:
          - type: number
          - type: 'null'
          title: Score
        expected:
          title: Expected
        actual:
          title: Actual
        rationale:
          anyOf:
          - type: string
          - type: 'null'
          title: Rationale
        justification:
          anyOf:
          - type: string
          - type: 'null'
          title: Justification
        cited_turns:
          items: {}
          type: array
          title: Cited Turns
        computed_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Computed At
        created_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Created At
      type: object
      required:
      - workspace_id
      - conversation_id
      - eval_key
      - eval_type
      - status
      title: CallEvalResult
      description: 'One eval verdict for one production call, keyed by ``conversation_id``.

        Mirrors the sim eval-result shape. ``justification`` and ``cited_turns`` come

        from the justified ai_query metric compute. PHI: ``justification`` / ``actual``

        can echo live transcript content; never log them.'
    CallEvalResultsResponse:
      properties:
        conversation_id:
          type: string
          format: uuid
          title: Conversation Id
        results:
          items:
            $ref: '#/components/schemas/CallEvalResult'
          type: array
          title: Results
      type: object
      required:
      - conversation_id
      - results
      title: CallEvalResultsResponse
    CreateProductionEvalDefinitionRequest:
      properties:
        eval_key:
          type: string
          maxLength: 128
          minLength: 1
          title: Eval Key
        eval_type:
          type: string
          enum:
          - assertion
          - metric
          title: Eval Type
        service_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Service Id
        assertion_kind:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Assertion Kind
        metric_key:
          anyOf:
          - type: string
            maxLength: 128
          - type: 'null'
          title: Metric Key
        expected:
          title: Expected
        params:
          additionalProperties: true
          type: object
          title: Params
        active:
          type: boolean
          title: Active
          default: true
      type: object
      required:
      - eval_key
      - eval_type
      title: CreateProductionEvalDefinitionRequest
    PaginatedResponse_ProductionEvalDefinition_:
      properties:
        items:
          items:
            $ref: '#/components/schemas/ProductionEvalDefinition'
          type: array
          title: Items
        has_more:
          type: boolean
          title: Has More
        continuation_token:
          anyOf:
          - type: integer
          - type: 'null'
          title: Continuation Token
        total:
          anyOf:
          - type: integer
          - type: 'null'
          title: Total
      type: object
      required:
      - items
      - has_more
      title: PaginatedResponse[ProductionEvalDefinition]
  securitySchemes:
    Bearer-Authorization:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the [`SignInWithAPIKey`](sign-in-with-api-key) endpoint.
    Bearer-Authorization-Organization:
      type: apiKey
      in: header
      name: X-ORG-ID
      description: An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
    Basic:
      type: http
      scheme: basic
      description: The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.