Service name | Service ID | Service description | QPS limit for API calls (Alibaba Cloud account and RAM users) |
OpenSearch Vector Dimensionality Reduction Service-001 | ops-embedding-dim-reduction-001 | Provides vector dimensionality reduction service, supporting vector dimensionality reduction up to 4k. You can fine-tune the model based on your business needs. | 50 Note To apply for higher QPS, submit a ticket. |
Prerequisites
The authentication information is obtained.
When you call an AI Search Open Platform service by using an API, you need to authenticate the caller's identity.
The service access address is obtained.
You can call a service over the Internet or a virtual private cloud (VPC). For more information, see Get service registration address.
Request description
General description
The request body must not exceed 8MB.
HTTP request method
POST
URL
{host}/v3/openapi/workspaces/{workspace_name}/embedding-tuning/{service_id}host: The address for calling the service, supports calling API services through both public network and VPC. For more information, see Query service endpoint.
workspace_name: The name of the workspace, such as 'default'.
service_id: The system built-in service ID, such as ops-embedding-dim-reduction-001.
Request parameters
Header parameters
API-KEY Authentication
Parameter | Type | Required | Description | Example value |
Content-Type | String | Yes | Request type: application/json | application/json |
Authorization | String | Yes | API-Key | Bearer OS-d1**2a |
Body parameters
Parameter | Type | Required | Description | Example value |
input | List<List<Float>> | Yes | Input vector collection. | [0.111,0.222,0.333] |
parameters | Map | No | Adjustable request parameters. These parameters may vary based on different service IDs. | |
parameters.output_dimension | Integer | No | Output dimension. Default value: 512. | 512 |
parameters.model_name | String | No | Name of the user-trained model. If it is a vector compression service, this is required. | xxxx-model |
Response parameters
Parameter | Type | Description | Example value |
result.output | List<List<Float>> | Fine-tuned vector results. | |
usage.doc_count | Int | The number of vector entries input in this request. | 2 |
Curl request example
curl --location 'http://****-hangzhou.opensearch.aliyuncs.com/v3/openapi/workspaces/default/embedding-tuning/ops-embedding-dim-reduction-001/' \
--header 'Authorization: Bearer Your-API-KEY' \
--header 'Content-Type: application/json' \
--data '{
"input": [
[0.111,0.222,0.333],
[0.121,0.221,0.331]
],
"parameters":{
"output_dimension": "512",
"model_name" : "xxxx"
}
}'Sample response
Normal sample response
{
"request_id": "450fcb80-f796-46c1-8d69-e1e86d29aa9f",
"latency": 564.903929,
"usage": {
"doc_count": 2
}
"result": {
"output":[
[0.111,0.222,0.333],
[0.121,0.221,0.331]
]
}
}Sample error response
In the event of an access request error, the output will specify the error reason through the code and message.
{
"request_id": "590A7EB8-AA84-****-AF31-8C35DC965972",
"latency": 0.0,
"code": "InvalidParameter",
"http_code": 400,
"message": "document.file_name required"
}Status codes
HTTP status code | Error code | Description |
200 | - | Request succeeded. Including task failed scenarios. The actual task status needs to be determined from result.status |
404 | BadRequest.TaskNotExist | The error message returned because the specified task does not exist. |
400 | InvalidParameter | Invalid request |
500 | InternalServerError | Internal error |
For more information, see Status codes.