From 7c8f6ced7f371779bdd8c5b62a9ecd00dc68df37 Mon Sep 17 00:00:00 2001 From: heblasco Date: Wed, 6 Mar 2024 10:26:36 +0100 Subject: [PATCH 1/3] Update ContentModerator endpoint and AIHub image version --- infra/modules/ca-aihub/main.tf | 4 ++++ infra/variables.tf | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/infra/modules/ca-aihub/main.tf b/infra/modules/ca-aihub/main.tf index fde15ff..b20221d 100644 --- a/infra/modules/ca-aihub/main.tf +++ b/infra/modules/ca-aihub/main.tf @@ -82,6 +82,10 @@ resource "azapi_resource" "ca_back" { name = "ContentModerator__SubscriptionKey", secretRef = "content-safety-key" }, + { + name = "ContentModerator__JailbreakDetectionEndpoint", + value = "contentsafety/text:detectJailbreak?api-version=2023-10-15-preview" + }, { name = "BrandAnalyzer__BingEndpoint", value = "https://api.bing.microsoft.com/v7.0/search" diff --git a/infra/variables.tf b/infra/variables.tf index 99d50fe..00a4eda 100644 --- a/infra/variables.tf +++ b/infra/variables.tf @@ -95,7 +95,7 @@ variable "ca_prep_docs_image" { } variable "ca_aihub_image" { - default = "ghcr.io/azure/aihub/aihub:1.0.2-preview.17" + default = "ghcr.io/azure/aihub/aihub:1.0.2-preview.19" } variable "use_random_suffix" { From 8c1c0b0052fe9f4193a1bcfe313fa6a823154928 Mon Sep 17 00:00:00 2001 From: heblasco Date: Wed, 6 Mar 2024 10:31:17 +0100 Subject: [PATCH 2/3] Add GPT-4 Vision deployment --- infra/modules/openai/main.tf | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/infra/modules/openai/main.tf b/infra/modules/openai/main.tf index d2778f2..86ef372 100644 --- a/infra/modules/openai/main.tf +++ b/infra/modules/openai/main.tf @@ -8,7 +8,7 @@ resource "azurerm_cognitive_account" "openai" { custom_subdomain_name = var.azopenai_name } -resource "azurerm_cognitive_deployment" "this" { +resource "azurerm_cognitive_deployment" "gpt-35-turbo" { name = "DemoBuild" cognitive_account_id = azurerm_cognitive_account.openai.id rai_policy_name = "Microsoft.Default" @@ -56,6 +56,22 @@ resource "azurerm_cognitive_deployment" "gpt4" { } } +resource "azurerm_cognitive_deployment" "gpt4-vision" { + name = "gpt4-vision" + cognitive_account_id = azurerm_cognitive_account.openai.id + rai_policy_name = "Microsoft.Default" + model { + format = "OpenAI" + name = "gpt-4" + version = "vision-preview" + } + + scale { + type = "Standard" + capacity = 40 + } +} + resource "azurerm_role_assignment" "openai_user" { scope = azurerm_cognitive_account.openai.id role_definition_name = "Cognitive Services OpenAI User" From 0e49d939cd041d0b046e652595a130028a15153e Mon Sep 17 00:00:00 2001 From: heblasco Date: Wed, 6 Mar 2024 10:42:34 +0100 Subject: [PATCH 3/3] Update ca_aihub module with new chat_gpt4 and chat_gpt4_vision configurations --- infra/main.tf | 50 ++++++++++++++++------------- infra/modules/ca-aihub/variables.tf | 4 +++ infra/modules/openai/main.tf | 4 +-- infra/modules/openai/outputs.tf | 20 ++++++++++-- 4 files changed, 51 insertions(+), 27 deletions(-) diff --git a/infra/main.tf b/infra/main.tf index 8c96962..0eaba44 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -191,29 +191,33 @@ module "ca_prep_docs" { } module "ca_aihub" { - source = "./modules/ca-aihub" - location = azurerm_resource_group.rg.location - resource_group_id = azurerm_resource_group.rg.id - ca_name = local.ca_aihub_name - cae_id = module.cae.cae_id - managed_identity_id = module.mi.mi_id - chat_gpt_deployment = module.openai.gpt_deployment_name - chat_gpt_model = module.openai.gpt_deployment_model_name - embeddings_deployment = module.openai.embedding_deployment_name - embeddings_model = module.openai.embedding_deployment_name - storage_account_name = module.st.storage_account_name - storage_account_key = module.st.key - storage_container_name = module.st.storage_container_name - search_service_name = module.search.search_service_name - search_index_name = module.search.search_index_name - openai_endpoint = var.enable_apim ? module.apim.gateway_url : module.openai.openai_endpoint - chat_fqdn = module.ca_chat.fqdn - pbi_report_link = var.pbi_report_link - content_safety_endpoint = module.cog.content_safety_endpoint - content_safety_key = module.cog.content_safety_key - cognitive_service_endpoint = module.cog.cognitive_service_endpoint - cognitive_service_key = module.cog.cognitive_service_key - speech_key = module.cog.speech_key + source = "./modules/ca-aihub" + location = azurerm_resource_group.rg.location + resource_group_id = azurerm_resource_group.rg.id + ca_name = local.ca_aihub_name + cae_id = module.cae.cae_id + managed_identity_id = module.mi.mi_id + chat_gpt_deployment = module.openai.gpt_deployment_name + chat_gpt_model = module.openai.gpt_deployment_model_name + chat_gpt4_deployment = module.openai.gpt4_deployment_name + chat_gpt4_model = module.openai.gpt4_deployment_model_name + chat_gpt4_vision_deployment = module.openai.gpt4_vision_deployment_name + chat_gpt4_vision_model = module.openai.gpt4_vision_deployment_model_name + embeddings_deployment = module.openai.embedding_deployment_name + embeddings_model = module.openai.embedding_deployment_name + storage_account_name = module.st.storage_account_name + storage_account_key = module.st.key + storage_container_name = module.st.storage_container_name + search_service_name = module.search.search_service_name + search_index_name = module.search.search_index_name + openai_endpoint = var.enable_apim ? module.apim.gateway_url : module.openai.openai_endpoint + chat_fqdn = module.ca_chat.fqdn + pbi_report_link = var.pbi_report_link + content_safety_endpoint = module.cog.content_safety_endpoint + content_safety_key = module.cog.content_safety_key + cognitive_service_endpoint = module.cog.cognitive_service_endpoint + cognitive_service_key = module.cog.cognitive_service_key + speech_key = module.cog.speech_key storage_connection_string = module.st.connection_string bing_key = var.bing_key diff --git a/infra/modules/ca-aihub/variables.tf b/infra/modules/ca-aihub/variables.tf index 22b46c2..b48eaa9 100644 --- a/infra/modules/ca-aihub/variables.tf +++ b/infra/modules/ca-aihub/variables.tf @@ -13,6 +13,10 @@ variable "search_service_name" {} variable "search_index_name" {} variable "chat_gpt_deployment" {} variable "chat_gpt_model" {} +variable "chat_gpt4_deployment" {} +variable "chat_gpt4_model" {} +variable "chat_gpt4_vision_deployment" {} +variable "chat_gpt4_vision_model" {} variable "embeddings_deployment" {} variable "embeddings_model" {} variable "openai_endpoint" {} diff --git a/infra/modules/openai/main.tf b/infra/modules/openai/main.tf index 86ef372..f703076 100644 --- a/infra/modules/openai/main.tf +++ b/infra/modules/openai/main.tf @@ -8,7 +8,7 @@ resource "azurerm_cognitive_account" "openai" { custom_subdomain_name = var.azopenai_name } -resource "azurerm_cognitive_deployment" "gpt-35-turbo" { +resource "azurerm_cognitive_deployment" "gpt_35_turbo" { name = "DemoBuild" cognitive_account_id = azurerm_cognitive_account.openai.id rai_policy_name = "Microsoft.Default" @@ -56,7 +56,7 @@ resource "azurerm_cognitive_deployment" "gpt4" { } } -resource "azurerm_cognitive_deployment" "gpt4-vision" { +resource "azurerm_cognitive_deployment" "gpt4_vision" { name = "gpt4-vision" cognitive_account_id = azurerm_cognitive_account.openai.id rai_policy_name = "Microsoft.Default" diff --git a/infra/modules/openai/outputs.tf b/infra/modules/openai/outputs.tf index 99d83be..d1b3941 100644 --- a/infra/modules/openai/outputs.tf +++ b/infra/modules/openai/outputs.tf @@ -7,11 +7,27 @@ output "openai_endpoint" { } output "gpt_deployment_name" { - value = azurerm_cognitive_deployment.this.name + value = azurerm_cognitive_deployment.gpt_35_turbo.name } output "gpt_deployment_model_name" { - value = azurerm_cognitive_deployment.this.model[0].name + value = azurerm_cognitive_deployment.gpt_35_turbo.model[0].name +} + +output "gpt4_vision_deployment_name" { + value = azurerm_cognitive_deployment.gpt4_vision.name +} + +output "gpt4_vision_deployment_model_name" { + value = azurerm_cognitive_deployment.gpt4_vision.model[0].name +} + +output "gpt4_deployment_name" { + value = azurerm_cognitive_deployment.gpt4.name +} + +output "gpt4_deployment_model_name" { + value = azurerm_cognitive_deployment.gpt4.model[0].name } output "embedding_deployment_name" {