Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
Use the text-davinci-003 model to get a predicted completion.
OpenAI := TsgcHTTP_API_OpenAI.Create(nil);
OpenAI.OpenAIOptions.ApiKey := 'API_KEY';
WriteLn(OpenAI._CreateCompletion('text-davinci-003', 'Say this is a test'));
Use the text-davinci-003 model to get a predicted completion 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_Completion.Create;
Try
oRequest.Model := 'text-davinci-003';
oRequest.Prompt := 'Say this is a test';
oRequest.Temperature := 1;
oRequest.N := 2;
oResponse := OpenAI.CreateCompletion(oRequest);
if Length(oResponse.Choices) > 0 then
WriteLn(oResponse.Choices[0].Text);
Finally
oRequest.Free;
oResponse.Free;
End;