|
| 1 | +--- |
| 2 | +title: Chat completion configuration |
| 3 | +titleSuffix: Azure App Configuration |
| 4 | +description: Learn how to create chat completion configuration in Azure App Configuration. |
| 5 | +ms.service: azure-app-configuration |
| 6 | +author: MaryanneNjeri |
| 7 | +ms.author: mgichohi |
| 8 | +ms.topic: how-to |
| 9 | +ms.date: 04/20/2025 |
| 10 | +ms.collection: ce-skilling-ai-copilot |
| 11 | +--- |
| 12 | + |
| 13 | +# Chat Completion configuration in Azure App Configuration |
| 14 | + |
| 15 | +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. |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | +- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free) |
| 19 | +- An App Configuration store. [Create a store](./quickstart-azure-app-configuration-create.md#create-an-app-configuration-store). |
| 20 | + |
| 21 | +## Create a chat completion configuration |
| 22 | + |
| 23 | +In this section, you create a chat completion configuration in Azure portal using the GPT-4o model as an example. |
| 24 | + |
| 25 | + 1. In Azure portal, navigate to your App configuration store. From the **Operations** menu, select **Configuration explorer** > **Create**, and then select **AI configuration**. |
| 26 | + |
| 27 | + 1. Specify the following values: |
| 28 | + - **Key**: Type **ChatApp:Model**. |
| 29 | + - **Label**: Leave this value blank. |
| 30 | + - **Model**: Select **gpt-4o**. |
| 31 | + - **Message**: Add a new message. |
| 32 | + - **Role**: Select **user** |
| 33 | + - **Content**: Type "What is the capital of France?" |
| 34 | + |
| 35 | + > [!div class="mx-imgBorder"] |
| 36 | + >  |
| 37 | + |
| 38 | +1. Leave the rest of the values as default then select **Apply**. |
| 39 | + |
| 40 | +## Add model connection configuration |
| 41 | + |
| 42 | +You successfully added your chat completion configuration named **ChatApp:Model** in the previous section. In this section, you add the connection details for your model, including the endpoint and deployment name. If required by your authentication method, you can also specify an API key using a Key Vault reference. |
| 43 | + |
| 44 | +> [!NOTE] |
| 45 | +> 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. |
| 46 | +> |
| 47 | +
|
| 48 | +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 a **gpt-4o** model. Note down the deployment name for later use. |
| 49 | + |
| 50 | +1. In your Azure OpenAI resource, from the **Resource Management** menu, select **Keys and Endpoint** and copy the Azure OpenAI resource endpoint. It should follow the format: `https://<open-ai-resource-name>.openai.azure.com`. If using the API key for authentication, copy the API key as well. |
| 51 | + |
| 52 | +1. Navigate to your App Configuration store and add the following key-values. 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). |
| 53 | + |
| 54 | + | **Key** | **Value** | |
| 55 | + |-----------------------------------------|-----------------------------------------------------------------------| |
| 56 | + | _ChatApp:AzureOpenAI:Endpoint_ | _Paste the resource endpoint you copied in the previous step_ | |
| 57 | + | _ChatApp:AzureOpenAI:DeploymentName_ | _Paste the model deployment name you copied in the previous step_ | |
| 58 | + |
| 59 | + If you plan to use an API key for authentication, you can optionally add it as a Key Vault reference using the following key-value. For detailed instructions, see [Add a Key Vault reference to App Configuration](./use-key-vault-references-dotnet-core.md#add-a-key-vault-reference-to-app-configuration). |
| 60 | + |
| 61 | + | **Key** | **Value** | |
| 62 | + |----------------------------------|----------------------------------------------------------------| |
| 63 | + | _ChatApp:AzureOpenAI:APIKey_ | _The Key Vault reference of your Azure OpenAI resource API key_ | |
| 64 | + |
| 65 | +1. Continue to the following instructions to implement the chat completion configuration into your application for the language or platform you're using. |
| 66 | + |
| 67 | + - [.NET](./quickstart-chat-completion-dotnet.md) |
0 commit comments