Given a prompt and an instruction, the model will return an edited version of the prompt.
Tell OpenAI to fix the spelling mistakes of a prompt.
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?'));
Tell OpenAI to fix the spelling mistakes of a prompt, with more random output and generate 2 completions for each prompt.
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;