Encode::Encode
Generates a vector representation of text or images using the specified embedding model. If the model does not exist or has not been loaded, an error will be returned for that particular data item.
It is recommended that multiple pieces of content are specified in a single request to take advantage of batching, especially when running with an attached GPU. Recommended sizes can be found at embedds/model-details and batching will be automatically done.
----
Not all models support [text, images, image_uris] a breakdown of present support is outlined below:
- ModelClass_INSTRUCTOR - requires: {text and data.instruction}
- ModelClass_CLIP - any_of: {text, images}
- application/json
Request Body required
batches object[]
repeated data items to generate encodings for
Array [model_class apiModelClassPossible values: [
ModelClass_Unknown
,ModelClass_CLIP
,ModelClass_INSTRUCTOR
,ModelClass_E5
]Default value:
ModelClass_Unknown
model_name stringspecific name of the model to apply the encoding transformation
text object
data object[]
Array [id stringvalue stringbytes byteinstruction string]images object
data object[]
Array [id stringvalue stringbytes byteinstruction string]image_uris object
data object[]
Array [id stringvalue stringbytes byteinstruction string]]
- 200
- default
A successful response.
- application/json
- Schema
- Example (from schema)
Schema
results object[]
list of embedding results corresponding to the ordered content submitted
Array [err_message stringexplanation for why the content could not be encoded
embedding float[]embedding representation of the the content
]
{
"results": [
{
"err_message": "string",
"embedding": [
0
]
}
]
}
An unexpected error response.
- application/json
- Schema
- Example (from schema)
Schema
- code int32
- message string
details object[]
Array [@type string]
{
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}