From d7ae0f04b4bb8624c09f36e587501e2d8653acd0 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:10:32 -0500 Subject: [PATCH 01/23] IaaC scripts to create Azure Services --- deploy/infrastructure/cli/README.md | 19 +++ .../cli/bicep/search-service.bicep | 20 +++ deploy/infrastructure/cli/deploy.ps1 | 124 ++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 deploy/infrastructure/cli/README.md create mode 100644 deploy/infrastructure/cli/bicep/search-service.bicep create mode 100644 deploy/infrastructure/cli/deploy.ps1 diff --git a/deploy/infrastructure/cli/README.md b/deploy/infrastructure/cli/README.md new file mode 100644 index 00000000..a9b00c21 --- /dev/null +++ b/deploy/infrastructure/cli/README.md @@ -0,0 +1,19 @@ +# CLI scripts for creating the Azure resources needed for the workshop + +## Synopsis +This folder contains a PowerShell script that will create the Azure resources needed for the workshop. The script will create a resource group for each of the workshop participants, and will create the required resources in each resource group. You will need to provide a subscription id, and optionally a resource group prefix, location, and the number of resource groups you want. The script will default to the values below if not provided. +resourceGroupPrefix = "myagi-1-rg-" +location = "eastus" +resourceGroupCount = 1 + + +## Steps +1. Install Azure CLI (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli), min version 2.53.0 +2. Install PowerShell (https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.1) +3. Change folder to `infrastructure/cli` +4. Run + ``` + ./deploy.ps1 -resourceGroupPrefix "" -location "" -resourceGroupCount "<1>" -subscriptionId "" + ``` + Note: Only subscriptionId is required, the rest are optional and will default to the values above if not provided. + diff --git a/deploy/infrastructure/cli/bicep/search-service.bicep b/deploy/infrastructure/cli/bicep/search-service.bicep new file mode 100644 index 00000000..8b25ba0c --- /dev/null +++ b/deploy/infrastructure/cli/bicep/search-service.bicep @@ -0,0 +1,20 @@ + +param location string = resourceGroup().location +param searchServiceName string + + +param sku object = { + name: 'standard' +} + +resource searchService 'Microsoft.Search/searchServices@2021-04-01-Preview' = { + name: searchServiceName + location: location + + properties: { + semanticSearch: 'free' + } + sku:sku + +} + diff --git a/deploy/infrastructure/cli/deploy.ps1 b/deploy/infrastructure/cli/deploy.ps1 new file mode 100644 index 00000000..9114eb64 --- /dev/null +++ b/deploy/infrastructure/cli/deploy.ps1 @@ -0,0 +1,124 @@ +param ( + [string]$resourceGroupPrefix = "myagi-1", + [string]$location = "eastus", + [string]$resourceGroupCount = 1, + [string]$subscriptionId = "SubscriptionId is required" +) + +# print variables + +Write-Host "resourceGroupPrefix: $resourceGroupPrefix" +Write-Host "location: $location" +Write-Host "resourceGroupCount: $resourceGroupCount" +Write-Host "subscriptionId: $subscriptionId" + +# set rgIndex to resourceGroupCount + +$rgIndex = $resourceGroupCount + +# set all these to false the first time you run this script. After that you can set them to true to skip creating resources that already exist +$skipRg = "false" +$skipOpenAI = "false" +$skipEmbeddingModelDeployment = "false" +$skipCompletionModelDeployment = "false" +$skipcognitiveSearch = "false" + + + +# create resource groups in a loop for rgIndex +# if skipRg is true, skip creating resource group + +if ($skipRg -eq "true") { + Write-Host "Skipping resource group creation" +} +else { + + for ($i = 1; $i -le $rgIndex; $i++) { + Write-Host "Creating resource group $resourceGroupPrefix-rg-$i in $location" + az group create --name "$resourceGroupPrefix-rg-$i" --location $location + } +} + +# create Azure Open AI service resource for each resource group + +for ($i = 1; $i -le $rgIndex; $i++) { + # if skipRg is true, skip creating resource group + if ($skipOpenAI -eq "true") { + Write-Host "Skipping OpenAI resource creation" + } + else { + Write-Host "Creating Azure Open AI service resource named $resourceGroupPrefix-OpenAIService-$i in $resourceGroupPrefix-rg-$i" + + az cognitiveservices account create ` + --name "$resourceGroupPrefix-OpenAIService-$i" ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --location $location ` + --kind "OpenAI" ` + --sku "s0" ` + --subscription $subscriptionId + } + + # if skipEmbeddingModelDeployment is true, skip embedding model deployment + + if ($skipEmbeddingModelDeployment -eq "true") { + Write-Host "Skipping embedding model deployment" + } + else { + # deploy embedding model + + Write-Host "Deploying embedding model $resourceGroupPrefix-EmbeddingModel-$i" + + az cognitiveservices account deployment create ` + --name "$resourceGroupPrefix-OpenAIService-$i" ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --deployment-name "$resourceGroupPrefix-EmbeddingModel-$i" ` + --model-name text-embedding-ada-002 ` + --model-version "2" ` + --model-format "OpenAI" ` + + } + + # if skipCompletionModelDeployment is true, skip completion model deployment + + if ($skipCompletionModelDeployment -eq "true") { + Write-Host "Skipping completion model deployment" + } + else { + # deploy completion model + + Write-Host "Deploying completion model $resourceGroupPrefix-CompletionModel-$i" + + az cognitiveservices account deployment create ` + --name "$resourceGroupPrefix-OpenAIService-$i" ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --deployment-name "$resourceGroupPrefix-CompletionModel-$i" ` + --model-name "gpt-35-turbo" ` + --model-version "0613" ` + --model-format "OpenAI" ` + + } + + # if skipcognitiveSearch is false, create cognitive search service with semantic search capability + + if ($skipcognitiveSearch -eq "true") { + Write-Host "Skipping cognitive search service creation" + } + else { + + Write-Host "Creating cognitive search service $resourceGroupPrefix-acs-$i in $resourceGroupPrefix-rg-$i" + + az deployment group create ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --template-file "bicep/search-service.bicep" ` + --parameters "searchServiceName=$resourceGroupPrefix-acs-$i" + + + } + + + +} + + + + From e3bf23db7277769f2a85223c3febf3e73aa2011a Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:21:22 -0500 Subject: [PATCH 02/23] step-by-step instructions for build your own copilot lab. --- docs/labs/02-build-your-own-copilot/README.md | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 docs/labs/02-build-your-own-copilot/README.md diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md new file mode 100644 index 00000000..187ae57e --- /dev/null +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -0,0 +1,138 @@ +# Steps: Build Your Own Copilot workshop + +## 1. Setup Local Environment + +1. Install Visual Studio Code (https://code.visualstudio.com/download) +2. Install the following VSCode extenstions + 1. Azure Tools (https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-node-azure-pack) + 2. Polyglot Notebooks (https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode) + 3. Semantic Kernel (https://marketplace.visualstudio.com/items?itemName=ms-semantic-kernel.semantic-kernel) + 4. Prompt flow for VSCode (https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow) + +3. Install Azure CLI (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli), min version 2.53.0 +4. Install PowerShell (https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.1) +5. Install Docker Desktop (https://www.docker.com/products/docker-desktop) +6. Install .NET 7.0 SDK (https://dotnet.microsoft.com/download/dotnet/7.0) +7. Install python 3.11 (https://www.python.org/downloads/) +8. Install jq (https://stedolan.github.io/jq/download/) + +## 2. Clone and run myagi locally + +1. Create a new folder for the workshop +2. Open Visual Studio Code +3. Open the new folder: File -> Open Folder -> Select the folder you created in step 1 +4. Open a new terminal: Terminal -> New Terminal (or Ctrl + Shift + `) +5. Clone this repo + + ``` + git clone https://github.com/ajai-d/miyagi.git + ``` +### 2.1 Provision Azure Services required for the workshop + +1. Change folder to miyagi/deploy/infrastructure/cli + + ``` + cd miyagi/deploy/infrastructure/cli + ``` +2. Login to Azure and select the subscription you want to use for the workshop + + ``` + az login + az account set --subscription "" + + ``` +3. Run the following command to create the Azure resources needed for the workshop. The script will create a resource group for each of the workshop participants, and will create the required resources in each resource group. You will need to provide a subscription id, and optionally a resource group prefix, location, and the number of resource groups you want. The script will default to the values below if not provided. + + ``` + ./deploy.ps1 -resourceGroupPrefix "" -location "" -resourceGroupCount "<1>" -subscriptionId "" + ``` + Note: If you are setting up the workshop just for you, make sure you set the value of resourceGroupCount to 1 +4. Wait until the script completes. It will take less than 10 minutes to complete. + +### 2.2 Setup configuration for myagi app + +1. Create a new file called .env in myagi/ui/typescript +2. Copy paste the contents of .env.local.example into .env and save the file +3. You will setup the values for the variables in the workshop [ this will be updated later] +4. Create a new file named appsettings.json in myagi/services/recommendation-service/dotnet +5. Copy paste the contents of appsettings.json.example into appsettings.json and save the file +6. Update appsettings.json with the values for the variables below. You can get the values from the Azure Portal. + > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Select Keys and Endpoint + + > Copy the values of the Language API endpoint and the key1 into "endpoint" and "apikey" in the appsettings.json file and save the file + + > Go back to your Open AI resource -> Overview -> Click Go to Azure OpenAI Studio -> Deployments + + > Copy the value of the deployment name for gpt-35-turbo model and paste it into the appsettings.json file as the value of the variable "deploymentOrModelId" + + > Copy the value of the deployment name for text-embedding-ada-002 model and paste it into the appsettings.json file as the value of the variable "embeddingDeploymentOrModelId" + +7. Create a new file named .env in myagi/sandbox/usecases/rag/dotnet +8. Copy paste the contents of .env.local.example into .env and save the file +9. Copy the values of OPenAI endpoint and key1 from step 6 into the .env file and save the file +10. Get the Azure Cognitive Search endpoint and the api key + > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Azure Cognitive Search resource -> Select Keys -> Copy the value of Primary Admin Key and paste it into the .env file as the value of the variable "SEARCH_API_KEY" + + > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Azure Cognitive Search resource -> Overview -> Copy the value of Url and paste it into the .env file as the value of the variable "SEARCH_ENDPOINT" + +### 2.3 Setup .NET secrets + +1. Open a new terminal: Terminal -> New Terminal (or Ctrl + Shift + `) +2. Change folder to myagi/services/recommendation-service/dotnet +3. Run the following command to set the secrets for the recommendation service. You will need to provide the values for the variables below. + + ``` + dotnet user-secrets set "USE_OPEN_AI" "False" + dotnet user-secrets set "serviceType" "AzureOpenAI" + dotnet user-secrets set "AZURE_SEARCH_ENDPOINT" "" + dotnet user-secrets set "AZURE_SEARCH_API_KEY" "" + dotnet user-secrets set "BING_API_KEY" "" + dotnet user-secrets set "MEMORY_COLLECTION" "miyagi-embeddings" + dotnet user-secrets set "QDRANT_PORT" "6333" + dotnet user-secrets set "QDRANT_ENDPOINT" "" + + ``` +### 2.4 Understanding implementation of the recommendation service + +Recommendation service implements RAG pattern using Semantic Kernel SDK. The details of the implementation are captured in the Jupyter notebook in the folder miyagi/sandbox/usecases/rag/dotnet. You can open the notebook in VSCode and run the cells to understand the implementation. Select kernel as .NET Interactive in the top right corner of the notebook. + +### 2.5 Run myagi frontend locally + +1. Open a new terminal: Terminal -> New Terminal (or Ctrl + Shift + `) +2. Change folder to myagi/ui/typescript +3. Run the following command to install the dependencies + + ``` + npm install --global yarn + yarn install + yarn dev + ``` +4. Open a browser and navigate to + ``` + http://localhost: + ``` + Get the port from the logs in the terminal. You should see the myagi app running locally. + +### 2.6 Run recommendation service locally +1. Open a new terminal: Terminal -> New Terminal (or Ctrl + Shift + `) +2. Change folder to myagi/services/recommendation-service/dotnet +3. Run the following command to run the recommendation service locally + ``` + dotnet build + dotnet run + ``` +4. Open a browser and navigate to + ``` + http://localhost:/swagger/index.html + ``` + Get the port from the logs in the terminal. You should see the swagger page for the recommendation service. + +### 2.7 Explore the recommendation service + +Go back to the ui -> click personalize button -> select financial advisor. You should see the recommendations from the recommendation service in the Top Stocks widget. + + + + + + From 01de574996a405492eedb8a67ee3b8c7087ccddd Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:53:39 -0500 Subject: [PATCH 03/23] test checkin --- docs/labs/02-build-your-own-copilot/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 187ae57e..3fbef032 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -16,6 +16,7 @@ 7. Install python 3.11 (https://www.python.org/downloads/) 8. Install jq (https://stedolan.github.io/jq/download/) + ## 2. Clone and run myagi locally 1. Create a new folder for the workshop From 9daba545c3c4260f70d0672ca3d82c0355f5f8c6 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Wed, 18 Oct 2023 21:17:26 -0500 Subject: [PATCH 04/23] postman collection for hydrating vector index --- .../setup/hydrate.postman_collection.json | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 services/recommendation-service/dotnet/setup/hydrate.postman_collection.json diff --git a/services/recommendation-service/dotnet/setup/hydrate.postman_collection.json b/services/recommendation-service/dotnet/setup/hydrate.postman_collection.json new file mode 100644 index 00000000..b59513b9 --- /dev/null +++ b/services/recommendation-service/dotnet/setup/hydrate.postman_collection.json @@ -0,0 +1,77 @@ +{ + "info": { + "_postman_id": "a6a96b6e-ecfa-4255-8fcc-320ec182c351", + "name": "hydrate", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "28637755" + }, + "item": [ + { + "name": "7288/datasets", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "accept", + "value": "*/*" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "https://localhost:7288/datasets", + "protocol": "https", + "host": [ + "localhost" + ], + "port": "7288", + "path": [ + "datasets" + ] + } + }, + "response": [] + }, + { + "name": "save 7288/datasets", + "request": { + "method": "POST", + "header": [ + { + "key": "accept", + "value": "*/*" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"metadata\": {\r\n \"userId\": \"50\",\r\n \"riskLevel\": \"aggressive\",\r\n \"favoriteSubReddit\": \"finance\",\r\n \"favoriteAdvisor\": \"Jim Cramer\"\r\n },\r\n \"dataSetName\": \"intelligent-investor\"\r\n\r\n}" + }, + "url": { + "raw": "https://localhost:7288/datasets", + "protocol": "https", + "host": [ + "localhost" + ], + "port": "7288", + "path": [ + "datasets" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file From d62cdcf7d7370b9088fe657e9ced31af6e915d59 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:56:42 -0500 Subject: [PATCH 05/23] steps to hydrate vector index --- docs/labs/02-build-your-own-copilot/README.md | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 3fbef032..501ade04 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -8,6 +8,8 @@ 2. Polyglot Notebooks (https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode) 3. Semantic Kernel (https://marketplace.visualstudio.com/items?itemName=ms-semantic-kernel.semantic-kernel) 4. Prompt flow for VSCode (https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow) + 5. Azure Container Apps (https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurecontainerapps) + 6. Docker Extension (https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) 3. Install Azure CLI (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli), min version 2.53.0 4. Install PowerShell (https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.1) @@ -15,6 +17,8 @@ 6. Install .NET 7.0 SDK (https://dotnet.microsoft.com/download/dotnet/7.0) 7. Install python 3.11 (https://www.python.org/downloads/) 8. Install jq (https://stedolan.github.io/jq/download/) +9. Install Postman (https://www.postman.com/downloads/) + ## 2. Clone and run myagi locally @@ -26,7 +30,8 @@ 5. Clone this repo ``` - git clone https://github.com/ajai-d/miyagi.git + git clone https://github.com/Azure-Samples/miyagi.git + ``` ### 2.1 Provision Azure Services required for the workshop @@ -95,7 +100,7 @@ ``` ### 2.4 Understanding implementation of the recommendation service -Recommendation service implements RAG pattern using Semantic Kernel SDK. The details of the implementation are captured in the Jupyter notebook in the folder miyagi/sandbox/usecases/rag/dotnet. You can open the notebook in VSCode and run the cells to understand the implementation. Select kernel as .NET Interactive in the top right corner of the notebook. +Recommendation service implements RAG pattern using Semantic Kernel SDK. The details of the implementation are captured in the Jupyter notebook in the folder miyagi/sandbox/usecases/rag/dotnet. You can open the notebook in VSCode and run the cells to understand step by step details of how the Recommendation Service is implemented. Pay special attention to how RAG pattern is implemented using Semantic Kernel. Select kernel as .NET Interactive in the top right corner of the notebook. ### 2.5 Run myagi frontend locally @@ -128,7 +133,31 @@ Recommendation service implements RAG pattern using Semantic Kernel SDK. The det ``` Get the port from the logs in the terminal. You should see the swagger page for the recommendation service. -### 2.7 Explore the recommendation service +### 2.7 Vectorize and persist embeddings in Azure Cognitive Search +1. Open Postman -> Click import -> select Files -> select the file miyagi/services/recommendation-service/dotnet/setup/hydate.postman_collection.json +2. Click hydrate -> GET 7288/datasets -> Click Send. You should see the following response + ``` + [ + "resources\\sample-datasets\\common-stocks-uncommon-profits.txt", + "resources\\sample-datasets\\intelligent-investor.txt", + "resources\\sample-datasets\\random-walk-down-wall-street.txt" + ] + ``` +3. Click hydrate -> POST save 7288/datasets -> Click Send. You should see the following response + ``` + { + "metadata": { + "userId": "50", + "riskLevel": "aggressive", + "favoriteSubReddit": "finance", + "favoriteAdvisor": "Jim Cramer" + }, + "dataSetName": "intelligent-investor" + + } + ``` + +### 2.8 Explore the recommendation service Go back to the ui -> click personalize button -> select financial advisor. You should see the recommendations from the recommendation service in the Top Stocks widget. From 0f906f0dfb786947a964d4d7343ed7c5683af1a8 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:45:31 -0500 Subject: [PATCH 06/23] v 0.9 --- docs/labs/02-build-your-own-copilot/README.md | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 501ade04..43fe3f21 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -30,9 +30,11 @@ 5. Clone this repo ``` - git clone https://github.com/Azure-Samples/miyagi.git + git clone -b ap/docs-and-iaac https://github.com/Azure-Samples/miyagi.git ``` + **Note:** the above branch is temporary. Soon you will be using the main branch. + ### 2.1 Provision Azure Services required for the workshop 1. Change folder to miyagi/deploy/infrastructure/cli @@ -55,6 +57,12 @@ Note: If you are setting up the workshop just for you, make sure you set the value of resourceGroupCount to 1 4. Wait until the script completes. It will take less than 10 minutes to complete. +5. Bump up the capacity for Open AI model deployments + + By default the Open AI model are deployed with 1K Tokens per minute (TPM) capacity. This is not enough for the workshop. You will need to bump up the capacity to 20K Tokens per minute. You can do this by going to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Overview -> Click Go to Azure OpenAI Studio -> Deployments -> Select the deployment for gpt-35-turbo model -> Click Edit Deployment -> Advanced Options -> Slide the TPM slider to 20K -> Click Save and close. + + Repeat the same steps for the deployment for text-embedding-ada-002 model. + ### 2.2 Setup configuration for myagi app 1. Create a new file called .env in myagi/ui/typescript @@ -90,14 +98,29 @@ ``` dotnet user-secrets set "USE_OPEN_AI" "False" dotnet user-secrets set "serviceType" "AzureOpenAI" - dotnet user-secrets set "AZURE_SEARCH_ENDPOINT" "" - dotnet user-secrets set "AZURE_SEARCH_API_KEY" "" dotnet user-secrets set "BING_API_KEY" "" dotnet user-secrets set "MEMORY_COLLECTION" "miyagi-embeddings" - dotnet user-secrets set "QDRANT_PORT" "6333" - dotnet user-secrets set "QDRANT_ENDPOINT" "" - + dotnet user-secrets set "deploymentOrModelId" "" + dotnet user-secrets set "embeddingDeploymentOrModelId" "" + dotnet user-secrets set "endpoint" "" + dotnet user-secrets set "apiKey" "" + dotnet user-secrets set "COSMOS_DB_CONNECTION_STRING" "" + ``` + Use the following instructions to get the values for the arguments to the dotnet user-secrets set command + + > **Bing API Key:** This will be provided to you during the workshop. + + > **Open AI Endpoint:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Select Keys and Endpoint -> Copy the value of Endpoint. + + > **Open AI API Key:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Select Keys and Endpoint -> Copy the value of key1. + + > **Cosmos DB Connection String:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Cosmos DB resource -> Keys -> Copy the value of the Cosmos DB Connection String. + + > **Completions model Deployment Id:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Overview -> Click Go to Azure OpenAI Studio -> Deployments -> Copy the value of the deployment name for gpt-35-turbo model. + + > **Embeddings model Deployment Id:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Overview -> Click Go to Azure OpenAI Studio -> Deployments -> Copy the value of the deployment name for text-embedding-ada-002 model. + ### 2.4 Understanding implementation of the recommendation service Recommendation service implements RAG pattern using Semantic Kernel SDK. The details of the implementation are captured in the Jupyter notebook in the folder miyagi/sandbox/usecases/rag/dotnet. You can open the notebook in VSCode and run the cells to understand step by step details of how the Recommendation Service is implemented. Pay special attention to how RAG pattern is implemented using Semantic Kernel. Select kernel as .NET Interactive in the top right corner of the notebook. @@ -161,6 +184,10 @@ Recommendation service implements RAG pattern using Semantic Kernel SDK. The det Go back to the ui -> click personalize button -> select financial advisor. You should see the recommendations from the recommendation service in the Top Stocks widget. +### 2.9 TODO: Deploy Apps to Azure Container Apps + +### 2.10 Expose Open AI through APIM + From 4b50f19ca7bd8ff204d466569e84a9a1735dca08 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:46:08 -0500 Subject: [PATCH 07/23] added additional azure services --- deploy/infrastructure/cli/deploy.ps1 | 112 +++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/deploy/infrastructure/cli/deploy.ps1 b/deploy/infrastructure/cli/deploy.ps1 index 9114eb64..70ead44c 100644 --- a/deploy/infrastructure/cli/deploy.ps1 +++ b/deploy/infrastructure/cli/deploy.ps1 @@ -22,6 +22,11 @@ $skipOpenAI = "false" $skipEmbeddingModelDeployment = "false" $skipCompletionModelDeployment = "false" $skipcognitiveSearch = "false" +$skipCosmosDB = "false" +$skipBlobStorage = "false" +$skipAzureContainerApps = "false" +$skipAzureContainerRegistry = "false" +$skipAPIM = "false" @@ -75,6 +80,8 @@ for ($i = 1; $i -le $rgIndex; $i++) { --model-name text-embedding-ada-002 ` --model-version "2" ` --model-format "OpenAI" ` + --scale-capacity "20" ` + --capacity "20" } @@ -95,7 +102,108 @@ for ($i = 1; $i -le $rgIndex; $i++) { --model-name "gpt-35-turbo" ` --model-version "0613" ` --model-format "OpenAI" ` + --capacity "30" + } + + # if skipCosmosDB is false, create CosmosDB account called miyagi with a container called recommendations + + if ($skipCosmosDB -eq "true") { + Write-Host "Skipping CosmosDB account creation" + } + else { + Write-Host "Creating CosmosDB account $resourceGroupPrefix-cosmos-$i in $resourceGroupPrefix-rg-$i" + + az cosmosdb create ` + --name "$resourceGroupPrefix-cosmos-$i" ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --kind "GlobalDocumentDB" ` + --subscription $subscriptionId + + Write-Host "Creating CosmosDB database $resourceGroupPrefix-cosmos-$i in $resourceGroupPrefix-rg-$i" + + az cosmosdb sql database create ` + --account-name "$resourceGroupPrefix-cosmos-$i" ` + --name "miyagi" ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --subscription $subscriptionId + + Write-Host "Creating CosmosDB container $resourceGroupPrefix-cosmos-$i in $resourceGroupPrefix-rg-$i" + + az cosmosdb sql container create ` + --account-name "$resourceGroupPrefix-cosmos-$i" ` + --database-name "miyagi" ` + --name "recommendations" ` + --partition-key-path "/partitionKey" ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --subscription $subscriptionId + } + + # if skipBlobStorage is false, create blob storage account with a container called miyagi + + if ($skipBlobStorage -eq "true") { + Write-Host "Skipping blob storage account creation" + } + else { + + $storageaccount = -join($resourceGroupPrefix,"blobstorge",$i) + Write-Host "Creating blob storage account $storageaccount in $resourceGroupPrefix-rg-$i" + + az storage account create ` + --name $storageaccount ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --location $location ` + --sku "Standard_LRS" ` + --subscription $subscriptionId + + Write-Host "Creating blob storage container miyagi in $resourceGroupPrefix-rg-$i" + + az storage container create ` + --name "miyagi" ` + --account-name $storageaccount ` + --subscription $subscriptionId + } + + # if skipAzureContainerRegistry is false, create Azure Container Registry called miyagi + + if ($skipAzureContainerRegistry -eq "true") { + Write-Host "Skipping Azure Container Registry creation" + } + else { + + $containerregistry = -join($resourceGroupPrefix,"acr",$i) + Write-Host "Creating Azure Container Registry $containerregistry in $resourceGroupPrefix-rg-$i" + + az acr create ` + --name $containerregistry ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --location $location ` + --sku "Basic" ` + --subscription $subscriptionId + } + + # if skipAzureContainerApps is false, create Azure Container Apps with a container called miyagi + + if ($skipAzureContainerApps -eq "true") { + Write-Host "Skipping Azure Container App creation" + } + else { + + $containerapp = -join($resourceGroupPrefix,"miyagi",$i) + Write-Host "Creating Azure Container Apps $containerapp in $resourceGroupPrefix-rg-$i" + + az containerapp up --name $containerapp ` + --resource-group "$resourceGroupPrefix-rg-$i" ` + --location centralus ` + --environment "$resourceGroupPrefix-env" ` + --image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest ` + --target-port 80 ` + --ingress external ` + --query properties.configuration.ingress.fqdn ` + + + + } # if skipcognitiveSearch is false, create cognitive search service with semantic search capability @@ -115,6 +223,10 @@ for ($i = 1; $i -le $rgIndex; $i++) { } + + + + } From 9e86928bafafaddb2ba7b6f49694bb896b3d2d37 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:48:48 -0500 Subject: [PATCH 08/23] added TODO --- docs/labs/02-build-your-own-copilot/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 43fe3f21..a3c6acc9 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -186,7 +186,7 @@ Go back to the ui -> click personalize button -> select financial advisor. You s ### 2.9 TODO: Deploy Apps to Azure Container Apps -### 2.10 Expose Open AI through APIM +### 2.10 TODO: Expose Open AI through APIM From 6b26cbe2783331336a1bfc10c20d35dd22b229eb Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 19:23:52 -0500 Subject: [PATCH 09/23] example configs --- .../dotnet/appsettings.json.example | 20 +++++++++++++++++++ ui/typescript/.env.local.example | 9 ++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 services/recommendation-service/dotnet/appsettings.json.example diff --git a/services/recommendation-service/dotnet/appsettings.json.example b/services/recommendation-service/dotnet/appsettings.json.example new file mode 100644 index 00000000..d1d1a956 --- /dev/null +++ b/services/recommendation-service/dotnet/appsettings.json.example @@ -0,0 +1,20 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Trace", + "Microsoft.AspNetCore": "Trace" + } + }, + "AllowedHosts": "*", + "deploymentOrModelId": "ajmiyagi1-CompletionModel-1", + "embeddingDeploymentOrModelId": "ajmiyagi1-EmbeddingModel-1", + "endpoint": "", + "apiKey": "", + "azureCognitiveSearchEndpoint": "", + "azureCognitiveSearchApiKey": "", + "cosmosDbUri": "", + "cosmosDbName": "miyagi", + "blobServiceUri": "", + "cosmosDbContainerName": "recommendations", + "logLevel": "Trace" + } \ No newline at end of file diff --git a/ui/typescript/.env.local.example b/ui/typescript/.env.local.example index 050a79c6..5bdae45c 100644 --- a/ui/typescript/.env.local.example +++ b/ui/typescript/.env.local.example @@ -1 +1,8 @@ -NEXT_PUBLIC_REST_API_ENDPOINT \ No newline at end of file +NEXT_PUBLIC_GA_MEASUREMENT_ID= +RECCOMMENDATION_SERVICE_URL= +NEXT_PUBLIC_CHAT_ID= +COPILOT_CHAT_BASE_URL= +NEXT_PUBLIC_COPILOT_CHAT_BASE_URL= +NEXT_PUBLIC_SK_API_KEY= +APIM_API_KEY= +NODE_TLS_REJECT_UNAUTHORIZED=0 \ No newline at end of file From 9c6e986d306741e83fff27be7404ed7470f2b014 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 19:31:50 -0500 Subject: [PATCH 10/23] updated model deployment ids --- .../recommendation-service/dotnet/appsettings.json.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/recommendation-service/dotnet/appsettings.json.example b/services/recommendation-service/dotnet/appsettings.json.example index d1d1a956..1653dbc8 100644 --- a/services/recommendation-service/dotnet/appsettings.json.example +++ b/services/recommendation-service/dotnet/appsettings.json.example @@ -6,8 +6,8 @@ } }, "AllowedHosts": "*", - "deploymentOrModelId": "ajmiyagi1-CompletionModel-1", - "embeddingDeploymentOrModelId": "ajmiyagi1-EmbeddingModel-1", + "deploymentOrModelId": "", + "embeddingDeploymentOrModelId": "", "endpoint": "", "apiKey": "", "azureCognitiveSearchEndpoint": "", From 9b2a9d9be03af722e14eb21a9d0f86588ba601eb Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:26:42 -0500 Subject: [PATCH 11/23] added additional steps for appsettings.json --- docs/labs/02-build-your-own-copilot/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index a3c6acc9..6711fb5c 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -81,6 +81,17 @@ > Copy the value of the deployment name for text-embedding-ada-002 model and paste it into the appsettings.json file as the value of the variable "embeddingDeploymentOrModelId" + > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select Azure Cognitive Search resource -> Keys -> Copy the value of the Primary Admin Key and paste it into the appsettings.json file as the value of the variable "azureCognitiveSearchApiKey" + + > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select Azure Cognitive Search resource -> Overview -> Copy the value of the Url and paste it into the appsettings.json file as the value of the variable "azureCognitiveSearchEndpoint" + + > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Cosmos DB resource -> Overview -> Copy the value of the Url and paste it into the appsettings.json file as the value of the variable "cosmosDbUri" + + > Leave the cosmosDbName as "miyagi" and the cosmosDbContainer name as "recommendations" + + > Set the blobServiceUri tp https://.blob.core.windows.net/ + + 7. Create a new file named .env in myagi/sandbox/usecases/rag/dotnet 8. Copy paste the contents of .env.local.example into .env and save the file 9. Copy the values of OPenAI endpoint and key1 from step 6 into the .env file and save the file From 86fadbc18e350d96a0e89d3d271a66cc4be5a890 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:27:45 -0500 Subject: [PATCH 12/23] formatting --- docs/labs/02-build-your-own-copilot/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 6711fb5c..15bbbb9d 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -87,9 +87,9 @@ > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Cosmos DB resource -> Overview -> Copy the value of the Url and paste it into the appsettings.json file as the value of the variable "cosmosDbUri" - > Leave the cosmosDbName as "miyagi" and the cosmosDbContainer name as "recommendations" + > Leave the cosmosDbName as "miyagi" and the cosmosDbContainer name as "recommendations" - > Set the blobServiceUri tp https://.blob.core.windows.net/ + > Set the blobServiceUri tp https://.blob.core.windows.net/ 7. Create a new file named .env in myagi/sandbox/usecases/rag/dotnet From 4f1b8f384eb8935a46a5f7f07fb80daae54bbcd1 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:31:22 -0500 Subject: [PATCH 13/23] switched order to make it easier --- docs/labs/02-build-your-own-copilot/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 15bbbb9d..e28e021e 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -81,10 +81,10 @@ > Copy the value of the deployment name for text-embedding-ada-002 model and paste it into the appsettings.json file as the value of the variable "embeddingDeploymentOrModelId" - > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select Azure Cognitive Search resource -> Keys -> Copy the value of the Primary Admin Key and paste it into the appsettings.json file as the value of the variable "azureCognitiveSearchApiKey" - > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select Azure Cognitive Search resource -> Overview -> Copy the value of the Url and paste it into the appsettings.json file as the value of the variable "azureCognitiveSearchEndpoint" + > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select Azure Cognitive Search resource -> Keys -> Copy the value of the Primary Admin Key and paste it into the appsettings.json file as the value of the variable "azureCognitiveSearchApiKey" + > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Cosmos DB resource -> Overview -> Copy the value of the Url and paste it into the appsettings.json file as the value of the variable "cosmosDbUri" > Leave the cosmosDbName as "miyagi" and the cosmosDbContainer name as "recommendations" From ece6b470fddfc5ee05c98f1b302d27ac4809211e Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:35:25 -0500 Subject: [PATCH 14/23] corrected formatting --- docs/labs/02-build-your-own-copilot/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index e28e021e..7b86abd7 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -89,7 +89,7 @@ > Leave the cosmosDbName as "miyagi" and the cosmosDbContainer name as "recommendations" - > Set the blobServiceUri tp https://.blob.core.windows.net/ + > Set the blobServiceUri tp https://yourstorageservicename.blob.core.windows.net/ 7. Create a new file named .env in myagi/sandbox/usecases/rag/dotnet From 2609aac8d7256f2aafe89b4aad30dbaa026b8e07 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:37:56 -0500 Subject: [PATCH 15/23] corrected the path to env example --- docs/labs/02-build-your-own-copilot/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 7b86abd7..a493ac53 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -93,7 +93,7 @@ 7. Create a new file named .env in myagi/sandbox/usecases/rag/dotnet -8. Copy paste the contents of .env.local.example into .env and save the file +8. Copy paste the contents of rag/.env.local.example into .env and save the file 9. Copy the values of OPenAI endpoint and key1 from step 6 into the .env file and save the file 10. Get the Azure Cognitive Search endpoint and the api key > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Azure Cognitive Search resource -> Select Keys -> Copy the value of Primary Admin Key and paste it into the .env file as the value of the variable "SEARCH_API_KEY" From abafe25d89c84e0e836ce3e5eb78b868aa01a7d2 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:44:56 -0500 Subject: [PATCH 16/23] simplified --- docs/labs/02-build-your-own-copilot/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index a493ac53..a7f59d9f 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -94,11 +94,8 @@ 7. Create a new file named .env in myagi/sandbox/usecases/rag/dotnet 8. Copy paste the contents of rag/.env.local.example into .env and save the file -9. Copy the values of OPenAI endpoint and key1 from step 6 into the .env file and save the file -10. Get the Azure Cognitive Search endpoint and the api key - > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Azure Cognitive Search resource -> Select Keys -> Copy the value of Primary Admin Key and paste it into the .env file as the value of the variable "SEARCH_API_KEY" +9. Copy the values from Step 6 into the .env file and save the file - > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Azure Cognitive Search resource -> Overview -> Copy the value of Url and paste it into the .env file as the value of the variable "SEARCH_ENDPOINT" ### 2.3 Setup .NET secrets From af15020076a6105e7960562ab36dc768282d7c00 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:51:54 -0500 Subject: [PATCH 17/23] changed order --- docs/labs/02-build-your-own-copilot/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index a7f59d9f..20684867 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -123,12 +123,14 @@ > **Open AI API Key:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Select Keys and Endpoint -> Copy the value of key1. - > **Cosmos DB Connection String:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Cosmos DB resource -> Keys -> Copy the value of the Cosmos DB Connection String. - > **Completions model Deployment Id:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Overview -> Click Go to Azure OpenAI Studio -> Deployments -> Copy the value of the deployment name for gpt-35-turbo model. > **Embeddings model Deployment Id:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Overview -> Click Go to Azure OpenAI Studio -> Deployments -> Copy the value of the deployment name for text-embedding-ada-002 model. + > **Cosmos DB Connection String:** Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Cosmos DB resource -> Keys -> Copy the value of the Cosmos DB Connection String. + + + ### 2.4 Understanding implementation of the recommendation service Recommendation service implements RAG pattern using Semantic Kernel SDK. The details of the implementation are captured in the Jupyter notebook in the folder miyagi/sandbox/usecases/rag/dotnet. You can open the notebook in VSCode and run the cells to understand step by step details of how the Recommendation Service is implemented. Pay special attention to how RAG pattern is implemented using Semantic Kernel. Select kernel as .NET Interactive in the top right corner of the notebook. From 39b88ee81262e06dd07546995843cdcb82dd3cd5 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:01:24 -0500 Subject: [PATCH 18/23] corrected the property name fields for az cog search --- sandbox/usecases/rag/.env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sandbox/usecases/rag/.env.example b/sandbox/usecases/rag/.env.example index f9870b86..13f5cfbf 100644 --- a/sandbox/usecases/rag/.env.example +++ b/sandbox/usecases/rag/.env.example @@ -3,5 +3,5 @@ AZURE_OPENAI_CHAT_MODEL="gpt-35-turbo" AZURE_OPENAI_EMBEDDING_MODEL="text-embedding-ada-002" AZURE_OPENAI_API_KEY="<...>" -AZURE_SEARCH_ENDPOINT="https://<...>.search.windows.net" -AZURE_SEARCH_API_KEY="<...>" +AZURE_COGNITIVE_SEARCH_ENDPOINT="https://<...>.search.windows.net" +AZURE_COGNITIVE_SEARCH_API_KEY="<...>" From 75f403b0c1c38b90b4d35d487a19a290f562abf9 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:07:46 -0500 Subject: [PATCH 19/23] added default port for ui --- docs/labs/02-build-your-own-copilot/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 20684867..bdccde2c 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -148,7 +148,7 @@ Recommendation service implements RAG pattern using Semantic Kernel SDK. The det ``` 4. Open a browser and navigate to ``` - http://localhost: + http://localhost: Default port is 4001 ``` Get the port from the logs in the terminal. You should see the myagi app running locally. From 3bced8a2c2589f10247c0282d93cdb86bcedb8c0 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:12:55 -0500 Subject: [PATCH 20/23] added default port for recommendation service --- docs/labs/02-build-your-own-copilot/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index bdccde2c..9d52b7db 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -162,7 +162,7 @@ Recommendation service implements RAG pattern using Semantic Kernel SDK. The det ``` 4. Open a browser and navigate to ``` - http://localhost:/swagger/index.html + http://localhost:/swagger/index.html Default port is 5224 ``` Get the port from the logs in the terminal. You should see the swagger page for the recommendation service. From 049f46f6e1db043f4c62491d648e300d77819f13 Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:09:10 -0500 Subject: [PATCH 21/23] fixed numbering --- docs/labs/02-build-your-own-copilot/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 9d52b7db..86087006 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -194,9 +194,9 @@ Recommendation service implements RAG pattern using Semantic Kernel SDK. The det Go back to the ui -> click personalize button -> select financial advisor. You should see the recommendations from the recommendation service in the Top Stocks widget. -### 2.9 TODO: Deploy Apps to Azure Container Apps +## 3. TODO: Deploy Apps to Azure Container Apps -### 2.10 TODO: Expose Open AI through APIM +## 4. TODO: Expose Open AI through APIM From 74dd318b211bbf5607d07435e91b9cc4cf800a5e Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Tue, 24 Oct 2023 18:14:16 -0500 Subject: [PATCH 22/23] fixed typo: myagi->miyagi --- docs/labs/02-build-your-own-copilot/README.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/labs/02-build-your-own-copilot/README.md b/docs/labs/02-build-your-own-copilot/README.md index 20684867..5e3ea052 100644 --- a/docs/labs/02-build-your-own-copilot/README.md +++ b/docs/labs/02-build-your-own-copilot/README.md @@ -21,7 +21,7 @@ -## 2. Clone and run myagi locally +## 2. Clone and run miyagi locally 1. Create a new folder for the workshop 2. Open Visual Studio Code @@ -52,7 +52,7 @@ 3. Run the following command to create the Azure resources needed for the workshop. The script will create a resource group for each of the workshop participants, and will create the required resources in each resource group. You will need to provide a subscription id, and optionally a resource group prefix, location, and the number of resource groups you want. The script will default to the values below if not provided. ``` - ./deploy.ps1 -resourceGroupPrefix "" -location "" -resourceGroupCount "<1>" -subscriptionId "" + ./deploy.ps1 -resourceGroupPrefix "" -location "" -resourceGroupCount "<1>" -subscriptionId "" ``` Note: If you are setting up the workshop just for you, make sure you set the value of resourceGroupCount to 1 4. Wait until the script completes. It will take less than 10 minutes to complete. @@ -63,12 +63,12 @@ Repeat the same steps for the deployment for text-embedding-ada-002 model. -### 2.2 Setup configuration for myagi app +### 2.2 Setup configuration for miyagi app -1. Create a new file called .env in myagi/ui/typescript +1. Create a new file called .env in miyagi/ui/typescript 2. Copy paste the contents of .env.local.example into .env and save the file 3. You will setup the values for the variables in the workshop [ this will be updated later] -4. Create a new file named appsettings.json in myagi/services/recommendation-service/dotnet +4. Create a new file named appsettings.json in miyagi/services/recommendation-service/dotnet 5. Copy paste the contents of appsettings.json.example into appsettings.json and save the file 6. Update appsettings.json with the values for the variables below. You can get the values from the Azure Portal. > Go to Azure Portal -> Resource Groups -> Select the resource group you created in step 3 of the previous section -> Select the Open AI resource -> Select Keys and Endpoint @@ -92,7 +92,7 @@ > Set the blobServiceUri tp https://yourstorageservicename.blob.core.windows.net/ -7. Create a new file named .env in myagi/sandbox/usecases/rag/dotnet +7. Create a new file named .env in miyagi/sandbox/usecases/rag/dotnet 8. Copy paste the contents of rag/.env.local.example into .env and save the file 9. Copy the values from Step 6 into the .env file and save the file @@ -100,7 +100,7 @@ ### 2.3 Setup .NET secrets 1. Open a new terminal: Terminal -> New Terminal (or Ctrl + Shift + `) -2. Change folder to myagi/services/recommendation-service/dotnet +2. Change folder to miyagi/services/recommendation-service/dotnet 3. Run the following command to set the secrets for the recommendation service. You will need to provide the values for the variables below. ``` @@ -135,10 +135,10 @@ Recommendation service implements RAG pattern using Semantic Kernel SDK. The details of the implementation are captured in the Jupyter notebook in the folder miyagi/sandbox/usecases/rag/dotnet. You can open the notebook in VSCode and run the cells to understand step by step details of how the Recommendation Service is implemented. Pay special attention to how RAG pattern is implemented using Semantic Kernel. Select kernel as .NET Interactive in the top right corner of the notebook. -### 2.5 Run myagi frontend locally +### 2.5 Run miyagi frontend locally 1. Open a new terminal: Terminal -> New Terminal (or Ctrl + Shift + `) -2. Change folder to myagi/ui/typescript +2. Change folder to miyagi/ui/typescript 3. Run the following command to install the dependencies ``` @@ -150,11 +150,11 @@ Recommendation service implements RAG pattern using Semantic Kernel SDK. The det ``` http://localhost: ``` - Get the port from the logs in the terminal. You should see the myagi app running locally. + Get the port from the logs in the terminal. You should see the miyagi app running locally. ### 2.6 Run recommendation service locally 1. Open a new terminal: Terminal -> New Terminal (or Ctrl + Shift + `) -2. Change folder to myagi/services/recommendation-service/dotnet +2. Change folder to miyagi/services/recommendation-service/dotnet 3. Run the following command to run the recommendation service locally ``` dotnet build From d498f1878452a107f6a4ff29d9822be9dc8bb12f Mon Sep 17 00:00:00 2001 From: ajai-d <106365942+ajai-d@users.noreply.github.com> Date: Tue, 24 Oct 2023 18:30:31 -0500 Subject: [PATCH 23/23] strip hypen from resourceGroupPrefix --- deploy/infrastructure/cli/deploy.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/infrastructure/cli/deploy.ps1 b/deploy/infrastructure/cli/deploy.ps1 index 70ead44c..13513e09 100644 --- a/deploy/infrastructure/cli/deploy.ps1 +++ b/deploy/infrastructure/cli/deploy.ps1 @@ -1,5 +1,5 @@ param ( - [string]$resourceGroupPrefix = "myagi-1", + [string]$resourceGroupPrefix = "miyagi1", [string]$location = "eastus", [string]$resourceGroupCount = 1, [string]$subscriptionId = "SubscriptionId is required" @@ -28,7 +28,9 @@ $skipAzureContainerApps = "false" $skipAzureContainerRegistry = "false" $skipAPIM = "false" +# strip - from resourceGroupPrefix +$resourceGroupPrefix = $resourceGroupPrefix.Replace("-",""); # create resource groups in a loop for rgIndex # if skipRg is true, skip creating resource group