[ASSISTANT]: The image shows a ginger and white cat sitting on a ground covered with dry leaves. The cat has a white chest and paws, with a ginger coat on its back and head. Its ears are perked up, and it appears to be looking intently at something. The background is out of focus, highlighting the cat as the main subject.
Last active
September 22, 2024 08:55
-
-
Save vman/2ed792620fb652af4a2d8be9b326cb34 to your computer and use it in GitHub Desktop.
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
using Azure.AI.OpenAI; | |
using Azure; | |
using OpenAI.Chat; | |
using System.Text.Json; | |
namespace OpenAI.SDK.Test | |
{ | |
internal class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
string endpoint = "https://<myopenaiservice>.openai.azure.com/"; | |
string key = "<my-open-ai-service-key>"; | |
string deploymentName = "gpt-4o"; | |
var openAiClient = new AzureOpenAIClient( | |
new Uri(endpoint), | |
new AzureKeyCredential(key), | |
new AzureOpenAIClientOptions(AzureOpenAIClientOptions.ServiceVersion.V2024_06_01)); | |
var chatClient = openAiClient.GetChatClient(deploymentName); | |
List<ChatMessage> messages = [ | |
new UserChatMessage( | |
ChatMessageContentPart.CreateImageMessageContentPart( | |
new Uri("https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/Orange_tabby_cat_sitting_on_fallen_leaves-Hisashi-01A.jpg/360px-Orange_tabby_cat_sitting_on_fallen_leaves-Hisashi-01A.jpg"), | |
ImageChatMessageContentPartDetail.High) | |
), | |
new UserChatMessage("Describe the image to me") | |
]; | |
ChatCompletion chatCompletion = chatClient.CompleteChat(messages); | |
Console.WriteLine($"[ASSISTANT]: {chatCompletion}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment