Skip to content

Commit

Permalink
Updated Model TextDavinciEdit001 looks to have been dropped from Open…
Browse files Browse the repository at this point in the history
… AI.
  • Loading branch information
jodendaal committed Mar 25, 2023
1 parent 0f444ad commit ee8d855
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task Get(string model, bool isSuccess, HttpStatusCode statusCode)
Assert.That(response.Result?.Choices?.Count() == 1, Is.EqualTo(isSuccess), "Choices are not mapped correctly");
if (isSuccess)
{
Assert.That(response.Result!.Choices.FirstOrDefault()!.Message.Content, Is.EqualTo("\n\nThis is a test."), "Choices are not mapped correctly");
Assert.That(response.Result!.Choices.FirstOrDefault()!.Message.Content.Trim(), Is.EqualTo("This is a test."), "Choices are not mapped correctly");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ namespace OpenAI.Net.Integration.Tests
{
internal class ImplicitInitialiseAndReturn : BaseTest
{
[TestCase(ModelTypes.TextDavinciEdit001,true, HttpStatusCode.OK,TestName = "GetById_When_Success")]
[TestCase(ModelTypes.GPT35Turbo,true, HttpStatusCode.OK,TestName = "GetById_When_Success")]
public async Task GetById(string model,bool isSuccess, HttpStatusCode statusCode)
{
var response = await GetResponse();

Assert.That(response.Id == ModelTypes.TextDavinciEdit001, Is.EqualTo(isSuccess), "Implicit conversion failed");
Assert.That(response.Id == ModelTypes.GPT35Turbo, Is.EqualTo(isSuccess), "Implicit conversion failed");
}

private async Task<ModelInfo> GetResponse()
{
var result = await OpenAIService.Models.Get(ModelTypes.TextDavinciEdit001);
var result = await OpenAIService.Models.Get(ModelTypes.GPT35Turbo);
if (result.IsSuccess)
{
return result;
Expand Down
9 changes: 5 additions & 4 deletions src/OpenAI.Net.Integration.Tests/ModelsService.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.Net;
using Newtonsoft.Json;
using System.Net;

namespace OpenAI.Net.Integration.Tests
{
internal class ModelsService : BaseTest
{
[TestCase(ModelTypes.TextDavinciEdit001,true, HttpStatusCode.OK,TestName = "GetById_When_Success")]
[TestCase(ModelTypes.GPT35Turbo,true, HttpStatusCode.OK,TestName = "GetById_When_Success")]
[TestCase("invalid_model", false, HttpStatusCode.NotFound,TestName = "GetById_When_Invalid_Model_Fail")]
public async Task GetById(string model,bool isSuccess, HttpStatusCode statusCode)
{
Expand All @@ -14,7 +15,7 @@ public async Task GetById(string model,bool isSuccess, HttpStatusCode statusCode

Assert.That(response.IsSuccess, Is.EqualTo(isSuccess), "Request failed");
Assert.That(response.StatusCode, Is.EqualTo(statusCode));
Assert.That(response.Result?.Id == ModelTypes.TextDavinciEdit001, Is.EqualTo(isSuccess), "Choices are not mapped correctly");
Assert.That(response.Result?.Id == ModelTypes.GPT35Turbo, Is.EqualTo(isSuccess), "Choices are not mapped correctly");
}

[TestCase(true, HttpStatusCode.OK)]
Expand All @@ -23,7 +24,7 @@ public async Task GetAll(bool isSuccess, HttpStatusCode statusCode)


var response = await OpenAIService.Models.Get();

Console.WriteLine(JsonConvert.SerializeObject(response.Result.Data));
Assert.That(response.IsSuccess, Is.EqualTo(isSuccess), "Request failed");
Assert.That(response.StatusCode, Is.EqualTo(statusCode));
Assert.That(response.Result?.Data.Count() > 0, Is.EqualTo(isSuccess), "Choices are not mapped correctly");
Expand Down

0 comments on commit ee8d855

Please sign in to comment.