LlamaIndex RAGs : Build 'ChatGPT Over Your Data' Using Natural Language.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone recently llama index team has released one project called Rags which is nothing but you know retrieval augmented generation so basically it is a chat GPT over your data so you might have uh seen you know the open AI has recently released something called gpts so gpts is like a you can build a custom chat GPT for yourself so if you haven't seen the gpts so basically gpts have something called gbt Builder where you can provide instructions in the natural language to create the chat bot and or you can also give some configuration like you can uh you know um call an external API and all of those things so basically you can use the natural language and you can build the chat B that can answer questions from your data and maybe some API something like that right and what llama index team did they try to you know uh do the similar functionality and so basically what they come up with right so we're going to have some kind of a stream lead application you know where you're going to have something called the rag Builder where you can use the natural language provide instructions and basically you can change it certain configuration and ultimately you're going to get the rag agent basically nothing but a stream Le chat bot where which can answer questions from your data right so this is actually the uh you know the GitHub repo for that particular project which is very recent actually and we're going to try this thing and see how good it is so we're going to follow this uh you know step by steps what we have here so basically as it is written here we're going to get actually one Str app that lets us you know that uh that going to help us create the rack pipeline uh that can interact with our document so basically we can describe our task and then we can change the configuration and then we can you know start using the chatbot so let's do this things so first of all you know we need to clone this project and install the requirement so I'm going to clone this project so let me clone this project okay so I use let's say k clone and I'm going to clone this particular project so I got this folder called Rags which has the you know project uh before this folder I had one PDF file which actually going to uh use for the this particular you know demo purpose right so I have the rags here maybe I can put that PDF inside the same folder so that you know okay so that PDF also I have here right so you could see uh we got some project here which had some maybe the requirement files you could see it streamlet and these other libraries and basically uh you know we have a streamlit application so let's not get into the code first but rather follow the stepbystep approach and install it right so the next thing we want we want to actually install the requirements so maybe I will simply use the pep install let's go into the folder first and let me do the peep install are the requirement files this one okay let's install the requirements make sure you know uh you have the upgraded streamate version you know because since it is uh based on stream lead most of the requirements will be already there I guess you know just going to so it's also going to require I guess Lang chain because internally it will be using you know the llms models and so let this installation complete maybe we can go through and see what's next okay we got some error there then once we install the requirement we need to uh make sure we put our open AI key because uh under the hood it's actually using uh okay basically it is here mentioned that it is inspired from the gpts that's fine the under the hood it is using you know the uh open AI model to generate the agent so we're going to require the open I key P dependency I think that's fine so the project you know so we have installed those dependencies and maybe let's say we can run this this is the streamlit application so if you look at the documentation we need to run this file one home or something this particular file right so let's run the streamlet application stream lead run this one right and when you run this file you could see that it is not able to find maybe the Secrets where it can find the opening key right so let me close this you know stop this run and let's follow the instruction and create that uh what it is required let's go back here and we need to create this particular file so let's go and create file here I go to the rags go to the new file and give that path so we got this dots stream lead and then we got this secr normal which is nothing but where you could specify your you it's like an environmental file kind of a thing where we could B our keys so I got one key for this is T let me copy P that key here okay so we got uh this SEC teral whatever this thing let me again uh run stream lead and see whether we are able to successfully run this time okay I think we didn't get any error so this is what you get a rag Builder kind of a thing you know so where you could use some natural language instructions and we should be able to actually generate the chatbot for ourself right so you could see we could specify something like task like this let's see what it says use this page to build the rag bot over your data right once the agent is finished creating check out the rack config so we can go here let's see rack config we can see there will be some configuration here we can see the generate currently there is no agent generated yet basically the rag agent is nothing but our chatbot that we're going to create so let's go to the home section and maybe you know we can start using natural instructions see whether we could create the agent right let's say uh you know um I can say that you know let's say I want to say I want to build chatbot that can answer from PDF file that's what I want to BU so I think under the hood it's going to use maybe this open a call what those things okay so um it is asking me can I give the PDF file path so I put the so it is currently able to take that local file actually the local PDF file so I have this file is here itself maybe I just it's since it is in the same folder I can give the path of the file as a name so I would say you know the file path maybe this and let's see whether it is able to do that thing maybe we can see what's happening under the hood so you can see it is calling the function to load data with the arguments and it has taken file name as whatever the file that I have you know uh provided and see whether it is able to run the thing the data from the PDF this has been loaded successfully now let's move on to the next step really so I think yeah I think data loaded successfully here we can see under the What's Happening Now what it is asking whether I would like to you know make any changes or set any parameters so let me ask you you know show me parameters first of all okay there is some spelling mistakes but I hope it understand that I'm asking for the parameters okay so it is showing me these are the parameters maybe you know I would say uh make top K as a three instead of two and I would say um maybe I take the Chun size and then I would say the chunk size as 52 because you could see it is 1024 and let's do this thing and see what happens so now um parameters have been successfully updated so we can see now the top K is set to three and the chunk size is 512 uh let's see whether they are really updated so we can go to the config where we should see those parameters so we can see the top K has been set to three and the chunk size is 512 right agent not created please create the agent still the agent is not created right let's see when we asked to change the parameter internally it is calling a function called s rack parameters with this particular arguments the problem let's go back to the you know the rag Builder and next we can create the system prompt for the chatbot what would you like the prompt to be you can describe the task you want the chatbot such as answering frequently as questions about you know uh I want let's say bot should answer any questions from PDF doc that's it simple and I think it is updating the prompt so I think it has updated the prompt let's go and see whether we see the prompt here yes so it has come up with the prompt see this is how it is saying you know the PDF document when responding queries you must consistently utilize the tools so I think it has certain tools like Lama index has the tools internally you know and it's going so tools are nothing but some functions that you can you know specify I guess so let me go back to again the Builder and and what now it is saying now that we have the data loaded we got the parameter set and the system prompt also created we can proceed to build agent right okay let's build agent so let's build agent and currently we don't have agent right so if you see the agent is not generated yet so the rag Builder is taking all the required information from us right okay I think it got reloaded okay uh maybe let's say say build agent and it should be able to now create the you know the drag agent which should be answering let's say questions from the document that we have given we can check what document actually you know uh I have let me show you the document what uh I got which is basically a dummy uh I created some e-commerce fq questions where it has questions related to maybe whether can I modify my order or maybe related to the return policy or something like that right so you could see the return policies 30 days something like that you know let's go back to the thing I think it has created the agent is there anything I would say I'm good and now we should be able to uh you know okay so let's go back to the uh agent now I think agent got created because you know uh we are looking at this particular agent and we can now ask question to that agent so let's see whether it is able to answer from this particular document right so basically we have created now a bot using the natural language and we describe what it uh it should do right maybe we ask the same question okay what is written policy maybe I would say as per doc 40 is return return policy and we can check under the hood what's happening so it is calling a function which is nothing but the vector tool basically it's going to be a vector index you know and like wrap around a query engine kind of a thing and you could see uh you know we are calling the vector index with the keyword called return policy and it going to retrieve I think it got output also let's look at the UI so it is saying the 30 days you know thing and we could see that it is a 30 days thing right so I can ask other questions I can ask something like you know can I modify order let's see I ask about the can I modify order again we can check Vector tool with ugs Mod ify order orders can be modified within 1 hour of the placement right and that's correct if you look at yeah 1 hour of the placement and it is able to find the thing and you know answer you now let's say here we could see you know these are the couple of options we have here but uh at the moment we didn't include the summarization it is a true false so we can on off the summarization let's say if we ask summarize uh PDF what it will do and maybe we could see under the hood what's happening it is still using the vector tool you see it actually should not search something like summarized PDF and it is trying to find something from the document okay actually but uh basically it should use the summarization tool so it is searching this um you know embedding the summarize PDF thing and we got account management product information privacy and something returns and refunds I think it is still able to because we are retrieving the 512 three chunks and basically the final prompt should be able to you know summarize whatever the three chunks what it has you know written but ideally more sophisticated ways actually there is something called summarization tool which we should on so if you go to the rack config we could you know include summarization let's say we use include summarization and maybe we can update the agent okay so earlier when we saw when we asked the question related to the summarization it used the vector tool now what will happen let's go back and ask same question like summarize PDF and let's see because now we got special tool uh which we enabled right which is summarization option and let's see now if you see summary tool with the Uggs this particular you know uh what do you call this particular tool now it is calling which is specifically designed for let's say summary and maybe we get the same answer but you know this is the way maybe we should actually uh you know so document that provides answer from frequently asked questions about e-commerce website it covers topic like ordering payment option shipping and delivery and and this is okay pretty good um kind of thing so maybe we can compare both the option but this is what we should do and this all information actually here so if you look at the description here that you can you know set the prompt you can decide whether you want to include summarization or not maybe you know I think you can supported LMS and embedding you could see what it is supported at the moment you got the open AI anthropic replicate and maybe we could use one of the hugging face kind of thing at the moment I think it is using embedding by default I think this is from opening embedding but it can also support the hugging face model so maybe uh we can further later experiment so this is typically good like you know we just get nice you know streamlit application which has these options and parameters and we can modify the code also I guess you know so uh whatever it's happening you could see it it has a small code base so you could see the stream file that what you see is this file particular you know the build drag B powered by this and that you can look at the uh agent utilities here what's happening under the hood cut resolve this is so there is a these are the classes load data you can see the load data supports I think it is support web page Also let's try web page and see so maybe I would say let me go back to the homepage where we were building and let's say um I think I tried this let's let's say I got some web page here related to the e-commerce and I say you know include this web page content also and we give the link up right uh that particular thing and let's see under the hood we could see something what's happening so it is calling load data with the argument and then it has taken the URLs that we have taken and it has loaded data successfully from that URL okay now what uh we can go back if you need anything at just setting no we are good right uh I think we are good here we don't need to make any parameter changes we go back to again agent and maybe uh let's see we ask questions based on that uh URL which has the type of e-commerce you know which has the business to Consumer consumer to business something like this so let's go and see you know what are types of e-commerce and I'm just thinking let's look at what's happening so it is calling Vector tool because we got those uh you know already details out there good it is able to get those types right which we just saw consumer to business business to business so we are able to update the bot with the new URL let's see whether it is able to retrieve the previous information so now we just tested the um you know the new web page that we added but we need to make sure it is still able to access the PDF document that we have earlier added there right so let's ask something else from that PDF also what type of I don't know maybe what the shipping cost how long does it take to delivery okay this might let's ask this one to make sure whether it is sealable to answer from the PDF also again Vector tool how long does delivery take okay why is taking time maybe it will be interesting to look at the code and see what's happening you know under the hood all the time uh it has a code and we can check oh it is still running what happened how long does delivery take okay not sure why it is taking this much time is it open AZ or not sure should I stop the run and then again try maybe I think so it stop the run maybe oh it's not going to stop oh sorry we got the answer actually you know so we just stopped actually before that but I think we got the answer under the H you could see we have got the answer that delivery takes 3 to five business days and the domestic order 7 to 14 days oh sorry domistic 325 the international 7 to4 is this correct yes it's correct so basically uh it is able to maybe there was some glitch uh you know to get the answer but I think it is able to do both the things so we tried first the PDF then we Tred we updated the bot with the new information like we give a web page URL and we then saw okay it is able to answer both the previous information and the new information right there's some glitch maybe right so you guys can try and see you know this is interesting I would say we should try actually other than open AI so if we're going to use it as alternative to gpds maybe we can treat it as a fully open source options right the open source embedding open source Al and that would be interesting to you know try working pretty good U like I just think like I got the better UI to play with you know I could reuse actually this thing for you know and it's since I buil application for the client it's good for them that they got some options where they could you know uh play with I hope you found this um uh you know video interesting maybe there is something glitch because I just you know sto it I hope you found this video useful you guys try and let me know right you know how you find these rags and new functionality what uh you know llama index has come up with thank you very much
Info
Channel: Pradip Nichite
Views: 5,403
Rating: undefined out of 5
Keywords: rags, llamaindex, llamaindex rags, rags pipeline, gpts
Id: wjIkzDydKOI
Channel Id: undefined
Length: 21min 17sec (1277 seconds)
Published: Sun Nov 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.