Skip to content

Commit 46f0714

Browse files
author
Maryanne Gichohi
committed
Address PR comments
1 parent 2dca409 commit 46f0714

File tree

2 files changed

+84
-12
lines changed

2 files changed

+84
-12
lines changed

articles/azure-app-configuration/howto-chat-completion-config.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,79 @@ In this section, you will create a chat completion configuration in Azure Portal
5050
1. In your Azure OpenAI resource, from the **Resource Management** menu, select **Keys and Endpoint** section and copy your Azure OpenAI resource endpoint. It should follow the format: `https://<open-ai-resource-name>.openai.azure.com`.
5151

5252
1. Select **Operations** > **Configuration explorer** > **Create** > **Key-Value**
53+
---
54+
title: Chat completion configuration
55+
titleSuffix: Azure App Configuration
56+
description: Learn how to create chat completion configuration in Azure App Configuration.
57+
ms.service: azure-app-configuration
58+
author: mgichohi
59+
ms.author: mgichohi
60+
ms.topic: how-to
61+
ms.date: 04/20/2025
62+
ms.collection: ce-skilling-ai-copilot
63+
---
64+
65+
# Chat Completion configuration in Azure App Configuration
66+
67+
Chat completion is an AI capability that enables models to generate conversational responses based on a series of messages. Unlike simple text completion, chat completion maintains context across multiple exchanges, simulating a natural conversation. With chat completion configuration, you can define and manage how AI models respond within your application. A typical configuration includes model selection, system and user prompts, and model-specific settings such as temperature or token limits.
68+
69+
## Prerequisites
70+
- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free)
71+
- An App Configuration store. [Create a store](./quickstart-azure-app-configuration-create.md#create-an-app-configuration-store).
72+
73+
> [!NOTE]
74+
> This tutorial demonstrates how to use chat completion configuration with an Azure OpenAI model. However, the chat completion configuration demonstrated in the tutorial can be applied to any AI model you choose to work with in your application.
75+
>
76+
77+
## Create a chat completion configuration
78+
79+
In this section, you will create a chat completion configuration in Azure Portal using the GPT-4o model as an example.
80+
81+
1. In Azure portal, navigate to your App configuration store. From the **Operations** menu, select **Configuration explorer** > **Create**. Then select **AI configuration**.
82+
83+
1. Specify the following values:
84+
- **Key**: Type **ChatLLM:Model**.
85+
- **Label**: Leave this value blank.
86+
- **Model**: Select **gpt-4o**.
87+
88+
> [!div class="mx-imgBorder"]
89+
> ![Screen shot shows the create new AI configuration form](./media/create-ai-chat-completion-config.png)
90+
91+
1. Leave the rest of the values as default then select **Apply**.
92+
93+
## Create an Azure OpenAI resource
94+
95+
1. Follow the [Get started with Azure OpenAI Service](/azure/ai-services/openai/overview#get-started-with-azure-openai-service) to create and deploy an Azure OpenAI service resource with following settings:
96+
97+
| Field | value |
98+
|-----------------|---------|
99+
| Select a model | gpt-4o |
100+
| Deployment name | gpt-4o |
101+
102+
1. In your Azure OpenAI resource, from the **Resource Management** menu, select **Keys and Endpoint** section and copy your Azure OpenAI resource endpoint. It should follow the format: `https://<open-ai-resource-name>.openai.azure.com`.
103+
104+
1. Select **Operations** > **Configuration explorer** > **Create** > **Key-Value**
105+
106+
1. Navigate to your App Configuration store and add the following key-value. Leave **Label** and **Content Type** with their default values. For more information about how to add key-values to a store using the Azure portal or the CLI, go to [Create a key-value](./quickstart-azure-app-configuration-create.md#create-a-key-value).
53107

108+
| **Key** | **Value** |
109+
|---------------------|-------------------------------------------------------------|
110+
| _ChatLLM:Endpoint_ | _Paste the model endpoint you copied in the previous step_ |
111+
112+
> [!TIP]
113+
> To store your model API key securely, consider storing it as a Key Vault reference.
114+
> - In your Azure OpenAI resource, go to the **Keys and Endpoint** section and copy your API key.
115+
> - In your App Configuration store, add a new Key Vault reference with the **Key** set to `ChatLLM:ApiKey` and the **Value** set as a Key Vault reference.
116+
> - For step-by-step guidance, see [Add a Key Vault reference to App Configuration](./use-key-vault-references-dotnet-core.md#add-a-key-vault-reference-to-app-configuration).
117+
118+
1. Continue to the following instructions to implement the chat completion configuration into your application for the language or platform you are using.
119+
120+
- [.NET](./quickstart-chat-completion-dotnet.md)
121+
122+
## Next steps
123+
124+
> [!div class="nextstepaction"]
125+
> [AI configuration](./concept-ai-configuration.md)
54126
1. Navigate to your App Configuration store and add the following key-value. Leave **Label** and **Content Type** with their default values. For more information about how to add key-values to a store using the Azure portal or the CLI, go to [Create a key-value](./quickstart-azure-app-configuration-create.md#create-a-key-value).
55127

56128
| **Key** | **Value** |

articles/azure-app-configuration/quickstart-chat-completion-dotnet.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,22 @@ In this guide, you build an AI chat application and iterate on the prompt using
6666
string endpoint = Environment.GetEnvironmentVariable("AZURE_APPCONFIGURATION_ENDPOINT");
6767
6868
options.Connect(new Uri(endpoint), credential)
69-
// Load all keys that start with `ChatLLM:` and have no label.
70-
.Select("ChatLLM:*")
71-
// Reload configuration if any selected key-values have changed.
72-
// Use the default refresh interval of 30 seconds. It can be overridden via AzureAppConfigurationRefreshOptions.SetRefreshInterval.
73-
.ConfigureRefresh(refresh =>
74-
{
75-
refresh.RegisterAll();
76-
});
69+
// Load all keys that start with `ChatLLM:` and have no label.
70+
.Select("ChatLLM:*")
71+
// Reload configuration if any selected key-values have changed.
72+
// Use the default refresh interval of 30 seconds. It can be overridden via AzureAppConfigurationRefreshOptions.SetRefreshInterval.
73+
.ConfigureRefresh(refresh =>
74+
{
75+
refresh.RegisterAll();
76+
});
7777
7878
_refresher = options.GetRefresher();
7979
}).Build();
8080
```
8181
8282
1. Create an instance of the `AzureOpenAIClient` to connect to your Azure OpenAI resource. You can use either Microsoft Entra ID or API key for authentication.
8383
84-
To access your Azure OpenAI resource with Microsoft Entra ID, you use `DefaultAzureCredential`. Assign the [Cognitive Services OpenAI User](../role-based-access-control/built-in-roles/ai-machine-learning.md#cognitive-services-openai-user) role to the identity represented by `DefaultAzureCredential`. For detailed steps, refer to the [Role-based access control for Azure OpenAI service](/azure/ai-services/openai/how-to/role-based-access-control) guide. Be sure to allow sufficient time for the permission to propagate before running your application.
84+
To access your Azure OpenAI resource with Microsoft Entra ID, you use `DefaultAzureCredential`. Assign the **Cognitive Services OpenAI User** role to the identity represented by `DefaultAzureCredential`. For detailed steps, refer to the [Role-based access control for Azure OpenAI service](/azure/ai-services/openai/how-to/role-based-access-control) guide. Be sure to allow sufficient time for the permission to propagate before running your application.
8585
8686
```csharp
8787
// Initialize the AzureOpenAIClient
@@ -241,9 +241,9 @@ In this guide, you build an AI chat application and iterate on the prompt using
241241
// Reload configuration if any selected key-values have changed.
242242
// Use the default refresh interval of 30 seconds. It can be overridden via AzureAppConfigurationRefreshOptions.SetRefreshInterval
243243
.ConfigureRefresh(refresh =>
244-
{
245-
refresh.RegisterAll();
246-
});
244+
{
245+
refresh.RegisterAll();
246+
});
247247
248248
_refresher = options.GetRefresher();
249249

0 commit comments

Comments
 (0)