Site icon TheWindowsUpdate.com

Bring your own Data to Azure OpenAI: Step-by-Step Guide

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

Introduction

In this blog, you will go through a step-by-step guide, from creating a ChatGPT deployment using your own data to deploying it to a website and making it available to anyone.

No Programming/Coding background is needed!

Technical Architecture

You will start by creating a resource group inside the Azure Platform. Inside this resource group you will create 3 resources a storage account resource, a cognitive search service, and an Azure OpenAI service. Inside Azure OpenAI service you'll create a gpt-35-turbo deployment, test it in the chat playground, and deploy it to a web app. In addition, We will modify the permissions of the website to allow anyone with a school or work account to access it.

 

Prerequisites:

An Azure subscription.

Access to Azure OpenAI in the desired Azure subscription.

Summary of the steps:

Step 1: Open Azure Portal and Create a new Resource group.

Step 2: Create an Azure Blob storage resource.

Step 3: Create an Azure Cognitive Search resource.

Step 4: Create an Azure OpenAI resource.

Step 5: Create a ChatGPT deployment.

Step 6: Bring your own Data to Azure OpenAI.

Step 7: Deploy to a Website or Power Virtual Agent.

Step 8: Modify the Website Access using Azure Active Directory.

 

Step 1: Open Azure Portal and Create a new Resource group

A resource group is a container that holds related resources for an Azure solution. The resource group can include all the resources for the solution or only those resources that you want to manage as a group. (Learn more: here)

 

1. Visit the Azure Portal https://portal.azure.com in your browser and sign in.

Now you are inside the Azure portal!

 

2. Type resource group in the search bar at the top of the portal page and select Resource groups from the options that appear.

 

3. Select Create from the toolbar to create a new resource group.

 

4. Perform the following tasks:

  • Select your Subscription.
  • Enter the Resource group name. It must be a unique value.
  • Select the Region you'd like to use.
  • Select Review + create followed by Create.

 

5. Wait for the resource group to be created then open it by selecting its name.

 

Step 2: Create an Azure Blob storage resource

Azure Blob Storage helps you create data lakes for your analytics needs, and provides storage to build powerful cloud-native and mobile apps. Optimize costs with tiered storage for your long-term data, and flexibly scale up for high-performance computing and machine learning workloads. (Learn more: here)

 

You will use it to store the uploaded documents.

 

1. Inside your newly created resource group, select Create resources.

 

2. Type storage account in the search bar of the Marketplace page and select Create Storage account from the options that appear.

 

3. Perform the following tasks:

 

Now, you have successfully created a storage account that will contain all of your Azure Storage data objects: blobs, files, queues, and tables. (Learn more: here)

Step 3: Create an Azure Cognitive Search resource

Azure Cognitive Search (formerly known as "Azure Search") is a cloud search service that gives developers infrastructure, APIs, and tools for building a rich search experience over private, heterogeneous content in web, mobile, and enterprise applications. (Learn more: here)

 

You will use it to search the uploaded documents' content.

 

1. Inside your resource group, select Create.

 

2. Type cognitive search in the search bar of the Marketplace page and select Create Azure Cognitive Search from the options that appear.

 

3. Perform the following tasks:

 

Now, you have successfully created a cognitive search service that will add a full-text search experience to your custom app. (Learn more: here)

 

Step 4: Create an Azure OpenAI resource

Azure OpenAI Service provides REST API access to OpenAI's powerful language models including the GPT-4, GPT-35-Turbo, and Embeddings model series. (Learn more: here)

 

You will use it to create large language models inside it.

 

1. Inside your resource group, select Create.

 

2. Type openai in the search bar of the Marketplace page and select Create Azure OpenAI from the options that appear.

 

3. Perform the following tasks:

 

Now, you have successfully created an Azure OpenAI service that will enable you to create deployments of different machine learning models. (Learn more: here)

 

Step 5: Create a ChatGPT deployment

Deployments provide endpoints to the Azure OpenAI base models, or your fine-tuned models, configured with settings to meet your needs, including the content moderation model, version handling, and deployment size. (Learn more: here)

 

This is the large language model that will generate the chat.

 

1. Inside your resource group, select the Azure Open AI resource that you previously created.

 

2. Select Go to Azure OpenAI Studio to open the studio.

 

3. Select Create new deployment to go to the deployments tab.

 

4. Select + Create new deployment to create a new ChatGPT deployment.

 

5. Perform the following tasks:

 

Now, you have successfully created a model deployment that will enable you to have a conversation with your own data. (Learn more: here)

 

Step 6: Bring your own Data to Azure OpenAI

Now, you need to bring it all together just like Lego pieces that we need to glue together to build our solution. 

 

You are using the previously created resources to configure this feature.

 

1. Inside your Deployments tab, select the previously created deployment followed by selecting Open in Playground. (The Playground is a place on Azure OpenAI where you can experiment with different generative models.)

 

2. Enter any text you want in the Chat session tab to test your deployed model.

Note: You can see that it doesn't recognize personal information and can only respond to general questions as its knowledge is derived from publically accessible data over the Internet.

 

Now, let's add your own data to make the model more grounded and enable it to respond to specific questions related to the data.

 

3. Select Add your data from the Assistant setup tab.

 

4. Inside the Add your data tab, select + Add a data source.

 

5. Inside the Data source tab, select Upload files as your data source followed by performing the following tasks:

 

6. Inside the Upload files tab, upload the document that you want to use as your data source followed by selecting Upload files, then selecting Next.

 

7. Inside the Data management tab, select the Search type followed by selecting Next. The Simple type will work for you.
Note: Semantic search will give you better search results but it has limited availability. (Learn more: here)

 

8. Inside the Review and finish tab, review all the properties then, select Save and close.

 

Now we have grounded our large language model to overcome the hallucinations it might give whenever it doesn't have a response for our prompt.

 

Take a look at this example below. (The book is available at Oliver Twist by Charles Dickens - Free Ebook (gutenberg.org))

 

As you can see the model not only responds to your queries it also gives you a reference to a specific text in the data source you uploaded.

 

Step 7: Deploy to a Website or Power Virtual Agent

Azure OpenAI enables you with a click of a button to deploy your grounded large language model to a website or power virtual agent.

 

You will deploy it to a web app but feel free to try the power virtual agent later.

 

1. Inside the Chat playground, select Deploy to followed by selecting A new web app... to create a website that anyone can interact with.

 

2. Perform the following tasks:

 

3. Select Launch web app to open the newly created website in a new tab.

 

4. Accept the requested permissions and proceed to the web application to test it.

 

Now you have successfully deployed your own ChatGPT using your own data to ground the model and get more reliable responses.

 

Step 8: Modify the Website Access using Azure Active Directory

The deployed web app is only available to you and to anyone inside your tenant. If you want to share it with anyone else they won't be able to access it.

 

You'll modify the access to allow anyone with a school or work account to access it.

 

1. Inside your resource group, select App service resource to open the web app properties.

 

2. Select Authentication to open the authentication settings for the website.

 

3. Select the link that appears beside the identity provider name to go to the Azure Active Directory settings. 

 

4. Select Authentication to modify the access to the website.

 

5. Under Supported account types, select Accounts in any organizational directory to make the website available to anyone with a work or school account.

 
Congratulations! You can now share the website with anyone and they will be able to access it.
 

Clean Up

To prevent additional charges that may incur to your account just delete the resource group that you created and it will delete everything inside it.

 

Conclusion

Azure OpenAI gives you endless possibilities whether you are an expert in the AI field or have no experience at all, With a few simple clicks you are able to build a large language model, train it on your own data, and deploy it to a website How cool?!
 
You can apply this to any type of data whether it is medical, legal, or any type of record, and chat with your own data with no hallucinations.
 

Found this useful? Share it with others and follow me to get updates on:

You can learn more at:

Feel free to share your comments and/or inquiries in the comment section below..
See you in future demos!
Exit mobile version