openapi: 3.1.0
info:
  title: NeMo Retriever Text Embedding NIM
  description: A service for embedding text.
  version: 1.1.0
paths:
  /v1/embeddings:
    post:
      summary: Create embeddings from the provided text batches
      operationId: get_embeddings_v1_embeddings_post
      parameters:
      - name: content-type
        in: header
        required: true
        schema:
          type: string
          maxLength: 32
          pattern: .*
          title: Content-Type
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmbeddingRequest'
      responses:
        '200':
          description: Embeddings successfully returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmbeddingResponse'
        '400':
          description: Unable to validate the request due to client error
        '404':
          description: Unable to find the specified model
        '415':
          description: This endpoint expects application/json
        '422':
          description: The request was invalid
        '503':
          description: Model evaluator was unavailable, try again momentarily
  /v1/models:
    get:
      summary: Get Models
      operationId: get_models_v1_models_get
      responses:
        '200':
          description: The available models loaded in the service.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelsResponse'
  /v1/health/live:
    get:
      summary: Health Live
      operationId: health_live_v1_health_live_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /v1/health/ready:
    get:
      summary: Health Ready
      operationId: health_ready_v1_health_ready_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /v1/metrics:
    get:
      summary: Metrics
      description: Handler for metrics endpoint.
      operationId: metrics_v1_metrics_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: string
                title: Response Metrics V1 Metrics Get
  /v1/license:
    get:
      summary: License
      description: Handler for license endpoint.
      operationId: license_v1_license_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LicenseEndpointModel'
  /v1/metadata:
    get:
      summary: Metadata
      description: Handler for metadata endpoint.
      operationId: metadata_v1_metadata_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetadataEndpointModel'
  /v1/manifest:
    get:
      summary: Manifest
      description: Handler for the manifest endpoint.
      operationId: manifest_v1_manifest_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManifestEndpointModel'
components:
  schemas:
    Embedding:
      properties:
        index:
          type: integer
          maximum: 8191.0
          minimum: 0.0
          format: int32
          title: Index
        embedding:
          anyOf:
          - items:
              type: number
            type: array
            maxItems: 1048576
            minItems: 1
          - type: string
            maxLength: 8388608
            minLength: 1
            format: binary
          title: Embedding
        object:
          type: string
          maxLength: 9
          pattern: embedding
          title: Object
          default: embedding
      type: object
      required:
      - index
      - embedding
      title: Embedding
    EmbeddingRequest:
      properties:
        input:
          anyOf:
          - type: string
            maxLength: 16777216
            minLength: 1
            pattern: .*
          - items:
              type: string
              maxLength: 16777216
              minLength: 1
              pattern: .*
            type: array
            maxItems: 8191
            minItems: 0
          title: Input
          examples:
          - This is some text to be embedded.
        model:
          type: string
          maxLength: 512
          minLength: 1
          pattern: .*
          title: Model
          examples:
          - NV-Embed-QA
        input_type:
          anyOf:
          - type: string
            enum:
            - passage
            - query
          - type: 'null'
          title: Input Type
        encoding_format:
          type: string
          enum:
          - float
          - base64
          title: Encoding Format
          default: float
        user:
          anyOf:
          - type: string
            maxLength: 512
            minLength: 1
            pattern: .*
          - type: 'null'
          title: User
          examples:
          - user-identifier
        truncate:
          type: string
          enum:
          - START
          - END
          - NONE
          title: Truncate
          default: NONE
      additionalProperties: false
      type: object
      required:
      - input
      - model
      title: EmbeddingRequest
    EmbeddingResponse:
      properties:
        object:
          type: string
          maxLength: 4
          pattern: list
          title: Object
          default: list
        data:
          items:
            $ref: '#/components/schemas/Embedding'
          type: array
          maxItems: 8192
          minItems: 1
          title: Data
        model:
          type: string
          maxLength: 512
          minLength: 1
          pattern: .*
          title: Model
          examples:
          - NV-Embed-QA
        usage:
          $ref: '#/components/schemas/UsageInfo'
      type: object
      required:
      - data
      - model
      - usage
      title: EmbeddingResponse
    LicenseEndpointModel:
      properties:
        name:
          type: string
          title: Name
          description: The name of the license for the NIM container.
        path:
          type: string
          title: Path
          description: The filepath within the container containing the license content.
        sha:
          type: string
          title: Sha
          description: A SHA1 hash of the license contents.
        size:
          type: integer
          title: Size
          description: The number of characters in the license content.
        url:
          type: string
          title: Url
          description: The url where this license is hosted externally.
        type:
          type: string
          enum:
          - file
          const: file
          title: Type
          description: The format of the license content.
        content:
          type: string
          title: Content
          description: The license text.
      type: object
      required:
      - name
      - path
      - sha
      - size
      - url
      - type
      - content
      title: LicenseEndpointModel
      description: A model representing the license response.
    ManifestEndpointModel:
      properties:
        manifest_file:
          type: string
          title: Manifest File
          description: The content of the manifest file describing the required model
            artifacts.
      type: object
      required:
      - manifest_file
      title: ManifestEndpointModel
      description: A model representing the manifest response.
    MetadataEndpointModel:
      properties:
        assetInfo:
          items:
            type: string
          type: array
          title: Assetinfo
          description: A list of required container assets excluding model artifacts
        licenseInfo:
          $ref: '#/components/schemas/LicenseEndpointModel'
          description: The license info.
        modelInfo:
          items:
            $ref: '#/components/schemas/ModelInfo'
          type: array
          title: Modelinfo
          description: A list of models being served by the NIM.
        version:
          type: string
          title: Version
          description: The version of the NIM service.
      type: object
      required:
      - assetInfo
      - licenseInfo
      - modelInfo
      - version
      title: MetadataEndpointModel
      description: A model representing the metadata response.
    ModelCard:
      properties:
        id:
          type: string
          maxLength: 1024
          minLength: 1
          pattern: .*
          title: Id
          examples:
          - NV-Embed-QA
        created:
          type: integer
          maximum: 4294967295.0
          minimum: 0.0
          title: Created
          default: 0
        object:
          type: string
          maxLength: 5
          pattern: model
          title: Object
          default: model
        owned_by:
          type: string
          maxLength: 1024
          pattern: .*
          title: Owned By
          default: organization-owner
      type: object
      required:
      - id
      title: ModelCard
    ModelInfo:
      properties:
        modelUrl:
          type: string
          title: Modelurl
        shortName:
          type: string
          title: Shortname
      type: object
      required:
      - modelUrl
      - shortName
      title: ModelInfo
      description: A model representing the model response.
    ModelsResponse:
      properties:
        object:
          type: string
          maxLength: 4
          pattern: list
          title: Object
          default: list
        data:
          items:
            $ref: '#/components/schemas/ModelCard'
          type: array
          maxItems: 1023
          minItems: 0
          title: Data
      type: object
      required:
      - data
      title: ModelsResponse
    UsageInfo:
      properties:
        prompt_tokens:
          type: integer
          maximum: 4294967295.0
          minimum: 0.0
          title: Prompt Tokens
          default: 0
        total_tokens:
          type: integer
          maximum: 4294967295.0
          minimum: 0.0
          title: Total Tokens
          default: 0
      type: object
      title: UsageInfo
