Blog Post

Educator Developer Blog
10 MIN READ

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

JohnAziz's avatar
JohnAziz
Iron Contributor
Sep 07, 2023

Introduction Overview: Empower Your Tech Entrepreneurship Journey with Microsoft Learn

Are you ready to embark on an exciting journey into the world of tech entrepreneurship and artificial intelligence? Welcome to this instructional blog, where we will take you through a transformative step-by-step guide. We'll show you how to create a ChatGPT deployment using your own data and deploy it to a website, making it accessible to anyone, regardless of your programming or coding background.

But that's not all! We have an exclusive call to action for you.

Join us for the "Empowering Tech Entrepreneurs: Harnessing a LLM in Power Platform" live session on November 2, 2023 where you will get to learn more about these amazing Microsoft Services and get answers to all the questions you might have. 

This Microsoft Learn session will provide you with valuable insights and practical knowledge to supercharge your tech entrepreneurship endeavors. Mark your calendar and don't miss this opportunity to accelerate your journey. Register Now!


No Programming/Coding Background Required!

We want to emphasize that this guide is designed for everyone, regardless of their technical background. You don't need to be a coding expert to follow along and make the most out of this transformative journey.

You'll be well on your way to harnessing the power of AI to enhance your tech entrepreneurship endeavors. Don't forget to join us for the Microsoft Learn session on November 2, 2023, to further expand your knowledge and network with fellow tech enthusiasts.

 

Are you ready to embark on this exciting journey? Let's dive in and empower your tech entrepreneurship dreams!


Let's Get Started

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.


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:

  • Select your Subscription.
  • Select the Resource Group you previously created.
  • Enter the Storage account name. It must be unique and only letters and numbers are allowed.
  • Select the Region you'd like to use.
  • Select the Performance tier you'd like to use. The Standard tier will work for you.
  • Select the data Redundancy type you'd like to use. The GRS type will work for you.
  • Check the Make read access to data available option.
  • Select Review followed by Create.

 

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 as it supports numerical filtering.

Azure OpenAI models only understand text and thus will not be able to provide us with the indexes.

 

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:

  • Select your Subscription.
  • Select the Resource Group you previously created.
  • Enter the Service name. It must be unique.
  • Select the Location you'd like to use.
  • Select the Pricing tier you'd like to use. The Standard tier will work for you.
  • Select Review + create followed by Create.

 

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:

  • Select your Subscription.
  • Select the Resource Group you previously created.
  • Select the Region you'd like to use.
  • Enter the service Name. It must be unique.
  • Select the Pricing tier you'd like to use. The Standard S0 tier will work for you.
  • Select Next followed by Next followed by Next followed by Create.

 

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:

  • Select a Model. gpt-35-turbo is a large language model that can act as our ChatGPT.
  • Select the Model version. The only supported version with the bring-your-own-model feature is 0301.
  • Enter a Deployment name. Any unique name shall work.
  • Select Create.

 

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:

  • Select the Azure Blob storage resource that you have previously created.
  • Select the Azure Cognitive Search resource that you have previously created.
  • Select Turn on CORS to give Azure OpenAI access to your storage account. (Learn more: here)
  • Enter the index name that will be used to index the uploaded files. Any name will work.
  • Select the acknowledgment that informs you that you will be charged for using the Azure Cognitive Search service.
  • Select Next.

 

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:

  • Enter a Name for the website. Note that this will be the website subdomain.
  • Select your Subscription.
  • Select the Resource Group you previously created.
  • Select the Location you'd like to use.
  • Select the Pricing plan you'd like to use. The Free F1 tier will work for you.
  • Select the acknowledgment that informs you that you will be charged for creating a web app.
  • Select Deploy.

 

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.
 

You can learn more at:

 

Join us live on November the 2nd, 2023 to learn more about Empowering Tech Entrepreneurs: Harnessing a LLM in Power Platform
Register for this event!

2 November, 2023 | 3:30 PM - 4:30 PM GMT

Learn about the new capabilities of Azure Machine Learning Registry that enables you to deploy Large Language Models like GPT and many more, and integrate it with Power Platform John Aziz, a Gold Microsoft Learn Student Ambassador from Egypt, and Lee Stott Principal Cloud Advocate Manager

In this session, you'll learn about Large Language Models and the steps you need to perform to deploy them to Azure Machine Learning, discover how to set up an Azure Machine Learning Workspace, deploy the machine learning model, learn about Power Apps and Power Automate, and integrate the deployed model with Power Apps. Follow along as we provide clear instructions, and make the process accessible to both beginners and experienced tech enthusiasts. 

By the end, you'll have a fully functional application capable of generating text and creative writing ideas. Connect with John and Lee on Twitter and LinkedIn to explore more Microsoft tools and cool tech solutions.

 

Do you want to become an entrepreneur and harness the power of AI in building your startup?

Join Microsoft Founders Hub for a chance to earn up to $2,500 of OpenAI credits and $1,000 of Azure credits to build your startup!

 

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

Feel free to share your comments and/or inquiries in the comment section below..
See you in future demos!
Updated Sep 24, 2023
Version 5.0