Deployment OpenAI with model gpt4 using ARM template

Javier Ávarez De Celis 10 Reputation points
2024-11-08T11:40:41.7033333+00:00

I am trying to launch an openAI resource and when it finishes launching a gpt-4 template, but I get the following error:

The 'properties' field is invalid, error: 'Error converting value "gpt-4" to type 'Microsoft.CognitiveServices.ResourceProvider.Contracts.ServiceModel'. Path 'model'.'.

If I change to gpt-3, gpt-4o I get the same error.

Template:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "resources": [
    {
      "type": "Microsoft.CognitiveServices/accounts",
      "apiVersion": "2022-12-01",
      "name": "[parameters('openAIName')]",
      "location": "[parameters('location')]",
      "kind": "OpenAI",
      "sku": {
        "name": "S0"
      },
      "properties": {
        "customSubDomainName": "[parameters('openAIDomain')]",
        "publicNetworkAccess": "Enabled"
      },
      "resources": [
        {
          "type": "deployments",
          "apiVersion": "2021-10-01",
          "name": "gpt4-deployment",
          "dependsOn": [
            "[resourceId('Microsoft.CognitiveServices/accounts', parameters('openAIName'))]"
          ],
          "properties": {
            "model": "gpt-4",
            "deploymentName": "[parameters('deploymentName')]",
            "modelVersion": "4",
            "scaleSettings": {
              "scaleType": "Standard"
            }
          }
        }
      ]
    }
  ],
  "parameters": {
    "openAIName": {
      "type": "string"
    },
    "location": {
      "type": "string",
      "defaultValue": "eastus"
    },
    "openAIDomain": {
      "type": "string",
      "metadata": {
        "description": "Custom subdomain name for the OpenAI service."
      }
    },
    "deploymentName": {
      "type": "string",
      "defaultValue": "gpt4-deployment",
      "metadata": {
        "description": "Name for the GPT-4 model deployment."
      }
    }
  },
  "outputs": {
    "openAIEndpoint": {
      "type": "string",
      "value": "[reference(parameters('openAIName')).properties.endpoint]"
    },
    "openAIKey": {
      "type": "string",
      "value": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts', parameters('openAIName')), '2021-10-01').key1]"
    }
  }
}

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,377 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Javier Ávarez De Celis 10 Reputation points
    2024-11-12T09:37:58.9466667+00:00

    Here is the template to solve this:

            {
                "type": "Microsoft.CognitiveServices/accounts",
                "apiVersion": "2024-06-01-preview",
                "name": "[parameters('openAIName')]",
                "location": "[parameters('location')]",
                "sku": {
                    "name": "[parameters('skuOpenAI')]"
                },
                "kind": "OpenAI",
                "properties": {
                    "customSubDomainName": "[parameters('openAIDomain')]",
                    "publicNetworkAccess": "Enabled"
                }
            },
            {
                "type": "Microsoft.CognitiveServices/accounts/deployments",
                "apiVersion": "2024-06-01-preview",
                "name": "[concat(parameters('openAIName'), '/gpt-4')]",
                "dependsOn": [
                    "[resourceId('Microsoft.CognitiveServices/accounts', parameters('openAIName'))]"
                ],
                "sku": {
                    "name": "GlobalStandard",
                    "capacity": 8
                },
                "properties": {
                    "model": {
                        "format": "OpenAI",
                        "name": "gpt-4",
                        "version": "turbo-2024-04-09"
                    },
                    "versionUpgradeOption": "OnceNewDefaultVersionAvailable",
                    "currentCapacity": 8
                }
            },
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.