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
- application/json
Body
required
A batch of text you want embedded.
Possible values: [nomic-embed-text-v1, nomic-embed-text-v1.5]
An enumeration.
Default value: search_document
The downstream task to generate embeddings for. Options are search_document, search_query, classification, and clustering.
Possible values: [truncate, mean]
How to handle input texts longer than context length. Use truncate to cut off text after context length, or mean to get the mean of embedding vectors of chunks from your input text.
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".
Default value: 768
Optionally reduce embedding dimensionality. Defaults to full-size embeddings if unspecified. Only applies to nomic-embed-text-v1.5.
Responses
- 200
- 422
Successful Response
- application/json
- Schema
- Example (from schema)
Schema
The embeddings
usage
object
required
The number of non-generated tokens ingested.
The total tokens used.
Possible values: [nomic-embed-text-v1, nomic-embed-text-v1.5]
An enumeration.
{
"embeddings": [
[
0
]
],
"usage": {
"prompt_tokens": 0,
"total_tokens": 0
}
}
Validation Error
- application/json
- Schema
- Example (from schema)
Schema
Array [
Array [
- MOD1
- MOD2
]
]
detail
object[]
loc
object[]
required
anyOf
string
integer
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}