Build a HR QnA App using Retrieval Augmentation Generation (RAG), AWS Bedrock, FAISS, Langchain

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
retrieval augmented generation or rag these are the three most common words that you're going to hear if you're looking to build any meaningful application with generative AI in this video I'm going to show you how to build an HR question and answer application with Amazon Bedrock Claw Foundation model Lang chin as the orchestrator and then we're going to integrate Amazon Bedrock Cloud Foundation model with our internal data source which is going to be HR PDF document in this case and then we're going to use Facebook AI similarity search as our Vector store so if you're are not aware about vectors vector embeddings or or vector store then you can check out my other video as part of the play list now this use case is part of my bestselling Udi course on generative Ai and Amazon Bedrock which you can check from the link below you can also check out some of the other use cases that I built as part part of this YouTube playlist on chatbot text summarization and some others if there are any other use cases that you want me to build as part of generative AI or Amazon Bedrock please leave a comment below now let's go and check out what we're going to build as part of this use case okay now this is the UI for our HR Q&A app before we pose any question to this application so let me just show you what we are going to use as our data source or the HR policy document so I don't have any SharePoint so just did a Google and I found this policy document for some company called UPL on the internet and you can see it has details around leaves Etc so this is what we're going to use as our internal data source okay now let's do a quick demo of this application now let's pose a few questions so let me say how many privilege leaves in a year so so it says based on provided context the number of privilege leaves in a year is 21 working days the eligibility section under 4.2 privilege leave States eligibility 21 working days in a year so if I go here and search privileg and you can see 21 working days in a year okay and that's what is saying all employees will have 21 working days under 4.2 privilege leave section okay so that's good now let's pose the next question let's say how many sick leave so the application run you can see here and it says based on the provided context employees have 9 days of seek leave available per here so if I do a search sick and you can you can see here we have 9 days per ANM in this lecture we're going to focus on understanding the architecture for this HR Q&A application with rag now rag consists of three distinct words retrieval augumented and generation and each of these words describe a process in itself and that's what I'm going to explain as we go along now let's assume we are part of an organization called as Tech Cloud bite and we have an HR Manager who is going to upload the HR policy document on the internal SharePoint of this organization called as Tech Cloud bite now before we can respond to the user queries on HR related to this organization the foundation model has to be able to ingest this data in the PDF which is our HR policy document for that we first need to create a data ingestion workflow now let's first understand how we can create this data inje workflow so remember we are using Lang chain as an ocrat for this use case but you can also use llama index or Amazon knowledge base and Agents from AWS okay now to build this data injection workflow the first thing we're going to do is we're going going to load the data in the memory and how do we do that we are going to use Pi PDF loader so this py PDF loader is a library provided by Lang so what this py PDF loader does is it loads all the data that we have in the PDF in the memory so the next step we're going to follow is we're going to transform the data or sometimes called as chunking so what this means is say we have a very long PDF document what we're going to do is we're going to break it down into a single page then maybe Paras then lines then characters and we'll continue to break it until we can create Vector embedding because that's our ultimate objective to create Vector embeddings from smaller chunks of data and how do we do that and again we're going to use something known as recursive character text splitter and this particular recursive character text letter what it does is it splits the data into certain number of characters so we can say that chunk it into 300 characters so typically between 200 to 500 characters we split the document so we create the first chunk of say 300 characters and then create Vector edings for that then we pick another 300 characters and then create another Vector embedding from that set of characters so you can also split by by code by number of tokens characters Etc so there are different ways of doing the data transformation or chunk now once you have split the data the third thing you're going to do is you're going to create Vector embeddings from those chunks of data or the fixed number of characters that you have defined through this recursive character text splitter and how are you going to create Vector embeddings so AWS provid provides you with text embedding tighten text model which can be used to create Vector embeddings from this data similarly for open AI they have their own solution which can help you create Vector edings but for AWS you use the Titan text embedding model so once you have created the vector embeddings the next thing you need to do is you need to store those Vector embeddings in a vector store so in our case we're going to use the FIS SS Facebook AI similarity search but you can also use Vector databases such as pine cone and there are many others out there so once you have stored these Vector embeddings in a vector store the next thing you have to do is you have to create a index for easier search and retrieval so you can imagine once you storing vector embeddings and they could range from thousands to millions and when you're trying to to do a similarity search searching through these millions of vector embedding can be challenging so you can create an index for easier search and retrieval okay now once this is done so you are done with your data inje workflow now let's understand how this integrates with our Bedrock Foundation model okay so now let's look at it from the user perspective from left to right so I have the user interface hrq and and now our user or employee post a question how many vacation days do I have in a year so once the user post this question it goes to our Titan text embedding model so what this Titan text embedding model does is it will create Vector embeddings for that question so once we have the vector embedding for this question we're going to do a similarity search in the vector store so we look at similar pieces of text in the vector store and once we have a matching piece of text based on the question that user has posed we get a response and sometimes it's also called as context now earlier I said that rag consists of three key wordss retrieval argumented and generation and this is where the retrieval piece fits in so when we retrieve the context from this Vector store which is matching the question of the HR employee this is sometimes called as retrieval okay now we know that what retrieval in rag means now let's continue now that this context we have here will be sent to the foundation model and along with this context we're also going to send the initial question that the user had POS so we have the question of the user and then we have the context that we retrieved from the vector store and together they will be sent to the Amazon Bedrock Cloud Foundation model because we are using the cloud Foundation model from anthropic here now sometimes this process of sending the context with the question to the Amazon Bedrock Foundation model is called as augumented which is the second keyword in the rag because we are argumenting the user question with some context so that's the augumented piece now once this Amazon Bedrock which our foundation model we choose gets this question and context it's going to generate an answer and then that answer would be sent back to the user and this generation of answer based on question and context is the third piece of rag or generation because it is generating a response so this is the architecture we're going to build as part of this use case I hope rag or retrieval augmented generation is clear to you now I'll see you in the next lecture thank you now in the next few lectures I'm going to show you how to build this employee HR question and answer application with retrieval augmented generation now let's go ahead and get started now the first first things I just created a blank folder here rag 2701 so I'm going to open the Anaconda Navigator okay now I have the Anaconda Navigator open so I'll just scroll down and open the vs code through this so let me do a launch my vs code is open so I'll just go to file and open folder so I will just open the blank folder that I had shown you rag 2701 okay now I open this blank folder here so I'll just create a file and let me call it as now let me just call it as rack backend so we'll have code for back end as well as front end okay so now what I've done is I've created a list of steps which you will use to write this code so I'll just copy this and these steps should should be available as part of this PP so I just paste it here okay now there are basically six steps we have to follow to write this backend code now from this solution architecture diagram let's understand what are those six steps okay now the first thing is we have an HR employee which has created a document highlighting the HR policies for the organization spe focused on leaves and when the employee queries the Q&A based system it is going to retrieve the answers from this HR policy so the first thing is HR will upload this HR policy document which can be a PDF into a SharePoint and in our case I just did some Google and I found an HR document which has been uploaded on the internet so instead of the SharePoint we'll just use the URL from the internet where we have uploaded this HR document so the first thing is once we have this URL or the source of the data then what we're going to do is we're going to load that data using document loader from the source so what does this mean this means that the data is going to be loaded into the memory so now let's see how we're going to do that so this is the URL that I have and which we're going to use as data source so this is publicly available on the inter so this is the leave policy from some company called as UPL limited and is publicly available okay now let's get started so the first thing we have to do is we have to import OS so I say import OS now the next thing we have to do is we have to import the document loader so if you go to the Lang chain documentation you can see there are multiple document loaders for CSV files PDF markdown Etc so we'll use the one for PDF which is the pi PDF so basically what the document loader does is it will load the document and in our case it's the PDF into the memory so we'll say from Lang chain do document loaders import Pi PDF so it should show me somewhere and P PDF loader okay now we have imported this P PDF loader which will import the document into the memory so this is the documentation from langin if you want to read about it a little more now the next step is we have to define the data source and in our case this is the URL that we will use as data source now let's go ahead and load this data into the memory so what we'll do is so we'll say maybe we'll call this variable data load and that will be equal to Pi PDF loader what we have imported from here and then we have to give the file path so you can see here it is showing us give the file path and it's a string you can see here so I'll say and in in our case the source data is the URL that I had just shown you so I'll just copy that and put it here so it's basically this the source data URL okay now we have loaded this PDF into the memory but now let's just try it out and see if it's working fine so what I can do is I can say data Maybe underscore test and then I will say and I'll just use the data uncore load variable and Dot and you can see there is a method called as load and split so let me use that now let's just go ahead and test this out so I will say print maybe length and let's say data underscore test and then maybe Also let's just try and retrieve a particular page and see if it works print so I'll say data underscore test and this is a variable we have from here and then maybe I'll just say retrieve second page and let's see if this works so let me just do a save and let me just run it now so just say run without debugging so it's giv me some response let me just see see what that is so you can see here so it's giving me that it has eight pages you can see here the length and if I just open it so let's see how many pages it has yeah so it has eight pages and then we said retrieve page number two and this is the content of page number two so it says page contents four contents and purpose so let's see what's there in the page number two so because it's it starts from 012 so it should be page number three actually in the PDF so let's see what's in the page number three so yeah you can see it's basically the page of table of contents purpose scope and Etc now if I just change it to maybe zero and you will see I will get a different response so I'll just do a save and run run without debugging and you can see again pay number pages eight but this has changed now so it says leave policy and then it says some metadata something let's just see on page number first and you can see Le policy India I think that's pretty much all that's there in this page so Le policy India okay now this is great so this is working okay I think this is pretty much from this lecture in the next lecture we'll see how to transform the data so what I'm going to do is I'm going to save this file and has data load so you can test it out because I don't want to keep this data related to testing of the load data here so I will save this file and let's call it as so I will say data load _ test and I'll just save it here and I will make it available as part of this lecture but we'll continue to write rest of the code in the rack back end so I will just remove this from from here so now you have two files one for the load test and one for the rag back end okay I'll see you in the next lecture when we transform the data hope you like this lecture thank you in the last lecture we learned that the HR uploads the HR policy document on a SharePoint and then we took that Source URL and then loaded this PDF document into the memory using the document loader in our case we use the Pi PDF load now in the third step what we're going to do is we're going to transform the data so what transformation of data means say we have one page of PDF with a lot of text so we going to break it down into paragraphs then lines and then into characters and why do we do that because ultimately our objective is to create an embedding out of that text so we want to split it into smaller chunks and and then create embeddings so this is what transformation of data means and we're going to split the data using text splitter and the method that we're going to use is recursive character text splitter and there are different ways of doing it you can do it through number of tokens number of characters and so on okay now let's go ahead and see how we're going to do that so here is some Lang chain documentation on text Splitters and you can see you can split by code character but we're going to use recursively split by character so first thing is we're going to do an import so we'll say from Lang chain do text you can see text splitter so say import recursive character text splitter okay now we just going to go ahead and implement this here so we'll say data _ split so we'll use this method and say maybe before that let me just move a little left and say I will say recursive character text splitter and this is what we had imported here now let's see what are the arguments for this so you can see you have the separators list then you have keep separator Boolean true and then you also have some arguments that you can pass so the first thing we're going to do is use the separators so we'll say separators and here it is and then you can see it's a list so so we're going to use what we have here and I'm just going to tell you in a little bit what this means okay so now what does this mean it means that if you have a document and we said that text Splitters would split it and in our case it's going to split by number of characters so the first thing is what it will do is once you have say a page of document so it's going to split with this and why this what we mean is going to split first it into paragraphs then it's going to split into lines characters and so on now the second argument that we need to pass is we need to tell this splitter into how long the characters should be so should they be split into say 100 characters th000 characters 10,000 characters or one character and a standard size is about 100 characters so that's what we're going to do so we'll say comma and junk underscore size and let's say it's about 100 characters and then we also might want some overlap between two different chunks so we'll say chunk underscore overlap and that will be say 10 again and now if you just go to the documentation you can see there are some other things as well so you have chunk size chunk overlap and then you can also use the length function okay now I think that's pretty much it um now we can just do a little bit of test whether this works fine or not so let me just take some data and say sample and let's just copy some sample data and test it out okay I have this UD core so let me just pick something from here so maybe I'll just copy some data points from here so let me just copy this and let me just paste the sample data here and now let's see how this data is split based on the function that we have written here okay so let's say data split test and let's now try it out so we'll say data split and it's the variable that we have written here and there's a method called as text split text and you can see here and then I'll just pass the argument so we have this data sample which we want to test so I'll say data sample here so now let's just go and print it out I'll say print and then I'll say data split test and which is this so now what should happen is for this data that we have written here it should split the data into 100 characters so either it will do 100 characters or slightly less than 100 characters and then it should also print it out as a list so maybe it should say that okay say these are 100 characters so then this should be the first element of the list then this should be the second element this should be the third element and then what it will do is once it generates these chunks then we are going to create an embedding in the next lecture now let's go ahead and test it out let me just do a save and let me just close this and run it again so that we can see clearly okay I'll just push it up so that we see what is being done okay now I think we can see a response you can see it's splited into a list and then it's broken down into various chunks so probably this is about 100 characters then this is the next one with another 100 characters now if I just reduce the chunk size to say 10 and let me just reduce this overlap to one and let's see what happens uh so right now it has still instructor as the first element so I do a save and let me run it again so run without okay now awesome so you can see it has reduced it into chunk size of 10 so because we changed it here so now it's much smaller so the first time is welcome to the most then comprehend because it's much larger than this word is much larger than 10 characters and earlier when we had 100 characters you can see we had so we had much longer sentences okay so what I'm going to do is I'm going to make it back to 100 because that's a standard size and I'm going to say overlap of 10 so overlap we provide sometimes because if there's data losses so so there is some chunk overlap okay so I'm going to do a save and what I'm going to do is I'm going to provide this as a separate file but I will remove this test from this rag back end and like this separate file that I had provided you can use that but we're going to continue without all this in our main file so I'll make this file available as part of this lecture okay so I'll just do a save save all and let's say data split test and I just do a save and I'll just open this R back end and I'm just going to remove this sample that we had created for testing okay awesome now in the next lecture we're going to create the embeddings and and Vector DB and store those embeddings in the vector DB I'll see you in the next lecture thank you so in the previous few lectures we learned that HR is going to create a policy document load it on the SharePoint then we're going to use the document loader P PDF loader to load the data from this PDF in the memory then we're going to transform the data using recursive character text splitter and this will split the PDF into smaller chunks so once we have created these chunks then in this lecture what we're going to do is we're going to create embeddings from these data junks using the Titan text embedding model which is used by bedro so once we have these text embeddings then we're going to store it in a vector store DB and in our case we're going to use this FIS SS which is Facebook AI similarity search which is a open source Vector DB provided by meta so once we have this DB we're going to store all these text embeddings in this Vector store and then create an index so that we can easily search our embeddings from this Vector store now let's go ahead and create the text embeddings Vector store and index in this lecture okay now we are on the step four so so the next thing we going to do is we're going to import Titan text for creating Vector embedding so I'll say from from Lang chain dot embeddings so I'll will say import Bedrock embeddings okay now like always we'll create a client connection with this Titan text Bedrock embedding so the first thing we're going to say is so let's call it as data embeddings and you can give it any name you want and we say equal to and then we'll say Bedrock embeddings you can see it shows us the option bedrock embeddings and let's see what are the arguments we need to pass so as usual we'll pass the credential profile name and then we'll also provide the model ID you can see model ID is amazon. Titan embedding embed Das text VI so let's pass these arguments so first thing I'm going to say is profile and credential profile so you can see as always we'll use the default profile that we have created and if you don't know how to create this then look at the lecture I had for the chatboard use case where I had shown what needs to be installed and how you create a client connection so look at that lecture uh for seeing what are the things we need to install it will be for my case it is the default profile that I'm going to use and now the second thing is model ID so model ID is here so now let's go and search for model ID so I'm logged to my console and from here we can search or we can also do a Google search so both should be fine to get this model ID and let's go here and let's look at base models and let's say Titan okay so you have Titan here let me just click on this and if you just scroll down and you can just copy it from here so you can see this UI AWS is continuously changing uh so you might see a slightly different UI but everything else should remain same so just go to this base model and then you can get this model ID so let's just put it here okay so now I think this is good so we created a client connection and we'll be able to use this Titan text embedding model okay now the next thing we have to do is as we saw so we have to create a vector DB and we said we're going to use the Facebook AI similarity search and then store these embeddings and index for search so these three things we have to do so let's do that so now let's let's first import the vector store so I'll say from Lang do Vector stores okay so I have it here and then I will say import and then we'll set we'll use the Facebook AI similarity search Vector DB so I'll say s okay so now we have it here FIS SS so next we have to import something known as vector store index Creator so I'll tell you in a little bit what it means first let me just say from Lang chain and do indexes okay here I have it I'll say import Vector store index Creator okay now let me just do a save so we said that in this lecture we're going to create the vector embeddings then store these vector embeddings and then create a index for search now these are three things we have to do so we can do them separately or we can use a wrapper called as Vector store index Creator so if I just go here and you can see here in the document Lang chain documentation Vector store index Creator is provided what it does is is basically a wrapper where it will take the data from text chunks or split that we have done it will create an embedding then it will store it in the vector DB and then it will create a index so you can use this wrapper rather than creating separately so that's what we're going to do and you can see the parameters that you can add embedding text splitter Vector store you have to provide and then you can also provide some arguments so we'll basically provide these three so we'll provide the details about our text splitter the Titan model the Titan embedding model and then also our Vector store which is fi SS so now let's go and do that so I will say so let's say dataor index and then we'll say say Vector store index Creator so here it is and now let's see what are the arguments it's giving me an error because I think I didn't import the right module so it should be Vector let me clear this out Vector store index Creator okay I think this is the right one okay now this error is gone so let me just see what are the argument it shows so you can see here Vector store CLS that is our FIS or chroma DB embeding and text splitter so now let's add these three details so let's say text splitter is here and what is the name of our text is dataor split so say data underscore split and the next one we have is embeddings so embeddings is here and the name for embeddings is data embeddings here so let's say data embeddings and the third one we have is the vector store so let's say Vector store _ CLS and the vector store we have is the Facebook AI similarity search okay now I think we have created the data index so next we have to create the index for this HR policy document so let's call this as maybe dbor index and and we'll say data underscore index so we get it from here and then we'll just use from loaders method and this do from loaders method it comes from Vector store index Creator so if I just go to the documentation so you can see here this is the documentation I was showing you here earlier so you can see here from loaders method create a vector store index from loaders and then you have to provide loaders list base loader okay so let me just go here from loaders so we'll say now you can see it's a list so now the data loader that we had here was Data underscore name so that was the variable name so we'll just say data underscore load and I'll just do a save okay now let's wrap this whole thing within a function so this is what we're going to do next so what I'll do is I will say here let's call it um maybe HR rore index okay now we'll just move this whole thing to a little right so we get the syntax is correct okay good so maybe I will move this WRA function comment on the top okay so let's remove some spacing here and then this should this function should return DB uncore index okay so then we'll get the index now let me just do a save okay that's pretty much all from this lecture in the next lecture we're going to look at how to create a function to connect to the Bedrock Foundation model I hope you like this lecture I'll see you in the next lecture thank you in the previous lecture we learned about how to create vector embeddings and store it in a vector store now let's look at the rest of the flow so we have the HR employee who will POS a question now that question will be sent to text embedding and in this case TI and text embedding model it will create an embedding and then there will be some similarity search that will be done it will generate a response then the question that the employee has posed along with the response or we can say context is sent to the Amazon Bedrock Foundation model and we're going to use Claw from anthropic as our foundation model here so those two would be sent to this Foundation model and it will generate a response which will be sent back to the user so as part of this lecture we're going to create a client connection with Amazon bedrock and then we're going to send the question and context to this Foundation model and generate a response now let's go ahead and see how we're going to do that so first thing is we have have to import betrock so we'll say from Lang chain do llms dot Bedrock import Bedrock so first let's create a function so let's say def HR uncore llm and okay now let's create a client connection so we'll say llm and that will be say bedrock and let's look at the arguments so you have whole bunch of arguments so maybe we'll use the credential profile name then we are also going to use the model ID and then we are going to use some model argument so those are three things we going to use so let's go and do that so first so the first thing we going to say is credential and credential profile name would be default because you can see my profile name is default here and the next is model ID model ID so now let's go ahead and check out what's the model ID so if you just do a Bedrock Cloud parameters and you can see here it will give you the details so if I just scroll down so first thing we need is the model ID so if you see the details here how it's written so you need to provide the model ID and this is our model ID so maybe I'll just copy the model ID from here let me just go back and we already have it here so we have discussed this in pretty much all the use cases so I'm not going to really describe a lot of things here the next is we'll use some parameters so maybe I'll just copy them from somewhere here you can see all the parameters you have temperature top K top sorry top P top K and here are some default values 0.51 250 for uh these parameters okay so maybe I'll just copy some default values that are here so max token to sample and temperature 0.1 and top P 0.9 so we can see top p and and maximum value minimum value and default value and then for temperature as well okay now we're going to say model arguments and then I'm just going to paste this okay let me move a little here okay so I think that's pretty much it and this will return llm okay now let me just move this to a little right and let's just do a save so before we start writing the last piece of code just couple of quick words on these model arguments so now this Max token to sample 300 means the maximum number of tokens that can be generated in a response is not going to be more than 3,000 so if you just see here max length specify the max number of tokens to be used in a generated response so it's about 4,000 is the max so just putting 300 and then for the temperature and topy they both control the randomness of the answers so maybe I'll just increase it to 3,000 and I'll do a save okay now the last thing we have to do is we have to write a function which searches the user prompt creates embedding from it and then does a similarity search with the vector store and then provides a context the context and the question from the user are then going to be sent to the large language model now let's go ahead and code for this so I will say maybe we'll call it HR ra response so this function would have couple of arguments the first is index and based on the user query we're going to create an embedding and that embedding is then searched in the index in the vector tool so that's the first one the second one is the question which the user is going to pose now what we're going to say is now because we're going to get a response for the HR query so we will say HR _ rack underscore query and that will be equal to we're going to say index because search in the vector store index Dot and query okay I think I missed a y here so I'll say query now this will have multiple parameters so the first thing is question and the question will be equal to to whatever input we get so we will mark it as question and the second thing is we need to provide it the llm that is it's going to use so we'll say llm that will be equal to okay now we need to provide the value of this llm so let's just create a variable and provide the value from there so let me call it as rore llm that will be equal to what we have have here so hore llm okay and then we can substitute the value for llm from here we will say rore llm and then last thing we will say is return HR R query and this is what we have here okay I think that's pretty much it the code that we need to write for the back end now in this next lecture we're going to learn how to create the code for the front end hope you like this lecture thank you in the last lecture we discussed how to create the rag backend file in this lecture I'm going to show you how to create the rag front end using stream lid now this file rag frontend dopy I'm going to make this available as part of this video but this code has been mainly written by AWS and streamlit I've only modified this code to change the look and feel and then add some of the functions that we have written in the this rag back end and substituted them in this front end okay so what I've done is I have put these three hash marks where you can either change the look and field or substitute the functions you have written in the back end in this code so that you can build end to end application so you can see I have three hashes here so that means I need to replace something so the first thing is you need to replace this rag uncore backend because I have the file name as ragor backend so if you have something else then you need to replace this with that file name the next thing is we're going to import that backend file as demo so either you can keep it as demo or you can name it something else if you want so that is a second change you have to make and if you're keeping the file name same then you don't need to make any change now the second thing you can do is you can change this page title so my title here is HR Q&A with rag so you can modify the heading if you want or you can let it be the same the third thing you have to do is again you can see three hashes are here modify the title and if you want to modify the title then you can go here HR Q&A with the r and you can modify this and I will show you in the front end as well so I already ran this application because I just wanted to show you what change here would mean in the front end UI so let me just go here so this is what the application would look like and if you see here HR Q&A with the rag and if I just go back so if you replace something here then it will reflect in this title the the first one that I had here hrq with rag so if you see here on the top HR q a with rag that's what if you make any changes that's what you will be reflected here okay now the third thing is you need to search again for three hashes and three hashes here again so you can see the spner message wait for magic all beautiful things in life take time and if I just do a refresh here then you can see that it is showing here wait for magic all beautiful things in life take time so if you want to make any changes to the spinner then this is where you can you can do it okay that's the fourth change that we have now let's go ahead and see another important chain which is again here your index function name from The backend file so this is the demo and here we had imported it as demo and then you have to give the name of the index function that you have written the front end file so it is HR index so if I go to my rag backend file and you can see here HR index so this is what you have to replace this was the WAP within a function that is the function you have to replace here hore index and demo comes from as I said here okay okay again you see three hashes here and that is the button name so you can see here learn J with Rahul trle and if you want to replace that learn gen with rul thle this button then you can modify it here okay now we have the last thing which is replace with rank function from the back end file so if you see here again we have the demo which we have imported from here and then we have this HR rag response so which comes from here the HR rag response this function name you have to replace here so if you given the same function name then you don't need to change anything okay that's pretty much it from the front end changes that we need to make let me do a save and now let's go ahead and run this as a terminal new terminal now I'll just run the command stream lit run and the file name which is the ragor front end in this case rore front end. pi and I'll just run this and you can see it automatically opens the file on my local machine so this is taking a little bit of time and now you can see it is showing up so it says HR Q&A with the rag and then wait for magic all beautiful things in life take time and it should show us the Go Button in a little bit okay now finally you can see it's showing up and we have this go button okay now let's quickly test this out so let me say how many casual leaves in in uh here and okay you can see now it's running okay so it gives me a response based on the provided context the eligibility for casual leaves is seven casual leaves in a year and if I just go to this leave policy the PDF that it is reading from and you can see here eligibility seven casual leaves in a year and that's the response it has given us from that document and in the next session I'm going to show a more detailed demo and ask a few more questions from this HR question and answer application with rack hope you like this lecture thank you okay now let's do a quick final demo of this application now let's pose a few questions so let me say how many privilege leaves in a year so it says based on provided context the number of privilege leaves in a year is 21 working days the eligibility section under 4.2 privilege leave States eligibility 21 working days in a year so if I go here and search privilege and you can see 21 working days in a year okay and that's what is saying all employees will have 21 working days under 4.2 privilege leave section okay so that's good now let's pose the next question let's say how many sick Le so the application is run you can see here and it says based on the provided context employees have 9 days of SE leave available per here so if I do a search sick and you can see here we have 9 days per ANM Okay so hopefully this lecture was useful I'll see you in the next lecture thank you
Info
Channel: GenAI with Rahul Trisal
Views: 3,245
Rating: undefined out of 5
Keywords: aws bedrock, aws bedrock tutorial, aws bedrock workshop, aws generative ai, aws bedrock mini project, aws bedrock hands-on, aws GenAI, amazon bedrock, amazon bedrock tutorial, amazon bedrock ai, aws bedrock demo, aws bedrock titan, aws rag, rag, faiss, rag tutorial, aws amazon bedrock and rag, retrieval augmented generation tutorial, amazon bedrock demo, aws, aws rag bedrock, aws rag workshop, amazon rag ai, amazon rag llm, aws bedrock example, what is amazon bedrock
Id: aNj-1wehoEo
Channel Id: undefined
Length: 52min 59sec (3179 seconds)
Published: Wed Feb 21 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.