hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.62k stars 4.66k forks source link

Warnings for azurerm_cognitive_deployment documentation #22198

Closed randompixel closed 1 year ago

randompixel commented 1 year ago

Is there an existing issue for this?

Community Note

Description

I was having issues with azurerm_cognitive_deployment which was giving me this error.

CreateOrUpdate: unexpected status 400 with error: InvalidResourceProperties: The specified scale type 'Standard' of account deployment is not supported by the model 'text-davinci-003'.

This was causing me confusion as "scale type" can only be set to Standard in Terraform so I wasn't sure what to do.

What this actually turned out to be was I was trying to deploy text-davinci-003 to uksouth which isn't supported (as per https://learn.microsoft.com/en-us/azure/cognitive-services/openai/concepts/models#gpt-3-models)

Is there anything that could be added to the documentation here to warn users that not all models can be deployed to all regions?

New or Affected Resource(s)/Data Source(s)

azurerm_cognitive_deployment

Potential Terraform Configuration

No response

References

No response

lonegunmanb commented 1 year ago

@randompixel Thanks for opening this pr, I've tried the following config and I reproduced your issue:

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "uksouth"
}

resource "azurerm_cognitive_account" "example" {
  name                = "example-ca"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  kind                = "OpenAI"
  sku_name            = "S0"
}

resource "azurerm_cognitive_deployment" "example" {
  name                 = "example-cd"
  cognitive_account_id = azurerm_cognitive_account.example.id
  model {
    format  = "OpenAI"
    name    = "text-davinci-003"
    version = "1"
  }

  scale {
    type = "Standard"
  }
}

I've met a similar error:

Deployment Name: "gpt-4-32k"): performing CreateOrUpdate: unexpected status 400 with error: InvalidResourceProperties: The specified scale type 'Standard' of account deployment is not supported by the model 'gpt-4-32k'.

It turns out that scale block is not required any more in cognitive deployment API version 2023-05-01 so we can deploy gpt-4-32k deployment via the portal, but for now the provider is using 2022-10-01 version, so we cannot deploy gpt-4-32k by using Terraform AzureRM Provider now.

I'll submit a pr to upgrade the API version.

jayendranarumugam commented 1 year ago

Hi @lonegunmanb , First of thanks for your PR :) I have tried the new version 3.64.0 and noticed few points

Did this case work for you during the development ?

kirk-marple commented 1 year ago

@lonegunmanb I can concur there's something wrong still, and can't rerun a deployment or I get the same problem as @jayendranarumugam where it resets it back to 0301 and then won't allow update.

lonegunmanb commented 1 year ago

Thanks @jayendranarumugam and @kirk-marple for letting me know the issue, I'll try to reproduce it on my side.

jayendranarumugam commented 1 year ago

@lonegunmanb I have created https://github.com/hashicorp/terraform-provider-azurerm/issues/22501 if you like to work on it. Thanks !

lonegunmanb commented 1 year ago

Thanks @jayendranarumugam, I'll take a look!

RyanRogersMicrosoft commented 1 year ago

Has anyone seen this error: Message: The specified scale type 'Standard' of account deployment is not supported by the model 'gpt-35-turbo'. from these configs:

openai.api_version = "2023-05-15"
model_name = "gpt-35-turbo"
deployment_name = "gpt-35-turbo"
model_version = "0613"

For ref: deployment = client.deployments.begin_create_or_update( resource_group_name=cog_rg, account_name=openai_instance_name, deployment_name=deployment_name, content_type = 'application/json', deployment={ "properties": { "model": { "format": "OpenAI", "name": model, "version": model_version }, "scaleSettings": { "scaleType": "Standard" } }, "sku": { "capacity": 1 } } ) And when I remove the scaleSettings section above I get: Code: InvalidResourceProperties Message: The scale settings of account deployment is invalid.

github-actions[bot] commented 7 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.