Skip to content

Commit

Permalink
Accept gpt and chat gpt deployment names as parameters; Ensure empty …
Browse files Browse the repository at this point in the history
…strings are not allowed
  • Loading branch information
mattgotteiner committed Jun 20, 2023
1 parent 868d238 commit bd73a5d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 10 additions & 8 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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' = {
Expand Down Expand Up @@ -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
}
}
}
Expand All @@ -127,7 +129,7 @@ module openAi 'core/ai/cognitiveservices.bicep' = {
}
deployments: [
{
name: gptDeploymentName
name: gptDeployment
model: {
format: 'OpenAI'
name: gptModelName
Expand All @@ -136,7 +138,7 @@ module openAi 'core/ai/cognitiveservices.bicep' = {
capacity: gptDeploymentCapacity
}
{
name: chatGptDeploymentName
name: chatGptDeployment
model: {
format: 'OpenAI'
name: chatGptModelName
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
},
"storageResourceGroupName": {
"value": "${AZURE_STORAGE_RESOURCE_GROUP}"
},
"chatGptDeploymentName": {
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT}"
},
"gptDeploymentName": {
"value": "${AZURE_OPENAI_GPT_DEPLOYMENT}"
}
}
}

0 comments on commit bd73a5d

Please sign in to comment.