Skip to content

Commit

Permalink
Remote build support and more parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelafox committed Sep 16, 2024
1 parent b5302c0 commit 3f6f277
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
3 changes: 0 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
"forwardPorts": [50505],
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:latest": {
"dockerDashComposeVersion": "v2"
},
"ghcr.io/azure/azure-dev/azd:latest": {}
},
"customizations": {
Expand Down
4 changes: 4 additions & 0 deletions azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
name: simple-chatgpt-python
metadata:
template: [email protected]
requiredVersions:
azd: ">= 1.10.0"
services:
aca:
project: ./src
language: py
host: containerapp
docker:
remoteBuild: true
31 changes: 24 additions & 7 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,33 @@ param createRoleForUser bool = true

param acaExists bool = false

// Parameters for the Azure OpenAI resource:
param openAiResourceName string = ''
param openAiResourceGroupName string = ''
param openAiResourceGroupLocation string = ''
@minLength(1)
@description('Location for the OpenAI resource')
// Look for the desired model in availability table. Default model is gpt-4o-mini:
// https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability
@allowed([
'eastus'
'swedencentral'
])
@metadata({
azd: {
type: 'location'
}
})
param openAiResourceLocation string
param openAiSkuName string = ''
param openAiApiVersion string = '' // Used by the SDK in the app code
param disableKeyBasedAuth bool = true

// Parameters for the specific Azure OpenAI deployment:
param openAiDeploymentName string // Set in main.parameters.json
param openAiModelName string // Set in main.parameters.json
param openAiModelVersion string // Set in main.parameters.json
param openAiDeploymentCapacity int = 30
param openAiApiVersion string = ''
param disableKeyBasedAuth bool = true
param openAiModelVersion string // Set in main.parameters.json
param openAiDeploymentCapacity int // Set in main.parameters.json
param openAiDeploymentSkuName string // Set in main.parameters.json

@description('Flag to decide whether to create Azure OpenAI instance or not')
param createAzureOpenAi bool // Set in main.parameters.json
Expand Down Expand Up @@ -59,7 +76,7 @@ module openAi 'core/ai/cognitiveservices.bicep' = if (createAzureOpenAi) {
scope: openAiResourceGroup
params: {
name: !empty(openAiResourceName) ? openAiResourceName : '${resourceToken}-cog'
location: !empty(openAiResourceGroupLocation) ? openAiResourceGroupLocation : location
location: !empty(openAiResourceLocation) ? openAiResourceLocation : location
tags: tags
disableLocalAuth: disableKeyBasedAuth
sku: {
Expand All @@ -74,7 +91,7 @@ module openAi 'core/ai/cognitiveservices.bicep' = if (createAzureOpenAi) {
version: openAiModelVersion
}
sku: {
name: 'Standard'
name: openAiDeploymentSkuName
capacity: openAiDeploymentCapacity
}
}
Expand Down
16 changes: 11 additions & 5 deletions infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,28 @@
"value": "${AZURE_PRINCIPAL_ID}"
},
"openAiDeploymentName": {
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT=gpt-35-turbo}"
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT=gpt-4o-mini}"
},
"openAiModelName": {
"value": "${AZURE_OPENAI_CHATGPT_MODEL=gpt-35-turbo}"
"value": "${AZURE_OPENAI_CHATGPT_MODEL=gpt-4o-mini}"
},
"openAiModelVersion": {
"value": "${AZURE_OPENAI_CHATGPT_MODEL_VERSION=0613}"
"value": "${AZURE_OPENAI_CHATGPT_MODEL_VERSION=2024-07-18}"
},
"openAiResourceName": {
"value": "${AZURE_OPENAI_RESOURCE}"
},
"openAiResourceGroupName": {
"value": "${AZURE_OPENAI_RESOURCE_GROUP}"
},
"openAiResourceGroupLocation": {
"value": "${AZURE_OPENAI_RESOURCE_GROUP_LOCATION}"
"openAiResourceLocation": {
"value": "${AZURE_OPENAI_RESOURCE_LOCATION}"
},
"openAiDeploymentCapacity": {
"value": "${AZURE_OPENAI_DEPLOYMENT_CAPACITY=30}"
},
"openAiDeploymentSkuName": {
"value": "${AZURE_OPENAI_DEPLOYMENT_SKU_NAME=Standard}"
},
"openAiSkuName": {
"value": "${AZURE_OPENAI_SKU_NAME}"
Expand Down

0 comments on commit 3f6f277

Please sign in to comment.