Skip to content

Commit

Permalink
OpenAI-DotNet 6.5.1 (RageAgainstThePixel#71)
Browse files Browse the repository at this point in the history
- Removed Obsolete from EditEndpoint as it has now been fixed by OpenAI
  • Loading branch information
StephenHodgson committed Mar 27, 2023
1 parent 4b01d8c commit 7ac7bc5
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 35 deletions.
29 changes: 9 additions & 20 deletions OpenAI-DotNet-Tests/TestFixture_04_Edits.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
using NUnit.Framework;
using OpenAI.Edits;
using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace OpenAI.Tests
{
[Obsolete]
internal class TestFixture_04_Edits
internal class TestFixture_04_Edits : AbstractTestFixture
{
[Test]
public async Task Test_1_GetBasicEdit()
{
var api = new OpenAIClient(OpenAIAuthentication.LoadFromEnv());
Assert.IsNotNull(api.EditsEndpoint);
EditResponse result = null;

try
{
var request = new EditRequest("What day of the wek is it?", "Fix the spelling mistakes");
result = await api.EditsEndpoint.CreateEditAsync(request);
}
catch (HttpRequestException)
{
Assert.IsNull(result);
}
catch (Exception e)
{
Assert.IsTrue(false, $"Expected exception {nameof(HttpRequestException)} but got {e.GetType().Name}");
}
Assert.IsNotNull(OpenAIClient.EditsEndpoint);
var request = new EditRequest("What day of the wek is it?", "Fix the spelling mistakes");
var result = await OpenAIClient.EditsEndpoint.CreateEditAsync(request);
Assert.IsNotNull(result);
Assert.NotNull(result.Choices);
Assert.NotZero(result.Choices.Count);
Console.WriteLine(result);
Assert.IsTrue(result.ToString().Contains("week"));
}
}
}
4 changes: 1 addition & 3 deletions OpenAI-DotNet/Edits/Choice.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

namespace OpenAI.Edits
{
[Obsolete]
public sealed class Choice
{
[JsonInclude]
Expand Down
5 changes: 2 additions & 3 deletions OpenAI-DotNet/Edits/EditRequest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using OpenAI.Models;
using System;
using System;
using System.Text.Json.Serialization;
using OpenAI.Models;

namespace OpenAI.Edits
{
[Obsolete]
public sealed class EditRequest
{
/// <summary>
Expand Down
1 change: 0 additions & 1 deletion OpenAI-DotNet/Edits/EditResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace OpenAI.Edits
{
[Obsolete]
public sealed class EditResponse : BaseResponse
{
[JsonInclude]
Expand Down
2 changes: 0 additions & 2 deletions OpenAI-DotNet/Edits/EditsEndpoint.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using OpenAI.Models;
using System;
using System.Text.Json;
using System.Threading.Tasks;

Expand All @@ -9,7 +8,6 @@ namespace OpenAI.Edits
/// Given a prompt and an instruction, the model will return an edited version of the prompt.<br/>
/// <see href="https://beta.openai.com/docs/api-reference/edits"/>
/// </summary>
[Obsolete("Models removed by OpenAI")]
public sealed class EditsEndpoint : BaseEndPoint
{
/// <inheritdoc />
Expand Down
6 changes: 4 additions & 2 deletions OpenAI-DotNet/OpenAI-DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ More context [on Roger Pincombe's blog](https://rogerpincombe.com/openai-dotnet-
<RepositoryUrl>https://github.com/RageAgainstThePixel/OpenAI-DotNet</RepositoryUrl>
<PackageTags>OpenAI, AI, ML, API, gpt-4, gpt-3.5-tubo, gpt-3, chatGPT, chat-gpt, gpt-2, gpt</PackageTags>
<Title>OpenAI API</Title>
<PackageReleaseNotes>Version 6.5.0
<PackageReleaseNotes>Version 6.5.1
- Removed Obsolete from EditEndpoint as it has now been fixed by OpenAI
Version 6.5.0
- Marked EditEndpoint Obsolete as codex and edit models have been removed
Version 6.4.3
- Fixed support for Azure Active Directory authentication for Azure OpenAI
Expand Down Expand Up @@ -97,7 +99,7 @@ Version 4.4.0
<AssemblyOriginatorKeyFile>OpenAI-DotNet.pfx</AssemblyOriginatorKeyFile>
<DelaySign>true</DelaySign>
<PackageId>OpenAI-DotNet</PackageId>
<Version>6.5.0</Version>
<Version>6.5.1</Version>
<Company>RageAgainstThePixel</Company>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>Assets\OpenAI-DotNet-Icon.png</PackageIcon>
Expand Down
4 changes: 0 additions & 4 deletions OpenAI-DotNet/OpenAIClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using OpenAI.Images;
using OpenAI.Models;
using OpenAI.Moderations;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Authentication;
Expand Down Expand Up @@ -71,9 +70,7 @@ public OpenAIClient(OpenAIAuthentication openAIAuthentication = null, OpenAIClie
ModelsEndpoint = new ModelsEndpoint(this);
CompletionsEndpoint = new CompletionsEndpoint(this);
ChatEndpoint = new ChatEndpoint(this);
#pragma warning disable CS0618
EditsEndpoint = new EditsEndpoint(this);
#pragma warning restore CS0618
ImagesEndPoint = new ImagesEndpoint(this);
EmbeddingsEndpoint = new EmbeddingsEndpoint(this);
AudioEndpoint = new AudioEndpoint(this);
Expand Down Expand Up @@ -159,7 +156,6 @@ private HttpClient SetupClient(HttpClient client = null)
/// Given a prompt and an instruction, the model will return an edited version of the prompt.<br/>
/// <see href="https://beta.openai.com/docs/api-reference/edits"/>
/// </summary>
[Obsolete("Models removed by OpenAI")]
public EditsEndpoint EditsEndpoint { get; }

/// <summary>
Expand Down

0 comments on commit 7ac7bc5

Please sign in to comment.