How to use CLI for developing Azure OpenAI project?

Gryffin Tuong 20 Reputation points
2024-04-12T23:02:53.74+00:00

I want to CLI for automatically deploying my azure OpenAI project, is that possible and how? I read all the cook book and but no idea how to do so.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,687 questions
0 comments No comments
{count} votes

Accepted answer
  1. YutongTie-MSFT 47,991 Reputation points
    2024-04-12T23:27:01.9133333+00:00

    @Gryffin TuongThanks for reaching out to us, you can refer to the document here - https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/azure-developer-cli

    Please make sure Azure Developer CLI installed on your machine, please check on the document for instructions or check on below steps.

    Clone and initialize the Azure Developer CLI template

    For the steps ahead, clone and initialize the template.

    BashAI ConvertCopy

    azd init --template openai-chat-your-own-data
    

    The azd init command prompts you for the following information:

    Environment name: This value is used as a prefix for all Azure resources created by Azure Developer CLI. The name must be unique across all Azure subscriptions and must be between 3 and 24 characters long. The name can contain numbers and lowercase letters only.
    

    Use the template to deploy resources

    Sign-in to Azure:

    BashAI ConvertCopy

    azd auth login
    

    Provision and deploy the OpenAI resource to Azure:

    BashAI ConvertCopy

    azd up
    

    azd prompts you for the following information:

    Subscription: The Azure subscription that your resources are deployed to.
    
       Location: The Azure region where your resources are deployed.
      
      **Note**
      
      The sample `azd` template uses the `gpt-35-turbo-16k` model. A recommended region for this template is East US, since different Azure regions support different OpenAI models. You can visit the **[Azure OpenAI Service Models](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models)** support page for more details about model support by region.
      
      **Note**
      
      The provisioning process may take several minutes to complete. Wait for the task to finish before you proceed to the next steps.
      
      Click the link `azd` outputs to navigate to the new resource group in the Azure portal. You should see the following top level resources:
      
          An Azure OpenAI service with a deployed model
         
             An Azure Storage account you can use to upload your own data files
            
                An Azure AI Search service configured with the proper indexes and data sources
               
    

    Upload data to the storage account

    azd provisioned all of the required resources for you to chat with your own data, but you still need to upload the data files you want to make available to your AI service.

    1. Navigate to the new storage account in the Azure portal.
    2. On the left navigation, select Storage browser.
    3. Select Blob containers and then navigate into the File uploads container.
    4. Click the Upload button at the top of the screen.
    5. In the flyout menu that opens, upload your data.

    Note

    The search indexer is set to run every 5 minutes to index the data in the storage account. You can either wait a few minutes for the uploaded data to be indexed, or you can manually run the indexer from the search service page.

    Connect or create an application

    After running the azd template and uploading your data, you're ready to start using Azure OpenAI on Your Data. See the quickstart article for code samples you can use to build your applications.

    Clone and initialize the Azure Developer CLI template

    For the steps ahead, clone and initialize the template.

    BashAI ConvertCopy

    azd init --template openai-chat-your-own-data
    

    The azd init command prompts you for the following information:

    Environment name: This value is used as a prefix for all Azure resources created by Azure Developer CLI. The name must be unique across all Azure subscriptions and must be between 3 and 24 characters long. The name can contain numbers and lowercase letters only.
    

    Use the template to deploy resources

    Sign-in to Azure:

    BashAI ConvertCopy

    azd auth login
    

    Provision and deploy the OpenAI resource to Azure:

    BashAI ConvertCopy

    azd up
    

    azd prompts you for the following information:

    Subscription: The Azure subscription that your resources are deployed to.
    
       Location: The Azure region where your resources are deployed.
      
       Note
      
      The sample `azd` template uses the `gpt-35-turbo-16k` model. A recommended region for this template is East US, since different Azure regions support different OpenAI models. You can visit the [Azure OpenAI Service Models](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models) support page for more details about model support by region.
      
       Note
      
      The provisioning process may take several minutes to complete. Wait for the task to finish before you proceed to the next steps.
      
      Click the link `azd` outputs to navigate to the new resource group in the Azure portal. You should see the following top level resources:
      
          An Azure OpenAI service with a deployed model
         
             An Azure Storage account you can use to upload your own data files
            
                An Azure AI Search service configured with the proper indexes and data sources
               
    

    Upload data to the storage account

    azd provisioned all of the required resources for you to chat with your own data, but you still need to upload the data files you want to make available to your AI service.

    1. Navigate to the new storage account in the Azure portal.
    2. On the left navigation, select Storage browser.
    3. Select Blob containers and then navigate into the File uploads container.
    4. Click the Upload button at the top of the screen.
    5. In the flyout menu that opens, upload your data.

     Note

    The search indexer is set to run every 5 minutes to index the data in the storage account. You can either wait a few minutes for the uploaded data to be indexed, or you can manually run the indexer from the search service page.

    Connect or create an application

    After running the azd template and uploading your data, you're ready to start using Azure OpenAI on Your Data. See the quickstart article for code samples you can use to build your applications.

    Please let us know if you need more help.

    Regards,

    Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.


0 additional answers

Sort by: Most helpful