From 32ac13bc5a59c6031ee2b47d9f452dc5198c85ba Mon Sep 17 00:00:00 2001 From: Steven Bucher Date: Mon, 13 Jan 2025 13:24:45 -0800 Subject: [PATCH 1/7] first pass as az oai deployment docs --- .../AzureOAIDeployment/DeployingAzureOAI.md | 88 +++++++++++++++++++ .../AzureOAIDeployment/openai.resources.bicep | 49 +++++++++++ .../AzureOAIDeployment/openai.solutions.bicep | 76 ++++++++++++++++ 3 files changed, 213 insertions(+) create mode 100644 docs/development/AzureOAIDeployment/DeployingAzureOAI.md create mode 100644 docs/development/AzureOAIDeployment/openai.resources.bicep create mode 100644 docs/development/AzureOAIDeployment/openai.solutions.bicep diff --git a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md new file mode 100644 index 00000000..b97f335f --- /dev/null +++ b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md @@ -0,0 +1,88 @@ +# Deploying Azure OpenAI Service via Bicep + +In order to use the `openai-gpt` agent you will either need a public OpenAI API key or an Azure +OpenAI deployment. Due to its additional features and manage-ability, we recommend using the Azure +OpenAI Service. This document provides easy step-by-step instructions on how to deploy the Azure +OpenAI Service using Bicep files. + +## Prerequisites + +Before you begin, ensure you have the following: + +- An active Azure subscription +- Azure CLI or Azure PowerShell installed +- Proper permissions to create resources in your Azure subscription + +## Steps to Deploy + +### 1. Getting the Bicep Files +There are two things needed to begin a chat experience with Azure OpenAI Service, an Azure OpenAI +Service and an Azure OpenAI Deployment. The Azure OpenAI Service is a resource that contains +multiple different model deployments. The Azure OpenAI Deployment is a model deployment that can be +called via an API to generate responses. + +Clone the repository and navigate to the `./docs/development/AzureOAIDeployment` directory: + +```sh +git clone www.github.com/PowerShell/AIShell +cd AIShell/docs/development/AzureOAIDeployment +``` + +### 2. Deploy the Azure OpenAI Service + +Deploy the Bicep file using the Azure CLI: + +#### Azure CLI +```sh +az deployment sub create ` + --name openai-deployment ` + --location eastus ` + --template-file ../openai.solution.bicep ` + --parameters ` + envName=dev ` + resourceGroupName=rg-test-openai ` + resourceGroupLocation=eastus ` + openAiServiceName= ` + openAiCustomDomain= ` + openAiResourceGroupLocation=eastus ` + openAiSkuName=S0 ` + openAiDeploymentName=aishell-deployment ` + openAiDeploymentModelName=gpt-4o ` + openAiDeploymentModelVersion=2024-11-20 +``` + +#### Azure PowerShell +```powershell +$parameters = @{ + envName = 'dev' + resourceGroupName = + resourceGroupLocation = 'eastus' + openAiServiceName = '' + openAiCustomDomain = '' + openAiResourceGroupLocation = 'eastus' + openAiSkuName = 'S0' + openAiDeploymentName = 'aishell-deployment' + openAiDeploymentModelName = 'gpt-4o' + openAiDeploymentModelVersion = '2024-11-20' +} + +New-AzResourceGroupDeployment -ResourceGroupName + -TemplateFile ./openai.solution.bicep + -TemplateParameterObject $parameters +``` + +### 4. Verify the Deployment and configure the agent + +After the deployment is complete, verify that the Azure OpenAI Service has been created: + +1. Go to the [Azure Portal](https://portal.azure.com/). +2. Navigate to your resource group. +3. Check for the newly created Azure OpenAI Service. + +## Conclusion + +You have successfully deployed the Azure OpenAI Service using Bicep files. You can now proceed to +configure and use the service as needed. + +For more information, refer to the +[Azure OpenAI Service documentation](https://docs.microsoft.com/en-us/azure/cognitive-services/openai/). diff --git a/docs/development/AzureOAIDeployment/openai.resources.bicep b/docs/development/AzureOAIDeployment/openai.resources.bicep new file mode 100644 index 00000000..708b90fb --- /dev/null +++ b/docs/development/AzureOAIDeployment/openai.resources.bicep @@ -0,0 +1,49 @@ +// Name of the Azure OpenAI service +param name string + +// Custom domain name for the Azure OpenAI service +param customDomainName string + +// Location of the Azure OpenAI service +param location string + +// Tags for the Azure OpenAI service +param tags object + +// Deployments for the Azure OpenAI service +param deployments array + +// Kind of the Azure OpenAI service +param kind string = 'OpenAI' + +// Public network access of the Azure OpenAI service +param publicNetworkAccess string = 'Enabled' + +// SKU of the Azure OpenAI service +param sku object + + +// Azure OpenAI service +resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = { + name: name + location: location + tags: tags + kind: kind + properties: { + customSubDomainName: customDomainName + publicNetworkAccess: publicNetworkAccess + } + sku: sku +} + +// Deployments for the Azure OpenAI service +@batchSize(1) +resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = [for deployment in deployments: { + parent: account + name: deployment.name + properties: { + model: deployment.model + raiPolicyName: contains(deployment, 'raiPolicyName') ? deployment.raiPolicyName : null + scaleSettings: deployment.scaleSettings + } +}] diff --git a/docs/development/AzureOAIDeployment/openai.solutions.bicep b/docs/development/AzureOAIDeployment/openai.solutions.bicep new file mode 100644 index 00000000..ddf74497 --- /dev/null +++ b/docs/development/AzureOAIDeployment/openai.solutions.bicep @@ -0,0 +1,76 @@ +// Name of the current environment +param envName string + +// Name of the resource group to deploy the resources to +param resourceGroupName string = '' + +// Location of the resource group to deploy the resources to +param resourceGroupLocation string = '' + +// Name of the OpenAI service +param openAiServiceName string + +// Location of the OpenAI service +param openAiResourceGroupLocation string + +// Custom domain name for the OpenAI service +param openAiCustomDomain string + +// SKU name for the OpenAI service +param openAiSkuName string + +// Name of the OpenAI deployment +param openAiDeploymentName string + +// Name of the OpenAI deployment model +param openAiDeploymentModelName string + +// Version of the OpenAI deployment model +param openAiDeploymentModelVersion string + +// Array of deployments, currently just one deployment will be used +param deployments array = [ + { + name: openAiDeploymentName + model: { + format: 'OpenAI' + name: openAiDeploymentModelName + version: openAiDeploymentModelVersion + } + scaleSettings: { + scaleType: 'Standard' + } + } +] + +// Tags for the resource group +param tags object = { + Creator: 'ServiceAccount' + Service: 'OpenAI' + Environment: envName +} + +// Scope of the deployment, currently just the subscription is supported +targetScope = 'subscription' + +// Createa the resource group +resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' = { + name: resourceGroupName + location: resourceGroupLocation +} + +// Create the OpenAI service by using a separate file +module openAi 'openai.resources.bicep' = { + name: 'openai' + scope: rg + params: { + name: openAiServiceName + customDomainName: openAiCustomDomain + location: openAiResourceGroupLocation + tags: tags + sku: { + name: openAiSkuName + } + deployments: deployments + } +} From ce43d8f0d4793c9f98584dfdfcebce157595c3d2 Mon Sep 17 00:00:00 2001 From: Steven Bucher Date: Mon, 13 Jan 2025 13:48:03 -0800 Subject: [PATCH 2/7] another pass --- .../AzureOAIDeployment/DeployingAzureOAI.md | 40 +++++++++++++------ ....solutions.bicep => openai.solution.bicep} | 2 +- 2 files changed, 28 insertions(+), 14 deletions(-) rename docs/development/AzureOAIDeployment/{openai.solutions.bicep => openai.solution.bicep} (98%) diff --git a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md index b97f335f..1a5bba7a 100644 --- a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md +++ b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md @@ -5,6 +5,11 @@ OpenAI deployment. Due to its additional features and manage-ability, we recomme OpenAI Service. This document provides easy step-by-step instructions on how to deploy the Azure OpenAI Service using Bicep files. +There are two things needed to begin a chat experience with Azure OpenAI Service, an Azure OpenAI +Service and an Azure OpenAI Deployment. The Azure OpenAI Service is a resource that contains +multiple different model deployments. The Azure OpenAI Deployment is a model deployment that can be +called via an API to generate responses. + ## Prerequisites Before you begin, ensure you have the following: @@ -16,10 +21,6 @@ Before you begin, ensure you have the following: ## Steps to Deploy ### 1. Getting the Bicep Files -There are two things needed to begin a chat experience with Azure OpenAI Service, an Azure OpenAI -Service and an Azure OpenAI Deployment. The Azure OpenAI Service is a resource that contains -multiple different model deployments. The Azure OpenAI Deployment is a model deployment that can be -called via an API to generate responses. Clone the repository and navigate to the `./docs/development/AzureOAIDeployment` directory: @@ -28,16 +29,23 @@ git clone www.github.com/PowerShell/AIShell cd AIShell/docs/development/AzureOAIDeployment ``` +There are two bicep files that are provided to help deploy the Azure OpenAI Service. The first file +is the `openai.resources.bicep` file which contains the definition and parameters for the Azure +OpenAI Service and deployment. The second file `openai.solutions.bicep` utilizes the +`openai.resources.bicep` file to deploy the Azure OpenAI Service as well as a resource group. + +For more detailed explanation of the files please see [Deploy an Azure OpenAI service with LLM deployments via Bicep][01]. + ### 2. Deploy the Azure OpenAI Service -Deploy the Bicep file using the Azure CLI: +Now that you have the bicep files you can add your own parameter values and deploy your own Azure OpenAI instance! Simply use either Azure CLI or Azure PowerShell and modify the parameters to your liking. The below configuration does have gpt-4o as the default model to use but you are welcome to #### Azure CLI ```sh az deployment sub create ` --name openai-deployment ` --location eastus ` - --template-file ../openai.solution.bicep ` + --template-file ./openai.solution.bicep ` --parameters ` envName=dev ` resourceGroupName=rg-test-openai ` @@ -73,16 +81,22 @@ New-AzResourceGroupDeployment -ResourceGroupName ### 4. Verify the Deployment and configure the agent -After the deployment is complete, verify that the Azure OpenAI Service has been created: -1. Go to the [Azure Portal](https://portal.azure.com/). -2. Navigate to your resource group. -3. Check for the newly created Azure OpenAI Service. + + + ## Conclusion You have successfully deployed the Azure OpenAI Service using Bicep files. You can now proceed to -configure and use the service as needed. +configure and use the service as needed in the portal! For more information, refer to the +[Azure OpenAI Service documentation][02]. + +A big thank you to Sebastian Jensen's medium article +[Deploy an Azure OpenAI service with LLM deployments via Bicep][01] for the inspiration and guidance +on how to deploy the Azure OpenAI Service using Bicep files. Please check out his blog for more +information and great AI content! + -For more information, refer to the -[Azure OpenAI Service documentation](https://docs.microsoft.com/en-us/azure/cognitive-services/openai/). +[01]: https://medium.com/medialesson/deploy-an-azure-openai-service-with-llm-deployments-via-bicep-244411472d40 +[02]: https://docs.microsoft.com/azure/cognitive-services/openai/ \ No newline at end of file diff --git a/docs/development/AzureOAIDeployment/openai.solutions.bicep b/docs/development/AzureOAIDeployment/openai.solution.bicep similarity index 98% rename from docs/development/AzureOAIDeployment/openai.solutions.bicep rename to docs/development/AzureOAIDeployment/openai.solution.bicep index ddf74497..a1c90a20 100644 --- a/docs/development/AzureOAIDeployment/openai.solutions.bicep +++ b/docs/development/AzureOAIDeployment/openai.solution.bicep @@ -53,7 +53,7 @@ param tags object = { // Scope of the deployment, currently just the subscription is supported targetScope = 'subscription' -// Createa the resource group +// Create a the resource group resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' = { name: resourceGroupName location: resourceGroupLocation From 01042ca116136beffbeefa2a15c6c7db82c17101 Mon Sep 17 00:00:00 2001 From: Steven Bucher Date: Tue, 14 Jan 2025 14:21:09 -0800 Subject: [PATCH 3/7] reworked bicep files and docs --- .../AzureOAIDeployment/DeployingAzureOAI.md | 156 ++++++++++++------ .../development/AzureOAIDeployment/main.bicep | 58 +++++++ .../AzureOAIDeployment/openai.resources.bicep | 49 ------ .../AzureOAIDeployment/openai.solution.bicep | 76 --------- 4 files changed, 162 insertions(+), 177 deletions(-) create mode 100644 docs/development/AzureOAIDeployment/main.bicep delete mode 100644 docs/development/AzureOAIDeployment/openai.resources.bicep delete mode 100644 docs/development/AzureOAIDeployment/openai.solution.bicep diff --git a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md index 1a5bba7a..43bb79bf 100644 --- a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md +++ b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md @@ -6,9 +6,9 @@ OpenAI Service. This document provides easy step-by-step instructions on how to OpenAI Service using Bicep files. There are two things needed to begin a chat experience with Azure OpenAI Service, an Azure OpenAI -Service and an Azure OpenAI Deployment. The Azure OpenAI Service is a resource that contains -multiple different model deployments. The Azure OpenAI Deployment is a model deployment that can be -called via an API to generate responses. +Service account and an Azure OpenAI Deployment. The Azure OpenAI Service account is a resource that +contains multiple different model deployments. The Azure OpenAI Deployment is a model deployment +that can be called via an API to generate responses. ## Prerequisites @@ -20,7 +20,7 @@ Before you begin, ensure you have the following: ## Steps to Deploy -### 1. Getting the Bicep Files +### 1. Getting and modifying the Bicep file Clone the repository and navigate to the `./docs/development/AzureOAIDeployment` directory: @@ -29,74 +29,126 @@ git clone www.github.com/PowerShell/AIShell cd AIShell/docs/development/AzureOAIDeployment ``` -There are two bicep files that are provided to help deploy the Azure OpenAI Service. The first file -is the `openai.resources.bicep` file which contains the definition and parameters for the Azure -OpenAI Service and deployment. The second file `openai.solutions.bicep` utilizes the -`openai.resources.bicep` file to deploy the Azure OpenAI Service as well as a resource group. +You will need to modify the `./main.bicep` file to include your own values. You will have to modify the parameters at the top of the file. -For more detailed explanation of the files please see [Deploy an Azure OpenAI service with LLM deployments via Bicep][01]. +```bicep +@description('This is the name of your AI Service Account') +param aiserviceaccountname string = '' + +@description('Custom domain name for the endpoint') +param customDomainName string = '' + +@description('Name of the deployment') +param modeldeploymentname string = '' + +@description('The model being deployed') +param model string = 'gpt-4' + +@description('Version of the model being deployed') +param modelversion string = 'turbo-2024-04-09' + +@description('Capacity for specific model used') +param capacity int = 80 + +@description('Location for all resources.') +param location string = resourceGroup().location + +@allowed([ + 'S0' +]) +param sku string = 'S0' +``` + +The above is defaulted to use your resource groups location as the location for the account and +`gpt-4` version `turbo-2024-04-09`. You can modify this based on the particular model you feel best +fits your needs. You can find more information on available models at +[Azure OpenAI Service models][03]. Additionally, you may need to modify the capacity of the +deployment based on what model you use, you can find more information at +[Azure OpenAI Service quotas and limits][04]. ### 2. Deploy the Azure OpenAI Service -Now that you have the bicep files you can add your own parameter values and deploy your own Azure OpenAI instance! Simply use either Azure CLI or Azure PowerShell and modify the parameters to your liking. The below configuration does have gpt-4o as the default model to use but you are welcome to +Now that you have modified the bicep files parameters, you are ready to deploy your own Azure OpenAI +instance! Simply use either Azure CLI or Azure PowerShell to deploy the bicep files. + +#### Using Azure CLI -#### Azure CLI ```sh -az deployment sub create ` - --name openai-deployment ` - --location eastus ` - --template-file ./openai.solution.bicep ` - --parameters ` - envName=dev ` - resourceGroupName=rg-test-openai ` - resourceGroupLocation=eastus ` - openAiServiceName= ` - openAiCustomDomain= ` - openAiResourceGroupLocation=eastus ` - openAiSkuName=S0 ` - openAiDeploymentName=aishell-deployment ` - openAiDeploymentModelName=gpt-4o ` - openAiDeploymentModelVersion=2024-11-20 +az deployment group create --resource-group --template-file ./main.bicep ``` -#### Azure PowerShell -```powershell -$parameters = @{ - envName = 'dev' - resourceGroupName = - resourceGroupLocation = 'eastus' - openAiServiceName = '' - openAiCustomDomain = '' - openAiResourceGroupLocation = 'eastus' - openAiSkuName = 'S0' - openAiDeploymentName = 'aishell-deployment' - openAiDeploymentModelName = 'gpt-4o' - openAiDeploymentModelVersion = '2024-11-20' -} +#### Using Azure PowerShell -New-AzResourceGroupDeployment -ResourceGroupName - -TemplateFile ./openai.solution.bicep - -TemplateParameterObject $parameters +```powershell +New-AzResourceGroupDeployment -ResourceGroupName -TemplateFile ./main.bicep ``` -### 4. Verify the Deployment and configure the agent +### 4. Configuring the agent to use the deployment +You will need to get the endpoint and key of the deployment you just created. You can do this using the following commands in either Azure CLI or Azure PowerShell. +#### Getting the endpoint +```powershell +Get-AzCognitiveServicesAccount -ResourceGroupName -Name | Select-Object -Property Endpoint +``` +```sh +az cognitiveservices account show --name --resource-group | jq -r .properties.endpoint +``` +#### Getting the key + +```powershell +Get-AzCognitiveServicesAccountKey -ResourceGroupName -Name | Select-Object -Property Key1 +``` + +```sh +az cognitiveservices account keys list --name --resource-group | jq -r .key1 +``` + +Now that you have the endpoint and key of the deployment, you can open up the `openai-gpt` agent and run `/agent config` to edit the json configuration file with all the details of the deployment. The example below shows the default system prompt and the fields that need to be updated. + +```json +{ + // Declare GPT instances. + "GPTs": [ + { + "Name": "ps-az-gpt4", + "Description": "", + "Endpoint": "", + "Deployment": "", + "ModelName": "gpt-4", + "Key": "", + "SystemPrompt": "1. You are a helpful and friendly assistant with + expertise in PowerShell scripting and command line.\n2. Assume user is using the operating system + `osx` unless otherwise specified.\n3. Use the `code block` syntax in markdown to encapsulate any + part in responses that is code, YAML, JSON or XML, but not table.\n4. When encapsulating command + line code, use '```powershell' if it's PowerShell command; use '```sh' if it's non-PowerShell CLI + command.\n5. When generating CLI commands, never ever break a command into multiple lines. + Instead, always list all parameters and arguments of the command on the same line.\n6. Please keep + the response concise but to the point. Do not overexplain." + } + ], + // Specify the default GPT instance to use for user query. + // For example: "ps-az-gpt4" + "Active": "ps-az-gpt4" +} +``` ## Conclusion -You have successfully deployed the Azure OpenAI Service using Bicep files. You can now proceed to -configure and use the service as needed in the portal! For more information, refer to the +You have successfully deployed the Azure OpenAI Service and configured your `openai-gpt` agent to +communicate with it! If you would like to go further in the model training, filters and settings you +can find more information about Azure OpenAI deployments at [Azure OpenAI Service documentation][02]. -A big thank you to Sebastian Jensen's medium article -[Deploy an Azure OpenAI service with LLM deployments via Bicep][01] for the inspiration and guidance -on how to deploy the Azure OpenAI Service using Bicep files. Please check out his blog for more -information and great AI content! - +A big thank you to Sebastian Jensen's medium article, +[Deploy an Azure OpenAI service with LLM deployments via Bicep][01] for inspiring the Bicep code and +guidance on how to deploy the Azure OpenAI Service using Bicep files. Please check out his blog for +more great AI content! [01]: https://medium.com/medialesson/deploy-an-azure-openai-service-with-llm-deployments-via-bicep-244411472d40 -[02]: https://docs.microsoft.com/azure/cognitive-services/openai/ \ No newline at end of file +[02]: https://docs.microsoft.com/azure/cognitive-services/openai/ +[03]: https://learn.microsoft.com/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat- +[04]: https://learn.microsoft.com/azure/ai-services/openai/quotas-limits \ No newline at end of file diff --git a/docs/development/AzureOAIDeployment/main.bicep b/docs/development/AzureOAIDeployment/main.bicep new file mode 100644 index 00000000..586eea7c --- /dev/null +++ b/docs/development/AzureOAIDeployment/main.bicep @@ -0,0 +1,58 @@ +@description('This is the name of your AI Service Account') +param aiserviceaccountname string = '' + +@description('Custom domain name for the endpoint') +param customDomainName string = '' + +@description('Name of the deployment ') +param modeldeploymentname string = '' + +@description('The model being deployed') +param model string = 'gpt-4' + +@description('Version of the model being deployed') +param modelversion string = 'turbo-2024-04-09' + +@description('Capacity for specific model used') +param capacity int = 80 + +@description('Location for all resources.') +param location string = resourceGroup().location + +@allowed([ + 'S0' +]) +param sku string = 'S0' + +resource openAIService 'Microsoft.CognitiveServices/accounts@2024-10-01' = { + name: aiserviceaccountname + location: location + identity: { + type: 'SystemAssigned' + } + sku: { + name: sku + } + kind: 'AIServices' + properties: { + customSubDomainName: customDomainName + } +} + +resource gpt4oMiniDeployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { + parent: openAIService + name: modeldeploymentname + properties: { + model: { + format: 'OpenAI' + name: model + version: modelversion + } + } + sku: { + name: 'Standard' + capacity: capacity + } +} + +output openAIServiceEndpoint string = openAIService.properties.endpoint diff --git a/docs/development/AzureOAIDeployment/openai.resources.bicep b/docs/development/AzureOAIDeployment/openai.resources.bicep deleted file mode 100644 index 708b90fb..00000000 --- a/docs/development/AzureOAIDeployment/openai.resources.bicep +++ /dev/null @@ -1,49 +0,0 @@ -// Name of the Azure OpenAI service -param name string - -// Custom domain name for the Azure OpenAI service -param customDomainName string - -// Location of the Azure OpenAI service -param location string - -// Tags for the Azure OpenAI service -param tags object - -// Deployments for the Azure OpenAI service -param deployments array - -// Kind of the Azure OpenAI service -param kind string = 'OpenAI' - -// Public network access of the Azure OpenAI service -param publicNetworkAccess string = 'Enabled' - -// SKU of the Azure OpenAI service -param sku object - - -// Azure OpenAI service -resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = { - name: name - location: location - tags: tags - kind: kind - properties: { - customSubDomainName: customDomainName - publicNetworkAccess: publicNetworkAccess - } - sku: sku -} - -// Deployments for the Azure OpenAI service -@batchSize(1) -resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = [for deployment in deployments: { - parent: account - name: deployment.name - properties: { - model: deployment.model - raiPolicyName: contains(deployment, 'raiPolicyName') ? deployment.raiPolicyName : null - scaleSettings: deployment.scaleSettings - } -}] diff --git a/docs/development/AzureOAIDeployment/openai.solution.bicep b/docs/development/AzureOAIDeployment/openai.solution.bicep deleted file mode 100644 index a1c90a20..00000000 --- a/docs/development/AzureOAIDeployment/openai.solution.bicep +++ /dev/null @@ -1,76 +0,0 @@ -// Name of the current environment -param envName string - -// Name of the resource group to deploy the resources to -param resourceGroupName string = '' - -// Location of the resource group to deploy the resources to -param resourceGroupLocation string = '' - -// Name of the OpenAI service -param openAiServiceName string - -// Location of the OpenAI service -param openAiResourceGroupLocation string - -// Custom domain name for the OpenAI service -param openAiCustomDomain string - -// SKU name for the OpenAI service -param openAiSkuName string - -// Name of the OpenAI deployment -param openAiDeploymentName string - -// Name of the OpenAI deployment model -param openAiDeploymentModelName string - -// Version of the OpenAI deployment model -param openAiDeploymentModelVersion string - -// Array of deployments, currently just one deployment will be used -param deployments array = [ - { - name: openAiDeploymentName - model: { - format: 'OpenAI' - name: openAiDeploymentModelName - version: openAiDeploymentModelVersion - } - scaleSettings: { - scaleType: 'Standard' - } - } -] - -// Tags for the resource group -param tags object = { - Creator: 'ServiceAccount' - Service: 'OpenAI' - Environment: envName -} - -// Scope of the deployment, currently just the subscription is supported -targetScope = 'subscription' - -// Create a the resource group -resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' = { - name: resourceGroupName - location: resourceGroupLocation -} - -// Create the OpenAI service by using a separate file -module openAi 'openai.resources.bicep' = { - name: 'openai' - scope: rg - params: { - name: openAiServiceName - customDomainName: openAiCustomDomain - location: openAiResourceGroupLocation - tags: tags - sku: { - name: openAiSkuName - } - deployments: deployments - } -} From c6c7b77cebafb5a7fa05a2e673cb8734e9577abe Mon Sep 17 00:00:00 2001 From: Steven Bucher Date: Tue, 14 Jan 2025 14:24:37 -0800 Subject: [PATCH 4/7] small format fixes --- docs/development/AzureOAIDeployment/DeployingAzureOAI.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md index 43bb79bf..ee164668 100644 --- a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md +++ b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md @@ -29,7 +29,8 @@ git clone www.github.com/PowerShell/AIShell cd AIShell/docs/development/AzureOAIDeployment ``` -You will need to modify the `./main.bicep` file to include your own values. You will have to modify the parameters at the top of the file. +You will need to modify the `./main.bicep` file to include your own values. You will have to modify +the parameters at the top of the file. ```bicep @description('This is the name of your AI Service Account') @@ -83,7 +84,7 @@ az deployment group create --resource-group --template-fil New-AzResourceGroupDeployment -ResourceGroupName -TemplateFile ./main.bicep ``` -### 4. Configuring the agent to use the deployment +### 3. Configuring the agent to use the deployment You will need to get the endpoint and key of the deployment you just created. You can do this using the following commands in either Azure CLI or Azure PowerShell. From 2db495b3586b330fb7b5aa26d023a1400ec74fa0 Mon Sep 17 00:00:00 2001 From: Steven Bucher Date: Tue, 14 Jan 2025 14:26:33 -0800 Subject: [PATCH 5/7] Update docs/development/AzureOAIDeployment/DeployingAzureOAI.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/development/AzureOAIDeployment/DeployingAzureOAI.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md index ee164668..0b8cf04c 100644 --- a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md +++ b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md @@ -121,14 +121,7 @@ Now that you have the endpoint and key of the deployment, you can open up the `o "Deployment": "", "ModelName": "gpt-4", "Key": "", - "SystemPrompt": "1. You are a helpful and friendly assistant with - expertise in PowerShell scripting and command line.\n2. Assume user is using the operating system - `osx` unless otherwise specified.\n3. Use the `code block` syntax in markdown to encapsulate any - part in responses that is code, YAML, JSON or XML, but not table.\n4. When encapsulating command - line code, use '```powershell' if it's PowerShell command; use '```sh' if it's non-PowerShell CLI - command.\n5. When generating CLI commands, never ever break a command into multiple lines. - Instead, always list all parameters and arguments of the command on the same line.\n6. Please keep - the response concise but to the point. Do not overexplain." + "SystemPrompt": "1. You are a helpful and friendly assistant with expertise in PowerShell scripting and command line.\n2. Assume user is using the operating system `osx` unless otherwise specified.\n3. Use the `code block` syntax in markdown to encapsulate any part in responses that is code, YAML, JSON or XML, but not table.\n4. When encapsulating command line code, use '```powershell' if it's PowerShell command; use '```sh' if it's non-PowerShell CLI command.\n5. When generating CLI commands, never ever break a command into multiple lines. Instead, always list all parameters and arguments of the command on the same line.\n6. Please keep the response concise but to the point. Do not overexplain." } ], // Specify the default GPT instance to use for user query. From b9a3a8cef7be959dcf73615400d2948771ca288d Mon Sep 17 00:00:00 2001 From: Steven Bucher Date: Tue, 14 Jan 2025 14:27:28 -0800 Subject: [PATCH 6/7] copilots suggestions --- docs/development/AzureOAIDeployment/DeployingAzureOAI.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md index 0b8cf04c..7601e4da 100644 --- a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md +++ b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md @@ -1,7 +1,7 @@ # Deploying Azure OpenAI Service via Bicep In order to use the `openai-gpt` agent you will either need a public OpenAI API key or an Azure -OpenAI deployment. Due to its additional features and manage-ability, we recommend using the Azure +OpenAI deployment. Due to its additional features and manageability, we recommend using the Azure OpenAI Service. This document provides easy step-by-step instructions on how to deploy the Azure OpenAI Service using Bicep files. From adf79d3995316ef49ed1a44c4b674a91c387ed0e Mon Sep 17 00:00:00 2001 From: Steven Bucher Date: Tue, 14 Jan 2025 17:28:52 -0800 Subject: [PATCH 7/7] Dongbos suggestions --- .../AzureOAIDeployment/DeployingAzureOAI.md | 32 +++++++------------ .../development/AzureOAIDeployment/main.bicep | 2 +- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md index 7601e4da..4993ce17 100644 --- a/docs/development/AzureOAIDeployment/DeployingAzureOAI.md +++ b/docs/development/AzureOAIDeployment/DeployingAzureOAI.md @@ -76,41 +76,31 @@ instance! Simply use either Azure CLI or Azure PowerShell to deploy the bicep fi ```sh az deployment group create --resource-group --template-file ./main.bicep + +// Get the endpoint and key of the deployment +az cognitiveservices account show --name --resource-group | jq -r .properties.endpoint + +az cognitiveservices account keys list --name --resource-group | jq -r .key1 ``` #### Using Azure PowerShell ```powershell New-AzResourceGroupDeployment -ResourceGroupName -TemplateFile ./main.bicep -``` - -### 3. Configuring the agent to use the deployment - -You will need to get the endpoint and key of the deployment you just created. You can do this using the following commands in either Azure CLI or Azure PowerShell. - -#### Getting the endpoint -```powershell +// Get the endpoint and key of the deployment Get-AzCognitiveServicesAccount -ResourceGroupName -Name | Select-Object -Property Endpoint -``` -```sh -az cognitiveservices account show --name --resource-group | jq -r .properties.endpoint -``` - -#### Getting the key - -```powershell Get-AzCognitiveServicesAccountKey -ResourceGroupName -Name | Select-Object -Property Key1 ``` -```sh -az cognitiveservices account keys list --name --resource-group | jq -r .key1 -``` +### 3. Configuring the agent to use the deployment -Now that you have the endpoint and key of the deployment, you can open up the `openai-gpt` agent and run `/agent config` to edit the json configuration file with all the details of the deployment. The example below shows the default system prompt and the fields that need to be updated. +Now that you have the endpoint and key of the deployment, you can open up the `openai-gpt` agent and +run `/agent config` to edit the json configuration file with all the details of the deployment. The +example below shows the default system prompt and the fields that need to be updated. -```json +```jsonc { // Declare GPT instances. "GPTs": [ diff --git a/docs/development/AzureOAIDeployment/main.bicep b/docs/development/AzureOAIDeployment/main.bicep index 586eea7c..39e882ea 100644 --- a/docs/development/AzureOAIDeployment/main.bicep +++ b/docs/development/AzureOAIDeployment/main.bicep @@ -39,7 +39,7 @@ resource openAIService 'Microsoft.CognitiveServices/accounts@2024-10-01' = { } } -resource gpt4oMiniDeployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { +resource azopenaideployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { parent: openAIService name: modeldeploymentname properties: {