Documentations

Text generation(Beta)

Service: agent.api.yating.tw/v1/
Request
URL: /textGenerations
Method: POST
Header
Name
Type
Info
*key
String
Bearer {key}
Body
Name
Type
Info
*model
String
general_v2_7b_4bit, taiwan_llama_v2_7b_4bit
inputs
Int
Inputs 至多放十個。
Prompt 總長度至多
512 tokens,計算方式是:
一個中文字算一個token
英文一個 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": "general_v2_7b_4bit",
"inputs": [
    {
      "prompt": "小明把蘋果給小王,小王給小美。問:蘋果最後在誰手上?"
    }
  ]
}
Response
Name
Type
Info
data
String
data.text
string
data.index
Int
usage
String
Total tokens generated in this request.
Example
{
   "data":[
      {
         "text":"小美",
         "index":0
      }
   ],
   "usage":{
      "promptTokens":5,
      "generationTokens":7,
      "totalTokens":12
   }
}