- 2 years ago
Welcome to this hands-on AI-900 lab session, where we explore Retrieval-Augmented Generation (RAG) with Azure AI Foundry! RAG enhances AI models by combining pre-trained generative AI with real-time data retrieval, allowing for more accurate, context-aware, and up-to-date responses. Whether you're preparing for the Microsoft AI-900 Certification or looking to build highly intelligent AI applications, this step-by-step tutorial will help you understand and implement RAG in Azure AI Foundry.
🔍 What You’ll Learn in This Video:
1️⃣ Introduction to Retrieval-Augmented Generation (RAG) & Its Benefits
2️⃣ How RAG Improves AI Accuracy with Real-Time Data
3️⃣ Setting Up Azure AI Foundry for RAG Implementation
4️⃣ Integrating External Knowledge Sources with AI Models
5️⃣ Building a RAG Pipeline for AI-Driven Search & Question Answering
6️⃣ Optimizing & Deploying RAG-Enabled AI Models in Azure
🛠️ Who Is This For?
AI & ML Enthusiasts exploring advanced AI techniques
Developers & data scientists working with AI-powered search & chatbots
Professionals preparing for the Microsoft AI-900 Certification
Businesses looking to enhance AI-driven applications with real-time information retrieval
📌 Key Highlights:
✅ Hands-on demo of Retrieval-Augmented Generation (RAG) in Azure AI Foundry
✅ Enhancing AI models with external knowledge retrieval
✅ Optimizing AI for customer support, knowledge management, and enterprise search
✅ Deploying and testing RAG-powered AI applications
rag in generative ai
how to implement rag in llm
💡 Learn how to integrate real-time knowledge with AI models using Azure AI Foundry & RAG today!
Explore our other Azure Courses and Practice Material on: https://www.youtube.com/@skilltechclub
🔍 What You’ll Learn in This Video:
1️⃣ Introduction to Retrieval-Augmented Generation (RAG) & Its Benefits
2️⃣ How RAG Improves AI Accuracy with Real-Time Data
3️⃣ Setting Up Azure AI Foundry for RAG Implementation
4️⃣ Integrating External Knowledge Sources with AI Models
5️⃣ Building a RAG Pipeline for AI-Driven Search & Question Answering
6️⃣ Optimizing & Deploying RAG-Enabled AI Models in Azure
🛠️ Who Is This For?
AI & ML Enthusiasts exploring advanced AI techniques
Developers & data scientists working with AI-powered search & chatbots
Professionals preparing for the Microsoft AI-900 Certification
Businesses looking to enhance AI-driven applications with real-time information retrieval
📌 Key Highlights:
✅ Hands-on demo of Retrieval-Augmented Generation (RAG) in Azure AI Foundry
✅ Enhancing AI models with external knowledge retrieval
✅ Optimizing AI for customer support, knowledge management, and enterprise search
✅ Deploying and testing RAG-powered AI applications
rag in generative ai
how to implement rag in llm
💡 Learn how to integrate real-time knowledge with AI models using Azure AI Foundry & RAG today!
Explore our other Azure Courses and Practice Material on: https://www.youtube.com/@skilltechclub
Category
🤖
TechTranscript
00:00hey guys welcome back this is Maruti and I'm back with the part two of retrieval
00:14augmented generation for your kind of information we are actually learning how
00:19we can use our own data with our GPT based LLM models let me give you a
00:24precap what we have exactly done here so if you check right now we have created
00:30one new project in Azure AI foundry and then we have configured two different
00:36GPT models here so we have used GPT 35 turbo and we have used text embedding
00:42EDA 002 these two models are actually useful in this particular lab because
00:47first model which is GPT model is going to connect with your data and then when
00:52it's connecting with your data is going to use Azure AI search service which is
00:56going to configure index for you and then creating this index is actually done by
01:01your EDA model which is for text embedding now if you have gone through the video
01:07I'm sure you understood what we have done we have actually used our own data and
01:12when we ask for some travel related information like when can we stay in New
01:16York is actually giving me an information which is coming from my own data which is
01:21provided by this margis travel kind of a brochures same way let's say if I ask a
01:26question that where can I stay in Dubai now I have some kind of a brochure for
01:36Dubai also in that and that's the reason when I asked this question is going to
01:40again go through the documents is going to use that indexer and based on that is
01:44going to give me the response which is going to be associated with the same
01:49margis travels document so this is what exactly we have done you can see is
01:54showing me that these are the options which you can try in the Dubai it's also
01:57showing me that three different hotels are there and then I can go for a
02:02booking to margis travel calm and it's showing me a reference document which is
02:07Dubai brochure dot PDF now obviously this is reading from my six different
02:11brochures which I have uploaded as a document as my own data in this one now
02:16let's get started with the next step because this is not done we have to make
02:21sure that this is going to be improvised with the help of prompt flow so that is
02:25what we are going to do next right now now the next thing which I'm going to do
02:29is I under the build and customize section I have a section called prompt flow so
02:34I'm going to click on prompt flow I do not have any prompt flow in this
02:38particular project right now I'm going to create a new prompt flow by the way if
02:43you are not familiar with prompt flow I strongly recommend you to check out this
02:47video which is actually giving you what is prompt flow and how you can use it in
02:51Azure AI foundry portal check out that video first and then you can continue with
02:56this one I'm going to click on create
03:00it's showing me that I can choose from the typewise flows which are available
03:06here or I can choose from the gallery option which is available here I am going to
03:12choose this one which is multi round Q&A on your data so remember this is
03:16something which is on my data that's the reason I'm choosing this prompt flow I'm
03:19going to click on clone it's showing me that okay your folder name is going to be
03:25multi round Q&A on your data now I just actually want to give a proper
03:29meaningful name so I know it's a multi round Q&A but I'm going to give a name
03:33of this flow brochure flow so this is my prompt flow for my own data I'm going to
03:38click on clone now when we do this thing this is a very common issue which happens
03:43every single time now there are two different solutions of this I have
03:47shown you one solution which was covered in the previous video where you just
03:51wait for 10 minutes and then it's going to be resolved automatically the second
03:55solution is you have to assign this kind of a permission access manually now we are
04:00going to see this here that how we can actually do it manually so I'm going into my
04:07Azure portal and I'm going into my resource group where I have all the
04:10services I am going to click on my AI service this is my Azure AI service and
04:15the first thing which I have to do is I have to configure identity for my Azure AI
04:21service so I have to configure identity in this particular service you can see in
04:26the identity section this is showing me that system assign identity is off I
04:31have to turn this on so that I can have a unique identity of this particular
04:35service I'm saying yes this process will take few seconds it's successfully done
04:43it's showing me a new unique object ID which is created for this particular
04:47identity I'm going to copy this and then I will go back to my resource group I'll go
04:52into the storage account and under the storage account I have to click on access
04:57control I am this is basically a role-based access control mechanism of
05:02Azure cloud where you can give particular permissions to a user's identity or a
05:07service identity I am going to use the manage identity of my Azure AI service so
05:12I will click on add role assignment in the job function roles I'm going to search
05:17for the role storage blob data reader this is the role which I want to assign so I'm
05:26selecting this clicking next and in the member section I'm going to click on manage
05:31identity select member and I'm going to select my manage identity which is my AI service so
05:42I'm going to select all system assigned manage identities and in this we have my
05:48Azure AI Maruti RAG hub kind of a service which is available here and this is my Maruti RAG service which
05:56is a different one so which one you want to associate here you have to check this thing
06:00remember when you are doing this thing the advisable thing is you put that
06:05particular ID now if it is searching for that ID you will be able to find that
06:09thing easily otherwise just remember the ID is D47 something something is there I'm
06:14going to remove this and from the available services I'm going to select my AI
06:19service so I'm going to select my RAG 8043 service I'm going to click on select
06:25and you can see this is actually showing me that this is my Azure AI project now same
06:31way if I choose select member all system assigned services is actually having one
06:41Azure AI service and in the service if I select my service and if I click on select
06:47this is the one which is actually that object ID which I've created so remember in my case this was
06:53my object ID you can see it is totally connected with this one this is my AI service and this is
06:58my AI project so please do not make this mistake do not choose your project or a hub specific ID
07:04here you choose that AI service ID so I'm just choosing that one which is this one and then I'm
07:10going to click on next conditions I do not want to give so that is perfectly fine review plus assign and
07:17review plus assign this assignment will be done and it may be going to take two to three minutes to
07:23work so maybe it's going to just provision that configuration role assignment is successfully done
07:28I need to go back to my Azure AI foundry portal and I need to try this once again so I'm going to click
07:34on clone this time when I do this thing it's showing me folder name is already there I'll just change
07:40the name of the flow to brochure flow one and I'll click on clone it's processing and I think this
07:47time it will work because permissions are successfully done okay my prompt flow is successfully loaded the
07:53first thing which I want you to observe is this graph you can see in the right side one this is not
07:58a very simple prompt flow it is starting with some inputs then you have multiple nodes inside this
08:03some of the nodes are associated with your LLM some of the nodes are doing some kind of a lookup
08:08then you have a node which is allowing you to write some kind of a python code in that and then you also
08:13have certain things for prompt variants and chat with the context this is a prompt flow graph which
08:18is showing you the step-by-step process what exactly you're going to do in this logical workflow now also
08:23in the left side if you just check you are going to have this nodes available with the logical code
08:28like this is going to modify query with the history and we have some logical code given inside that
08:33configuration so what is the system message we want to give what kind of a chat history we want to
08:38associate and then what kind of an input we are looking for is all configured here remember
08:42because of this configurations only this is going to connect with the other options so you can see
08:48all these blue lines which are showing you the connected options is actually here because of the
08:52configuration which you have done in the prompt flow as of now before I do anything here I am going
08:58to click on start compute session which is actually going to start a serverless compute session for this
09:03prompt flow this can take some time but I need that compute compute session because without that I
09:09won't be able to modify my prompt flow so let's wait for one to three minutes which they are showing
09:14you here that it will take around one to three minutes to start the session just wait for the
09:19session to start once you're getting a green tick here then you can proceed to the next step
09:23okay so now our compute session is actually successfully running so this means that we can proceed
09:30what I want you to see right now is we have multiple nodes here the first part here is actually showing
09:37you inputs we have two inputs chat history and chat input basically the text which you are going to
09:44provide when you are chatting with your chat bot then we have outputs which is having chat underscore
09:49output kind of a variable the value of that will be chat with context dot output I do not want to
09:55change anything in my input and output but we want to do some kind of a configuration with my next node
10:02which is actually going to associate with my LLM in this case you can see this is modify query with
10:07history I want to make sure that in this connection section I want to connect with my Azure AI service
10:13so I'm going to select my Azure AI service connection the API will be chat the deployment name is going
10:22to be my GPT 35 turbo 16 K temperature is 0 by default which is fine I do not want to change it max token
10:31everything else is fine in the response format we want to change that type is actually text because we
10:39are going to provide the text kind of a data this is perfectly fine this is the first configurational change
10:43which we have done in this node I do not want to change anything in the prompt section so this is
10:48all fine it's configured properly we'll scroll down and now we are moving forward to lookup section in
10:55the lookup section we have ml index content which is of type string in the value of this I want to
11:01choose my index type which is going to be registered index and then in the asset ID I'm going to choose my
11:09brochure index which I have created this is my brochures index 1 and we'll click on save queries
11:19are fine query type I want to change to hybrid vector plus keyword and the top K is going to be 2
11:27which is perfectly fine so these are the two changes which we have done in the lookup section next we are
11:32scrolling down to generate prompt context in this we have to make sure that this particular input section
11:38is having search result which is actually having value lookup dot output this is perfectly fine we
11:46don't need to change anything here in the prompt variant also if you check we have a context which
11:51is associated with our prompt context then we have chat history and chat input which is going to be
11:57associated with our input chat history and the input so this is also all good we don't need to change
12:03anything in this so this is also all good we don't need to do any modification here in the chat with the
12:09context we have to set our collection so we are going to change the connection to our Azure AI service
12:15API is still going to be chat the deployment name is going to be GPT 35 turbo 16k and type we are going to
12:26change to text so this one's format is going to be type text in the inputs of this particular section we
12:32have prompt text which is having a value prompt variants dot output which is having a value prompt
12:38variants dot output which is perfectly fine if all things look good I think it's going to work so let's
12:44do the save first do not forget to click on the save button this is saved successfully and now let's do
12:50one thing let's click on this chat section which is on the right top corner this is going to come up
12:56with some pre-loaded chat I do not want to focus on this so this is perfectly fine I'll just close this
13:03panel I'll get rid of this particular message which is by default coming and and I'm going to put my own
13:10prompt which is where can I stay in London when I submit this prompt is going to give me a result
13:17completion result is generated and you can see that this time also this is giving me the response
13:23based on my own data it's showing me the related information of London with Margis travel and then
13:29it's also showing me the Margis travel website this execution work very well not only that it's actually
13:35going to be a multi-tend conversation so exactly after this asking a question that where can I stay in
13:40London if I ask another following question like what can I do there if I put this if I put this
13:49this is going to be smart enough to understand that I'm talking about London only and with respect to
13:54that London's location is going to give me what kind of things I can do in London you can see they are
13:59showing me a result in London there are numerous activities and attractions to enjoy and they are
14:04showing me some of the options of those activities and attractions now this is actually remembering my
14:10previous question and what I have asked there and it's also able to relate with that and it's
14:14giving me the next answer associated with that this is something which we have achieved with the
14:18help of this prompt flow because this is going to be taking care of multiple question and answer
14:22kind of a flow with that now if you're all good with this if you're happy with this prompt flow the
14:27next thing which you have to do is you have to click on this deploy button I'm going to click on
14:31deploy and I want to deploy my brochure flow so this is going to be the name of the endpoint they are saying
14:36maruti rag with some kind of a number which is fine the deployment name is also fine the
14:42virtual machine which is going to be associated with this it's standard d2 asv4 something like that and
14:48I just want one instance count with that I'm okay with the default configuration if somehow if I get an
14:54issue because of my virtual machine quota then I'll change the size of this later on but as of now I'm fine with
14:59this I'll click on next in the advanced settings I do not want to change anything related to
15:05authentication type or some other network access related things so all I'm going to do is review
15:09plus create this deployment is going to be created right now it's going to have my LLM associated with
15:17that and this is going to take some time so just wait for some time click on the notification bell icon
15:22on this particular portal and then you can see that it's just going to show me here if it is done or not
15:29so it's just showing me that my endpoint and my deployment of this particular prompt flow is going
15:33on now this will take some time but while this is taking the time I should remind you that when you're
15:39clicking on this notification bell icon why don't you click on the notification bell icon of this
15:43youtube channel because that's going to make sure that whenever we create a new videos you'll get a
15:49notification also do not forget to subscribe to this particular channel please click on the subscribe
15:54button so that you will be connected with us always okay so I waited for some time and you can see I'm
16:01getting an error right now as expected I do not have enough quota available in my subscription so it's
16:07just showing me that not enough cluster CPU quota available for your particular region now obviously I have
16:14to go and delete some of the clusters and then I can create a new one and then if I do that thing it's
16:19going to work it's going to work fine and it's going to deploy this one but yeah I'm not stretching
16:24this video for that particular deployment you know how to deploy a model you know how to take care of
16:29the prompt flow deployment because we have done this thing in other videos also so I'm not doing that
16:34thing right now I hope you understood the changes which we have done inside the prompt flow and anyhow
16:40right now I know that this is going to work fine because we have checked this thing in this internal chat
16:44so the only thing which is remaining now is the deployment of this particular prompt flow and
16:50that's something which we are not doing in this video I hope you understood this thank you so much
16:54and I'll see you tomorrow with another dose of Azure AI thank you