Skip to content

Commit

Permalink
vision resources
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Apr 22, 2024
1 parent fc73208 commit 173d9db
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 52 deletions.
73 changes: 34 additions & 39 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ locals {
content_safety_name = "${var.content_safety_name}${local.name_sufix}"
cognitive_services_name = "${var.cognitive_services_name}${local.name_sufix}"
speech_name = "${var.speech_name}${local.name_sufix}"
vision_name = "${var.vision_name}${local.name_sufix}"
bing_name = "${var.bing_name}${local.name_sufix}"
search_name = "${var.search_name}${local.name_sufix}"
form_recognizer_name = "${var.form_recognizer_name}${local.name_sufix}"
Expand Down Expand Up @@ -137,6 +138,7 @@ module "cog" {
cognitive_services_name = local.cognitive_services_name
content_safety_name = local.content_safety_name
speech_name = local.speech_name
vision_name = local.vision_name
content_safety_storage_resource_id = module.st.storage_account_id
deploy_bing = var.deploy_bing
}
Expand Down Expand Up @@ -194,38 +196,38 @@ 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
cae_default_domain = module.cae.default_domain
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[0].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 = module.cog.bing_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
cae_default_domain = module.cae.default_domain
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[0].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
vision_endpoint = module.cog.vision_endpoint
vision_key = module.cog.vision_key
storage_connection_string = module.st.connection_string
bing_key = module.cog.bing_key
tenant_id = data.azurerm_subscription.current.tenant_id
managed_identity_client_id = module.mi.client_id
enable_entra_id_authentication = var.enable_entra_id_authentication
Expand All @@ -246,10 +248,3 @@ module "plugin" {
openai_model = module.openai.gpt_deployment_name
openai_endpoint = module.openai.openai_endpoint
}

module "cv" {
source = "./modules/cv"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
cv_name = local.cv_name
}
24 changes: 24 additions & 0 deletions infra/modules/ca-aihub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,30 @@ resource "azapi_resource" "ca_back" {
name = "ImageAnalyzer__DeploymentName",
value = var.chat_gpt4_vision_deployment
},
{
name = "VideoAnalyzer__OpenAIEndpoint",
value = "${var.openai_endpoint}"
},
{
name = "VideoAnalyzer__OpenAISubscriptionKey",
value = ""
},
{
name = "VideoAnalyzer__ContainerName",
value = "video-analyzer"
},
{
name = "VideoAnalyzer__DeploymentName",
value = var.chat_gpt4_vision_deployment
},
{
name = "VideoAnalyzer__VisionEndpoint",
value = var.vision_endpoint
},
{
name = "VideoAnalyzer__VisionSubscriptionKey",
value = var.vision_key
},
{
name = "FormAnalyzer__FormRecogEndpoint",
value = "${var.cognitive_service_endpoint}"
Expand Down
3 changes: 3 additions & 0 deletions infra/modules/ca-aihub/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ variable "cognitive_service_endpoint" {}
variable "cognitive_service_key" {}
variable "speech_key" {}

variable "vision_endpoint" {}
variable "vision_key" {}

variable "storage_connection_string" {}
variable "bing_key" {}

Expand Down
10 changes: 10 additions & 0 deletions infra/modules/cog/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ resource "azurerm_cognitive_account" "speech" {
custom_subdomain_name = var.speech_name
}

resource "azurerm_cognitive_account" "vision" {
name = var.vision_name
kind = "ComputerVision"
sku_name = "S1"
location = var.location
resource_group_name = var.resource_group_name
public_network_access_enabled = true
custom_subdomain_name = var.vision_name
}

resource "azurerm_resource_group_template_deployment" "main" {
count = var.deploy_bing ? 1 : 0
name = "${var.bing_name}-${uuid()}"
Expand Down
8 changes: 8 additions & 0 deletions infra/modules/cog/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ output "speech_key" {
output "bing_key" {
value = var.deploy_bing ? jsondecode(azurerm_resource_group_template_deployment.main[0].output_content).accessKeys.value.key1 : "<bing not deployed>"
}

output "vision_endpoint" {
value = azurerm_cognitive_account.vision.endpoint
}

output "vision_key" {
value = azurerm_cognitive_account.vision.primary_access_key
}
1 change: 1 addition & 0 deletions infra/modules/cog/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ variable "location" {}
variable "content_safety_name" {}
variable "cognitive_services_name" {}
variable "speech_name" {}
variable "vision_name" {}
variable "bing_name" {}
variable "deploy_bing" {}
variable "content_safety_storage_resource_id" {}
7 changes: 0 additions & 7 deletions infra/modules/cv/main.tf

This file was deleted.

Empty file removed infra/modules/cv/outputs.tf
Empty file.
3 changes: 0 additions & 3 deletions infra/modules/cv/variables.tf

This file was deleted.

10 changes: 7 additions & 3 deletions infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ variable "cognitive_services_name" {
default = "cog-cognitive-aihub"
}

variable "vision_name" {
default = "cog-vision-aihub"
}

variable "speech_name" {
default = "cog-speech-aihub"
}
Expand Down Expand Up @@ -95,15 +99,15 @@ variable "ca_chat_image" {
}

variable "ca_prep_docs_image" {
default = "ghcr.io/azure/aihub/aihub-prepdocs:1.0.9"
default = "ghcr.io/azure/aihub/aihub-prepdocs:1.0.10"
}

variable "ca_plugin_image" {
default = "ghcr.io/azure/aihub/aihub-plugin:1.0.9"
default = "ghcr.io/azure/aihub/aihub-plugin:1.0.10"
}

variable "ca_aihub_image" {
default = "ghcr.io/azure/aihub/aihub:1.0.9"
default = "ghcr.io/azure/aihub/aihub:1.0.10"
}

variable "use_random_suffix" {
Expand Down

0 comments on commit 173d9db

Please sign in to comment.