J2 完整版
开发环境
开发环境
POST
https://api.ai21.com/studio/v1/j2-{model_type}/complete
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.ai21.com/studio/v1/j2-/complete?members&reference&Type&_postman_listIndexKey=key&_postman_listAllowsMultipleValues' \
--data-raw '{
"numResults": 1,
"maxTokens": 16,
"minTokens": 0,
"temperature": 0.7,
"topP": 1,
"topKReturn": 0,
"frequencyPenalty": {
"scale": 0,
"applyToWhitespaces": true,
"applyToPunctuations": true,
"applyToNumbers": true,
"applyToStopwords": true,
"applyToEmojis": true
},
"presencePenalty": {
"scale": 0,
"applyToWhitespaces": true,
"applyToPunctuations": true,
"applyToNumbers": true,
"applyToStopwords": true,
"applyToEmojis": true
},
"countPenalty": {
"scale": 0,
"applyToWhitespaces": true,
"applyToPunctuations": true,
"applyToNumbers": true,
"applyToStopwords": true,
"applyToEmojis": true
}
}'
响应示例响应示例
{
"id": "7921a78e-d905-c9df-27e3-88e4831e3c3b",
"prompt": {
"text": "I will",
"tokens": [
{
"generatedToken": {
"token": "▁I▁will",
"logprob": -9.654844284057617,
"raw_logprob": -9.654844284057617
},
"topTokens": null,
"textRange": {
"start": 0,
"end": 6
}
}
]
},
"completions": [
{
"data": {
"text": " complete this",
"tokens": [
{
"generatedToken": {
"token": "▁complete",
"logprob": -6.360593795776367,
"raw_logprob": -6.491568565368652
},
"topTokens": null,
"textRange": {
"start": 0,
"end": 9
}
},
{
"generatedToken": {
"token": "▁this",
"logprob": -2.253995180130005,
"raw_logprob": -2.886030673980713
},
"topTokens": null,
"textRange": {
"start": 9,
"end": 14
}
}
]
},
"finishReason": {
"reason": "length",
"length": 2
}
}
]
}
请求参数
Path 参数
model_type
string
必需
Body 参数application/json
返回响应
修改于 2023-11-13 02:34:31