RAG with Azure AI Search and Azure Open AI in 9 minutes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this lecture is about a rag uh it is not a rag to reach a story it is about retrieval augmented generation so the generation is done by the llm the large language model and the retrieval augmentation is done by some external information so we'll put into practice and see of how it is done so it is done by the azur opening ey being the llm and the external inform information is provided by Azure AI search so let's look at the architecture here so the architecture is two main parts in which there is this data sources which in case it is files and here we put it into asure AI search that is the first step so when a user puts in an user input it goes through the orchestrator it goes the queries goes into the Azure AI search the aurei search gives the knowledge and the knowledge along with a prompt is sent again by the orchestrator to the azer openi and it gets a response back to the user so that's the whole flow so let's break it down into parts so the first is a data injection so here what happens is a file is broken into Pages it is uploaded to aure blob and then the program will break each page into sections and each section is loaded into a your AI search the indexing of each section is done so how it is done so let's consider a PDF and let's take for example the actual thing so here we are in this application zi search dots so we are considering this document so it is a document from a class 11 Biology book and it is chapter 4 Animal Kingdom it has got 18 pages so when we upload it what happens is that it has got 18 pages and this page is broken up into various sections each page and this is uploaded into Azure AI search so we'll see it in action here so here's our program the program of the upload docs it has got these parts so continuing on that what happens is that if you see it then this is uploaded and you see this upload goes on through this program and there are 17 there are 18 chapters 18 pages so there are um so 18 PDFs are made it starts from 0 to 0 to 17 is 18 and then it is broken up into 34 section so that means each page is broken up into two sections so here each page is broken up into section one and section two so how this is done all the code that I'll show will be checked into GitHub so this is a notebook that we use for upload docs so we'll not go through the code line by line but rather I would take your attention to some of the important features the important features are this first we create the search index and then what we do is upload the blobs that is for the file name uh we put it into the blob storage and then we put it the what we do is that we break up the blob into several SE several pages and each page is s divided into sections and then the indexing of the section goes on but before we do this what we should do is that I should have shown you this we should create an Azure AI search resource so this is the AI search Resorts and this is the as your AI search resource and you create it just like as you create any resource here and uh what the most important thing is that you put on the semantic ranker so the semantic ranker uses deep neural networks to provide relevant results and answers based on semantics that is intentions not on just lexical analysis which means not just keywords so this is a plan which is a free one two St if you want a much more stronger plan there is the standard always so this is the Azure EI search that we are referring to in the program another point is that here is the uh asure account and here it is the container the Dos which we are putting and in the docs we'll see that if if you go into the docs it will come up it will show all the PDFs that have been uploaded so you see here from 0 to 8 18 uh 7 these blobs have been stored so that's the thing now once all that is ingested what we do is now query so quering what would happen is that you search using the aurei search the search results are obtained and then it is sent to AER open and the answer is sent by azer open to the user so I'll just show you in the code of how it is done we have used streamlit as the UI so so in the streamly tab what we do is that here is the user input and um we are getting this thing and we are searching the client we searching the client here and we are getting the search results and we are doing the query type as semantic and we are getting the top three results and for each of the top three results we're getting the references and then after we get the references what we do is that we send the prompt as as well as uh the user input to the aure open which will generate the answer if you just go to generate answer uh go to definition you will see that this is how we are using AER openi here and the prompt is here and in the prompt here what we are passing is the context the context is the search results that we are getting so the content is from the search results that we are getting so let's see this in action and to get get it into action what we'll do is that we'll uh we will run the application so let us run the application so this is so the while we run the application what I would like to show you is that if we go to to chat GPT open Ai and if you go to chat GPT openi and if I use my application out here and say if I type in We compare the application here so let it come back so this is the application here so let me ask this uh this is a very difficult question for me so but let's ask this uh application so when we ask it it goes in it goes so it has given the references right away from where it is picking the answer and it is quite fast it gives the answer about the dipl blastic and the triploblastic organization so let's do something very interesting here so this is a Biology book so let us ask what is segmentation here to Chad GPT and let's see what what answer it gets so Chad GPT is giving the answer and it is giving the answer because it does does not know the context and it is giving lots lots and lots of answers so you see it gave a lot of answers which is here and it give answers based on Market segmentation computer science image processing biology sales segmentation and so and so forth so so when we ask this question to this application out here what is segmentation let's see what it getes the answer mind you this answer will come from the text here and this segmentation let's see what it answers so it picks up these answers from these two and you see how it is giving since this is this chapter is on Animal Kingdom so so it gets the answer based on this context and the answer is that it is a division of the animal SP to a series of similar or identical repeating segments so that is very important important it catches a context here and gives an answer which is very specific to the document which you really want this is very particularly important for your Enterprise data where you would like to ask questions and get answers based on the Enterprise data not on everything that is out there in the public very contextual answer which will help you hope this helped you in our explanation of rag thank you bye
Info
Channel: Ambarish Ganguly Academy
Views: 11,735
Rating: undefined out of 5
Keywords:
Id: VKDoaXDT30A
Channel Id: undefined
Length: 9min 26sec (566 seconds)
Published: Mon Dec 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.