Skip to content

Commit

Permalink
test: Added vision tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Sep 26, 2024
1 parent 74a55e4 commit e4e8103
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/tests/OpenAI.IntegrationTests/Tests.Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,28 @@ public async Task GenerateFiveRandomWordsAsJsonObject(CustomProvider customProvi

Console.WriteLine(response);
}

[DataTestMethod]
[DataRow(CustomProvider.OpenAi)]
[DataRow(CustomProvider.Ollama)]
//[DataRow(CustomProvider.Together)]
public async Task ChatWithVision(CustomProvider customProvider)
{
var pair = GetAuthorizedChatApi(customProvider, model: customProvider switch
{
CustomProvider.Together => "meta-llama/Llama-Vision-Free",
_ => null,
});
using var api = pair.Api;

CreateChatCompletionResponse response = await api.Chat.CreateChatCompletionAsync(
messages: [
"Please describe the following image.",
H.Resources.images_dog_and_cat_png.AsBytes().AsUserMessage(mimeType: "image/png"),
],
model: pair.Model);

Console.WriteLine("[ASSISTANT]:");
Console.WriteLine($"{response.Choices[0].Message.Content}");
}
}

0 comments on commit e4e8103

Please sign in to comment.