Skip to content

Instantly share code, notes, and snippets.

View vman's full-sized avatar
👨‍💻

Vardhaman Deshpande vman

👨‍💻
View GitHub Profile
var azureClient = new AzureOpenAIClient(new Uri(endpoint), new ApiKeyCredential(key));
OpenAIFileClient fileClient = azureClient.GetOpenAIFileClient();
AssistantClient assistantClient = azureClient.GetAssistantClient();
OpenAIFile infoFile = await fileClient.UploadFileAsync("C:\\Users\\vardh\\Documents\\Customers.xlsx", FileUploadPurpose.Assistants);
AssistantCreationOptions assistantOptions = new()
{
Name = "CodeInterpreterProMAX",
var azureClient = new AzureOpenAIClient(new Uri(endpoint), new ApiKeyCredential(key));
OpenAIFileClient fileClient = azureClient.GetOpenAIFileClient();
AssistantClient assistantClient = azureClient.GetAssistantClient();
OpenAIFile infoFile = await fileClient.UploadFileAsync("C:\\Customers.xlsx", FileUploadPurpose.Assistants);
AssistantCreationOptions assistantOptions = new()
{
Name = "CodeInterpreterProMAX",
string endpoint = "https://<myopenaiservice>.openai.azure.com/";
string key = "<my-open-ai-service-key>";
string deploymentName = "gpt-4o";
var azureClient = new AzureOpenAIClient(new Uri(endpoint), new ApiKeyCredential(key));
OpenAIFileClient fileClient = azureClient.GetOpenAIFileClient();
AssistantClient assistantClient = azureClient.GetAssistantClient();
VectorStoreClient vectorClient = azureClient.GetVectorStoreClient();
string endpoint = "https://<myopenaiservice>.openai.azure.com/";
string key = "<my-open-ai-service-key>";
string deploymentName = "gpt-4o";
//We are using the Azure OpenAI Service so create an Azure OpenAI client
var azureClient = new AzureOpenAIClient(new Uri(endpoint), new ApiKeyCredential(key));
AssistantClient assistantClient = azureClient.GetAssistantClient();
//Create assistant
AssistantCreationOptions assistantOptions = new()
{
var chatClient = openAiClient.GetChatClient(deploymentName);
List<ChatMessage> messages = [
new UserChatMessage(
ChatMessageContentPart.CreateImageMessageContentPart(
new Uri("https://dalleprodsec.blob.core.windows.net/private/images/generated_00.png"),
ImageChatMessageContentPartDetail.High)
),
new UserChatMessage(
ChatMessageContentPart.CreateImageMessageContentPart(
var chatClient = openAiClient.GetChatClient(deploymentName);
string dataURI = "data:image/jpeg;base64,<long-data-uri-of-image>";
//convert data uri to binary data
byte[] binaryData = Convert.FromBase64String(dataURI.Split(',')[1]);
List<ChatMessage> messages = [
new UserChatMessage(
ChatMessageContentPart.CreateImageMessageContentPart(BinaryData.FromBytes(binaryData), "image/jpeg",
var chatClient = openAiClient.GetChatClient(deploymentName);
List<ChatMessage> messages = [
new UserChatMessage(
ChatMessageContentPart.CreateImageMessageContentPart(BinaryData.FromStream(File.OpenRead("C:\\images\\ROBOT ASTRONAUT .png")), "image/jpg" ,
ImageChatMessageContentPartDetail.High)
),
new UserChatMessage("What is in this image?")
];
var chatClient = openAiClient.GetChatClient(deploymentName);
List<ChatMessage> messages = [
new UserChatMessage(
ChatMessageContentPart.CreateImageMessageContentPart(
new Uri("https://www.allrecipes.com/thmb/HbnN9fkzDBmzI83sbxOhtbfEQUE=/750x0/filters:no_upscale():max_bytes(150000):strip_icc():format(webp)/AR-15022-veggie-pizza-DDMFS-4x3-step-01-a32ad6054e974ecd9f79c8627bc9e811.jpg"),
ImageChatMessageContentPartDetail.High)
),
new UserChatMessage("What can I cook with these ingredients?"),
];
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)
import * as React from 'react';
import styles from './HelloTeams.module.scss';
import { IHelloTeamsProps } from './IHelloTeamsProps';
import { useEffect, useState } from 'react';
const HelloTeams: React.FunctionComponent<IHelloTeamsProps> = (props: IHelloTeamsProps) => {
const [themeState, setThemeState] = useState<string>(props.teamsTheme || "default");
const [styleState, setStyleState] = useState<string>(styles.containerdefault);