Available in Classic and VPC
Perform a vectorization task to represent long text as numbers.
Request
This section describes the request format. The method and URI are as follows:
| Method | URI |
|---|---|
| POST | /v1/api-tools/embedding/v2 |
Request headers
For information about the headers common to all CLOVA Studio APIs, see CLOVA Studio request headers.
Request body
You can include the following data in the body of your request:
| Field | Type | Required | Description |
|---|---|---|---|
text |
String | Required | Text (tokens) to perform embedding
|
Request example
The request example is as follows:
curl --location --request POST 'https://clovastudio.stream.ntruss.com/v1/api-tools/embedding/v2/' \
--header 'Authorization: Bearer {API Key}' \
--header 'X-NCP-CLOVASTUDIO-REQUEST-ID: {Request ID}' \
--header 'Content-Type: application/json' \
--data '{
"text": "How's the weather today?"
}'
Response
This section describes the response format.
Response body
The response body includes the following data:
| Field | Type | Required | Description |
|---|---|---|---|
status |
Object | - | See Response status. |
result |
Object | - | Response result |
result.embedding |
Array | - | Embedding performance results
|
result.inputTokens |
Integer | - | Number of tokens in the text performing embedding |
Response example
The response example is as follows:
Succeeded
The following is a sample response upon a successful call.
{
"status": {
"code": "20000",
"message": "OK"
},
"result": {
"embedding": [ -0.3861295, -0.7903874, ... , 0.2994273, -0.7736456, -0.24933687 ]
"inputTokens": 4
}
}
Failure
The following is a sample response upon a failed call.