Skip to content

Commit 5b7f3d8

Browse files
author
Seth
committed
Quota - implemented AZD quota check, removed model array for embedding and gpt only, removed scripts
1 parent 0a22b20 commit 5b7f3d8

8 files changed

Lines changed: 64 additions & 361 deletions

azure.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,4 @@ hooks:
1414
shell: sh
1515
run: chmod u+r+x ./scripts/set_conns_env_vars.sh; ./scripts/set_conns_env_vars.sh
1616
interactive: true
17-
continueOnError: false
18-
preprovision:
19-
posix:
20-
shell: sh
21-
run: chmod u+r+x ./scripts/validate_model_deployment_quotas.sh; chmod u+r+x ./scripts/validate_model_quota.sh; ./scripts/validate_model_deployment_quotas.sh --subscription $AZURE_SUBSCRIPTION_ID --location $AZURE_LOCATION --models-parameter "aiModelDeployments"
22-
interactive: false
23-
continueOnError: false
24-
windows:
25-
shell: pwsh
26-
run: ./scripts/validate_model_deployment_quotas.ps1 -Subscription $env:AZURE_SUBSCRIPTION_ID -Location $env:AZURE_LOCATION -ModelsParameter "aiModelDeployments"
27-
interactive: false
2817
continueOnError: false

infra/main.bicep

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,27 @@ targetScope = 'resourceGroup'
55
@description('The name of the environment/application. Use alphanumeric characters only.')
66
param name string
77

8-
@description('Specifies the location for all the Azure resources. Defaults to the location of the resource group.')
8+
@metadata({ azd: { type: 'location' } })
9+
@description('Specifies the location for all the Azure resources.')
910
param location string
1011

11-
@description('Optional. Specifies the OpenAI deployments to create.')
12-
param aiModelDeployments deploymentsType[] = []
12+
@description('Specifies the AI embedding model to use for the AI Foundry deployment. This is the model used for text embeddings in AI Foundry. NOTE: Any adjustments to this parameter\'s values must also be made on the aiDeploymentsLocation metadata in the main.bicep file.')
13+
param aiEmbeddingModelDeployment modelDeploymentType
14+
15+
@description('Specifies the AI chat model to use for the AI Foundry deployment. This is the model used for chat interactions in AI Foundry. NOTE: Any adjustments to this parameter\'s values must also be made on the aiDeploymentsLocation metadata in the main.bicep file.')
16+
param aiGPTModelDeployment modelDeploymentType
17+
18+
@metadata({
19+
azd: {
20+
type: 'location'
21+
usageName: [
22+
'OpenAI.GlobalStandard.gpt-4o,150'
23+
'OpenAI.GlobalStandard.text-embedding-3-small,100'
24+
]
25+
}
26+
})
27+
@description('Required. Location for AI Foundry deployment. This is the location where the AI Foundry resources will be deployed.')
28+
param aiDeploymentsLocation string
1329

1430
@description('Specifies whether creating an Azure Container Registry.')
1531
param acrEnabled bool = false
@@ -83,12 +99,6 @@ param documentIntelligenceEnabled bool = false
8399
param networkAcls object ={
84100
defaultAction: 'Deny'
85101
bypass: 'AzureServices' // ✅ Allows trusted Microsoft services
86-
// virtualNetworkRules: [
87-
// {
88-
// id: networkIsolation ? network.outputs.vmSubnetName : ''
89-
// ignoreMissingVnetServiceEndpoint: true
90-
// }
91-
// ]
92102
}
93103

94104
@description('Name of the first project')
@@ -216,13 +226,26 @@ module cognitiveServices 'modules/cognitive-services/main.bicep' = {
216226
params: {
217227
name: name
218228
resourceToken: resourceToken
219-
location: location
229+
location: aiDeploymentsLocation
220230
networkIsolation: networkIsolation
221231
networkAcls: networkAcls
222232
virtualNetworkResourceId: networkIsolation ? network.outputs.virtualNetworkId : ''
223233
virtualNetworkSubnetResourceId: networkIsolation ? network.outputs.vmSubnetId : ''
224234
logAnalyticsWorkspaceResourceId: logAnalyticsWorkspace.outputs.resourceId
225-
aiModelDeployments: aiModelDeployments
235+
aiModelDeployments: [
236+
for model in [aiEmbeddingModelDeployment, aiGPTModelDeployment]: {
237+
name: empty(model.?name) ? model.modelName : model.?name
238+
model: {
239+
name: model.modelName
240+
format: 'OpenAI'
241+
version: model.version
242+
}
243+
sku: {
244+
name: 'GlobalStandard'
245+
capacity: model.capacity
246+
}
247+
}
248+
]
226249
userObjectId: userObjectId
227250
contentSafetyEnabled: contentSafetyEnabled
228251
visionEnabled: visionEnabled
@@ -357,7 +380,7 @@ module sqlServer 'modules/sqlServer.bicep' = if (sqlServerEnabled) {
357380
}
358381
}
359382

360-
import { sqlDatabaseType, databasePropertyType, deploymentsType } from 'modules/customTypes.bicep'
383+
import { sqlDatabaseType, databasePropertyType, modelDeploymentType } from 'modules/customTypes.bicep'
361384

362385

363386
output AZURE_KEY_VAULT_NAME string = keyvault.outputs.name

infra/main.parameters.json

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,33 +50,19 @@
5050
"bingGroundingEnabled": {
5151
"value": "${AZURE_BING_GROUNDING_ENABLED}"
5252
},
53-
"aiModelDeployments": {
54-
"value": [
55-
{
56-
"name": "textembed",
57-
"model": {
58-
"name": "text-embedding-ada-002",
59-
"format": "OpenAI",
60-
"version": "2"
61-
},
62-
"sku": {
63-
"name": "Standard",
64-
"capacity": 10
65-
}
66-
},
67-
{
68-
"name": "gpt",
69-
"model": {
70-
"name": "gpt-4o",
71-
"version": "2024-05-13",
72-
"format": "OpenAI"
73-
},
74-
"sku": {
75-
"name": "GlobalStandard",
76-
"capacity": 10
77-
}
78-
}
79-
]
53+
"aiEmbeddingModelDeployment": {
54+
"value": {
55+
"modelName": "text-embedding-3-small",
56+
"version": "1",
57+
"capacity": 100
58+
}
59+
},
60+
"aiGPTModelDeployment": {
61+
"value": {
62+
"modelName": "gpt-4o",
63+
"version": "2024-05-13",
64+
"capacity": 150
65+
}
8066
}
8167
}
8268
}

infra/modules/customTypes.bicep

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,22 @@ type longTermBackupRetentionPolicyType = {
253253
yearlyRetention: string?
254254
}
255255

256+
@export()
257+
@description('The AI model deployment type for Cognitive Services account.')
258+
type modelDeploymentType = {
259+
@description('Optional. The name of the Cognitive Services account deployment model. The modelName will be used by default if not specified.')
260+
name: string?
261+
262+
@description('Required. The format of the Cognitive Services account deployment model.')
263+
modelName: string
264+
265+
@description('Required. The version of the Cognitive Services account deployment model.')
266+
version: string
267+
268+
@description('Required. The capacity of the resource model definition representing SKU.')
269+
capacity: int
270+
}
271+
256272
@export()
257273
type deploymentsType = {
258274
@description('Optional. Specify the name of cognitive service account deployment.')

scripts/validate_model_deployment_quotas.ps1

Lines changed: 0 additions & 69 deletions
This file was deleted.

scripts/validate_model_deployment_quotas.sh

Lines changed: 0 additions & 83 deletions
This file was deleted.

scripts/validate_model_quota.ps1

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)