Skip to content

Commit

Permalink
Chat request response format (#82)
Browse files Browse the repository at this point in the history
* Added ResponseFormat to ChatCompletionRequest
Added Test for json mode
Corrected failing integration test

* Changed ResponseFormat to use a class rather than an anonymous object.

* Corrected integration tests
  • Loading branch information
jodendaal committed Nov 10, 2023
1 parent 87e4ab3 commit a25c1b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/OpenAI.Net.Integration.Tests/ImageService_Variation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task Variation_Base64ToFileContent(bool isSuccess, HttpStatusCode s
o.Size = "256x256";
o.ResponseFormat = ImageResponseFormat.Base64;
o.Style = ImageStyleOptions.Vivid;
o.Quality = ImageQualityOptions.HighDefinition;
o.Quality = ImageQualityOptions.Standard;
o.Model = ImageModelOptions.Dalle2;
});

Expand All @@ -47,7 +47,7 @@ public async Task Variation_Base64ToFileContent(bool isSuccess, HttpStatusCode s
Assert.That(response.StatusCode, Is.EqualTo(statusCode));
Assert.That(response.Result?.Data?.Count() == 1, Is.EqualTo(isSuccess), "Data is not mapped correctly");
Assert.That(response.Result?.Data?[0].Url?.Contains("https://"), isSuccess ? Is.EqualTo(isSuccess) : Is.EqualTo(null), "Choice text not set");
Assert.That(response.ErrorResponse?.Error?.Message?.Contains("is not one of ['256x256', '512x512', '1024x1024']"), isSuccess ? Is.EqualTo(null) : Is.EqualTo(true), "Error message not returned");
Assert.That(response.ErrorResponse?.Error?.Message, isSuccess ? Is.EqualTo(null) : Contains.Substring("is not one of ['256x256', '512x512', '1024x1024']"), "Error message not returned");
}

[TestCase(true, HttpStatusCode.OK, "256x256", TestName = "Variation_FileInfoFileContent_When_Success")]
Expand Down

0 comments on commit a25c1b4

Please sign in to comment.