HemulGM / DelphiOpenAI

OpenAI API wrapper for Delphi. Use ChatGPT, DALL-E, Whisper and other products.
MIT License
232 stars 57 forks source link

Completion return 'The model `text-davinci-003` has been deprecated, #43

Closed Fab8573 closed 1 month ago

Fab8573 commented 4 months ago

Hello,

The default model of completion = text-davinci-003 doesn't work more.

Your sample :

var Completions := OpenAI.Completion.Create( procedure(Params: TCompletionParams) begin Params.Prompt(MemoPrompt.Text); Params.MaxTokens(2048); end); try for var Choice in Completions.Choices do MemoChat.Lines.Add(Choice.Index.ToString + ' ' + Choice.Text); finally Completions.Free; end;

Will return : Exception OpenAIExceptionInvalidRequestError with the message 'The model text-davinci-003 has been deprecated, learn more here: https://platform.openai.com/docs/deprecations'.

Because of by default: OpenAI.complmetion :

constructor TCompletionParams.Create; begin inherited; Model('text-davinci-003'); Temperature(0); end;

Maybe replaced by :

constructor TCompletionParams.Create; begin inherited; Model('gpt-3.5-turbo-instruct'); //Model('text-davinci-003'); Temperature(0); end; `

Of course ovveride params.model can be a workarround :

var Completions := OpenAI.Completion.Create( procedure(Params: TCompletionParams) begin Params.Prompt(MemoPrompt.Text); Params.MaxTokens(2048); Params.model('gpt-3.5-turbo-instruct'); // HERE end); try for var Choice in Completions.Choices do MemoChat.Lines.Add(Choice.Index.ToString + ' ' + Choice.Text); finally Completions.Free; end;`

HemulGM commented 4 months ago

Are you sure this model is approaching the old "completions"?