forked from RageAgainstThePixel/OpenAI-DotNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenAI-DotNet 6.5.0 (RageAgainstThePixel#70)
- Marked EditEndpoint Obsolete as codex and edit models have been removed
- Loading branch information
1 parent
ac9d263
commit 4b01d8c
Showing
8 changed files
with
66 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
using NUnit.Framework; | ||
using OpenAI.Edits; | ||
using System; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
|
||
namespace OpenAI.Tests | ||
{ | ||
internal class TestFixture_04_Edits : AbstractTestFixture | ||
[Obsolete] | ||
internal class TestFixture_04_Edits | ||
{ | ||
[Test] | ||
public async Task Test_1_GetBasicEdit() | ||
{ | ||
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")); | ||
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}"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
namespace OpenAI.Edits | ||
{ | ||
[Obsolete] | ||
public sealed class EditResponse : BaseResponse | ||
{ | ||
[JsonInclude] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters