DAY-6: LLM Generative AI Project using OpenAI & LangChain

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay so I think uh I'm visible and audible to everyone visible please do confirm in the chat if I'm Audible and visible to all of you and then we'll start with the session yeah hello everyone uh good afternoon to all so we'll start within 2 minute I'll let everyone join uh so we'll start by 3:30 okay F so I think uh we can start with the session so welcome back to this community session of generative AI uh this is day six and today we going to start with our first end to end project that's going to be a McQ generator so guys uh this is this is our first uh like end to end project which we are going to implement by using this generative AI uh by using the llms and all and in this particular project we'll try to use the all the concept basically whatever we have learned so far in our course in our committee session so first of all uh let me show you that where you will find out all the session all the uh resources and all because we have updated each and everything over the dashboard and each and everything you will find out uh in the uh resource section so let me show you that uh particular thing and for that guys you just need to visit the Inon website and after visiting the website you need to search about the generative AI so search about the generative Ai and there you will find out two dashboard so first uh One dashboard for the English and One dashboard for the Hindi so yes I'm taking a same session on my on the Inon Hindi YouTube channel as well so you can search I neon Tech Hindi so there I'm taking a same session and uh there also I'm explaining the concept of the generative VI and all so guys here what you need to do here you need to click on this particular dashboard generative AI Community session and once you will click on that so it will ask you for the enrollment and here we are not going to charge you anything any cost so if you are new then please uh do sign up and then uh try to enroll in this particular course now here guys uh just uh enroll to this particular course and after that you will be redirected redirecting to the dashboard so after sign in you will get a dashboard uh here you can see this is a this is a complete dashboard uh just a second let me show you that this is the one so this is the this is the dashboard guys and here you will find out all the recording so uh so far I took uh five session day one day two day three day four day five and in this particular session I covered each and everything regarding the generative AI whatever uh is required if you want to start with the projects and all so uh just go through with the very first session there you will find out complete introduction and in the second one so in the second session uh there I have discussed each and everything about the open Ai and in the third session I have discussed about the lench and then I talked about the a few more concept like lch memory and all even I have discussed about the hugging phas API so if you want to use any open source model if you don't want to use a model from the open AI so uh you can access the model from the hugging phase also that thing also I taught you so if you will go through with my session each and everything you will find out now it's time to implement the project so we'll try to implement a project and the project is going to be end to end and not even single so uh not even this project so we are going to implement two more project with a few more advanced concept like vector databases and uh there we'll discuss about the RG and there we are going to create our web API by using the fast API and flast so each and everything we are going to do here itself in a live session so please make sure that you enroll uh for this particular dashboard and please try to check with the Inon YouTube channel as well there we are uploading each and every video so once you will search over the Inon so let me show you that so uh first of all you need to open your uh open your YouTube and there search about the uh ion so here you can see so open the Inon YouTube channel and inside that uh like there you'll find out one live section so just click on this live section and you will find out all the recordings so here you will find out all the recording from day one to day five and uh today I'm uh teaching a project it's a day six and uh if you will open any sort of a video so here in the description also you will find out each and every detail so here you will find out a course detail here you find out each and every detail basically whatever is required so please make sure that uh like you are enrolling to the dashboard for the entire resources and all and yes recorded video is available over the Inon YouTube channel as well got it so I think uh this is fine this is clear now let's start with the project so as you have seen the uh the topic uh so the topic is what the topic is the project name is what the project name is a McQ generator using open Ai and length chain now why I took this a particular project because see uh we have learned each and everything we have learned each and every concept so far related to open API related to The Lang chain now how we can utilize those information until we are not going to implement the project so in that case we won't be utilize that particular information whatever we have learned even we won't uh we won't be able to relate those thing with a real time thing so that's why I kept this project for all of you in between and then we'll try to move into some Advanced concept like databases and all and we'll try to create a few more a few more project in our upcoming session but yeah so here uh we are going to start of from the very basic project and then we'll go to the advanc label got it now what all thing I'm going to discuss in today's class in today's session along with the project so here I will teach you the entire setup of the project so here uh we are not going to implement this project in a Jupiter notebook so for that we are going to create a complete development environment so I will show you how you can create a like and and development environment and then we'll try to deploy this project as well so in tomorrow I will show you how you can deploy this project along with the cicd concept along with the continuous integration and continuous deployment concept so in today's session we'll try to see that how we can set up our uh development environment and then uh we'll try to uh implement the Jupiter notebook regarding a different different application and then we'll try to convert that Jupiter notebook into a ENT application got it yes or no so the agenda is clear to all of you please uh do let me know in the chat yes or no great so I think uh we can start and uh yeah if you are liking the session then please hit the like button and keep watching so guys uh the first of all let me write it down each and everything each and every step uh whatever we are going to do here and whatever uh we'll be doing throughout the session so for that uh I'm using my Blackboard and here itself I'm going to write it down the each and everything so first of all let me remove it and yes uh I have opened the fresh one now let me write it down each and everything uh uh regarding today's session so guys see the first uh thing which we going to do uh that is uh environment setup so at the first place uh we going to uh set up our uh environment our development environment I will show you the complete a project setup so here let me write it down so setup development environment so the first thing which we're going to do uh we going to set the development environment now after that what I will do after setting the development environment then I will try to uh run a few experiments run few experiments uh few experiment in a Jupiter notebook so we we'll run a few experiment in a jupyter notebook after that we'll create a end to end we'll create a modular coding like by using this particular experiment and all so I will do a like modular coding I will create a several file and then I will try to segregate the code so uh after doing a few experiment in a Jupiter notebook I will convert this Jupiter notebook into a modular one got it modular coding now after that after uh converting to a model one Modular One definitely uh like uh my code will be uh my code will be already and then I will create my web API then I will create my web API by by using the stream LD so here by using the stream LD I will be using I will be creating my web API and after uh creating this web API definitely for sure I will test it and finally we'll try to deploy our application on my cloud platform in my AWS or AER got it so these are few step uh these are the these are few things uh basically which we're going to perform uh regarding this particular project so today uh I will be uh cover this two point the first one second one and maybe the third one and tomorrow I will create a web API because we have a time restriction the session is just for the 2 hour otherwise I can complete this thing within a uh class itself so today I'm going to complete this two thing and tomorrow uh I will be converting uh the entire code in a modular one and then uh we are going to create a web API and finally we're going to deploy the application got it now after that now after that what uh we are going to learn so after completing this thing we're going to learn about the vector databases we'll try to learn a vector databases we'll try to see that what all options we have if we want to store the embedding not even the vector databases what all other options we have so we'll try to explore about the mongodb cassendra and we'll try to look into the SQL based database also and then finally uh we'll look into the vector databases or different different options we have and then uh we'll try to use the RG concept on top of that and we'll create a few more project so yes uh from today's onwards our project journey is going to be start so don't miss it and within 2 week our aim to complete at least three and two and project in a live session itself got it so I hope this idea is clear to all of you now uh let's start uh first uh with the project setup so the implementation the project basically I'm going to implement in a jupter notebook so entire development setup I'm going to create in my uh sorry I'm going to create in my VSS code so for the entire development I'm going to use my vs code and today I will show you how you can set up your vs code for the Android development got it so for that guys uh what you need to do first open your CMD uh uh Implement along with me because uh I will share the GitHub link with all of you so that you can uh write it down the code you can copy each and everything from there itself and along with the code I will I will be writing all the commands and all whatever I'm going to use in my uh in my project so in my project setup and all so each and everything I will be uh I will be writing in my GitHub uh I will be writing in my readme file and then I will give you uh through my GitHub link so guys uh you can follow uh uh each and everything along with me so uh first let me start from the project setup so uh here guys uh first of all what you need to do so in any any directory in C directory in D directory in whatever folder you need to create uh one folder you need to create one fresh folder okay so go in uh go with any directory C drive uh C directory D directory C drive D drive e Drive and inside that you need to create one folder so here you can see this is my location C user sunny and here I'm going to create my folder one fresh folder so for creating a folder there's a command like mkd by using this particular command I can create a folder so here I'm going to write it down mkd and my project name so let's say my project name is what McQ generator so this is the like uh this is the folder name which I have written now uh yes I have created my folder now what I need to do I need to move into my folder now I need to change the directory so here I need to move into my folder I to change the directory so for that we have a command like CD CD and CQ generator this is my folder name now you can see I'm into my folder now I inside my folder and from this particular folder I need to launch my VSS code so for launching the vs code from the command promp there is a command the command is called code dot code space dot so once you will write it down on this particular command code space dot so in that case you will be able to launch your jupyter notebook in a current folder right so here is my folder name my folder name is what my folder name is McQ now here you can see I'm able to launch my jup I I'm able to launch my vs code inside this particular folder now if you want to verify so for that what you can do you can go with your terminal so just click on the new terminal and here you will find out the same location which you are seeing over the command prompt so guys here you can see you are into the same location which you were seeing over the command prom got it now let's say uh if you don't have this vs code so from there you can install this vs code so for that you just need to go through the Google just search over the Google just search about the google.com and here write it down vs code download so write it down here vs code download so you will get a link for downloading the vs code and here uh this is the link guys I'm giving you this particular link inside the chat and here uh like you can go through with this particular link and you can download the vs code according to your opening system system so if you are using Mac uh so you can download from here if you are using the Linux so from uh for the Linux you can download from here if you using Windows so for the windows you can download from here you will find out all the three option for are different different operting system now uh once you are done uh uh like with the download and all so after that what you need to do so after that you need to install it so just try to do a double click and install this vs code inside your system and then you can follow follow the same procedure so you can create a directory you can uh write it down this first and then you can change the directory and from that particular directory you can launch the VSS code got it now if you're are not able to do it by using this command line so by using uh by using the UI also you can do the same thing so for that uh just uh go inside your directory and here create a new folder so create a new folder and then do the right click and check with the show more option and and here you will find out option for launching this vs code so by using this uh GUI also you can do a same thing and by using the command prom also you can do a same thing so I took this command prompt approach and here you can see I'm able to launch my VSS code inside this particular folder so if you are done till here so please do let me know in the chat please uh tell me guys if uh you are done till here tell me first have you open your vs code in a folder if you did it then please write it on the chat yes yeah I'm waiting for 1 minute so until you can open it yeah you can use the pyam also uh not only issue with that py Cham will also work any ID so here I'm using this vs code okay so I think uh now everyone is done so let's start with a further step so after opening this vs code so F the first thing uh the first thing which you need to do you need to initialize the git so here guys uh what you need to do you need to initialize the git so uh here see we have uh uh like a various option here once you will click on this drop- down so here you will find out of various option like Power Cell G bash command prom Ubuntu Kali so in your case it there might be only G bash command prompt or Powershell but in my case here you will find here you can see I have a different different ter teral right but maybe in your case you just have this git bash and command prom that's that's all fine right so either you can work with this git bash or you can work with the command prom but don't work with this poers shell because otherwise unnecessarily you will get uh errors and all so I won't recommend you to uh work with this Powers shell and all so if you want to work uh with a like with a terminal so here either use this git bash or this command Pro don't select this Powershell so here I'm using this git bash so here I can uh easily run my uh uh like Linux command also so yes uh if you don't want to use this git bash so you can use this command prom also that is also fine now guys here uh you'll find out that okay so this is what this is my git bash now uh here if you're are not able to see the base environment so for that what you need to do so just try to click on this View and go with the command pet so here you need to go uh you need to click on The View and click on the command plet and then select python interpreter so here you will find out various interpreter so you need to select this base interpreter and after that you need to relaunch this git badge so in that case uh if if you are not getting that base environment in your uh git badge so after like following this step uh definitely you will be able to see that so here now you can see I have a b environment on my good B now uh let me uh let me run the further thing so the first thing what you need to do over here like so the first thing you need to initialize the git right so inside this directory you need to initialize the git so for initializing the git I just need to write it down a simple command that is what that is a git in it so by using this particular command I can initialize the git in my current folder in my local folder so now this local folder will be treated as a local repository and then I can uh I can upload this same folder on my uh G GitHub and yes like that's going to be my central repository so GitHub is going to be my central repository and as of now if I'm going to initialize the git in my local folder so this is what this is my local repository each and every thing each and every track actually I'm going to keep it keep over here itself in my local folder so that uh like the entire data you will find out inside the dogit folder I will show you that so here you need to write it down this git in it so once you will write down this g in it uh so you will be able to I the G inside this particular folder okay now uh here you can create a file so here I'm going to create my read me file so r e a d MD so readme do MD so it's going to be a markdown file MD means what it's be it's it's a markdown file so here uh guys you can see I created my markdown file right now uh if I want to publish see as of now see if you will look into this particular folder so let me reveal it inside the file explorer so just try to click uh do the right click on this file and reveal in the file explorer so here you will find out this dotg and here you will find out each and every information so because of this dogit folder actually uh this a local folder is being treated as a local repository now here you will find out each and every metadata so regarding your commits and all so whatever codes you are going to upload whatever like changes you are going to made and all right whatever uh changes you are going to commit and uh so each and every metadata you will find out inside this dogit folder and why we use this uh git guys tell me we use this git for the code versioning got it I think uh you have a basic idea about the git so I'm not going into the depth of this git and all as of I'm just U like giving you the uh the high level overview that's it now here uh you can see I have create I have initialized the git and here you can see this dot git folder inside my uh dot git folder inside inside my local repository so is it fine to all of you I think yes now what I can do here so here I can publish the bran so I can publish the this local repository to my GitHub so for that what you can do see you can use this uh terminal also and here this vs code has given you the gii option so just click on that just click on this particular option and here you will find out uh the various thing right so uh here you will find out the a various options and all now let me show you step by step so the first thing what you need to do so first you need to add your file so for adding the file you just need to click on this plus icon so uh if you want to add the file uh so for that you need to click on this plus icon and after that uh like you need to uh write it on the message so you write down now that first you run this git in it and then you run this git add git add and the file name so I'm doing the same thing over here so by using this plus icon I'm I'm adding this particular file right so uh in my uh like staging area right so and then I will do the commit after writing a message so here I'm writing down writing the message uh this is my first commit so here uh my message is this is my first commit now after writing the message what I will do I will commit it after committing is uh after committing uh it okay so it will ask to me would you like to publish this Branch so I would say yes I would I want to publish this particular Branch so here it is is asking to me how you would like to publish it so whether uh as a private repository or as a public repository is going to publish over the GitHub actually so here it is asking to me how you'd like to publish it whether as a private repository or as a public repository so as of now I'm going to uh publish publish this particular Branch as a public repository so you can click on this public repository and yes it will publish a branch so it is uploading all the file here you can see and then it will give you this a particular popup so here it is telling you that please sign in with your browser so once I will uh click on this uh sign in with your browser so yes it is uh doing that and uh just wait it is publishing the branch so it has given me uh this particular page now let let me authorize it so here I need to click on this confirm and after that guys you can see authentication succeed so now uh my branch is uh published let me show you that so here you can see you can open it and this is guys this is my Branch okay so I published this branch on my GitHub so I hope this thing is uh clear to all of you and you are able to publish your branch yes or no guys tell me are you able to publish your branch just a second great so now let me give you this particular link and and so that whatever code and all I'm going to write it down so directly you can copy and paste from here itself from my git so let me give you this uh particular uh link uh so that you can copy each and everything from here itself just a second so did you get it please uh do let me know in the chat if you got my code tell me guys fast sorry if you got if you got my link then uh please do let me know in the chat again I'm pasting uh this particular link so this is my GitHub link guys yes please do confirm if you got my GitHub I given you the GitHub guys yes or no I am waiting for a reply please check it check with the popup so first you need to sign in through the browser and then only you will be able to log in if you're not able to follow this GUI approach uh in that case uh what you can do so you can uh like uh push it through the command line also yeah if you are not able to log in so through this uh command line you can uh configure the username and the uh like email ID so for that there is a like a command so let me show you that particular Command right just a second so what I can do I can show you over here itself uh so you can search over the Google how to configure how to configure get uh username so you can search over the Google and then you will get a command so let me give you those particular command if you are not able to uh sign in but please make sure that if you're getting the popup then then directly you can sign in but if you're getting any sort of error right so for that there is a command so get config hyphen iph Global hyphen iph Global user.name and here you need to pass your username so like whatever username you have so you just need to pass your usern name and then you need to pass the you need to configure the email also okay so here uh for the user name and in a similar way you need to configure the uh you need to configure the email so let me give you this uh two command now here let me write it down that you need to write it down your your username your user name and here is a command guys so first try to configure your username and here again I'm giving you the same command along with the username you can configure your email also so let me write it on the email and in the double code actually you need to pass your email so here your email ID so guys uh run this two commands on your uh on your uh command line actually and then you will be able to sign in from here itself got it yes or no till here uh everything is fine everything is clear I given you the GitHub Link in the chat so um you can click on that and you can uh like you can check with my repository each and everything I'm going to update over there itself so that uh you can copy and paste the code directly from there now guys uh here uh if you're not able to find out uh if you're not able to click on this link so you can search uh with my user name also so or over the Google you can write it down Sun Savita GitHub you will get the GitHub directly it will give you the link link of the GitHub and this repository is a public repository so directly you can go through with my repository and you will find out this particular project got it great yes uh from the same terminal you need to configure your username and email ID okay now here we have published uh this code as a uh like to my GitHub right this this particular repository this local repository I published to my GitHub now I need to follow few more step for setting up my environment so the next thing what I need to do here I need to create my environment because I'm not going to work in my base environment and I'm going to create a virtual environment over here okay so for creating a virtual environment there is very a simple command so let me write it down on that command so cond cond create cond create hyphen P okay hyphen p and here you need to write it on the environment name so here my environment name is going to be en EnV e andv and then you can write down the python version python is equal to 3. 8 so I'm using over here 3.8 and then hyphen y so this is my command uh which I'm going to run and by using this particular command I can create the environment in a current directory itself in a current repository so here you can see this is what this is my environment uh which is being created so just wait for some time it will take uh few second let it create so my environment name is what my environment name is EnV now here my environment is getting created and it is done now after that what I need to do guys so here I need to activate my environment so for activating the environment you need to write it down Source activate if you are using this G terminal so in that case instead of this cond you can write down this Source because sometimes this cond gives issue so I'm not going with this cond here so I'm using this source of over here so you need to write it down the source activate activate and here dot dot means current directory and from this current directory there is a folder folder name is environment e andv right so here you can see I'm able to activate my environment and here you can see this is what this is my virtual environment got it now let me clear it first of all so here now you can see it is giving me a uh like uh it is giving me a how it is giving me so many files uh for adding right so U like here it is giving me more than 5,000 fil but I cannot like add all the files I cannot like add all the files on my GitHub right so for that what I will do if I want if I don't want to track it if I don't want to track this particular file so I can U mention this name this EnV name in in the file the file name is what the file name is dog ignore so here let me create one more file in this uh particular directory and my file name is what my file name is uh dogit ignore so here I'm writing this uh dogit ignore uh and the touch command is the touch command for creating a file so touch dog ignore now here you can see I'm able to create this particular file this dog ignore now inside this file you can mention the name the name of whatever file which you don't want to trag so here if I don't want to trag this EnV folder right if you don't want to trag these many file if I don't want to upload it in my cloud repository right or if I don't want to track it uh by using this git so you can mention it you can mention this folder name inside this dot inside this dog ignore file so here I'm writing EnV uh EnV is nothing it's a folder name now once I return it once I return this uh EnV inside this do G ignore now you can see it is not going to track it at all so here uh it is not going to trag uh this particular folder now and it is giving you only it is giving me only one file now yes I can uh add it so here uh first I'm going to add this file get add and this file name now here I'm writing my message so I have added I added my git ignore so this is my message and after that what I will do after uh after this after this one I'm going to commit it so edit my G ignore and then do the commit now uh you need to click on this sync changes your and your changes will be sync so the same file you will find out the same file you will find out in my GitHub also so uh let me show you where you will find out that let me open my GitHub and uh here guys here is my GitHub let me show you the repository here is my all the repository and this is the uh like folder this is my like project actually now see uh I just added this do get ignore now see see that uh commit just now just now I committed uh this uh particular file and here you can see my DOT get ignore now once you will open it so here you will find out the folder name so the folder name is what EnV so I don't want to track this file throughout my process right so I uh if I don't want to track this file at all so yes uh for that I will mention it inside my dog ignore file got it now uh till here I think everything is fine everything is clear and I hope you are of you are able to follow me till here so please do let me know in the chat guys if uh uh everything is clear everything is fine till here what about 3.9 yes you can use 3.9 3.10 as well but don't use 3.11 3.12 or 3.13 till 3.9 and 10 it's fine but please make sure that uh uh please make sure that you are going to use the same version which I am using uh so you won't face any sort of a issue any you won't get any sort of error uh during the implementation got it yeah so if it is done then uh please do let me know guys please write it on the chat and uh please hit the like button if you are liking the session then done can I get a quick confirmation of the chat great so I think uh now everyone is done so here I have created my environment now guys what you need to do so after that you need to create your requirement. txt so inside the requirement. txt I'm going to mention the entire requirement right so for creating a requirement. txt so from uh here also you can create by using this particular icon otherwise you can use the same command same touch command command by using that command also you can create the requiring txt in a current folder in a current repository now uh for creating a requir txt so I'm using this particular icon and here I'm writing requirement R Qi r m me n ts. txt now in this particular file I'm going to mention all the requirement whatever requirement I'm having regarding this project right so I'm mentioning all the requirement inside this re. txt so guys uh let me copy and paste all the requirement whatever is there all I'm going to write it down here itself so the first thing which I'm going to use uh in my project that's going to be open a so I'm using the open a API and for that this open package is required already I shown you how to use open API how to install this particular package because earlier we also we have created the environment and there also we have installed this open AI if you have attended my previous session then definitely you must be aware about this particular thing now here uh there's a open AI now the second thing which I need to uh install in my local environment in my current virtual environment that's going to be a l chain so here guys let me write down the L chain so you need to install the L chain in your current environment first thing is open Ai and the second thing is what the second thing is the Len chain the third one uh which I'm going to write it down over here that's going to be extrem late because here I'm going to create a API by using this stream lit so here I'm going to like install the stream lit in my local uh like environment in my current virtual environment the second thing which I'm going to be install over here uh that's going to be python hy. ENB so I will tell you what is the use of this particular like uh uh this particular package python. EnV so I'm going to install this uh python hon. EnV package and I will tell you what is the use of this particular package and apart from that I'm going to use I'm going to download one more package that is going to be a pi PDF so Pi PDF 2 so these many thing I'm going to be installed in my current virtual environment okay and apart from that I'm going to create couple of more folder right couple of more folder I'm going to create in my local repository in my local folder so a couple of more uh files and folder not only folder files also so here uh uh requ txt is done now I'm going to create one more file the file is going to be setup uh setup uh setup.py file now why we use this setup.py file we use the setup.py file for installing a local package local package in my virtual environment if I want to install the local package in my virtual environment for that we use this setup.py file got it so I created the setup. py file I created the require. txt now let me create a one more file so here I'm going to create so not file actually I'm going to create one folder here my folder name is going to be SRC SRC means what SRC means source code now inside the SRC I'm going to create a one more folder and the folder name is going to be so first of all let me create a file inside this SRC the file name is going to be dot uh sorry _ init.py so here inside this SRC folder I'm going to create init file okay init file I will tell you why we create this init file inside the folder what is the requirement of that and uh each and everything I will explain you don't worry so here uh you can see Ive created this init file and inside this inside this SRC folder itself I'm going to create one more folder the folder name is going to be McQ itself so McQ generator and this is what this is my project project so McQ generator so this is what guys this McQ generator is nothing it's my folder and inside this also I'm going to create one init file so here let me create the init file inside uh this folder also so init init.py so what I did guys tell me so here if you will look into this uh if you will let me reveal it inside the file explorer and let me show you that what I did so here uh just look into the SRC folder so inside this SRC folder I created two things first I created this init file and the second one I created the McQ generator folder and whatever source code whatever source code I'm going to write it down throughout my project so I'm I will be writing down here itself apart from the Jupiter notebook so each and every line of code modular coding I will be doing over here itself inside my McQ generator folder fer got it now here uh what I did I created this init file underscore uncore init underscore uncore now what is the requirement of this init file why I did it because see if I let's say uh like here I want to consider this a folder this folder as a package as a local package right this folder actually I want to consider as a package now what is the meaning of the package so the package is nothing it's a it's a folder itself folder which is containing a multiple python file and inside the python file you have a code you have a code like classes functions and all right so you have a folder inside the folder you have a file and inside the file you have written a code right so now guys see uh let's say if you're installing pandas if you're installing numai if you're installing maybe open AI or let's say if you're installing langen so what is this tell me it's nothing it's a f it's a package itself it's a package now and package means what package package is nothing it's a folder right folder is what what F the package is equal to folder right folder itself is called a package now inside the package or inside the folder what you will find out inside that you'll be having multiple python files right and inside those python file you uh someone has written a code uh in terms of function and classes and that is what uh that only you are going to use right so this uh lank chin this uh open AI this pandas numai someone already created it and they have uploaded over the pii repository and from there you are going to install it inside your project but here this McQ generator actually it is your local package where you are going to create a multiple folder multi multiple python file and uh if you want to treat it if you want to treat this folder as a package so for that there's a convention from the python side you will have to mention this init file inside the folder right so here my folder is what my folder name is SRC SRC means what it's a short form of the source code SRC now this SRC actually I want to treat as my local package so there is a convention from the python side you need to mention this init file or you need to create this init file inside this folder then only it will be treated as a local package I think the idea is clear now so by using this setup.py file by using this setup.py file I'm installing this local package in my current virtual environment got it I think now each and everything is clear to all of you now let me back to my code so here is what here is my code so I created couple of a folder couple of file now guys uh let me create one more file uh like one more folder over here and the folder name is going to be experiment so here I'm going to be create one more folder and the folder name is going to be experiment and inside this particular folder I'm going to create my Jupiter notebook I'm going to create my ipynb file Okay so so for creating IP 1V file inside this particular folder so you can click on this folder and click on this file icon and then you can write down your name so here I can uh write down the name any any name I can write it down here let's say McQ dot ipnb uh do ipnb so what is the meaning of this ipynb so ipynb means nothing uh I python uh notebook okay that's the full form of this ipynb now here you can see this is what is my Jupiter notebook now whatever experiments uh whatever experim experiments will be there throughout this project so I'm going to do my entire experiment over here itself in my Jupiter notebook and then I will convert into an end to end code into my end to end pipeline got it now here uh the first thing what you need to do so you need to select the kernel so just click on this select kernel and then click on this python environment then you will get all the python environment so this is your current virtual environment so this this the this interpreter which you can see over here the first place which is a recommended one so this is from your current virtual environment from the EnV itself here you can see EnV python.exe so here I'm going to select the same kernel so here I have selected this particular kernel now you can see uh I'm done with everything now I just need to uh I just need to like uh install the recomand txt I will start by writing the code so let me give you this each and every file and folder so for that I just need to Ed it from here itself so I'm going to add all the files and all over here I think it is done now I will write it on my uh like message so my message is structure updated so here is what here's my message guys now let me commit it so structure s c Tru structure updated now I have written my message after adding all the file now once I will do the commit and it will will ask to my sync it will it will ask to me would you like to sync changes so yes I want to do it now I will click on okay so as soon as I will click on okay you will find out every file and folder in my repository itself so now let me show you uh every file and folder uh so here guys you can see I have a experiment folder now inside that there is my file ipv file that's what this this this file this particular file I'm going to use for my uh entire experiments and all and here you will find out my SRC folder inside the SRC folder you will find out the init file and one more folder that is what that's the McQ generator and then you will find out this setup.py also so here I have the setup.py as of now you won't be able to find out any sort of a code over here but don't worry I will keep it inside my setup.py file and here you can see my require. txt so here I have mentioned all the requirements got it now let me uh give you this link to all of you so I'm pasting this link inside the chat and if you're not able to click on that so you can search over the Google let me search in front of you only so just go through the Google and search Sun Savita GitHub so once you will search it uh then automatically you will get a GitHub link just go through with the GitHub link and here click on the repository so here is a repository click on the repository and the very first project this one McQ generat uh so just click on this uh this particular project and I have kept each and everything over here itself inside one folder so if you are done till here then please do let me know in the chat yes in my previous class I shown you how to use hugging pH API Hub don't worry uh after this project I will use the open source model only I won't going to use any uh like any model from the open itself but yeah in today's project in the very first project I'm going to use the openi API along with the Lang chain got it tell me guys uh is it fine to all of you are you able to create an environment and uh did you publish it have you created a environment did you created a GitHub um and sorry did you initialize the aid get basically and did you publish your repository if everything is done then uh please do let me know guys I will uh move with a further step so please uh write down the chat if uh you are done till here then I will proceed uh with the further commands don't worry I will give you all the thing all the commands and all in a documented format so you won't face any such issues and all or in a single uh like go you can run like each and everything don't worry I will give you that first of all tell me uh if you are able to do along with uh if you able to do till here if you able to do these many thing then uh please give me a quick confirmation or if you are comfortable till here please do let me know fine so I think uh we can proceed now so uh here I have created uh you can see uh I created uh many files and folder now let me open this setup. py file okay so here I have open my setup. py5 and here I'm going to write it down some sort of a code so what I can do let me copy the code uh there is only just one function and here I pasted the code got it now uh just look into the code so what I have written over here so here I have imported one uh statement uh the statement is what the statement is a find package so from setup tool I'm going to import the find package and here is what here is my setup here's my method setup method now here I have mentioned couple of thing uh so I'm calling this particular method setup method and I have mentioned uh some parameters so the first parameter is a name so here I'm going to write down my here I'm going to write down the name of the package now here is a version version of the package now here is the author author is a sun sun Savita author email s.v. and here is install requirement so these are are the package which is like required okay now here is a package so find package so once uh see uh this find package actually this this particular method only it is responsible for finding out the local package for from your local directory so wherever uh it is able to find out this dot init file wherever it is able to find out this do init file it will consider that folder as a package got it now uh here you you can see so I have imported this thing find package setup uh find package find package and setup method and I have written all like these many thing over here right so this is the like name of my package uh which I have written over here right each and everything is each and everything F now see guys if you want to install this package so for that there's a command the command is PIP install package name right I think you all agree so if you want to install this this particular package open AI load Lang Chen stream late python python. EnV P PDF so for that there is a command the command is PIP install and package name if you want to install this require. txt so for that there is a command the command name is what the command name is PIP install hyr re. txt right but if you want to install this a local package into your current virtual environment so uh how we can do that so for that also we have a command the command is what the command is directly you can install this setup.py file you can write it down python setup.py install so in that case it will install or it will download all the current package from your folder into the virtual environment got it that's the first way the second way is what so here you can write it down in the requir txc itself you can write it down hyph e dot right so uh if you are writing this hyph e dot so in that case it will search all the local package all the local package into your current directory into your uh current folder and it will download or it will install it inside your virtual environment again I'm repeating see if you want to install this particular package so for that there is a command pip install re. TX pip install package name if you want to install all the package by using the rec. txt so there is a command pip install hyphen r .txt got it now but see let's say if you want to install this local package into your virtual environment so how you can do that so for that you have two ways the first one python setup.py install if you're running this command so definitely you will be able to install it the second one is what the second one is you can mention this hyph e dot inside your recording. txt so automatically it will search this it will search out the packages into your current folder into your your current repository and it will execute the setup.py in back end got it great now what I'm going to do here I'm going to be install this require. txt and so for first of all let me show you that what all packages we have inside the current virtual environment so if I will write it on the PIP list uh so here you will find out that we just have this three packages three to four packages into my current virtual environment how many packages guys three to four packages only right which comes uh by uh which is a by default only which comes uh along with the environment itself whenever we are going to create an environment now if I want to install all these packages into my current virtual environment so how we can do that so uh if I want to like run this re. txd so how we can do that so for that there is a command let me write down the command pip install hyr requirement. txt so pip install hyphen r. txt so once I will hit enter so so here you can see my all the packages is getting installed into my current environment so just wait for some time uh it is getting install and it will take some time uh tell me guys are you doing a l with me yes you can use it uh if you want to make a mini project so definitely you can use it and even you can create it uh here itself and you can showcase as a mini project tomorrow we are going to deploy it also after a web API and then uh by using the advanced concept we are going to create one more application so how's the session so far uh did you like the session tell me guys uh did you like the session did you like the uh like content if you're liking the session then please hit the like button yeah still it is installing so it will take some time I'll let it install yes you can go through with my GitHub link so here is my GitHub link just wait I'm giving you that still it is downloading uh I think we should wait more yeah I think now it is done so uh first of all let me clear the screen and uh here uh you will find out that it has created one folder uh the folder name is what McQ generator do egy info so it has created one folder and this folder actually uh it is having the entire information regarding your local package so you can visit and you can check with the different different files over here so this is the package information metadata version this one this is the P package version right this is the package name author is sunny and author email ID requir txt so these are are these all are the requirements actually right along with the packages now you will find out all the like details inside this particular fold folder the folder name is what McQ generator. ayen info it has created a various file inside that which is keeping all the or which is uh like uh keeping all the like meta information regarding your project got it I hope uh this thing is clear to all of you now uh what I can do uh first of all let me close all the files from here now let me open my uh ipv file and here what I'm going to to do here I'm going to here I'm going to like uh run my uh like import statement so what I can do I can run import OS so here I'm going to write import OS import Json import Os Os means what opening system and here I'm writing import Json import Json now here I'm writing import pandas as PD pandas as PD and here let's say I'm writing import Trace back so these are a few uh uh like a few packages basically which I imported over here now if I want to run it now if I want to run this particular cell so for that I just need to press shift plus enter right just press shift plus enter and you will be able to run it now as soon as you will run it it will ask you would you like to install the IPI kernel yes I want to install it because without that I won't be able to execute this particular notebook so here you need to click on the install and my IPython kernel ipy kernel is getting installed guys so it will take uh some time so let it install and then I will explain you the further thing further concept I given you the GitHub Link in the chat uh you can search over the GitHub uh sorry you can search over the Google s with the GitHub and then you will get the GitHub link my GitHub link and check with the very first repos very first project that is the McQ generator itself the project name the folder name is same McQ generator here you can see this one McQ generator just search over the Google Sun Savita GitHub so here you can see my ipy kernel is getting installed so let it installed and after that uh I will write it on my further code and uh let I will show you uh further concept as well uh regarding this um entire project okay yeah so now it is done and here you can see uh we are able to import this particular statement import Os Os me operating system Json pandas and traceback also now guys here what you need to do the next uh import statement which I'm going to write it down over here which is going to be a opena itself so here I'm going to use the Leng chain and by using the Lang CH I'm going to import this chat open API right because I want to access the open API and by using this particular method only I'll be able to access the open API now let me run it so it's the same method it's the same method which I have shown you in my previous classes so there I was using the lenin. llm open a now in the recent version in the updated version they have given you one more method it's a similar one only it's updated one and which is doing the same thing uh like like the previous one like the open a method and the method name is what the method name is chat open AI so yes uh we are able to import this method and now what I need to do so uh actually we this is a this is not a method this is a class so here what I'm going to do I'm going to create a object of this particular class now so for that let me copy it and let me paste it over here so this is going to my llm so by using this particular uh method itself uh I will be able to call my openi API and I'll be able to collect the llm model inside my my llm variable right so for that I need to mention couple of uh couple of parameter so here I'm going to mention few parameter let me do it over here so these are the parameter guys which I have mentioned over here so the first parameter is going to be open a API key and here basically I need to mention the key key of the open a open API now after that uh there is a model name so here I'm going to use GPT 3.5 turbo model and then uh I I I have created one more parameter I I'm going to write down one more parameter that is going to be a temperature you know what is the meaning of temperature so here I'm going to set the value 0.5 so between 0 to two you can mention any value of the temperature so what is the meaning of that the meaning is nothing meaning is very very simple you are going to like you want to create a model if you are mentioning uh like if you're mentioning the value near to two right so the range is from 0 to two if you are mentioning the value near to two this will be more creative it the value is will be near to zero so the model will be less creative it will give you the straightforward answer that's it now here guys this key will be required this open AI key will be required how we can get the open AI key I shown you how to generate opena key in my previous classes right again I'm not going to show you that now here actually I'm going to collect my openi key but this time I'm not going to paste it directly over here instead of that what I'm going to do I'm going to use my OS module so here what I'm going to write it down I'm going to write it down this a particular uh method I'm going to call this os. get environment method that uh os. get environment key method so here I'm going to call this os. getv and here uh this is what this is my environment variable so what I can do guys I can create uh environment variable I can create one environment variable into my uh Windows environment variable and I can read it I can read my key from there okay I can read my key from there the second way I can export it temporarily right so here I can U on my uh terminal itself I can write it down export and here I can mention this variable name open API key and I can pass the value in that case also I will be able to read it the Third Way is there the Third Way is like you can create create your EnV file right you can create your local environment file and there inside that particular file whatever variable is required whatever important variable is there you can keep it over there itself right the first one is a global approach uh Global means what so here if you are going to search environment variable in your windows search box so you will get the uh you will get the uh environment variable all the list of the environment variable here you can see right so you will get the list of the environment variable this one right this one now here you can see I I created one key and I keept it over here so from there also I can read it from there also I can read it by writing the same thing I I just need to mention the key the key name over here the second way the second way is a temporary way temporary way means you can export the key over here Itself by using the export command you just need to write down the export and here you can mention the variable name and you can pass the value of that particular variable that's the second second way now the Third Way is what here you can create EnV file so EnV file in your local repository itself so no need to create any sort of a variable in your environment variable here itself inside this EnV file itself you can keep your all the variable all your secret variable and by using the same command you can read it so that is a third way so I'm going to select the third way the third option so here I'm going to create the EnV file okay so EnV file uh so this is what this my EnV file and inside this EnV file I'm going to keep my key so I'm going to write down the key value and the variable name is going to be a same so let me copy the variable from here the variable is going to be open AI API key and let me keep the variable over here and here I I'm going to write down the value of this particular key so in the double code actually I'm going to write down the value so let me paste my key over here I already generated it uh I believe you know how to generate the key so let me copy and paste it over here so this is what guys this is my key which I already generated now let me open my file and here what I'm going to do I'm going to read my value the value of this key so you can treat this EnV file as your local environment right so which you have created inside the folder itself and there you can keep your all the secret variable right so now if I'm going to run this OS os. G EnV now if I will run this particular command now if I'm going to print the key so here you will find out my key value so here guys uh here is what here is my key open a key now let me show you and here it is giving me none uh let me run it again why it is not going to why it is not getting it now let me show you it is none wait guys let me restart the terminal it happens in this vs code actually uh some times I have seen but okay so fine I forgot to do one thing uh why I'm getting this none why I'm getting this none because I need to load this environment first all right so I need to load this environment first and for that uh I will have to import something see I already written one module python hy. EnV right so here I have written the module python hy. EnV let me show you this module so here uh let me open the pi first of all and here I can show you the module uh just a second Pi Pi now let me show you this particular module python hy. EnV uh see python hyphen do uh EnV reads key value pair from a EnV file and can set them as a environment variable right so it helps in a development or application uh following the 12 Factor principle so here you can read everything about it if your application T is configuration from the environment variable it's a 12 Factor application launching it in a development it's not very practical because you have to set those environment variable yourself means you will have to set the environment variable in your local system um okay if you don't want to do it you can create the EnV folder in your local so that will be your local environment file local environment file itself which will be available inside your local uh like uh reposit itself in your local folder itself got it now here the first thing uh see first you need to import this thing this from. EnV import load. EnV and then you can you have to call this uh particular method so what I'm going to do here so I'm doing a same thing uh where is my vs code here is my vs code I'm going to do a same thing just a second I'm going to load it uh I'm going to load this uh EnV so here from EnV this is is my EnV file from EnV I'm going to import a load. EnV and here is what here is my method so as soon as I will run it so here I will be able to load my all the values from this EnV file now let me run it uh let's see whe whether I'm getting the value or not so it is saying this OS is not defined so first of all let me import the OS this is also fine this is also fine and now each and everything is fine now what I can do now I can call it and let's see whether I'm getting my key or not now see guys I'm able to get my key from from my EnV file so here is my EnV file and from here what I'm getting I'm getting my key right now let me keep this EnV in my do getting node so I can push my changes in my G in that case you won't get this uh key actually you you will just get like uh the other file so here I'm writing EnV and once I return it now it is you can see it is not going to track it uh at all so now uh you want you will find out that there is no such color anything and now what I can do I can give you all the files and all other files basically so let me click on the plus yeah now let me commit it so here I'm going to write it down uh file updated file updated and let me commit it and sync changes now click on okay and here guys you will find out my entire code Let me refresh it now and yes there is the entire code so I think uh you got the code over here set the print yeah so here is a key let me remove it from here just a second yeah now it gone so tell me guys uh are you able to follow till here uh did you get the entire code the code which I shared with all of you please uh do let me know in the chat if you got the code then here I kept the entire code uh in my GitHub itself yes uh yes or no please uh write down the chat guys please uh do let me know just search over the Google s Savita GitHub and there you will find out this McQ generator repository in my repository section and here is the entire code if you are done till here then please uh give me a confirmation so I will proceed with the further uh further concept done done done great fine so now let's start with the implementation so till here actually I just shown you the uh I just shown you the environment setup and all now we are ready for implementing the project okay so within uh this uh within this one hour actually I just shown you the entire setup now this is the onetime job I set up my entire environment now let's start with the Practical uh now let's start with the experiments and all and in tomorrow's session I will create uh the I will create the Modular One modular project and there I will create the steam allet application also and finally will try to deploy it now here uh you can see uh now each and everything is done now let's try to call this a chat open a method and let's see we are able to access the llm on on so here you can see it is running and now it is done so if you will look into this llm llm now here you can see we are able to do it we are able to call it now here let's try to run the further code now we are going to use all the concept the entire concept whatever we have learned throughout the community session right throughout the throughout this community session in our openi in the Lang so we we are going to use those entire concept over here now uh for that basically what I'm going to do step by step I'm going to write it down each and everything so first of all I'm going to import each and everything in a single shot right so here uh you can see I have imported all the statement so this Trace back and all I'm going to remove it from here which I already did it this is also I already imported now let me remove this also and here uh just chat open I also I already imported now uh here this open AI prompt template llm chain sequential and this get open Ai call back this is very important uh this is very important class which I imported over here uh I will show you the name I will show you the use of this particular class this C open call back in a very detailed way because it's going to be very very important right so far I haven't discussed about it I discuss about the sequential chain I discuss about the llm chain I discuss about the prompt template but I I haven't discussed about this get openi call back so now let me import all the statements over here so you you can see we are able to import it and yeah it is done now we already created a object of this chat open Ai and we are able to get my llm by using this open AI API till here I think everything is fine everything is clear now let's move to the next one now just tell me guys if we are talking about so here what I can do let me open my a pen and let me ask a few question to all of you so here uh what I'm doing uh just a second MH yeah so here uh just uh let me ask a few question so let's say we have imported the llm means uh we are able to access my llm this uh GPD model by using this uh open a or API by using this L chain framework now to this LM what I will do what I will pass to this llm tell me so to llm to this particular llm I will pass my uh prompt right I will I will pass my input prom so here actually what I will have to do I will have to design my input prompt right what I will have to do guys tell me I will to design my input prompt and here as a output what I will get tell me as output also I will get a pumpt right so here what I will have to do I will have to design my input and output prom right so whatever my whatever my input so that a particular prompt and here what will be my output that a particular prompt got it now let's try to design my input prompt and let's try to design the response as well then in which format I will get the response so here initially I clarified this thing the project is going to be a McQ generator right I going to generate McQ McQ right whatever topic whatever uh subject I will give to my uh GPT model So based on that particular subject based on that particular uh like based on that particular text is going to generate a McQ so let's say I'm giving my paragraph I'm I'm giving one paragraph to my GPT model So based on that particular paragraph let's say I given a paragraph related to our data science uh okay I I I given one a PDF file or text file or whatever file to my GPT model so in that inside that like you have a paragraphs you have a data So based on that data is going to generate a mcqs right so let me do one thing thing so here uh first of all let me design my prompt so here what I'm going to do guys I'm going to design my prompt by using this prompt template I think you already know about the prompt template in my previous class I already clarifi the uh the concept of the prompt template if you don't know then please go and check with the previous session so here what I'm going to do guys here I'm going to Define my prompt template so just wait uh let me copy and paste the code because already I written this uh like a single single line so let me copy and paste and I'm going to explain you so here my prompt is what so here my prompt inside the prompt actually you will find out in the prompt template you will find out two thing first is a input variable and the second is template right so here you can see as a template I given this particular variable now to this particular variable I have to pass some sort of a text right some sort of a like a template and all I will pass it just wait right so here is my template variable and I will pass my template over here I'm not going to write it down directly here I'm going to pass pass it to my variable and that variable I I'm passing inside my prompt template right now in an input variable you can see we have a couple of we have a couple of variable we have couple of parameter the first one is text the second one is a number the third one is a subject the fourth one is a tone and the fifth one is a response Jon so we have a five variable inside my input variable in my previous classes uh I shown you this prompt template along with the uh simple input variable along with the one input variable right now here inside this one I have written five input variable and here I'm going to Define my template now let's see what will be my template so from here basically I'm going to copy the template and let me paste it over here so I'm saying to my chat GPT so I'm saying to my chat GPT that uh you are expert McQ maker right so I'm giving my a text so on whatever text I want to generate a McQ I'm passing a text over here right and I'm saying to my Chad GPT that you are an expert McQ maker given the aop text so whatever text we have given to you it's your job by using this particular text it's your job to create a quiz of number so how many quiz you want to create so five quiz six quiz seven quiz8 quiz you can pass a number over here so 5 six seven quiz 8 quiz you can pass the number and here uh you need to create a five multiple let's say I'm writing number is equal to five so five multiple choice question for the subject now whatever subject we are going to pass over here in tone so tone means what tone actually it is defining a difficulty level so here if tone is simple so it is going to generate a five simple McQ question if tone is uh intermediate so it is going to generate five intermediate question if tone is difficult it's going to generate five difficult inter five difficult McQ question got it now here I'm saying make sure the question are not repeated and check all the question to be confirming the text as well so each and everything I'm telling to my GPT right so make sure to format your response like so here actually I have to for I have to pass the format also here I'm going to pass here I have to pass the format also like in which format you have to generate a quiz now let me give you the format now let me show you the format so uh which format actually I have designed over here so here what I'm going to do I'm giving you the format the format basically which uh I have designed so let me show you the response format now guys this is the response format just just see over here see so response or it's my response forat so here I'm saying uh like there is my McQ multiple here I have written first okay there my means U like it's a number itself that's it now here I'm seeing McQ multiple choice question now here is a option that uh you have a four Option 1 2 3 4 and here basically I will be getting my correct answer so it is this one this one actually this is my first McQ along with the number along with a question along with the number this is my first McQ first McQ now here will be my McQ now here will be my all the options and here will be my correct answer right so this is my response form me and here is my template basically which I'm passing to my GPT model and here uh I'm going to create my prompt template that's it by using this particular template and these are the these are the variable which user is going to pass right which user is going to pass these are the variable now let me do one thing let me run it and here you can see we are able to create a like we have like written a template and this is what this is my prompt template which I created that's it I think this is fine now here uh yes once it is done uh like my template and all basically it will be created that is fine now after that what I'm going to do I'm going to create the chain right I think you already know about the chain llm chain I I explained you the concept of the llm chain that why we use llm chain we use llm chain for connecting a several component so here as of now I just have two component first is llm and the second is prompt so I'm going to connect both component all together and for that I'm going to use llm chain so let's try to use the llm chain and here I have already written the code let me copy and paste it over here and so this is what guys this is my uh like uh this is my uh like llm chain so here I'm passing my llm model with whatever model I took by using the open API and here is what here is my prompt so prompt is what so quiz generation prompt so the prompt which I have created by using this particular template and by using this particular response right in this format basically I want a response now this is what guys this is the llm chain all all the concept see whatever I have we have learned so far I'm going to use all those concept for creating this particular project right so so at least you can understand that where we are using uh like those Concept in a real time right so here is what here is my question now let me run it and here I have created my question that is fine now guys just tell me uh here uh I'm creating my quiz right so here I'm creating my quiz now here actually see I created a quiz but this quiz is correct or not the basically in the at the end you can see in the format I have written this correct answer I want a correct answer from it so after analyzing a quiz actually I want a correct answer so for that also I have defined one more template now let me show you that template so what I did actually let me show you the template 2 which I have created uh so here I have created the second second template now in the second template you will find out uh just a second let me copy all the uh like thing over here and see this is what guys this is my second template now here I'm saying here I'm saying actually uh you are an expert English grammarian and writer I'm telling to my chat jpd I'm telling my GPD actually so given a multiple choice quiz for this particular subject right this particular subject now you need to evaluate the complexity of the question and give a complexity analysis of the quiz right give the complexity analysis of the quiz only use at Max 50 words for complexity if the quiz is not at for the quantitive and the analytic ability of the student update the quiz update the quiz question which needs to be changed and change the tone such as uh such that it perfectly fits to the student ability so here I have written so here actually see here I'm passing my quiz whatever quiz basically I'm generating so in this second template I have written the uh I have written the like prompt regarding to the evaluation regarding to the quiz evaluation whatever quiz I am going to generate right first I will generate and then I will evaluate it here in the second prompt now let me run it and here I'm going to create my one more chain so here I'm going to create uh so here basically uh before creating a chain basically uh let me create just a second so here uh what I'm going to do I'm going to create my template so here in the template you will find out only two variable first is subject and the second is quiz this two variable it is coming from the user side I will show you how like it is coming from the user side and how user will be passing once we'll be creating a end to end application got it now here we have a quiz evaluation prompt and this is what this is my second prompt and now what I will do regarding this prompt also I will create my chain right so here uh here is my quiz chain now I'm going to create one more chain that's going to be a quiz evaluation chain so let me uh like uh copy this particular code step by step I have written each and everything and that is what I'm going to show you so here is what guys here is my review chain right so in this one I'm passing my llm I'm passing my quiz Evolution prompt and here output key is What so whatever output I'm getting now as a review so here I'm going to collect it inside this particular variable and verbos isal to True means what means whatever exe means uh during the execution whatever is happening now each and everything I will be able to find out on my screen itself that's the meaning of verbos is equal to two that's it now here if I'm running this review a chain so I have created two chain now now after creating this th I created First Chain quiz chain I created second chain review chain now I'm going to connect both chain right by using sequential chain so the same concept ccept I taught you in my previous session so first I created one chain where I'm going to add two component llm and my prompt Ive created second chain and now I'm going to collect both chain right both Chain by using the sequential uh by using the simple sequential chain now here what I'm going to do so here already I have imported this thing if you look into my import statement so I have already imported this a sequential chain now let me create a object of this a sequential chain and then uh I'm going to write it down the both name over here so here what I'm going to do so let me uh create object of this sequential chain now so here guys you can see we have a sequential chain and to this sequential chain I'm passing the quiz chain I'm generating a quiz and I'm passing to my review chain right so from here I'm generating a quiz and I'm passing to my review chain and these all are my input variable and these all are my output variable and verbos is equal to to True right clear so here I'm going to create a object of this sequential chain I hope till here everything is fine everything is clear to all of you please do let me know I use the uh previous Concepts only I haven't T I haven't taught you anything new uh I use the previous concept whatever I taught you in my previous classes so please do let me know if this part is clear to all of you yes or no it's very easy very simple don't worry at the end I will revise all the concepts uh whatever I'm using here whatever I'm writing over here but first tell me is it clear or not this one if you can write it on the chat I think that would be great you can hit the like button you can let me know in the chat so please do it guys uh I'm waiting for a reply because after uh this one the climax will come and in that like we are going to create a quizzes and all whatever is there clear clear clear yes or no yes saan your understanding is correct first combining two template using llm chain and then two chains we are going to combine by using the sequential CH okay okay now uh I think till here everything is fine everything is clear now let's see how we are going to generate a quiz from here after giving this many of things after doing these many of things so we are able to uh we are able to like uh here you can see we are able to create a sequential chain now the next thing is what here actually what I want guys tell me I want a text I want a data so if you have a data in PDF you can load the PDF if you have a data in txt file you can load the txt file right if you have data in some other file you can load the data from there from anywhere right so first you will have to provide a text you will have to provide a data on top of that data you are going to create or you are going to generate a quiz right so let me do one thing here I'm going to create uh I'm going to create one file the file name is going to be uh wait I'm going to create one file the file name is going to be data.txt so data.txt now what I'm going to do here uh I'm going to my Google and from there uh I'm going to copy and paste some sort of a text so let's say I'm searching about the machine learning machine learning machine learning so here I'm going to search about the machine learning now here uh is what here is my machine learning now from here what I'm going to do so here I'm going to take all the data for this one right so I took this particular data and I'm copy I'm going to copy it and let me paste it over here where I'm going to paste I'm going to paste in my data.txt so this is the complete data which I pasted over here you can check it you can reveal this file in your folder so click on reveal in file explorer you will find out this particular file uh this data.txt right just open it and here is your data which I copy and paste it from the uh like Google itself from the Wikipedia right great now let me close it and here is what here is your data now do one thing Let's uh do one thing so let's try to read this particular data so here what I'm going to do so here uh let me open my file ipy andv file and here I'm going to read this particular data so for reading a data actually we have a we have a like a code so let me write it down the code over here so I'm writing over here you need to open this file in a read mode and just read the data in this particular variable now here I need to provide the file path so for providing providing a file path let me write it down here file underscore path and here R means what R means read it and there I'm giving my absolute path so here I am passing the complete path of the file so this is the file path guys which I have given which I have written over here now let me run it and let me check with the file path that I got it or not so here what I can do I can uh check with the file underscore part now let me run it and see guys this is what this is my file path now I'm uh running this particular code and here you will find out inside the text what I got I got my data so here is what here inside my text you will find out you uh we have the entire data now let me print it let me keep this text variable inside the print method so see guys I got the entire data so whatever data I kept it inside my file inside my txt file so you can see all the data over here itself got it now after that what I will do see now there is a crucial part and there you will find out the new thing right and one more thing let me do one more thing over here so see I created a response I created a response here is what guys tell me here is my response now this response actually it's a dictionary this is what this is a dictionary right this one now over here if I want to convert into a Json serializer so for that there is a method json. terms and here actually I'm passing this dictionary now why I'm doing it so here if I want to serialize the python dictionary into a Json format so here uh into a Json format is string so that's for that's why for that only I'm going to call this particular method json. dumps right so here I'm going to call this json. dumps and here you will be able to find out I'm going to convert this a particular dictionary this python dictionary into Json format his string right this is fine this is clear to all of you we got a text we got this dictionary and we got a chain now my final step will come into the picture now let me show you my final step so over here uh my final step is this one now just just be careful guys and after that my response will be coming and I will be able to generate my output so here guys see uh in the final response you will find out that we are going to call this get open a call back right this is the new thing for all of you and here I I already imported this get open Ai call back if you will look into the import statement here a from len. callback get open Ai call back so here you will find out I'm U like calling a same thing I'm calling this get open Ai call back right now inside this G open call back you will find out that we are going to call our Genera evaluated generate generate evaluate change so this is the same thing basically uh the same variable over here you can see this one uh like after creating after getting this is the object actually generate uh generate evaluate chain this is what tell me this is the object object basically which I'm keeping over here sequential chain is a class right where I'm passing this particular argument and this is what this is my object this one generate evaluate chain now I'm calling this particular object over here this one right this this particular object I'm calling over here this is fine this is fine this you are able to understand and here we are getting a response after calling but what is the meaning of this G open Ai call back why we are using it so just see over here I have written something over here how to set up token uses tracking in Lang chain so if you want to understand the token uses if you want to track your tokens and all input token output token your pricing each and everything each and everything you will get by using this get openi call bag you can check it by using this link which I kept it over here here is a documentation link so let me copy and paste it over here over the browser and here here actually you will find out a complete detail about this G openi call back so let me show you so here is tracking token uses so whatever number of uh token you are going to use what will be the pricing input token number output token number everything you will get it over here by using this get open a call back right so just see over here we are going to import it we are going to create a llm we are going to got get we are going to get our llm over here and here we are going to call this invoke method and there is my my result now if I'm going to print the CV so here you will get the entire detail regarding the token let me show you in terms of my code right so whatever code and all whatever like project I'm going to create regarding that now before that just see over here uh generate evaluate chain this is what this is my object now here if you will look into this particular object so we are we have a couple of input variable the first input variable is text that is is the same thing the text itself right text you know right which one uh what is the text like whatever uh which one this text actually so whatever uh like uh data right we are passing for generating a McQ right on whatever data we want to generate a McQ this this this takes actually now here is a number how many McQ you want to generate subject tone simple Simplicity hard intermediate and here is what here is a uh like request response so I will have to mention everything over here inside this variable so json. dumps already we did it text we already did it now let me Define this number subject and tone so here let me take it as a a variable so here guys you will see that we have a number we have a subject and we have a tone so number how many uh quiz you want to generate I want to generate five quiz here subject let's say subject is machine learning let me change the subject I'm going to keep it as a machine learning so here the subject name is machine learning now uh here Stone actually tone let's say it's a simple one simple McQ I want just like a simple msq now if I will uh like run it so here I have initialized my variable now guys if I will run this one now you will find out that everything I'm going to get in my response itself so let me run it and see so it is running and guys over here you can see this it's still it is running and it will take some time because it is evaluating each and everything in back end whatever template whatever prompts I have given and based on that it will generate a response it will generate a McQ so just wait for some time and it is working working working yeah now it is done guys see we got a response and inside this response I have everything but before showing you the response let me show you something over here so here what I'm going to do here I'm going to show you the number of tokens number of tokens uh input tokens output tokens and the complete cost right so here what I'm going to do let me copy the code uh which I already written and it's a simple like lines and all I'm just copy and pasting because I don't want to waste the time okay because if I'm writing it from a scratch it it takes a time right so here uh I'm saying total number of tokens input token plus output token now here prompt token and prompt completion mean this is the input token and this is the output token and this is complete number of token and here there is a total cost now if I will run it guys so here you will find out that I this is my total number of token this is my input token this is my output token and this is the cost and it is in dollar so I'm able to track each and everything by using this uh open a call back getting my point now let's try to get get a response so let's try to uh get a response from here uh so let's try to uh get a quizzes and all so first of all let me show you the response so if I'm going to print the response now so you will find out uh it's nothing it's the uh dictionary itself right so inside the dictionary uh you have uh different different key and value now in this dictionary you will find out one key quiz right so if I'm going to write it down here so here if I'm going to write it down response. response. get get quiz so if I'm going to write down here response. get quiz now see guys here I'm able to get my quiz here I'm able to get my quiz right so what I'm going to do now I'm going to keep it inside my variable my variable is what quiz this is what this is my quiz right now what I'm going to do here I'm going to write it down Json json. load right Json do loads and here I'm passing my quiz q i z now once I will write it down like this so you will find out my all the quiz so here this is my first quiz and it is in the same format it is in the same format the response format which I have defined so this is my first quiz and here is McQ who coined the term machine learning so Donald have Arthur samel Samuel Walter pittz and Warren M right so here there is a correct answer now here the second quiz what was the earliest machine learning model introduced by the Arthur Samuel so speech recognization image classification so you can see guys your entire quiz over here whatever number I have given I have given five number I'm able to generate a five quiz from the uh from the GPT model by giving a correct prompt and by giving a correct uh like response format so there is uh you just uh required a python over here that's it nothing apart from that and you will be able to create the project a project according to your requirement and this type of project you can integrate everywhere let's say uh uh like in a dashboard itself in your dashboard you will find out the quizzes and the assignment so you can automate that project uh that process you can generate a quizzes and all from here uh right and then you can append it inside uh the dashboard and all so uh like something like that you can make a real-time connectivity I think you are getting my point now let's uh look into the uh let let's try to create a data frame by using this uh dictionary so for that what I'm going to do so here uh I'm going to create a data frame uh just a second uh first of all let me keep everything inside the list so for that I already written one code so here is the code guys uh here I'm going to create uh let me do one thing Let Me Keep It Quiz only so here is what here is my list and inside this list we have our items means uh my quiz and my uh basically value okay means my options now here actually I'm going to keep it in a particular format whatever string I'm going to be collect from here I'm going to join in by using this pipe and here I'm going to append it everything now let me run it and you will get a better understanding so if I'm going to run it now see uh so it is giving me St Str object has no uh attribute items what is the issue over here okay so just wait uh let me keep it over here inside the quiz itself and now I think it is fine so just a second yeah now is fine so if I'm going to show you this quiz table data now now you will get all the thing over here so yeah now I got each and everything in a list and see every value every option we are going to segregate by using this pipe and for that only I have written this code once you will go through it you will be getting it now I can convert it into a data frame so here uh let me convert this uh thing this a particular thing in into a data frame so here if I'm going to write it down PD do data data Frame data frame and here I'm going to say that okay I'm going to uh open the parenthesis and [Music] then yeah so here guys see this is my McQ means there is my question here is my choices there is h four choices and here is a correct answer now let me keep this thing in my uh variable that is going to be a quiz and now let me convert this uh data frame as a CSV file so here I'm going to convert this data this uh quiz actually into a CSV file so quiz dot toore CSV and here I can write it down the name and the name is going to be a machine learning quiz so machine uh machine learning. CSV right machine learning. CSV index is equal to false index is equal to false now if I will run it guys see in my current uh directory in my uh like current local directory you will find out this CSV file now let me open the CSV file and here you can see my quiz I just given the number of quiz how many number of quiz I want uh see uh if you will look into the code now now you will be getting that uh this this number actually this this thing basically which I will I was providing to my um like object this one number of quiz subject and tone so this is the only thing which I want from my user and for this one only I'm going to create my web application as of now I shown you the simple implementation in the python notebook in ipb itself now in tomorrow's class what I'm going to do so here I have created the folder the folder name is what SRC folder and inside that I have a McQ generator now each and every line of code I'm going to write it down in my py file I'm going to create a modular coding I I'm going to write down the modular coding here and then finally we are going to create a web API right web API and uh here U like yes by using the web API you just need to pass this particular value number of quiz you just need to pass this three to four value you need to pass the text this particular text you need to pass the number of quizzes subject and the toone that's it and you uh and after that once you will hit the button so the quiz will be in your hand this one got it yes or no tell me guys so how is a project uh did you uh like this tell me did you like this Jupiter implementation yes or no tell me guys fast do you have any any like uh any U that doubts and all so please do let me know I will be clarify that and uh don't worry you won't face any sort of issue so whatever step I followed just follow those step and try to do this uh um this notebook implementation at least and tomorrow we'll convert this notebook implementation into an end to end project so let me give you this code now so here I can uh add it this file this file and this file also so I added this three file now let me write down the message all files updated updated okay so just a second all file updated and here let me commit it and sync the changes so now guys just check with the GitHub you will get the uh files and all right let me show you the GitHub now and here is my guub so guys uh just check with the GitHub here you will find out the CSV file quizzes and all uh and here see quizzes Which I generated by using the GPT and here actually there is a ipv file where you'll find out the entire code okay yes it is generating a quiz from the text itself so let's say if you are giving this part let's say any different text so let me do one thing let me give the different text over here uh so just a second I'm going to generate a different text now uh so any topic uh uh any topic basically anything you can like search over here let's say you are going to search about the biology so biology uh Wikipedia so just search about the biology and here open the like Wikipedia page copy it from here copy it as of now and just keep it over here inside the text inside your txt file now see we'll automate this particular process so you don't need to paste it like this you just need to uh give your documentation to your streamlit application or to your flask application or Jango application will automate that particular process don't worry uh even we can automate like many thing uh instead of providing this particular text and all right no need to provide this text by writing directly by writing the name also we can generate a quiz okay that is also possible that is also possible as of now I'm giving my text and based on that see this is the biology text right now what I can do I just need to open my ipynb here and after that I just need to load this text so here I'm going to load my text this one and I'm going to change my subject so instead of this machine learning I'm writing here biology right I have written biology over here let me run it so here I got uh that biology text this is the biology text and uh yes uh I think now everything is same this is fine this is fine now let me run it so here if I'm going to run it so now it is generating mcqs from those a particular text whatever text I have given regarding the biology and all so it is taking that text and it is generating a uh mcqs and all so it will take some time let it run and then you can save uh this file over here so now it is done uh it is getting we are getting some issues incorrect API key provided okay it is saying incorrect API ke provided I think some issue is there with a API key but yeah the process will be same right I will check with the API key issues what is this uh now see guys uh I think you got my point you got the like concept and you got about the project also and today we are going to create in2 and one and we'll try to deploy it also so don't miss tomorrow's session tomorrow's class and please try to revisit the session please try to check with the YouTube there already I the recording uh will be available just after the session right after the session so from there you can revise the thing whatever you are missing now key wise uh you can get the key from the uh from the GitHub only so just check with the GitHub there uh you will get the keys and all not key actually code okay so whatever code and all I have written so you will get the entire code from my GitHub itself fine so I hope guys uh it is clear to all of you now we can conclude the session if you are having any sort of a doubt anything so you can write it down on my LinkedIn you can write it down in the uh comment section I will try to clarify that I will give you the response and tomorrow we'll connect on the same time at 300 p.m. IST for the further implementation so until guys thank you bye-bye take care uh tomorrow we'll meet again a same time uh so thank you guys thank you bye-bye thank you for joining the session yeah
Info
Channel: iNeuron Intelligence
Views: 10,988
Rating: undefined out of 5
Keywords: generative ai project, generative ai applications, end to end LLM project, LLM project, Generative AI end to end project, Generative AI project, LLM projects using open ai, LLM projects using Langchain, gen ai project using open ai, generative ai project using openai, generative ai project using langchain, LLM project using open ai and langchain, ineuron, ineuron intelligence, ineuron intelligence generative ai, ineuron generative ai, generative ai
Id: bsfobtZJCik
Channel Id: undefined
Length: 124min 50sec (7490 seconds)
Published: Mon Dec 11 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.