Azure OpenAI: A Beginner’s Guide

alpa buddhabhatti
8 min readFeb 10, 2024

--

What is Azure OpenAI

Azure OpenAI is a suite of AI services that allows you to apply natural language algorithms on your data without any prior knowledge of math, data science, or machine learning. It can help you make your app more intelligent without writing actual code for natural languages.

Azure OpenAI refers to the collaboration between Microsoft Azure (a cloud computing platform), and OpenAI (an artificial intelligence research organization).

Why use Azure OpenAI

It includes a wide range of capabilities, including natural language processing, computer vision, speech recognition, and more. One of the key features of Azure OpenAI is its ability to generate high-quality, human-like text using advanced language models.

With Azure OpenAI, you can leverage these language models to perform a variety of tasks on your data.

For example,

  1. Summarize large files or documents
  2. Extracting the most important information and presenting it in a concise format.
  3. Q&A App (Ask questions about your private data or Public Data(internet), and get answers that are based on the latest available information.)
  4. To generate code automatically.
  5. To analyze and summarize other types of media, such as video or image files.
  6. Ask Natural languages query to your Structure Data (Help to build a SQL query from English Text and generate result as well.)
  7. Writing a Blog, Email, Testcases, Sample data & description based on Specification, etc.
  8. And many more

How to consume Azure OpenAI

Azure OpenAI provides a web app that enables you to consume your model with just a few clicks. Additionally, it generates code for you in JSON, which can help you understand it more. The service uses models that are built based on text, code, or embeddings. You can apply simple or semantic search on your private data or on public data from internet data.

Where to start your journey with Azure OpenAI

As you become more familiar with Azure OpenAI, you can explore more advanced features such as Azure Cognitive Search and vector databases with embedding models.

What else do I need to know about Azure OpenAI

To fully utilize Azure OpenAI, you need Azure Cognitive Search or a vector database. For a vector database, you must use an embedding model as well.

RBAC permission & Role

DEMO 1: Apply Azure Open AI on public Data(over internet)

Lets create an Azure OpenAI on Open Data

By following these steps, users can easily understand the process of setting up, testing, deploying, and utilizing the Azure OpenAI service.

  1. Create Azure OpenAI Instance: Set up an Azure OpenAI instance as the first step.
  2. Test with Math Query: Use the search box to input a simple math query like ‘2 + 2 =?’.Verify that the result is displayed as ‘4’.
  3. Test with Location Query: Inquire about local information, for example, ‘Where can I pick a train in Northampton?’ Observe and confirm that the system provides the address of the train location in Northampton.
  4. One-Click Deployment: If you have the necessary permissions, deploy the Azure OpenAI instance with a single click, generating a Web App for you. NOTE that you need Client Id and Secret so either you need permission to create App Registration or you need to have Client Id
  5. Automatic Code Generation: The system will automatically generate code snippets in various formats such as JSON, C#, CURL, and more.
  6. Endpoint and Key Provision: The deployment process will also provide you with an endpoint and a key, enabling you to call the Azure OpenAI service effectively.

DEMO 2: Apply Azure Open AI on your Own Data(Private data)

Let’s create an Azure OpenAI model using your own data stored in Azure Data Lake Gen2.

High-level Design diagram :

Following Azure Resources are required:

  1. Create an Azure AI Search.
  2. Create Azure Blob Storage with Container.
  • In the Azure portal, create a new Azure Blob Storage resource.
  • Within the storage account, create a container to hold your files (e.g., PDFs).

3. Upload a PDF File:

  • Upload your desired *.pdf file to the container you created in step 3.

4. Create an Azure OpenAI Instance.

5. Model Deployment:

  • Deploy your trained model to the Azure OpenAI instance you created in step 4.

6. Chat Playground — Add Your Data:

  • Access the Chat Playground feature.
  • Choose Azure Blob Storage as your data source.
  • Configure properties like Blob storage, Container, and Azure OpenAI.
  • Provide a suitable index name and select options other than Vector search.

7. Generate an Index:

  • The system will generate an index based on your configuration.
  • You can view this index in the Azure AI service.

8. Test with a Query:

  • Use a query based on your data (e.g., “Can you please give me a list of hotels in Dubai?”).
  • The system will retrieve relevant information from the file stored in Azure Blob Storage.

9. One-Click Deployment:

  • If you have the necessary permissions, deploy the Azure OpenAI instance with a single click.
  • This will generate a Web App for you.
  • Note that you’ll need a Client ID and Secret. Ensure you have permission to create an App Registration or obtain the Client ID.

10. Automatic Code Generation:

  • The system will automatically generate code snippets in various formats (JSON, C#, CURL, etc.) for your deployment.
  • When you Click on View code , you will also see below which you need in step 11.

11. Endpoint and Key Provision:

  • The Model deployment process will provide you with an endpoint and a key.
  • You can use these to call the Azure OpenAI service effectively.

How can Azure OpenAI be integrated into Azure Data Factory pipelines, Azure Synapse Data Integration pipelines, or Microsoft Fabric using a no-code approach

You can consume Azure OpenAI as Rest API. Let see how to consume it using Azure Data Factory

  • In your ADF pipeline, add a web activity.
  • Configure the web activity to make an HTTP request to the Azure OpenAI REST API endpoints.
  • Pass the necessary parameters (such as prompts or input data) to the API.
  • Handle the responses within your ADF pipeline.

Note — Same idea works in Azure Synapse Data Integration Pipeline & Microsoft Fabric

How to test Azure OpenAI using Postman?

Using Azure OpenAI Rest URL+Key +API version +Content-Type, you can call Azure OpenAI to Postman as below .

Few Keywords:

Large Language Models (LLMs) : Prebuild model ChatGPT and GPT-4

Token: A token is a piece of text that the model reads or writes. For example, “hello” is one token, and “.” is another token.

Prompt: A prompt is the text that you give to the model as input. For example, “Write a poem about love” is a prompt.

Completion: A completion is the text that the model gives you as output based on the prompt. For example, “Love is a feeling that fills the heart / With joy and warmth and light” is a completion.

Embedding: An embedding is a number that represents the meaning of the text. For example, the embedding of “cat” is closer to the embedding of “dog” than to the embedding of “car”.

Temperature: Temperature is a number that controls how creative or predictable the model’s output is. For example, with high temperature, the model might write “Love is a fire that burns the soul / With passion and fury and pain”. With low temperature, the model might write “Love is a bond that connects two people / With trust and respect and care”.

Few Tips:

Patience After Deployment: After deploying a model in Azure OpenAI, it’s essential to be patient. Sometimes, there might be initial hiccups or errors. Give it a little time to settle down and stabilize. If you encounter any issues, Refresh the page periodically to see if the issue resolves.

Semantic Search and Index Settings: When using Semantic Search with Azure AI Search, ensure that your search index is configured appropriately for semantic capabilities.

Region Selection: Choose the right region for both Azure OpenAI and Azure AI Search. Keep in mind that Azure OpenAI might not be available in all regions.

Azure AI Search SKU: When setting up Azure AI Search, consider using at least the Basic SKU.

Plan Selection for AI Search: If you’re using Bring Your Own Data with Azure AI Search, pay attention to the search plan you select.

YouTube Recording : TBC

Conclusion:

Azure OpenAI is a powerful platform that provides access to advanced AI models and tools. It can be used to perform a wide range of tasks related to data analysis and processing, including text summarization, question-answering, code generation, and media analysis. By leveraging the capabilities of Azure OpenAI, businesses and developers can save time and resources while gaining valuable insights from their data.

Use Full Links

How to generate text with Azure OpenAI Service — Azure OpenAI | Microsoft Learn

How to switch between OpenAI and Azure OpenAI Service endpoints with Python — Azure OpenAI Service | Microsoft Learn

Quickstart — Get started using GPT-35-Turbo and GPT-4 with Azure OpenAI Service — Azure OpenAI Service | Microsoft Learn

slearn-openai (microsoftlearning.github.io)

Use your own data with Azure OpenAI Service — Training | Microsoft Learn

Ref — Role-based access control for Azure OpenAI — Azure AI services | Microsoft Learn

--

--

alpa buddhabhatti

Microsoft Data MVP | Lead Data Engineer| MCT| DP-201 | DP-202|AI-100| AZ-204 | MB2-716 | AZ-900 | Masters in Computer Science |International Speaker