Connecting to an Azure OpenAI Service
Now that we’ve set up our Azure OpenAI Service and deployed the models we’ll be interacting with, let’s open this chapter’s Notebook and start chatting.
In the Chapter11.dib
file, we’ll start by installing the Azure.AI.OpenAI
NuGet package with the following C# code cell:
#r "nuget:Azure.AI.OpenAI,2.0.0-beta.2" using Azure; using Azure.AI.OpenAI; using Azure.AI.OpenAI.Chat;
This installs the various dependencies we’ll need for our code in this chapter and allows us to easily reference types in those namespaces.
Next, we’ll need to authenticate with AzureOpenAIClient
. We’ll do this by providing our endpoint and key as Uri
and AzureKeyCredential
, respectively.
Because these are secure values, we shouldn’t store them in our Notebook.
Thankfully, we can prompt users to enter specific values via the @input
directive, followed by a string prompt.
Here’...