Skip to content

Commit 5b0af8c

Browse files
AngelosPAngelos Petropoulos
andauthored
Updated the 'How to work with Azure OpenAI' section with … (#161)
* Updated the 'How to work with Azure OpenAI' section with instructions to use Azure OpenAI client library for .NET and where to find it + some sample code. * Changed the wording to make it sound less like an optional recommendation and more like an instruction. --------- Co-authored-by: Angelos Petropoulos <[email protected]>
1 parent 057e54b commit 5b0af8c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,29 @@ The first image shows a red apple with a smooth skin and a single leaf, while th
678678

679679
## How to work with Azure OpenAI
680680

681-
Details for using the OpenAI .NET library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview) are coming soon. Please watch here and the [Azure.AI.OpenAI project](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/openai/Azure.AI.OpenAI) for updates.
681+
For Azure OpenAI scenarios use the [Azure SDK](https://github.com/Azure/azure-sdk-for-net) and more specifically the [Azure OpenAI client library for .NET](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/openai/Azure.AI.OpenAI/README.md).
682+
683+
The Azure OpenAI client library for .NET is a companion to this library and all common capabilities between OpenAI and Azure OpenAI share the same scenario clients, methods, and request/response types. It is designed to make Azure specific scenarios straightforward, with extensions for Azure-specific concepts like Responsible AI content filter results and On Your Data integration.
684+
685+
```c#
686+
AzureOpenAIClient azureClient = new(
687+
new Uri("https://your-azure-openai-resource.com"),
688+
new DefaultAzureCredential());
689+
ChatClient chatClient = azureClient.GetChatClient("my-gpt-35-turbo-deployment");
690+
691+
ChatCompletion completion = chatClient.CompleteChat(
692+
[
693+
// System messages represent instructions or other guidance about how the assistant should behave
694+
new SystemChatMessage("You are a helpful assistant that talks like a pirate."),
695+
// User messages represent user input, whether historical or the most recen tinput
696+
new UserChatMessage("Hi, can you help me?"),
697+
// Assistant messages in a request represent conversation history for responses
698+
new AssistantChatMessage("Arrr! Of course, me hearty! What can I do for ye?"),
699+
new UserChatMessage("What's the best way to train a parrot?"),
700+
]);
701+
702+
Console.WriteLine($"{completion.Role}: {completion.Content[0].Text}");
703+
```
682704

683705
## Advanced scenarios
684706

0 commit comments

Comments
 (0)