我正在尝试使用插入完成。
似乎我应该使用一个名为suffix:的参数来通知插入的结束位置。

端点的有效负载:POST /v1/completions
{
"model": "code-davinci-002",
"prompt": "Write a JSON document for a person with first name, last name, email and phone number\n\n{\n",
"suffix": "\n}",
"temperature": 0,
"max_tokens": 256,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0
}我尝试在GPT3的ruby实现中这样做。
parameters
=> {
:model=>"code-davinci-001",
:prompt=>"generate some JSON for a person with first and last name {",
:max_tokens=>250,
:temperature=>0,
:top_p=>1,
:frequency_penalty=>0,
:presence_penalty=>0,
:suffix=>"\n}"}post(url: "/v1/completions", parameters: parameters)我得到了一个无效的suffix参数错误
{"error"=>{"message"=>"Unrecognized request argument supplied: suffix", "type"=>"invalid_request_error", "param"=>nil, "code"=>nil}}发布于 2022-10-06 11:17:43
我查看了来自OpenAI的有效载荷和的有效负载,并看到了这个问题。
我的红宝石库将模型设置为code-davinci-001,而OpenAI则使用code-davinci-002。
一旦我在调试中手动更改了模型:属性,完成就开始正常工作。
{
"id"=>"cmpl-5yJ8b01Cw26W6ZIHoRSOb71Dc4QvH",
"object"=>"text_completion",
"created"=>1665054929,
"model"=>"code-davinci-002",
"choices"=>
[{"text"=>"\n \"firstName\": \"John\",\n \"lastName\": \"Smith\"",
"index"=>0,
"logprobs"=>nil,
"finish_reason"=>"stop"}],
"usage"=>{"prompt_tokens"=>14, "completion_tokens"=>19,
"total_tokens"=>33}
}https://stackoverflow.com/questions/73972852
复制相似问题