给定提示和指令,模型将返回提示的编辑版本。
让 OpenAI 修正提示词中的拼写错误。
OpenAI := TsgcHTTP_API_OpenAI.Create(nil);
OpenAI.OpenAIOptions.ApiKey := 'API_KEY';
WriteLn(OpenAI._CreateEdit('text-davinci-edit-001', 'Fix the spelling mistakes', 'What day of the wek is it?'));
告知 OpenAI 修正提示中的拼写错误,增加输出随机性,并为每个提示生成 2 个完成结果。
OpenAI := TsgcHTTP_OpenAI_JSON.Create(nil);
OpenAI.OpenAIOptions.ApiKey := 'API_KEY';
oRequest := TsgcOpenAIClass_Request_Edit.Create;
Try
oRequest.Model := 'text-davinci-edit-001';
oRequest.Input := 'What day of the wek is it?';
oRequest.Instruction := 'Fix the spelling mistakes';
oRequest.Temperature := 1;
oRequest.N := 2;
oResponse := OpenAI.CreateEdit(oRequest);
if Length(oResponse.Choices) > 0 then
WriteLn(oResponse.Choices[0].Text);
Finally
oRequest.Free;
oResponse.Free;
End;