Embedding
- Print
- PDF
Embedding
- Print
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Available in Classic and VPC
Perform vectorization tasks to represent text as numbers.
Request
The following describes the request format for the endpoint. The request format is as follows:
Method | URI |
---|---|
POST | /testapp/v1/api-tools/embedding/{modelName}/{appId} |
Request headers
The following describes the headers.
Header | Required | Description |
---|---|---|
X-NCP-CLOVASTUDIO-API-KEY | Y | API key issued when creating the test app |
X-NCP-APIGW-API-KEY | Y | API Gateway key issued when creating the test app or service app |
X-NCP-CLOVASTUDIO-REQUEST-ID | N | Request ID for each request |
Content-Type | Y | application/json |
Request path parameters
The following describes the parameters.
Field | Type | Required | Description |
---|---|---|---|
modelName | string(enum) | Y | Embedding execution models: clir-emb-dolphin, clir-sts-dolphin |
appId | string | Y | Unique ID of the applicable test app or service app |
Request model
The following describes the models.
Name | clir-emb-dolphin | clir-sts-dolphin |
---|---|---|
Main purpose | Model with good generality that can be applied to any domain | Model specialized for precise measurement of semantic details in sentences |
Request body
The following describes the body.
Field | Type | Required | Description |
---|---|---|---|
texts | string | Y | Text to embed |
Request syntax
The following is a sample syntax.
curl --location 'https://clovastudio.apigw.ntruss.com/testapp/v1/api-tools/embedding/{modelName}/{appId}' \
--header 'X-NCP-CLOVASTUDIO-API-KEY: <X-NCP-CLOVASTUDIO-API-KEY>' \
--header 'X-NCP-APIGW-API-KEY: <X-NCP-APIGW-API-KEY>' \
--header 'X-NCP-CLOVASTUDIO-REQUEST-ID: <X-NCP-CLOVASTUDIO-REQUEST-ID>' \
--header 'Content-Type: application/json' \
--data '{
"text": "How's the weather today?"
}'
Response
The following describes the response format.
Response body
The following describes the body.
Field | Type | Required | Description |
---|---|---|---|
embedding | array[float] | Y | Embedding execution result (consists of 1024 float lists) |
inputTokens | integer | Y | Number of tokens used to enter request text |
Response syntax
The following is a sample syntax.
Success
The following is a sample syntax 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 syntax upon a failed call.
Was this article helpful?