Getting Started with Azure OpenAI Service With an Example of GPT Turbo Model

Introduction

Microsoft has provided Azure OpenAI service, a cloud solution to deploy, customize, and host large language models. It provides you with the best of OpenAI's latest models and APIs with security and scalability in the Azure Cloud platform. For this, we all know that Microsoft has partnered with OpenAI to enable Azure OpenAI users to get access to and use the newest language model innovations in the cloud platform.

Let's get to models currently supported in Microsoft Azure. Below are the models that the Azure OpenAI supports.

  • GPT-4 models: These are the latest generation of GPT models, which can generate code completion and natural language based on the natural language prompts.
  • GPT 3.5 models: Based on the natural language prompt, it can generate natural language and code completion. GPT-35-turbo models are designed for chat-based interactions, as it work perfectly with most generative AI scenarios.
  • Embedding models: These models generate numeric vectors based on the input text and is useful in language analytics. These models compare the text sources for similarities.
  • Dalle models: Based on natural language, it generates images. Currently, it is in preview mode.

This article demonstrates the following.

  • Create a resource group for Open AI.
  • Create Azure OpenAI service.
  • Demo to use Azure OpenAI Studio.
  • Create and Deploy your Azure OpenAI model in Azure OpenAI studio and get the Endpoint and key of the service.

Now, let’s jump to get started with Azure OpenAI Service.

Prerequisites

You need to have the following things to get started with OpenAI learning tutorials:

  • Azure subscription, which has been approved for the Azure OpenAI service.

You can sign up for a free Azure Subscription here:  https://azure.microsoft.com/free

  • Access to OpenAI Service

And then you can request to access the Azure OpenAI service here: https://aka.ms/oaiapply

Let’s begin with the steps:

Create Resource Group

In this section, we will create a resource group that we will use for Azure OpenAI Service later in the demonstration.

Step 1: Create a new Resource group for Azure OpenAI service under the subscription that has OpenAI service enabled.

Azure Image

Give the resource group name and choose the available region. At the time of this article write up there are certain regions that have only access to the Azure OpenAI service. So for available region you can check here.

Step 2: Review and Create

Once the region is selected you can click on Review and create and then click on create.

Review And create

Creating an Open AI Service

Step 1. Create OpenAI service

Now, we will create a new Azure OpenAI service. For this, go to Azure OpenAI service and click on Create.

Create

Then, provide details as shown below and click on Next. Note: if you have multiple resource groups, then select the one that has access to Open AI Service. I didn’t have a resources group that has access to Open AI, so I just created it in the previous section. If you already have one, then you don’t have to create a new one.

Next

Step 2. Select the network as per your need.

Network

Step 3. Now, we will give tags.

Tags

After that, click on Create as depicted below.

Create Tags

Deployment may take a few seconds.

 Microsoft Azure

Now, your Open AI service is created. You can go to your service and explore the Azure OpenAI Studio further.

OpenAI Studio

Deploying OpenAI Model in Azure OpenAI Studio

In this section, we will learn to deploy OpenAI models in Azure OpenAI Studio.

Step 1. Log in to your OpenAI Studio, where you can deploy, manage, and explore the AI models. Firstly, we need to create a new deployment for a model in OpenAI studio.

Service

This article will demonstrate a sample example of the GPT-35 turbo model.

Step 2. Click on Create New Deployment and provide the information as depicted below.

  • Model: gtp-35-turbo
  • Model version: default
  • Deployment name: my-gpt-demo-model

Then click on the Create button.

Deploy model

Step 3. Go to the playground.

In the left pane of Azure OpenAI studio, go to completion under the Playground as shown below.

Completion

Step 4. Select your model in Deployments, and in the Examples dropdown, you can see there are lots of options; however, we will select Generate a quiz. So, our model will generate a quiz.

Generate Quiz

At the bottom, we have to set the number of tokens detected in the text. Tokens are the basic units of prompts-essentially words or word-parts in the text.

Once you select the example: generate quiz option, you will get the summary of the quiz as illustrated below.

Gererate

Step 5. Get the Endpoint and Key

Once it is generated, you can go to the View code section and get the Endpoint and key of the service, and then you can use it in your application.

Additionally, you can get the sample code in different languages such as Python, json, C3, and curl.

Python

Conclusion

Hence, this article has demonstrated how to get started with Azure OpenAI services as well as how to create an OpenAI service and deploy the OpenAI model with an example of the GPT turbo model to generate a quiz with all necessary steps. I hope you will find it useful to create your own OpenAI service and integrate it into your application.

References