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[]
Responses
- 200
- default
A successful response.
- application/json
- Schema
- Example (from schema)
Schema
results object[]
{
"results": [
{
"err_message": "string",
"embedding": [
0
]
}
]
}
An unexpected error response.
- application/json
- Schema
- Example (from schema)
Schema
- code int32
- message string
details object[]
{
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}
POST /encode
Request
Request
curl / cURL
curl -L -X POST 'https://infrawhispers.github.io/encode' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"data": [
{
"model_class": "ModelClass_INSTRUCTOR",
"model_name": "INSTRUCTOR_LARGE",
"text": [
"3D ActionSLAM: wearable person tracking ...",
"Inside Gohar World and the Fine, Fantastical Art"
],
"instructions": [
"Represent the Science title:",
"Represent the Magazine title:"
]
}
]
}'
python / requests
curl -L -X POST 'https://infrawhispers.github.io/encode' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"data": [
{
"model_class": "ModelClass_INSTRUCTOR",
"model_name": "INSTRUCTOR_LARGE",
"text": [
"3D ActionSLAM: wearable person tracking ...",
"Inside Gohar World and the Fine, Fantastical Art"
],
"instructions": [
"Represent the Science title:",
"Represent the Magazine title:"
]
}
]
}'
go / native
curl -L -X POST 'https://infrawhispers.github.io/encode' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"data": [
{
"model_class": "ModelClass_INSTRUCTOR",
"model_name": "INSTRUCTOR_LARGE",
"text": [
"3D ActionSLAM: wearable person tracking ...",
"Inside Gohar World and the Fine, Fantastical Art"
],
"instructions": [
"Represent the Science title:",
"Represent the Magazine title:"
]
}
]
}'
nodejs / axios
curl -L -X POST 'https://infrawhispers.github.io/encode' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"data": [
{
"model_class": "ModelClass_INSTRUCTOR",
"model_name": "INSTRUCTOR_LARGE",
"text": [
"3D ActionSLAM: wearable person tracking ...",
"Inside Gohar World and the Fine, Fantastical Art"
],
"instructions": [
"Represent the Science title:",
"Represent the Magazine title:"
]
}
]
}'