“Over the past decade, innovative applications of deep neural networks coupled with increasing computational power have led to continuous AI breakthroughs in areas such as vision, speech, language processing, translation, robotic control and even gaming. Modern AI systems work well for the specific problem on which they’ve been trained, but getting AI systems to help address some of the hardest problems facing the world today will require generalization and deep mastery of multiple AI technologies.OpenAI and Microsoft’s vision is for artificial general intelligence to work with people to help solve currently intractable multidisciplinary problems, including global challenges such as climate change, more personalized healthcare, and education.”
“AI is one of the most transformative technologies of our time and has the potential to help solve many of our world’s most pressing challenges,” said Satya Nadella, CEO, Microsoft. “By bringing together OpenAI’s breakthrough technology with new Azure AI supercomputing technologies, our ambition is to democratize AI — while always keeping AI safety front and center — so everyone can benefit.”
The above quotes and the reflection is where Azure OpenAI Service comes in. Azure OpenAI Service is now General Availability state. In this blog post, I thought I would share a few tips to get easily started with the Azure OpenAI Service.
OpenAI is a company focused on AI research and development. For the businesses, organizations and individuals, Generative Pre-trained Transformer (GPT), the powerful natural language model implementation, developed by OpenAI, became an instant hit, because of its potential to transform the businesses. Azure OpenAI Service is a new Azure Cognitive Service that provides REST API access to OpenAI’s powerful language models including the GPT-3, Codex and Embeddings model series with enterprise capabilities such as security, compliance, and regional availability that are available only on Azure. When thinking about leveraging Azure OpenAI Service in our solution, it is very important to find out what the Azure OpenAI Service can do for us, what problems we can use OpenAI API to solve?
In general, the large-scale, generative AI models with deep understandings of language and code, developed by OpenAI, could be used in scenarios where we would use natural language processing models trained with deep learning. Some examples use cases, where you can use, could be writing assistance, code generation, and reasoning over data. Looking into the examples provided in the Azur OpenAI Studio for a deployment with GPT-3 Davinci Model, can sure help relating to scenarios we can leverage the capabilities for: Summarize Text, Classify Text, Natural Language to SQL, General New Product Names, English to French, Parse unstructured data, Classification. We will discuss some of these examples in detail, in this blog post. The potential really is limitless, in my opinion. One real life example is discussed in the article: Build: Azure OpenAI Service helps customers accelerate innovation with large AI models; Microsoft ex...
And yes, I could use OpenAI to write this blog post. I haven’t written yet; however, I am sure that would be a much better experience to explore out.
OpenAI developed powerful models like GPT-3, Code, DALL-E. Currently, Azure OpenAI Service makes the GPT-3.5, Codex, and DALL•E 2 models generally available for businesses. GPT-3 model in general works with natural languages, Codex models are to generate codes from natural languages, while DALL·E 2 could be used to create images given a description in natural language. With each model though, we would have to understand the model capabilities so we can effectively use it for our intended scenarios.
Take for example, the GPT-3 model. We have Ada, Babbage, Curie and Davinci as the model names. Davinci is the most capable model, in terms of the task it can perform with the instruction (prompt) we provide. Ada is the lowest capable model; however, it is the fastest. Please note that, Azure OpenAI Service uses the following naming convention for the models for easy exploration of their abilities:
Keeping this naming convention, an example model to be deployed, would be text-davinci-003, where text representing the GPT-3 model. If we would like to work with Codex model, then the model’s name may look like code-davinci-002. Please note that the exact model’s name will vary based on the region you provision the service and the current available models in Azure OpenAI Service. Here is a snapshot of the available models, when I provisioned the service in South Central US
For more information on the OpenAI models, available in Azure OpenAI service, refer to Azure OpenAI models - Azure OpenAI | Microsoft Learn
When working with Azure OpenAI Service, getting a firm grasp of the key concepts is really the key to get the most out of the Azure OpenAI Service API calls. The key concepts are:
Simply put, the input you give to the OpenAI models, through the API call is the Prompt. The output, generated by the API and returned to you, is Completion. The API endpoint, that you present your input, will attempt to match the context or pattern, from your text (of the prompt), to create the completion.
For example, when I enter “How is the weather today at Irving, TX?”, in the Azure OpenAI studio, for a target deployment (the API endpoint), it returns, “The weather is sunny and warm with a high of 86 degrees.”. My question is the Prompt in the example and the response I get back is the Completion.
As we can see, formulation of effective Prompt, giving the correct context, is very important exercise to get the most relevant Completion and we have to master this aspect.
Token is how the models, behind the API calls, would understand and process the Prompts, as they break down the prompts (tokenize) into token. These tokens can be as simple as words or combinations of characters.
Finally, the Models are the brains, working behind the API call (the deployments). Ada, Babbage, Curie and Davinci are some of the model names, for example, for the GPT-3 model, we can use it for understanding or generating natural language or code.
To understand the capabilities and use the different OpenAI models to solve big problems, and imagine what’s possible, the best place to start is the Azure OpenAI Studio. Upon provisioning the Azure OpenAI service, you would first want to explore the service capabilities, navigating to the Azure OpenAI studio.
In the Azure OpenAI studio, there are various examples for prompt completions that you can explore out. One important step, before exploring any capability is to deploy a model though. To deploy a model, you first would open the playground, which you can navigate to, simply by clicking on the “Experiment with prompt completions” (or more appropriately clicking on the link “Go to playground”) option.
Once in the playground, there are three important areas to explore.
First the “Models” tab, under Management section. These are models, developed by OpenAI, that are currently available to explore (please refer to Language Model Section above for a reference screenshot).
Next up is the “Deployments” tab under Management section. To explore the models available, we first need to deploy a model, by clicking “+Create a new deployment” option, under the “Deployments” tab. The screenshot below shows the dialog to select a model when you click on “+Create a new deployment” button. Please note that, if you have already created a deployment using one of the models, that model will not be available to create another deployment, that model will be moved under “Already deployed” section.
Now that you have the deployment, let us explore what the model can do for us, by navigating to the “Playground” tab. When you move to the “Playground” tab, you may see a deployment selected by default, under the “Deployment” area. While we can look on the parameters to control the response generated by the model, in the blog, I will only explore the default result behavior. Let us go through a few scenarios.
I would like to summarize some random text, so I pick up some text from the internet about Davos 2023 – World Economic Forum. I enter the following in the text area and then click “Generate”:
“Davos 2023: Latest Updates From the World Economic Forum
And here is the response I get:
Another scenario, I would like to have the deployment to write some code for me. I type:
Write a function to convert Fahrenheit to Celsius
And here is the result I get back:
Impressive, no? This is just a quick random test to get a first impression of the un-tapped power of Azure OpenAI Service. We can investigate the “Examples” by “Loading an example” option to explore further. The more you explore the playground, the more familiar you get with how the models work for you. This is the key to finding out which OpenAI API capabilities are better suited for your problem scenario.
Now that I have a deployment of a certain model in my Azure OpenAI Service, can I send a REST API requests to the deployment? Absolutely, and it is very simple. I have used Visual Studio code, with Python language to try out a simple call. Azure OpenAI Studio “Playground” made it even simpler to try this API call.
I took the sample and simply created the python file to test the API call, in visual studio. Here is the screenshot of the python run, with the response from the API call:
While sophisticated applications (i.e., generate DAX query in PowerBI, use Azure OpenAI with other Azure Cognitive Service to create powerful end to end business application etc.) will be typical development projects, leveraging the OpenAI API calls, the above run though is an attempt to get you easily started and get familiarize yourself with Azure OpenAI Service. Once you are up and running, you can customize your model for your advanced application leveraging fine-tuning process. The possibilities are unlimited.
I will deep dive with more Azure OpenAI Service capabilities in future blogs, in the hopefully this blog will help you get started and explore the possibilities.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.