Blog home > , , , , > How to migrate production ready AI apps to Azure OpenAI Service

How to migrate production ready AI apps to Azure OpenAI Service

Open to anyone with an idea

Microsoft for Startups Founders Hub brings people, knowledge and benefits together to help founders at every stage solve startup challenges. Sign up in minutes with no funding required.

As a startup in Founders Hub, you can get started with $2,500 of OpenAI credits to begin experimenting with powerful AI models on day one. As you prepare to roll out your solution into production, your available Azure credits (up to $150K) can then be applied towards Azure OpenAI Service.

We’re often asked how to weigh the differences between these two options. This post aims to clarify the key benefits of transitioning to Azure OpenAI Service.

With Azure OpenAI Service, you still get access to the same remarkable OpenAI models like GPT-3, DALL-E 2, and Codex through simple API calls. But now these capabilities are enhanced by Microsoft Azure’s enterprise-grade security, compliance, support, availability, and responsible AI practices.

Whereas OpenAI provides raw access to models, Azure OpenAI Service empowers you to build on top of them in smarter ways:

  • Pre-trained solutions allow instant deployment so you can focus on customization rather than implementation
  • Auto-scaling infrastructure enables quick prototyping and seamless transition to production
  • Higher performance handles more requests per second and delivers faster response times
  • Greater scalability adjusts up or down to your needs, so you only pay for what you use
  • Enhanced security is backed by Azure’s secure cloud platform with encryption, compliance, and privacy
  • Higher reliability guarantees 99.9% uptime to minimize disruption
  • Robust support provides documentation and technical experts to assist you

By making the leap from OpenAI to Azure OpenAI Service, startups can accelerate innovation, reduce risk, and get the most value from their AI investments.

How to transition to Azure OpenAI Service?

Section 1: Get Access to Azure OpenAI

  1. Switching from OpenAI to Azure OpenAI is easy and straightforward. Here are the steps you need to follow:
    Create an Azure account: If you don’t have an Azure account yet, you can create one for free [here](https://azure.microsoft.com/en-us/free/). You can join the Microsoft for Startups program (Founder’s Hub) and get free credit to use for any Azure service.
  2. Request access to Azure OpenAI: Once you have an Azure account, you can request access to Azure OpenAI [here](https://azure.microsoft.com/en-us/services/openai/). You will need to provide some information about yourself and your use case for GPT-3. You will also need to agree to the terms and conditions of the service.
  3. Wait for approval: After you submit your request, you will receive an email confirmation. You will then have to wait for Microsoft to review your request and grant you access to Azure OpenAI. This may take a few days or weeks, depending on the demand and availability of the service.
  4. Create an Azure OpenAI resource: Once you receive an email notification that your request has been approved, you can create an Azure OpenAI resource [here](https://portal.azure.com/#create/Microsoft.OpenAIService). You will need to choose a subscription, a resource group, a region, a pricing tier, and a resource name. You will also need to enable the GPT-3 endpoint that you want to use (beta or production).

Get your API key: After you create your Azure OpenAI resource, you can get your API key here.  You will need this key to authenticate your requests to the GPT-3 endpoint, instructions here.

Section 2: Deploy GPT Model on Azure OpenAI Studio

  1. Check the prerequisites for creating a resource and deploying a model using Azure OpenAI. (Access granted to Azure OpenAI in the desired Azure subscription)
  2. Create a resource using the Azure portal or other methods
  3. Deploy a model using Azure OpenAI Studio and select a model from the available options
  4. Adjust the advanced options for your deployment such as content filter and tokens per minute rate limit
  5. Check the status of your deployment and wait for it to succeed
  6. Create a system prompt
  7. Add your data using Azure OpenAI Studio:
  • Navigate to Azure OpenAI Studio and sign-in with credentials that have access to your Azure OpenAI resource.
  • Select the Chat playground tile.
  • On the Assistant setup tile, select Add your data (preview) > + Add a data source.
  • In the panel that appears, select Upload files under Select data source. Select Upload files. Azure OpenAI needs both a storage resource and a search resource to access and index your data.
  • For documents and datasets with long text, it is recommended to use the available data preparation script.
  • For Azure OpenAI to access your storage account, you will need to turn on Cross-origin resource sharing (CORS). If CORS isn’t already turned on for the Azure Blob storage resource, select Turn on CORS.
  • Select your Azure Cognitive Search resource, and select the acknowledgment that connecting it will incur usage on your account. Then select Next.
  • On the Upload files pane, select Browse for a file and select the files you want to upload. Then select Upload files. Then select Next.
  • Review the details you entered, and select Save and Close.
  • The model will use information from your data to construct the response.

Section 3: Migrated and Refined Existing OpenAI Endpoint to Azure OpenAI

OpenAI uses the model keyword argument to specify what model to use. Azure OpenAI has the concept of deployments and uses the deployment_id keyword argument to describe which model deployment to use.

Here is an example code snippet:

Azure Openai
import openai
openai.api_key = “sk-…”
openai.organization = “…”

Azure OpenAI.
import openai
openai.api_type = “azure”
openai.api_key = “…”
openai.api_base = “https://example-endpoint.openai.azure.com”
openai.api_version = “2023-05-15” # subject to change

You can use Azure Active Directory authentication for Azure OpenAI.
import openai
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
token = credential.get_token(“https://cognitiveservices.azure.com/.default”)
openai.api_type = “azuread”
openai.api_key = token.token
openai.api_base = “https://example-endpoint.openai.azure.com”
openai.api_version = “2023-05-15” # subject to change

You can learn more here. Finally, you need to test your code and make sure everything works as expected. You can use the same methods and parameters as before, and you should get the same results from the Azure OpenAI service as from the OpenAI service. However, you might notice some improvements in performance, reliability, security, and scalability, as well as access to additional features and services from Azure.

That’s it! You have successfully migrated from OpenAI to Azure OpenAI, and you can now enjoy the best of both worlds.

In summary, migrating from OpenAI to Azure OpenAI offers an array of compelling benefits, empowering your AI applications with greater performance, scalability, security, reliability, and support. By leveraging the powerful GPT-4 model and the extensive suite of AI tools and services provided by Azure, you can unlock a new realm of possibilities for your startup.

 

Microsoft for Startups Founders Hub members receive Azure cloud credits that can be used toward Azure OpenAI Service or OpenAI to help build their product. Sign up now.

Tags: , , , ,

Blog home > , , , , > How to migrate production ready AI apps to Azure OpenAI Service

How to migrate production ready AI apps to Azure OpenAI Service

Microsoft for Startups, Founders Hub

Open
to anyone with an idea

Microsoft for Startups Founders Hub brings people, knowledge and benefits together to help founders at every stage solve startup challenges. Sign up in minutes with no funding required.

As a startup in Founders Hub, you can get started with $2,500 of OpenAI credits to begin experimenting with powerful AI models on day one. As you prepare to roll out your solution into production, your available Azure credits (up to $150K) can then be applied towards Azure OpenAI Service.

We’re often asked how to weigh the differences between these two options. This post aims to clarify the key benefits of transitioning to Azure OpenAI Service.

With Azure OpenAI Service, you still get access to the same remarkable OpenAI models like GPT-3, DALL-E 2, and Codex through simple API calls. But now these capabilities are enhanced by Microsoft Azure’s enterprise-grade security, compliance, support, availability, and responsible AI practices.

Whereas OpenAI provides raw access to models, Azure OpenAI Service empowers you to build on top of them in smarter ways:

  • Pre-trained solutions allow instant deployment so you can focus on customization rather than implementation
  • Auto-scaling infrastructure enables quick prototyping and seamless transition to production
  • Higher performance handles more requests per second and delivers faster response times
  • Greater scalability adjusts up or down to your needs, so you only pay for what you use
  • Enhanced security is backed by Azure’s secure cloud platform with encryption, compliance, and privacy
  • Higher reliability guarantees 99.9% uptime to minimize disruption
  • Robust support provides documentation and technical experts to assist you

By making the leap from OpenAI to Azure OpenAI Service, startups can accelerate innovation, reduce risk, and get the most value from their AI investments.

How to transition to Azure OpenAI Service?

Section 1: Get Access to Azure OpenAI

  1. Switching from OpenAI to Azure OpenAI is easy and straightforward. Here are the steps you need to follow:
    Create an Azure account: If you don’t have an Azure account yet, you can create one for free [here](https://azure.microsoft.com/en-us/free/). You can join the Microsoft for Startups program (Founder’s Hub) and get free credit to use for any Azure service.
  2. Request access to Azure OpenAI: Once you have an Azure account, you can request access to Azure OpenAI [here](https://azure.microsoft.com/en-us/services/openai/). You will need to provide some information about yourself and your use case for GPT-3. You will also need to agree to the terms and conditions of the service.
  3. Wait for approval: After you submit your request, you will receive an email confirmation. You will then have to wait for Microsoft to review your request and grant you access to Azure OpenAI. This may take a few days or weeks, depending on the demand and availability of the service.
  4. Create an Azure OpenAI resource: Once you receive an email notification that your request has been approved, you can create an Azure OpenAI resource [here](https://portal.azure.com/#create/Microsoft.OpenAIService). You will need to choose a subscription, a resource group, a region, a pricing tier, and a resource name. You will also need to enable the GPT-3 endpoint that you want to use (beta or production).

Get your API key: After you create your Azure OpenAI resource, you can get your API key here.  You will need this key to authenticate your requests to the GPT-3 endpoint, instructions here.

Section 2: Deploy GPT Model on Azure OpenAI Studio

  1. Check the prerequisites for creating a resource and deploying a model using Azure OpenAI. (Access granted to Azure OpenAI in the desired Azure subscription)
  2. Create a resource using the Azure portal or other methods
  3. Deploy a model using Azure OpenAI Studio and select a model from the available options
  4. Adjust the advanced options for your deployment such as content filter and tokens per minute rate limit
  5. Check the status of your deployment and wait for it to succeed
  6. Create a system prompt
  7. Add your data using Azure OpenAI Studio:
  • Navigate to Azure OpenAI Studio and sign-in with credentials that have access to your Azure OpenAI resource.
  • Select the Chat playground tile.
  • On the Assistant setup tile, select Add your data (preview) > + Add a data source.
  • In the panel that appears, select Upload files under Select data source. Select Upload files. Azure OpenAI needs both a storage resource and a search resource to access and index your data.
  • For documents and datasets with long text, it is recommended to use the available data preparation script.
  • For Azure OpenAI to access your storage account, you will need to turn on Cross-origin resource sharing (CORS). If CORS isn’t already turned on for the Azure Blob storage resource, select Turn on CORS.
  • Select your Azure Cognitive Search resource, and select the acknowledgment that connecting it will incur usage on your account. Then select Next.
  • On the Upload files pane, select Browse for a file and select the files you want to upload. Then select Upload files. Then select Next.
  • Review the details you entered, and select Save and Close.
  • The model will use information from your data to construct the response.

Section 3: Migrated and Refined Existing OpenAI Endpoint to Azure OpenAI

OpenAI uses the model keyword argument to specify what model to use. Azure OpenAI has the concept of deployments and uses the deployment_id keyword argument to describe which model deployment to use.

Here is an example code snippet:

Azure Openai
import openai
openai.api_key = “sk-…”
openai.organization = “…”

Azure OpenAI.
import openai
openai.api_type = “azure”
openai.api_key = “…”
openai.api_base = “https://example-endpoint.openai.azure.com”
openai.api_version = “2023-05-15” # subject to change

You can use Azure Active Directory authentication for Azure OpenAI.
import openai
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
token = credential.get_token(“https://cognitiveservices.azure.com/.default”)
openai.api_type = “azuread”
openai.api_key = token.token
openai.api_base = “https://example-endpoint.openai.azure.com”
openai.api_version = “2023-05-15” # subject to change

You can learn more here. Finally, you need to test your code and make sure everything works as expected. You can use the same methods and parameters as before, and you should get the same results from the Azure OpenAI service as from the OpenAI service. However, you might notice some improvements in performance, reliability, security, and scalability, as well as access to additional features and services from Azure.

That’s it! You have successfully migrated from OpenAI to Azure OpenAI, and you can now enjoy the best of both worlds.

In summary, migrating from OpenAI to Azure OpenAI offers an array of compelling benefits, empowering your AI applications with greater performance, scalability, security, reliability, and support. By leveraging the powerful GPT-4 model and the extensive suite of AI tools and services provided by Azure, you can unlock a new realm of possibilities for your startup.

 

Microsoft for Startups Founders Hub members receive Azure cloud credits that can be used toward Azure OpenAI Service or OpenAI to help build their product. Sign up now.