MicrosoftDocs / azure-docs-sdk-python

Azure Python SDK documentation, hosted on docs.microsoft.com.

Home Page:https://docs.microsoft.com/python/api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create AOAI deployment with cogservices create API without passing in account (instead pass key + endpoint)

nanditamohan opened this issue · comments

I want to create a AOAI model deployment using this API, since its the only one which supports deployment_name being set (OAI api does not support this: openai/openai-python#457):

I was suggested to do this:

from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient
client = CognitiveServicesManagementClient(credential=<credential>, subscription_id=<subscription_id>)

deployment = client.deployments.begin_create_or_update(
    resource_group_name="<resource_group_name>",
    account_name="<account_name>",
    deployment_name="<deployment_name>",
    deployment={
        "properties": {
          "model": {
            "format": "OpenAI",
            "name": "<model name>",
            "version": "<model version>"
          },
          "scaleSettings": {
            "scaleType": "Standard"
          }
        }
    }
)

However, what I'm building does not have access to the Cog Services account name and rg, sub - but only has the AzureML subscription, resourceGroup as well as AzureOpenAI account base, key, version and type. Is there a way to use this library to create a deployment with that information instead of account info?

Thanks for the help!