Skip to content

Commit

Permalink
update bicep to deploy only one model
Browse files Browse the repository at this point in the history
  • Loading branch information
thivy committed Sep 6, 2024
1 parent c3ffb8b commit 39c1e9c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 265 deletions.
14 changes: 9 additions & 5 deletions docs/migration.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# Migration
# Migration 2.1

The new changes merges GPT-4 and GPT-4 Vision models into a single GPT-4o model. This allows multi-modal inputs and generates text as an output. The new model is available within the following [regions](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-and-gpt-4-turbo-preview-model-availability).

# Migration 2.0

The following changes and services are required to migrate from the old version to the new version.

Refer the `.env.example` file for the latest environment variable changes.

If you previously had Azure Chat running and have pulled the v2 version you will need at minimum to make the following changes:

* Change the "OPENAI_API_KEY" environment setting to "AZURE_OPENAI_API_KEY"
* Add an additional container to your Cosmos DB database called "config" with a partition key of "/userId"
* Add the "AZURE_KEY_VAULT_NAME" environment setting with the name of your Azure Key Vault
* Add the "New Azure Services" settings below if you wish to use these features
- Change the "OPENAI_API_KEY" environment setting to "AZURE_OPENAI_API_KEY"
- Add an additional container to your Cosmos DB database called "config" with a partition key of "/userId"
- Add the "AZURE_KEY_VAULT_NAME" environment setting with the name of your Azure Key Vault
- Add the "New Azure Services" settings below if you wish to use these features

## New Azure Services

Expand Down
27 changes: 5 additions & 22 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ param location string
param openAILocation string

param openAISku string = 'S0'
param openAIApiVersion string = '2023-12-01-preview'
param openAIApiVersion string ='2024-05-13'

param chatGptDeploymentCapacity int = 120
param chatGptDeploymentName string = 'chat-gpt-35-turbo'
param chatGptModelName string = 'gpt-35-turbo'
param chatGptModelVersion string = '1106'
param chatGptDeploymentCapacity int = 30
param chatGptDeploymentName string = 'gpt-4o'
param chatGptModelName string = 'gpt-4o'
param chatGptModelVersion string = '2024-05-13'
param embeddingDeploymentName string = 'embedding'
param embeddingDeploymentCapacity int = 120
param embeddingModelName string = 'text-embedding-ada-002'
Expand All @@ -40,17 +40,6 @@ param dalleDeploymentName string = 'dall-e-3'
param dalleModelName string = 'dall-e-3'
param dalleApiVersion string = '2023-12-01-preview'

// DALL-E v3 only supported in Sweden Central for now
@description('Location for the GPT vision instance resource')
@allowed(['swedencentral','westus',])
param gptvisionLocation string

param gptvisionDeploymentCapacity int = 1
param gptvisionDeploymentName string = 'gpt-4-vision'
param gptvisionModelName string = 'gpt-4'
param gptvisionApiVersion string = '2023-12-01-preview'
param gptvisionModelVersion string = 'vision-preview'

param formRecognizerSkuName string = 'S0'
param searchServiceIndexName string = 'azure-chat'
param searchServiceSkuName string = 'standard'
Expand Down Expand Up @@ -93,12 +82,6 @@ module resources 'resources.bicep' = {
dalleDeploymentName: dalleDeploymentName
dalleModelName: dalleModelName
dalleApiVersion: dalleApiVersion
gptvisionLocation: gptvisionLocation
gptvisionApiVersion: gptvisionApiVersion
gptvisionDeploymentCapacity: gptvisionDeploymentCapacity
gptvisionDeploymentName: gptvisionDeploymentName
gptvisionModelName: gptvisionModelName
gptvisionModelVersion: gptvisionModelVersion
formRecognizerSkuName: formRecognizerSkuName
searchServiceIndexName: searchServiceIndexName
searchServiceSkuName: searchServiceSkuName
Expand Down
180 changes: 18 additions & 162 deletions infra/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "16779160080190232837"
"version": "0.29.47.4906",
"templateHash": "18214004695586675733"
}
},
"parameters": {
Expand Down Expand Up @@ -48,23 +48,23 @@
},
"openAIApiVersion": {
"type": "string",
"defaultValue": "2023-12-01-preview"
"defaultValue": "2024-05-13"
},
"chatGptDeploymentCapacity": {
"type": "int",
"defaultValue": 120
"defaultValue": 30
},
"chatGptDeploymentName": {
"type": "string",
"defaultValue": "chat-gpt-35-turbo"
"defaultValue": "gpt-4o"
},
"chatGptModelName": {
"type": "string",
"defaultValue": "gpt-35-turbo"
"defaultValue": "gpt-4o"
},
"chatGptModelVersion": {
"type": "string",
"defaultValue": "1106"
"defaultValue": "2024-05-13"
},
"embeddingDeploymentName": {
"type": "string",
Expand Down Expand Up @@ -103,36 +103,6 @@
"type": "string",
"defaultValue": "2023-12-01-preview"
},
"gptvisionLocation": {
"type": "string",
"allowedValues": [
"swedencentral",
"westus"
],
"metadata": {
"description": "Location for the GPT vision instance resource"
}
},
"gptvisionDeploymentCapacity": {
"type": "int",
"defaultValue": 1
},
"gptvisionDeploymentName": {
"type": "string",
"defaultValue": "gpt-4-vision"
},
"gptvisionModelName": {
"type": "string",
"defaultValue": "gpt-4"
},
"gptvisionApiVersion": {
"type": "string",
"defaultValue": "2023-12-01-preview"
},
"gptvisionModelVersion": {
"type": "string",
"defaultValue": "vision-preview"
},
"formRecognizerSkuName": {
"type": "string",
"defaultValue": "S0"
Expand Down Expand Up @@ -239,24 +209,6 @@
"dalleApiVersion": {
"value": "[parameters('dalleApiVersion')]"
},
"gptvisionLocation": {
"value": "[parameters('gptvisionLocation')]"
},
"gptvisionApiVersion": {
"value": "[parameters('gptvisionApiVersion')]"
},
"gptvisionDeploymentCapacity": {
"value": "[parameters('gptvisionDeploymentCapacity')]"
},
"gptvisionDeploymentName": {
"value": "[parameters('gptvisionDeploymentName')]"
},
"gptvisionModelName": {
"value": "[parameters('gptvisionModelName')]"
},
"gptvisionModelVersion": {
"value": "[parameters('gptvisionModelVersion')]"
},
"formRecognizerSkuName": {
"value": "[parameters('formRecognizerSkuName')]"
},
Expand All @@ -282,8 +234,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "14077555141603956691"
"version": "0.29.47.4906",
"templateHash": "18109441359842852578"
}
},
"parameters": {
Expand All @@ -301,36 +253,28 @@
"type": "string"
},
"openAiSkuName": {
"type": "string",
"defaultValue": "S0"
"type": "string"
},
"chatGptDeploymentCapacity": {
"type": "int",
"defaultValue": 30
"type": "int"
},
"chatGptDeploymentName": {
"type": "string",
"defaultValue": "chat-gpt-35-turbo"
"type": "string"
},
"chatGptModelName": {
"type": "string",
"defaultValue": "chat-gpt-35-turbo"
"type": "string"
},
"chatGptModelVersion": {
"type": "string",
"defaultValue": "1106"
"type": "string"
},
"embeddingDeploymentName": {
"type": "string",
"defaultValue": "text-embedding-ada-002"
"type": "string"
},
"embeddingDeploymentCapacity": {
"type": "int",
"defaultValue": 10
"type": "int"
},
"embeddingModelName": {
"type": "string",
"defaultValue": "text-embedding-ada-002"
"type": "string"
},
"dalleLocation": {
"type": "string"
Expand All @@ -347,29 +291,6 @@
"dalleApiVersion": {
"type": "string"
},
"gptvisionLocation": {
"type": "string"
},
"gptvisionDeploymentCapacity": {
"type": "int",
"defaultValue": 30
},
"gptvisionDeploymentName": {
"type": "string",
"defaultValue": "gpt-4-vision"
},
"gptvisionModelName": {
"type": "string",
"defaultValue": "gpt-4"
},
"gptvisionApiVersion": {
"type": "string",
"defaultValue": "2023-12-01-preview"
},
"gptvisionModelVersion": {
"type": "string",
"defaultValue": "vision-preview"
},
"speechServiceSkuName": {
"type": "string",
"defaultValue": "S0"
Expand Down Expand Up @@ -408,7 +329,6 @@
"variables": {
"openai_name": "[toLower(format('{0}-aillm-{1}', parameters('name'), parameters('resourceToken')))]",
"openai_dalle_name": "[toLower(format('{0}-aidalle-{1}', parameters('name'), parameters('resourceToken')))]",
"openai_gpt_vision_name": "[toLower(format('{0}-aivision-{1}', parameters('name'), parameters('resourceToken')))]",
"form_recognizer_name": "[toLower(format('{0}-form-{1}', parameters('name'), parameters('resourceToken')))]",
"speech_service_name": "[toLower(format('{0}-speech-{1}', parameters('name'), parameters('resourceToken')))]",
"cosmos_name": "[toLower(format('{0}-cosmos-{1}', parameters('name'), parameters('resourceToken')))]",
Expand All @@ -435,7 +355,7 @@
"version": "[parameters('chatGptModelVersion')]"
},
"sku": {
"name": "Standard",
"name": "GlobalStandard",
"capacity": "[parameters('chatGptDeploymentCapacity')]"
}
},
Expand Down Expand Up @@ -479,19 +399,6 @@
"[resourceId('Microsoft.Web/sites', variables('webapp_name'))]"
]
},
{
"type": "Microsoft.KeyVault/vaults/secrets",
"apiVersion": "2021-06-01-preview",
"name": "[format('{0}/{1}', variables('keyVaultName'), 'AZURE-OPENAI-VISION-API-KEY')]",
"properties": {
"contentType": "text/plain",
"value": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts', variables('openai_gpt_vision_name')), '2023-05-01').key1]"
},
"dependsOn": [
"[resourceId('Microsoft.CognitiveServices/accounts', variables('openai_gpt_vision_name'))]",
"[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]"
]
},
{
"type": "Microsoft.KeyVault/vaults/secrets",
"apiVersion": "2021-06-01-preview",
Expand Down Expand Up @@ -613,25 +520,6 @@
"[resourceId('Microsoft.CognitiveServices/accounts', variables('openai_dalle_name'))]"
]
},
{
"type": "Microsoft.CognitiveServices/accounts/deployments",
"apiVersion": "2023-05-01",
"name": "[format('{0}/{1}', variables('openai_gpt_vision_name'), parameters('gptvisionDeploymentName'))]",
"properties": {
"model": {
"format": "OpenAI",
"name": "[parameters('gptvisionModelName')]",
"version": "[parameters('gptvisionModelVersion')]"
}
},
"sku": {
"name": "Standard",
"capacity": "[parameters('gptvisionDeploymentCapacity')]"
},
"dependsOn": [
"[resourceId('Microsoft.CognitiveServices/accounts', variables('openai_gpt_vision_name'))]"
]
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2022-05-01",
Expand Down Expand Up @@ -693,22 +581,6 @@
"name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
"value": "true"
},
{
"name": "AZURE_OPENAI_VISION_API_KEY",
"value": "[format('@Microsoft.KeyVault(VaultName={0};SecretName={1})', variables('keyVaultName'), 'AZURE-OPENAI-VISION-API-KEY')]"
},
{
"name": "AZURE_OPENAI_VISION_API_INSTANCE_NAME",
"value": "[variables('openai_gpt_vision_name')]"
},
{
"name": "AZURE_OPENAI_VISION_API_DEPLOYMENT_NAME",
"value": "[parameters('gptvisionDeploymentName')]"
},
{
"name": "AZURE_OPENAI_VISION_API_VERSION",
"value": "[parameters('gptvisionApiVersion')]"
},
{
"name": "AZURE_OPENAI_API_KEY",
"value": "[format('@Microsoft.KeyVault(VaultName={0};SecretName={1})', variables('keyVaultName'), 'AZURE-OPENAI-API-KEY')]"
Expand Down Expand Up @@ -809,7 +681,6 @@
"[resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), 'AZURE-DOCUMENT-INTELLIGENCE-KEY')]",
"[resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), 'AZURE-OPENAI-API-KEY')]",
"[resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), 'AZURE-OPENAI-DALLE-API-KEY')]",
"[resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), 'AZURE-OPENAI-VISION-API-KEY')]",
"[resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), 'AZURE-SEARCH-API-KEY')]",
"[resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), 'AZURE-SPEECH-KEY')]",
"[resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), 'AZURE-STORAGE-ACCOUNT-KEY')]",
Expand Down Expand Up @@ -1024,21 +895,6 @@
"name": "[parameters('openAiSkuName')]"
}
},
{
"type": "Microsoft.CognitiveServices/accounts",
"apiVersion": "2023-05-01",
"name": "[variables('openai_gpt_vision_name')]",
"location": "[parameters('gptvisionLocation')]",
"tags": "[parameters('tags')]",
"kind": "OpenAI",
"properties": {
"customSubDomainName": "[variables('openai_gpt_vision_name')]",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "[parameters('openAiSkuName')]"
}
},
{
"type": "Microsoft.CognitiveServices/accounts",
"apiVersion": "2023-05-01",
Expand Down
Loading

0 comments on commit 39c1e9c

Please sign in to comment.