Skip to main content

Embed Text

POST 

/v1/embedding/text

Generates text embeddings

nomic-embed-text was trained to support these tasks:

  • search_document (embedding document chunks for search & retrieval)
  • search_query (embedding queries for search & retrieval)
  • classification (embeddings for text classification)
  • clustering (embeddings for cluster visualization)

In the Nomic API or Python client, specify your task with the task_type parameter (default is search_document if no task_type is provided)

Using nomic-embed-text with other libraries requires you to use a prefix to specify your embedding task. See our HuggingFace model card for details.

Request

Body

required

    texts string[]required

    A batch of text you want embedded.

    model NomicTextEmbeddingModel (string)

    Possible values: [nomic-embed-text-v1, nomic-embed-text-v1.5]

    Default value: nomic-embed-text-v1

    The model to use when embedding.

    task_type

    object

    The downstream task to generate embeddings for. Options are search_document, search_query, classification, and clustering.

    anyOf

    string

    long_text_mode LongTextHandlingMode (string)

    Possible values: [truncate, mean]

    Default value: mean

    How to handle text longer than the model can accept.

    max_tokens_per_text Max Tokens Per Text (integer)

    Default value: 8192

    Maximum amount of tokens per text. Defaults to 8192 if long_text_mode is "mean", or the maximum model input size if long_text_mode is "truncate".

    dimensionality

    object

    Optionally reduce embedding dimensionality. Defaults to full-size embeddings if unspecified. Only applies to nomic-embed-text-v1.5.

    anyOf

    integer

Responses

Successful Response

Schema

    embeddings array[]required

    The embeddings

    usage

    object

    required

    The embedding usage

    prompt_tokens Prompt Tokens (integer)required

    The number of non-generated tokens ingested.

    total_tokens Total Tokens (integer)required

    The total tokens used.

    model NomicTextEmbeddingModel (string)required

    Possible values: [nomic-embed-text-v1, nomic-embed-text-v1.5]

    The model used to produce the embeddings.

Loading...