Adaptive ML Completions API

The Completions API from Adaptive ML — 1 operation(s) for completions.

OpenAPI Specification

adaptive-ml-completions-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: concorde artifacts::rest Completions API
  description: ''
  license:
    name: UNLICENSED
    identifier: UNLICENSED
  version: 0.1.0
tags:
- name: Completions
paths:
  /api/v1/chat/completions:
    post:
      tags:
      - Completions
      summary: Generate chat completion
      description: 'Generate a chat completion from a prompt using one model in your project.

        Your prompt messages can include several roles.

        This endpoints supports streaming'
      operationId: Chat
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatInput'
        required: true
      responses:
        '200':
          description: a stream will be returned if `streaming = true` in the request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/ChatResponseChunk'
components:
  schemas:
    ChatResponseChunk:
      type: object
      required:
      - id
      - choices
      - created
      - session_id
      properties:
        id:
          type: string
        choices:
          type: array
          items:
            $ref: '#/components/schemas/Delta'
        created:
          $ref: '#/components/schemas/Timestampsec'
        session_id:
          type: string
          format: uuid
        usage:
          oneOf:
          - type: 'null'
          - $ref: '#/components/schemas/Usage'
    ChatInput:
      allOf:
      - $ref: '#/components/schemas/GenerateParameters'
      - type: object
        required:
        - messages
        - model
        properties:
          messages:
            type: array
            items:
              $ref: '#/components/schemas/ChatMessageInput'
          model:
            type: string
            description: can be of the form `{project}/{model}` or `{project}`. In the latter it will use the default model
          stream:
            type: boolean
          stream_options:
            oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/StreamOptions'
          session_id:
            type:
            - string
            - 'null'
            format: uuid
          user:
            type:
            - string
            - 'null'
            format: uuid
          ab_campaign:
            oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/IdOrKey'
          n:
            type: integer
            format: int32
            minimum: 0
          labels:
            oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DictString'
          metadata:
            oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DictString'
              description: alias for labels
          system_prompt_args:
            type:
            - object
            - 'null'
            description: Will be used to render system prompt template
            additionalProperties: {}
            propertyNames:
              type: string
          tags:
            type:
            - array
            - 'null'
            items:
              type: string
          use_tools:
            type: boolean
          tools:
            type:
            - array
            - 'null'
            items:
              $ref: '#/components/schemas/ToolOverride'
            description: Override tool configuration for this request - enables/disables specific tools
          store:
            type:
            - boolean
            - 'null'
    MessageContentPart:
      oneOf:
      - type: object
        required:
        - text
        - type
        properties:
          text:
            type: string
          type:
            type: string
            enum:
            - text
      - type: object
        required:
        - image_url
        - type
        properties:
          image_url:
            type: string
          type:
            type: string
            enum:
            - image_url
    IdOrKey:
      type: string
      description: id or key of the entity
      examples:
      - 76d1fab3-214c-47ef-bb04-16270639bf89
    Usage:
      type: object
      required:
      - completion_tokens
      - prompt_tokens
      - total_tokens
      properties:
        completion_tokens:
          type: integer
          format: int32
          minimum: 0
        prompt_tokens:
          type: integer
          format: int32
          minimum: 0
        total_tokens:
          type: integer
          format: int32
          minimum: 0
    ToolOverride:
      type: object
      required:
      - id
      - enabled
      properties:
        id:
          type: string
        enabled:
          type: boolean
    Delta:
      type: object
      required:
      - delta
      - index
      - completion_id
      properties:
        delta:
          $ref: '#/components/schemas/ChatChoiceMessage'
        index:
          type: integer
          format: int32
          minimum: 0
        completion_id:
          type: string
        finish_reason:
          type:
          - string
          - 'null'
    ChatResponse:
      type: object
      required:
      - id
      - created
      - choices
      - session_id
      - usage
      properties:
        id:
          type: string
        created:
          $ref: '#/components/schemas/Timestampsec'
        choices:
          type: array
          items:
            $ref: '#/components/schemas/ChatChoice'
        session_id:
          type: string
          format: uuid
        usage:
          $ref: '#/components/schemas/Usage'
    Timestampsec:
      type: number
      description: Unix Timestamp in seconds
      examples:
      - '1720712536'
    MessagePackage:
      oneOf:
      - type: string
      - type: array
        items:
          $ref: '#/components/schemas/MessageContentPart'
    ChatMessageInput:
      type: object
      required:
      - content
      - role
      properties:
        content:
          $ref: '#/components/schemas/MessagePackage'
        role:
          type: string
        name:
          type:
          - string
          - 'null'
        completion_id:
          type:
          - string
          - 'null'
          format: uuid
        metadata: {}
    StreamOptions:
      type: object
      properties:
        include_usage:
          type: boolean
    ChatChoice:
      type: object
      required:
      - index
      - message
      - completion_id
      - model
      properties:
        index:
          type: integer
          format: int32
          minimum: 0
        message:
          $ref: '#/components/schemas/ChatChoiceMessage'
        finish_reason:
          type:
          - string
          - 'null'
        completion_id:
          type: string
        model:
          type: string
    GenerateParameters:
      type: object
      properties:
        stop:
          type:
          - array
          - 'null'
          items:
            type: string
        max_tokens:
          type:
          - integer
          - 'null'
          format: int32
          minimum: 0
        temperature:
          type:
          - number
          - 'null'
          format: float
        top_p:
          type:
          - number
          - 'null'
          format: float
        max_ttft_ms:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 0
    ChatChoiceMessage:
      type: object
      required:
      - id
      - role
      - content
      properties:
        id:
          type: string
        role:
          type: string
        content:
          type: string
    DictString:
      type: object
      description: dictionnary with key and values as string
      additionalProperties:
        type: string
      examples:
      - key: value