Skip to main content
Check out the Intelligent Apps on Azure Container Apps series for quick demo bytes | Give us a 🌟 on GitHub

7.1 Personalizing Education with Generative AI and Retrieval Augmented Generation Part 1

· 10 min read
#60Days Of IA

Graphic of three blocks, surrounded by a circle in the top right corner. At the bottom of the graphic is text that reads, "Personalizing Education with Generative AI and Retrieval Augmented Generation: Laying the Groundwork with Azure Container Apps.

Personalizing Education with Generative AI and Retrieval Augmented Generation Part 1: Laying the Groundwork with Azure Container Apps

Tired of one-size-fits-all learning? Imagine a virtual tutor that adjusts to your specific needs and helps you understand complex topics. That’s the power of Intelligent Apps — apps that leverage machine learning (ML), data analytics, and predictive/generative artificial intelligence (AI) to create dynamic, interactive user experiences.

In this three-part series, you’ll build an education app that uses generative AI and Retrieval Augmented Generation (RAG) to create customized lessons, answer users’ questions in detail, and generate quizzes that adapt to their progress. You’ll use several exciting Azure technologies:

  • Azure OpenAI Service — Provides the core AI capabilities for your app
  • Azure AI Search — Offers a knowledge base that your app can access using RAG, allowing the large language model (LLM) to provide more accurate explanations
  • Azure Container Apps — Lets you easily package and run apps in a flexible and scalable environment.

The Intelligent Application's architecture comprises Azure OpenAI, Azure AI Search, an Azure Storage Account, and the Knowledge Base.

Let’s get started!


To follow this tutorial, ensure you have the following:

Build a Personal Tutor with AI and Azure Container Apps

In this first part of the series, you’ll build the foundation for an AI-powered Python tutor. This tutor will use a knowledge base to answer your Python questions of varying difficulties and create tailored quizzes.

Creating an Azure Storage Account for RAG Data

Start by creating a space to store the knowledge base that your chatbot will use for RAG. Sign in to the Azure portal and search “Storage accounts” in the search bar. Click + Create to start a new storage account.

On the Basics tab, set the following configurations:

  • Subscription — Select the same subscription as your resource group.
  • Resource group — Select the resource group you created earlier.
  • Storage account name — Enter a unique name for your storage account.
  • Region — Choose a region according to your preference.
  • Pricing tier — Select Standard S0.

The storage account creation page has seven tabs: Basics, Advanced, Networking, Data protection, Encryption, Tags, and Review. Basics is open. Below are two sections: Project details and Instance details. Under Project details are fields for Subscription (Azure subscription 1) and Resource group (personal-tutor). Under Instance details are fields for Storage account name (blank) and Region ((US) East US). At the bottom are two buttons: Review and Next: Advanced.

For the other tabs, keep the default settings.

Finally, click Review + Create, and then Create.

Next, you’ll upload the knowledge base linked in this tutorial’s prerequisites. Use HTML formatting for this project.

Once you have created your storage account, navigate to it from the Azure portal and click Upload. In the window that appears, create a new container, give it a descriptive name, and check Private (no anonymous access). Select the newly created container and click Browse for files. Select the file or folder you want to upload. Then, click Upload to upload the blob.

The Edututor storage account page lists menu options including Overview, Activity log, Tags, Diagnose and solve problems, Access Control (IAM), Data migration, Events, and Storage Mover. There are also menus for Data storage (Containers, File shares, Queues, and Tables), and Security + monitoring (Networking, Front Door and CDN), and Access keys. To the right of the page is a window to upload a blob, with the option to drag and drop a file or select an existing container.


Register for Episode 4 of the new learning series on Intelligent Apps with Serverless on Azure.

Join the community along with MVPs, and the Azure Product Group on how to leverage AI with Serverless on Azure technologies—Azure Container Apps and Azure Functions—to build intelligent applications.

Creating an Azure OpenAI Service

With your knowledge base ready, you’ll now set up the core AI component: an Azure OpenAI service that uses RAG to access this knowledge base and generate customized lessons and quizzes.

In the Azure portal search bar, search “Azure OpenAI.” Click + Create to start a new service.

The Azure OpenAI service page lets the user create a new service.

Match the Basics tab configurations to the following:

  • Subscription and Resource group — Ensure these match your previous Azure resources for consistency.
  • Region — This demonstration uses Sweden Central as the region. Note that some models are only available in limited regions, so be sure to select the right region.
  • Name — Create a unique name for your OpenAI resource.
  • Pricing tier — Select Standard S0.

The page to create an Azure OpenAI service has four tabs: Basics, Network, Tags, and Review + submit. Basics is open. There are three sections: Project Details, Instance Details, and Content review policy (not visible here). Under Project Details are fields for Subscription (Azure subscription 1) and Resource group (personal-tutor). Under Instance Details are region (Sweden Central), Name (pythontutor), and Pricing tier (Standard S0). At the bottom of the page are Previous and Next buttons.

Click Next.

On the Networking tab, select All networks, including the internet, can access this resource.

Finally, click Review + Create, and then Create.

Once your Azure OpenAI service is ready, you’ll set up the necessary AI models. Within your Azure OpenAI resource, click Go to Azure OpenAI Studio. Then, under Management on the left pane, select Deployments.

Screenshot of the Deployments page.

Click + Create new deployment. You’ll deploy two models for your application:

  • text-embedding-ada-002 to create the embeddings of the knowledge base
  • GPT-4 to generate personalized courses and quizzes

The form to deploy a model contains three fields: Select a model (a dropdown menu), Model version (a dropdown menu), and Deployment name. At the bottom are two buttons: Create and Cancel.

Creating an Azure AI Search Resource

With your AI models in place, it’s time to make your knowledge base easily accessible to them.

In the Azure OpenAI Studio, navigate to Playground and select Chat. Locate the Add your data option and click + Add a data source.

The Chat playground within Azure OpenAI Studio.

A window will open where you can connect to the Azure Blob Storage you created earlier. Use the following configurations for the data source:

  • Select data source — Select Azure Blob Storage.
  • Subscription — Choose the same subscription as your other services.
  • Select Azure Blob storage resource — Select the storage account you created.
  • Select storage container — Select the container that has your knowledge base.
  • Select Azure AI Search resource — Create a new Azure AI Search resource.

Screenshot of the for to select or add  a data source . It includes the following fields: Select data source, Subscription. Select Azure Blob storage resource, Select storage container, Select Azure AI Search resource, Enter the index name, and Index schedule. There's a checkbox, selected here, for Add vector search to this search resource. Below is an Embedding model heading, with a Select an embedding model field below. Azure OpenAI - embedding-model is selected. Below is a checkbox, selected, for acknowledging you'll incur costs for usage. The bottom of the page has two buttons: Next and Cancel.

Since you don’t have an existing Search resource, select Create a new Azure AI Search resource, hyperlinked under the Select Azure AI Search resource dropdown. Azure AI Search makes the content of your knowledge base searchable by converting the data into numeric representations called vectors. These vectors capture the meaning and relationships between words.

On the Basics tab, configure the resource as follows:

  • Subscription and Resource Group — Choose the same subscription and resource group as your other services.
  • Service name — Enter a name for your search service.
  • Location — Choose a location according to your preference.
  • Pricing tier — Select Basic.

The form to create a search service features five tabs: Basics, Scale, Networking, Tags, and Review + create. Basics is open. There are two sections: Project details (containing Subscription and Resource Group) and Instance details (containing Service name, Location, and Pricing tier). At the bottom are three buttons: Review + create, Previous, and Next: Scale.

Click Review + create.

Return to the Select or add data source window. Configure the rest of the options as follows:

  • Enter the index name — Provide an index name that will reference your data source.
  • Indexer schedule — Choose Once.
  • Enable the Add vector search to this search resource option.
  • Select an embedding model — Choose the text-embedding-ada-002 model that you deployed earlier.

Check the acknowledgment box and click Next.

Then, in the Data management window, select Vector as the Search type. Check the acknowledgment and click Next.

The Data management form includes a Search type dropdown, where Vector is selected. Below is a checkbox, selected here, to acknowledge that costs will incur with usage. At the bottom are three buttons: Back, Next, and Cancel.

Finally, click Save and close.

The Review and finish page of the form summarizes the options and data choices from previous steps. At the bottom are three buttons: Back, Save and close, and Cancel.

Now that your data and services are connected, the next tutorial will focus on building the core application logic and creating a web interface to interact with your chatbot.

Next Steps

And with that, you’ve reached the end of the first tutorial of this series. You’ve established a solid Azure foundation and connected your knowledge base to powerful AI services. In the next part of this series, you’ll use Python to build a chatbot that enables dynamic interaction and personalized learning experiences for your users. See you there!

To build on the skills you’ve gained here, explore more AI and cloud topics by registering for Serverless on Azure Learn Live series. Then, put your knowledge to the test — and earn a Microsoft Learn badge — by joining our Cloud Skills Challenge.