From d5136c4aad6d46ef5b00741b6aef4923e1bb7406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthew=20Bola=C3=B1os?= Date: Tue, 18 Jul 2023 21:48:34 +0100 Subject: [PATCH] Update Copilot Chat article (#104) * Update Copilot Chat article * Updates to copilot chat article * Final changes * Final final --- .../samples-and-solutions/copilot-chat.md | 120 ++++++++++++++++-- 1 file changed, 110 insertions(+), 10 deletions(-) diff --git a/semantic-kernel/samples-and-solutions/copilot-chat.md b/semantic-kernel/samples-and-solutions/copilot-chat.md index f3e0e5f0..a5ee08fb 100644 --- a/semantic-kernel/samples-and-solutions/copilot-chat.md +++ b/semantic-kernel/samples-and-solutions/copilot-chat.md @@ -1,17 +1,17 @@ --- -title: Copilot Chat Sample App -description: Copilot Chat sample app +title: Get started using Chat Copilot +description: Learn how to use the Chat Copilot reference app to build your own integrated large language model chatbot. author: smonroe ms.topic: samples ms.author: smonroe ms.date: 04/07/2023 ms.service: mssearch --- -# Copilot Chat Sample App +# Chat Copilot [!INCLUDE [subheader.md](../includes/pat_large.md)] -The Copilot Chat sample allows you to build your own integrated large language model chatbot. This is an enriched intelligence app, with multiple dynamic components including command messages, user intent, and memories. +The Chat Copilot reference app allows you to build your own integrated large language model chatbot. This is an enriched intelligence app, with multiple dynamic components including command messages, user intent, and memories. The chat prompt and response will evolve as the conversation between the user and the application proceeds. This chat experience uses a chat plugin containing multiple functions that work together to construct the final prompt for each exchange. @@ -32,12 +32,112 @@ The chat prompt and response will evolve as the conversation between the user an ## Running the app The [Copilot Chat Sample App](https://github.com/microsoft/semantic-kernel/blob/main/samples/apps/copilot-chat-app/README.md) is located in the Semantic Kernel GitHub repository. -1) Follow the [Setup](/semantic-kernel/get-started) instructions if you do not already have a clone of Semantic Kernel locally. -2) Follow the instructions to [Register an Azure Application](/azure/active-directory/develop/quickstart-register-app) -3) Open the ReadMe file in the Copilot Chat sample folder. -4) Follow the ReadMe instructions to configure, start, and test the Backend API Server -5) Follow the ReadMe instructions to start the front end WebApp -5) A browser should automatically launch and navigate to https://localhost:3000. with the sample app running +1) Clone [Semantic Kernel](https://github.com/microsoft/semantic-kernel) locally. +2) To enable authentication, [register an Azure Application](/azure/active-directory/develop/quickstart-register-app). We recommend using the following properties: + - Select __Single-page application (SPA)__ as platform type, and set the Web redirect URI to _http://localhost:3000_ + - Select __Accounts in any organizational directory and personal Microsoft Accounts__ as supported account types for this sample. + + > [!Note] + > Make a note of the Application (client) ID from the Azure Portal; we will use it in step 4. + +3) Install requirements + + # [Windows](#tab/Windows) + Open a PowerShell terminal as an administrator and navigate to the _/samples/apps/copilot-chat-app/scripts_ directory in the Semantic Kernel project. + + ```powershell + cd /samples/apps/copilot-chat-app/scripts + ``` + + Next, run the following command to install the required dependencies: + ```powershell + ./Install-Requirements.ps1 + ``` + + # [Ubuntu/Debian Linux](#tab/Linux) + Open a bash terminal as an administrator and navigate to the _/samples/apps/copilot-chat-app/scripts_ directory in the Semantic Kernel project: + ```bash + cd samples/apps/copilot-chat-app/scripts + + # Ensure the install scripts are executable + chmod +x Install-Requirements-UbuntuDebian.sh + ``` + + Next, run the following command to install the required dependencies: + ```bash + ./Install-Requirements-UbuntuDebian.sh + ``` + # [Other](#tab/other) + + For all other operating systems, ensure NET 6.0 SDK (or newer), Node.js 14 (or newer), and Yarn classic ([v1.22.19](https://classic.yarnpkg.com/)) package manager are installed before proceeding. + + Afterwards open a terminal and navigate to the _/samples/apps/copilot-chat-app/scripts_ directory in the Semantic Kernel project. + ```bash + cd samples/apps/copilot-chat-app/scripts + ``` + --- + + +4) Run the configuration script + + # [PowerShell](#tab/Powershell) + If you are using Azure OpenAI, run the following command. Replace the `{AZURE_OPENAI_ENDPOINT}`, `{AZURE_OPENAI_API_KEY}`, and `{APPLICATION_CLIENT_ID}` values in the following command before running it: + + ```powershell + ./Configure.ps1 -AzureOpenAI -Endpoint {AZURE_OPENAI_ENDPOINT} -ApiKey {AZURE_OPENAI_API_KEY} -ClientId {APPLICATION_CLIENT_ID} + ``` + + If you are using OpenAI, run the following command. Replace the `{OPENAI_API_KEY}` and `{APPLICATION_CLIENT_ID}` values in the following command before running it: + + ```powershell + ./Configure.ps1 -openai -ApiKey {OPENAI_API_KEY} -ClientId {APPLICATION_CLIENT_ID} + ``` + + # [Bash](#tab/Bash) + First, ensure the configuration script is executable: + ```bash + # Ensure the configure scripts are executable + chmod +x Configure.sh + ``` + + If you are using Azure OpenAI, run the following command. Replace the `{AZURE_OPENAI_ENDPOINT}`, `{AZURE_OPENAI_API_KEY}`, and `{APPLICATION_CLIENT_ID}` values in the following command before running it: + + ```bash + ./Configure.sh --azureopenai --endpoint {AZURE_OPENAI_ENDPOINT} --apikey {AZURE_OPENAI_API_KEY} --clientid {APPLICATION_CLIENT_ID} + ``` + + If you are using OpenAI, run the following command. Replace the `{OPENAI_API_KEY}` and `{APPLICATION_CLIENT_ID}` values in the following command before running it: + + ```bash + ./Configure.sh --openai --apikey {OPENAI_API_KEY} --clientid {APPLICATION_CLIENT_ID} + ``` + --- + +5) Run the start script + + # [PowerShell](#tab/Powershell) + + ```powershell + setx ASPNETCORE_ENVIRONMENT "Development" + + ./Start.ps1 + ``` + + # [Bash](#tab/Bash) + + ```bash + export ASPNETCORE_ENVIRONMENT=Development + + # Ensure the start scripts are executable + chmod +x Start.sh + chmod +x Start-Backend.sh + chmod +x Start-Frontend.sh + + # Start CopilotChat + ./Start.sh + ``` + --- +6) Congrats! A browser should automatically launch and navigate to _https://localhost:3000_ with the sample app running. ## Exploring the app With the Copilot Chat sample app running, you can start interacting with the chatbot. The app will start with a default conversation thread where you can ask it questions.