Embeddings¶
Convert text or multimodal content to vectors for later retrieval or similarity calculations.
POST https://token.moi.matrixorigin.cn/v1/embeddings
Before you call¶
Prepare credentials with Genesis access and a model ID that supports Embeddings.
Request body¶
Replace $GENESIS_ACCESS_TOKEN with an access token or service-account API key, and $MODEL_ID with the model ID to call.
curl -X POST \
"https://token.moi.matrixorigin.cn/v1/embeddings" \
-H "Authorization: Bearer $GENESIS_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"model": "'"$MODEL_ID"'",
"input": [
"MatrixOne is a database for the intelligent era.",
"Genesis provides model invocation APIs."
],
"encoding_format": "float"
}'
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Embeddings model ID to call. |
|
string or array of string or array of object |
Yes |
Text to convert to vectors. |
|
string |
No |
Vector encoding format. The example uses |
|
integer |
No |
Expected vector dimensions; use only when the selected model supports them. |
Successful response¶
The service returns one corresponding vector result for each input.
{
"object": "list",
"model": "<MODEL_ID>",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.018, -0.042, 0.337] }
]
}
Field |
Type |
Description |
|---|---|---|
|
string |
Response object type; the example is |
|
string |
Model ID that processed the request. |
|
array of object |
Vector results for this input; each item corresponds to one input text. |
The following table expands each item in the example data array.
Field |
Type |
Description |
|---|---|---|
|
string |
Result object type; the example is |
|
integer |
Position corresponding to the |
|
array of number or string |
Vector for this text; the actual type depends on the requested encoding format. |
Error response¶
{
"error": {
"message": "<human-readable error message>",
"type": "<error type; may be omitted>",
"code": "<error code; may be omitted>"
}
}
Field |
Type |
Description |
|---|---|---|
|
object |
Error object. |
The following table expands the example error object.
Field |
Type |
Description |
|---|---|---|
|
string |
Human-readable error message. |
|
string |
Error category returned by the model service; it may be omitted. |
|
string or null |
Error code returned by the model service; it may be omitted. |