Embedding
    • PDF

    Embedding

    • PDF

    Article summary

    Available in Classic and VPC

    Perform vectorization tasks to represent text as numbers.

    Request

    This section describes the request format. The method and URI are as follows:

    MethodURI
    POST/v1/api-tools/embedding/{modelName}

    Request headers

    The following describes the request headers.

    FieldRequiredDescription
    AuthorizationRequiredAPI key for authentication <e.g.,> Bearer nv-************
    X-NCP-CLOVASTUDIO-REQUEST-IDOptionalRequest ID
    Content-TypeRequiredRequest data format
    • application/json

    Request path parameters

    You can use the following path parameters with your request:

    FieldTypeRequiredDescription
    modelNameEnumRequiredModel for performing embedding
    • clir-emb-dolphin | clir-sts-dolphin
      • clir-emb-dolphin: highly generalizable model that can be applied to any domain (default)
      • clir-sts-dolphin: model specialized for precisely measuring the meaning of sentences

    Request body

    The following describes the body.

    FieldTypeRequiredDescription
    textStringRequiredText (tokens) to perform embedding
    • 1-500

    Request example

    The request example is as follows:

    curl --location --request POST 'https://clovastudio.stream.ntruss.com/testapp/v1/api-tools/embedding/{modelName}' \
    --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:

    FieldTypeRequiredDescription
    embeddingArray-Embedding performance results
    • Composed of a list of 1024 floats
    inputTokensInteger-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.


    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.