From 37ed6412e63ae8b8cc0cbeb955b1c332c91be691 Mon Sep 17 00:00:00 2001 From: Chris Pietschmann Date: Fri, 15 Mar 2024 17:43:18 -0400 Subject: [PATCH] Add gpt-35-turbo model deployment to v1 Bicep and Terraform --- IaC/Bicep/v1/deploy.bicep | 23 +++++++++++++++++++++++ IaC/Terraform/v1/main.tf | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/IaC/Bicep/v1/deploy.bicep b/IaC/Bicep/v1/deploy.bicep index a62506c..f7c1109 100644 --- a/IaC/Bicep/v1/deploy.bicep +++ b/IaC/Bicep/v1/deploy.bicep @@ -5,6 +5,8 @@ param location string = resourceGroup().location param azureOpenAISku string = 'S0' +param openai_deployment_name string = 'b59-gpt35-turbo' + var resourceTags = { project: 'https://github.com/build5nines/AIChatUI' } @@ -26,3 +28,24 @@ resource azureopenai 'Microsoft.CognitiveServices/accounts@2023-10-01-preview' = publicNetworkAccess: 'Enabled' } } + +resource azureopenaideployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = { + name: openai_deployment_name + sku: { + capacity: 120 + name: 'Standard' + } + parent: azureopenai + properties: { + model: { + format: 'OpenAI' + name: 'gpt-35-turbo' + version: '0613' + } + raiPolicyName: 'Microsoft.Default' + versionUpgradeOption: 'OnceCurrentVersionExpired' + scaleSettings: { + capacity: 120 + } + } +} diff --git a/IaC/Terraform/v1/main.tf b/IaC/Terraform/v1/main.tf index 7df2773..b5ebcc4 100644 --- a/IaC/Terraform/v1/main.tf +++ b/IaC/Terraform/v1/main.tf @@ -5,6 +5,9 @@ terraform { source = "hashicorp/azurerm" version = "~>3" } + azapi = { + source = "azure/azapi" + } } } @@ -12,12 +15,19 @@ provider "azurerm" { features {} } +provider "azapi" { + +} + + locals { resource_prefix = "b59-eus2-aichatui" location = "eastus2" openai_sku = "S0" + openai_deployment_name = "b59-gpt35-turbo" + resourceTags = { project = "https://github.com/build5nines/AIChatUI" } @@ -36,4 +46,26 @@ resource azurerm_cognitive_account azureopenai { kind = "OpenAI" sku_name = local.openai_sku tags = local.resourceTags -} \ No newline at end of file +} + +# https://learn.microsoft.com/en-us/azure/templates/microsoft.cognitiveservices/accounts/deployments?pivots=deployment-language-terraform +resource "azapi_resource" azureopenaideployment { + type = "Microsoft.CognitiveServices/accounts/deployments@2023-05-01" + name = local.openai_deployment_name + parent_id = azurerm_cognitive_account.azureopenai.id + body = jsonencode({ + properties = { + model = { + format = "OpenAI" + name = "gpt-35-turbo" + version = "0613" + } + versionUpgradeOption = "OnceCurrentVersionExpired" + raiPolicyName = "Microsoft.Default" + } + sku = { + capacity = 120 + name = "Standard" + } + }) +}