Embedding v2
    • PDF

    Embedding v2

    • PDF

    Article summary

    Available in Classic and VPC

    Perform a vectorization task to represent long text as numbers.

    Request

    The following describes the request format for the endpoint. The request format is as follows:

    MethodURI
    POST/v1/api-tools/embedding/v2/{appId}

    Request headers

    The following describes the headers.

    HeadersRequiredDescription
    X-NCP-CLOVASTUDIO-API-KEYYAPI key issued when creating the test app
    X-NCP-APIGW-API-KEYYAPI Gateway key issued when creating the test app or service app
    X-NCP-CLOVASTUDIO-REQUEST-IDNRequest ID for each request
    Content-TypeYapplication/json

    Request path parameters

    The following describes the parameters.

    FieldTypeRequiredDescription
    appIdstringYUnique ID of the applicable test app or service app

    Request body

    The following describes the body.

    FieldTypeRequiredDescription
    textsstringYText to perform embedding
  • Rang: up to 8192 (tokens)
  • 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.

    FieldTypeRequiredDescription
    embeddingarray[float]YEmbedding execution result (consisting of 1024 float lists)
    inputTokensintegerYNumber of tokens used to enter request text

    Response syntax

    The following is a sample syntax.

    Succeeded

    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?

    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.