Generate sparse embeddings

no
Summary: Generate sparse vector embeddings for the given texts using the specified model. Provide either 'instructions' or both 'task' and 'target' alongside 'texts'. Set 'fetch_labels' to true to include token labels in the response.

Original Documentation

Documentation Index#

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

Generate sparse vector embeddings for the given texts using the specified model. Provide either ‘instructions’ or both ’task’ and ’target’ alongside ’texts’. Set ‘fetch_labels’ to true to include token labels in the response.

OpenAPI#

openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /embed_sparse:
    post:
      summary: Generate sparse embeddings
      description: >-
        Generate sparse vector embeddings for the given texts using the
        specified model. Provide either 'instructions' or both 'task' and
        'target' alongside 'texts'. Set 'fetch_labels' to true to include token
        labels in the response.
      operationId: embed_sparse_embed_sparse_post
      parameters:
        - name: x-chroma-token
          in: header
          required: true
          schema:
            type: string
          description: Chroma API key for authentication.
        - name: x-chroma-embedding-model
          in: header
          required: true
          schema:
            type: string
            enum:
              - Qwen/Qwen3-Embedding-0.6B
              - BAAI/bge-m3
              - prithivida/Splade_PP_en_v1
              - naver/efficient-splade-VI-BT-large-doc
              - naver/efficient-splade-VI-BT-large-query
          description: The embedding model to use.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - required:
                    - instructions
                - required:
                    - task
                    - target
              description: Request body for embedding endpoints.
              properties:
                texts:
                  items:
                    type: string
                  title: Texts
                  type: array
                task:
                  anyOf:
                    - type: string
                    - type: 'null'
                  title: Task
                target:
                  anyOf:
                    - type: string
                    - type: 'null'
                  title: Target
                instructions:
                  anyOf:
                    - type: string
                    - type: 'null'
                  title: Instructions
                fetch_labels:
                  anyOf:
                    - type: boolean
                    - type: 'null'
                  title: Fetch Labels
              required:
                - texts
              title: EmbedRequestBody
              type: object
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SparseEmbedResponse'
        '400':
          description: >-
            Invalid request (missing headers, unsupported model, or malformed
            body)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication failed (invalid or missing API key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '501':
          description: Operation not supported for this model
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SparseEmbedResponse:
      properties:
        embeddings:
          items:
            $ref: '#/components/schemas/SparseEmbeddingItem'
          type: array
          title: Embeddings
        num_tokens:
          type: integer
          title: Num Tokens
      type: object
      required:
        - embeddings
        - num_tokens
      title: SparseEmbedResponse
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
      type: object
      required:
        - error
      title: ErrorResponse
    SparseEmbeddingItem:
      properties:
        indices:
          items:
            type: integer
          type: array
          title: Indices
        values:
          items:
            type: number
          type: array
          title: Values
        labels:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Labels
      type: object
      required:
        - indices
        - values
      title: SparseEmbeddingItem

Built with Mintlify.

Link last verified June 7, 2026. View original ↗
Source: Chroma Docs
Link last verified: 2026-04-05