Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova committed Aug 5, 2024
1 parent 40d0f2a commit e368bb1
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions tests/Chat/ChatSmokeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,29 +476,6 @@ public void SerializeChatMessageContentPartAsImageBytes(bool fromRawJson)
}
}

[Test]
public async Task JsonResult()
{
ChatClient client = GetTestClient<ChatClient>(TestScenario.Chat);
IEnumerable<ChatMessage> messages = [
new UserChatMessage("Give me a JSON object with the following properties: red, green, and blue. The value "
+ "of each property should be a string containing their RGB representation in hexadecimal.")
];
ChatCompletionOptions options = new() { ResponseFormat = ChatResponseFormat.JsonObject };
ClientResult<ChatCompletion> result = IsAsync
? await client.CompleteChatAsync(messages, options)
: client.CompleteChat(messages, options);

JsonDocument jsonDocument = JsonDocument.Parse(result.Value.Content[0].Text);

Assert.That(jsonDocument.RootElement.TryGetProperty("red", out JsonElement redProperty));
Assert.That(jsonDocument.RootElement.TryGetProperty("green", out JsonElement greenProperty));
Assert.That(jsonDocument.RootElement.TryGetProperty("blue", out JsonElement blueProperty));
Assert.That(redProperty.GetString().ToLowerInvariant(), Contains.Substring("ff0000"));
Assert.That(greenProperty.GetString().ToLowerInvariant(), Contains.Substring("00ff00"));
Assert.That(blueProperty.GetString().ToLowerInvariant(), Contains.Substring("0000ff"));
}

[Test]
[NonParallelizable]
public async Task HelloWorldChatWithTracingAndMetrics()
Expand Down

0 comments on commit e368bb1

Please sign in to comment.