jodendaal/OpenAI.Net

TextEdit Deprecated

jodendaal opened this issue · 0 comments

The v1/edits API has been deprecated by OpenAI and no longer works.

The following models have also been deprecated and no longer work.

text-davinci-edit-001
audio-transcribe-001
code-cushman-001
code-davinci-002
code-davinci-edit-001
text-davinci-edit-001
text-davinci-insert-001
text-davinci-insert-002

The TextCompletionService should be removed.
The ModelTypes should be updated to remove deprecated models.

OpenAI suggests using the ChatCompletion endpoint with a query like this.

[Test]
public async Task TetEditReplacement()
{
    var messages = new List<Message>
    {
        Message.Create(ChatRoleType.System, "You are a spell checker. Fix the spelling mistakes"),
        Message.Create(ChatRoleType.User, "What day of the wek is it?"),
    };

    var response = await OpenAIService.Chat.Get(messages, o => {
        o.MaxTokens = 1000;
    });

    Assert.That(response.IsSuccess, Is.True);
    Assert.That(response.Result.Choices[0].Message.Content, Is.EqualTo("What day of the week is it?"));
}