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.
- If you don’t already have one, you can sign up for an Azure free account.
- For students, you can use the free Azure for Students offer which doesn’t require a credit card only your school email.
Access to Azure OpenAI in the desired Azure subscription.
-
Azure OpenAI requires registration and is currently only available to approved enterprise customers and partners. See Limited access to Azure OpenAI Service for more information.
-
You can apply for access to Azure OpenAI by completing the form at https://aka.ms/oai/access.
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!
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.
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. Auto-update to default will automatically update the model version within two weeks of a new version being released.
- 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.
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
Found this useful? Share it with others and follow me to get updates on:
- Twitter (twitter.com/john00isaac)
- LinkedIn (linkedin.com/in/john0isaac)
You can learn more at:
- Develop Generative AI solutions with Azure OpenAI Service - Training | Microsoft Learn
- Introduction to Azure Cognitive Search - Training | Microsoft Learn
- Create an Azure Storage account - Training | Microsoft Learn
Feel free to share your comments and/or inquiries in the comment section below..
See you in future demos!