From bd73a5d4fa33d71adb42739f4f4173e11a21f1ed Mon Sep 17 00:00:00 2001 From: Matt <57731498+mattmsft@users.noreply.github.com> Date: Tue, 20 Jun 2023 00:32:07 +0000 Subject: [PATCH] Accept gpt and chat gpt deployment names as parameters; Ensure empty strings are not allowed --- infra/main.bicep | 18 ++++++++++-------- infra/main.parameters.json | 6 ++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/infra/main.bicep b/infra/main.bicep index 5f47c5c144..b1c11ed9bc 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -37,10 +37,10 @@ param formRecognizerResourceGroupLocation string = location param formRecognizerSkuName string = 'S0' -param gptDeploymentName string = 'davinci' +param gptDeploymentName string = '' param gptDeploymentCapacity int = 30 param gptModelName string = 'text-davinci-003' -param chatGptDeploymentName string = 'chat' +param chatGptDeploymentName string = '' param chatGptDeploymentCapacity int = 30 param chatGptModelName string = 'gpt-35-turbo' @@ -50,6 +50,8 @@ param principalId string = '' var abbrs = loadJsonContent('abbreviations.json') var resourceToken = toLower(uniqueString(subscription().id, environmentName, location)) var tags = { 'azd-env-name': environmentName } +var gptDeployment = empty(gptDeploymentName) ? 'davinci' : gptDeploymentName +var chatGptDeployment = empty(chatGptDeploymentName) ? 'chat' : chatGptDeploymentName // Organize resources in a resource group resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { @@ -109,8 +111,8 @@ module backend 'core/host/appservice.bicep' = { AZURE_OPENAI_SERVICE: openAi.outputs.name AZURE_SEARCH_INDEX: searchIndexName AZURE_SEARCH_SERVICE: searchService.outputs.name - AZURE_OPENAI_GPT_DEPLOYMENT: gptDeploymentName - AZURE_OPENAI_CHATGPT_DEPLOYMENT: chatGptDeploymentName + AZURE_OPENAI_GPT_DEPLOYMENT: gptDeployment + AZURE_OPENAI_CHATGPT_DEPLOYMENT: chatGptDeployment } } } @@ -127,7 +129,7 @@ module openAi 'core/ai/cognitiveservices.bicep' = { } deployments: [ { - name: gptDeploymentName + name: gptDeployment model: { format: 'OpenAI' name: gptModelName @@ -136,7 +138,7 @@ module openAi 'core/ai/cognitiveservices.bicep' = { capacity: gptDeploymentCapacity } { - name: chatGptDeploymentName + name: chatGptDeployment model: { format: 'OpenAI' name: chatGptModelName @@ -313,8 +315,8 @@ output AZURE_RESOURCE_GROUP string = resourceGroup.name output AZURE_OPENAI_SERVICE string = openAi.outputs.name output AZURE_OPENAI_RESOURCE_GROUP string = openAiResourceGroup.name -output AZURE_OPENAI_GPT_DEPLOYMENT string = gptDeploymentName -output AZURE_OPENAI_CHATGPT_DEPLOYMENT string = chatGptDeploymentName +output AZURE_OPENAI_GPT_DEPLOYMENT string = gptDeployment +output AZURE_OPENAI_CHATGPT_DEPLOYMENT string = chatGptDeployment output AZURE_FORMRECOGNIZER_SERVICE string = formRecognizer.outputs.name output AZURE_FORMRECOGNIZER_RESOURCE_GROUP string = formRecognizerResourceGroup.name diff --git a/infra/main.parameters.json b/infra/main.parameters.json index 4399196494..931cf76b76 100644 --- a/infra/main.parameters.json +++ b/infra/main.parameters.json @@ -43,6 +43,12 @@ }, "storageResourceGroupName": { "value": "${AZURE_STORAGE_RESOURCE_GROUP}" + }, + "chatGptDeploymentName": { + "value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT}" + }, + "gptDeploymentName": { + "value": "${AZURE_OPENAI_GPT_DEPLOYMENT}" } } }