Documentations

Text embedding(Beta)

Service: agent.api.yating.tw/v1/
Request
URL: /embeddings
Method: POST
Header
Name
Type
Info
*key
String
Bearer {key}
Body
Name
Type
Info
*model
String
Similarity:
text-encoder-v1
Question answering:
text-encoder-question-v1, text-encoder-answer-v1
inputs
Int
每個item長度至多 512 tokens,計算方式是: 1. 一個中文字算一個token 2. 英文一個 wordpiece 算一個token,例如embedding算三個 (em, bed, ding)
** for English,
You can think of tokens as pieces of words used for natural language processing. For English text, 1 token is approximately 4 characters or 0.75 words. As a point of reference, the collected works of Shakespeare are about 900,000 words or 1.2M tokens
Example
{
  "model": " text-encoder-v1",
  "inputs": [ "The food was delicious and the waiter...", "..."]
}
Response
Name
Type
Info
data
String
data.embedding
list
embeddings
data.index
Int
usage
String
Total tokens generated in this request.
Example
{
  "data": [
    {
      "embedding": [
        0.018990106880664825,
        -0.0073809814639389515,
        .... (1024 floats total for ada)
        0.021276434883475304,
      ],
      "index": 0
    },
    {
      "embedding": [
        0.018990106880664825,
        -0.0073809814639389515,
        0.021276434883475304,
      ],
      "index": 1
    }
  ],
  "usage": {
    "total_tokens": 8
  }
}