You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -19,7 +19,7 @@ In this quickstart you will create a .NET console app that retrieves chat comple
19
19
20
20
## Prerequisites
21
21
22
-
- Complete the tutorial to [Create a chat completion configuration](./howto-chat-completion-config#create-a-chat-completion-configuration).
22
+
- Complete the tutorial to [Create a chat completion configuration](./howto-chat-completion-config.md#create-a-chat-completion-configuration).
23
23
-[.NET SDK 6.0 or later](https://dotnet.microsoft.com/download)
24
24
25
25
## Create a console app
@@ -58,160 +58,159 @@ In this quickstart you will create a .NET console app that retrieves chat comple
58
58
1. Open the _Program.cs_, and add the following namespaces at the top of the file:
59
59
60
60
```csharp
61
-
using Microsoft.Extensions.Configuration;
62
-
using Azure.Identity;
63
-
using Azure.AI.OpenAI;
64
-
using OpenAI.Chat;
61
+
using Microsoft.Extensions.Configuration;
62
+
using Azure.Identity;
63
+
using Azure.AI.OpenAI;
64
+
using OpenAI.Chat;
65
65
```
66
66
67
67
1. Connect to your App Configuration store by calling the `AddAzureAppConfiguration` method in the _Program.cs_ file.
68
68
69
69
You can connect to App Configuration using **Microsoft Entra ID (recommended)**, or a connection string. In this example, you use Microsoft Entra ID, the `DefaultAzureCredential` to authenticate to your App Configuration store. Follow the [instructions](./concept-enable-rbac.md#authentication-with-token-credentials) to assign your credential the **App Configuration Data Reader** role. Be sure to allow sufficient time for the permission to propagate before running your application.
70
70
71
71
```csharp
72
-
var credential = new DefaultAzureCredential();
72
+
var credential = new DefaultAzureCredential();
73
73
74
-
IConfiguration configuration = new ConfigurationBuilder()
Console.WriteLine($"Hello, I am your AI assistant powered by Azure App Configuration ({model})");
85
+
Console.WriteLine($"Hello, I am your AI assistant powered by Azure App Configuration ({model})");
86
86
```
87
87
88
88
1. Create an instance of the `AzureOpenAIClient`. Use the existing instance of `DefaultAzureCredential` we created in the previous step to authenticate to your Azure OpenAI resource. Assign your credential the [Cognitive Services OpenAI User](../role-based-access-control/built-in-roles/ai-machine-learning.md#cognitive-services-openai-user) or [Cognitive Services OpenAI Contributor](../role-based-access-control/built-in-roles/ai-machine-learning.md#cognitive-services-openai-contributor). For detailed steps, see [Role-based access control for Azure OpenAI service](/azure/ai-services/openai/how-to/role-based-access-control). Be sure to allow sufficient time for the permission to propagate before running your application.
89
89
90
90
```csharp
91
-
// Existing code to connect to your App configuration store
92
-
// ...
91
+
// Existing code to connect to your App configuration store
92
+
// ...
93
93
94
-
// Initialize the AzureOpenAIClient
95
-
AzureOpenAIClient client = new AzureOpenAIClient(new Uri(modelEndpoint), credential);
Good heavens! A pocket-sized contraption combining telegraph, camera, library, and more—instant communication and knowledge at one’s fingertips! Astonishing!
Copy file name to clipboardExpand all lines: articles/azure-app-configuration/quickstart-chat-completion-javascript.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ In this quickstart you will create a Node js console app that retrieves chat com
19
19
20
20
## Prerequisites
21
21
22
-
- Complete the tutorial to [Create a chat completion configuration](./howto-chat-completion-config#create-a-chat-completion-configuration).
22
+
- Complete the tutorial to [Create a chat completion configuration](./howto-chat-completion-config.md#create-a-chat-completion-configuration).
23
23
-[LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). For information about installing Node.js either directly on Windows or using the Windows Subsystem for Linux (WSL), see [Get started with Node.js](/windows/dev-environment/javascript/nodejs-overview)
24
24
25
25
@@ -46,6 +46,7 @@ In this quickstart you will create a Node js console app that retrieves chat com
46
46
```
47
47
48
48
1. Create a file named app.js in the *app-config-chat-completion* directory and import the required packages:
Good heavens! A pocket-sized contraption combining telegraph, camera, library, and more—instant communication and knowledge at one’s fingertips! Astonishing!
Good heavens! A pocket-sized contraption combining telegraph, camera, library, and more—instant communication and knowledge at one’s fingertips! Astonishing!
0 commit comments