How to Build an AI Document Chatbot in 10 Minutes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the burning question that every company has right now is how do I integrate chat GPT with my own company data and I found a way to do that in literally 10 minutes and that's what I will show you in today's video I'm going to introduce you to flowwise a visual UI Builder that lets you build large language models apps in literally minutes I'm going to show you how you can set it up how you can get started and then we're going to build a conversational AI that can answer questions about your own data so let's get into it alright so today we're going to look at flow wise build large language models apps easily so why is this so awesome well first of all it's open source meaning we can just download it load it straight from the GitHub repository get started spin it up locally to get a visual Builder just like you're seeing over here to connect building blocks basically together to create a simple app and the cool thing about this and why I like this is that under the hood it's all Lang chain basically and I've been doing quite some experiments with letting chain and the repository on my GitHub you can find over here I will link that in the description but the really cool thing is that we can use under the hood length chain which is extremely powerful in spinning up large language models apps but now we can do it from a visual Builder and this will really allow us to pretty quickly in like matter of minutes prototype large language models apps testing capability and then scale from there now in order to follow along with this tutorial you need an open AI API key which is free to set up but it does require you to fill in a credit card because you will get charged very little amounts think of cents for every query that you do and you need a Pinecone API key which is currently also free to set up and doesn't require a credit card for this tutorial so to get started we are first going to visit the flowwise getter repository and then clone this whole repository if you're new to git then please First Look up a tutorial on how to do that but we are going to copy the link over here and then we're gonna to go to your project and for me that is the Lang chain experiments project that I basically already have up and running within fias code and then what you would do is you would open up a terminal so you can go new terminal over here and then first of all check where you want to store the folder basically so you can see in the top right corner for me it is over here the flow wise so I already have it but what you would do is first like check okay in which project directory am I and you can do this from vs code or just from the terminal or the command prompt and then you get clone and then type the URL over here copy paste it and then what this will do basically is it will clone the whole folder that you're seeing over here from the repository and so you have it locally on your system that's step one all right and then coming back to the repository if we scroll down in the readme over here we can see that we have two ways to start this up so we can use npn following the quick start or we can use Docker if you want to use npm you need npm installed on your system which I will link in the description but I'm going to use Docker for this and that requires you to install Docker again both these tools are free and very simple to install for npm follow this tutorial for Docker just go to docker.com link will also be in the description so download and install Docker and make sure that it's running so you open the app after installing it and the reason that I use Docker is to have a little bit more flexibility because Port 3000 is already in use on my system and with this we can specify the port so in order to do that if you follow along with Docker we can come back to fias code and then if you look in the flowwise folder that you just cloned from the repository open it up there is a Docker folder and there is at first a DOT EMV example file you should rename that file to dot EMV and then change the port over here to a port that you want to use you can also leave it at the default of like 3000 like I've said I'm going to use another Port because it's already in use all right and with the repository now cloned and either npm installed or Docker installed we can start up the application so I'm gonna follow the docker example where we are going to run Docker compose up with the flag D inside the docker folder of the project over here so how are we going to do that well first of all again make sure where you are in the terminal so we are now top level in the land chain experiments folder and I'm going to see the first into flow wise and then into Docker so then make sure you're in Docker so you can see the docker compose file over here and I remember I'm doing this on Mac on Windows this might be a little different to do this but the principal suit should be the same you should configure your terminal to be in this folder and then when you run LS you should see the docker compose yaml file what we can now do is we can run Docker Dash compose up Dash D what this will do is this will spin up the Dokken container and start a local server basically for the application to run on so as you can see it's now spinning up the containers and again make sure that Docker is running so download the application first and then make sure it's running in the background and then what you can do once it's up and running you can come to the browser open up a new tab and then go to localhost and then specify the port that you just mentioned and now we're inside the application where inside flow wise AI this is really exciting right so I already have two examples over here but I'm going to show you how to build these from scratch right now alright so let's start off with the conversational retrieval QA chain fancy word but we are going to go to the marketplace and then we can see that example over here so it's very convenient they already have some boilerplates that we can use as a start so I'm going to select this one over here we can already see the flow and now all we have to do basically is filling some parameters and our API keys and we can get started so I'm going to say we're going to use this template and I'm first going to save this and I'm going to call this document chatbot alright now we're going to go from left to right and basically say hey this is our text splitter so if you remember from the previous tutorial that I did on Lang chain this is how you chunk documents and allow it to feed it to the AI without surpassing the token limit here we can upload a txt file in this case so that is also already in place and now we have two open AI blocks over here one for the chat and one for the embeddings to convert the data the text to a vector that we can use to perform similarity search so the step that we now have to do is first fill in your open AI API key so you can find your openai API key in the portal at openai.com and then you just paste it in here now next we have to configure Pinecone and for this you are going to copy and paste first of all your Pinecone API key provides up put that in here and then we have to select an environment and also an index so in order to do that you are going to go back to the Pinecone console you go to indexes then select create index and you can name this whatever you want as you can see I already have a test index that I'm going to use for this and then so it's the name and then the important thing is that we need to specify the correct dimensions and that is the number over here and that is because that is the number that openai uses within their embeddings that we are going to use so specify that number over here and then just select create index and as you can see we're on the starter plan no costs it's just seven days of storage so make sure to create that and then what we have to do is we have to copy the environment so as you can see I'm in Asia South East gcp put that into the environment over here and then also specify your index over here which is test in my case namespace is not required I'm not sure what that is forward but we can leave it blank alright so now we have configured the API Keys we have configured Pinecone and now we are basically ready to start chatting with data so make sure to save this so we have our document chatbot and now the final thing that we have to do is upload a file so I've prepared a simple txt file which is literally just the readme of the land chain experiments getter repository that I've created and we are going to import that so you can see we now have the txt file save it again and now watch the magic happen we can open up the chat interface over here and then can ask what is this doc about and here we go this talk is about Lang chain a comprehensive framework designed for developing applications powered by large language models and boom we created a chatbot that can answer questions about your own data in under 10 minutes and actually what's going on behind the scenes is pretty interesting it's using Lang chain but in a very access possible way as you can see but the cool thing about this at least what I find really cool is that like you see you can we can really use this for rapid prototyping so I wouldn't be confident like creating a full application with this but and that's just because I don't really know exactly what's going on under the hood but I know that we are using building blocks that are accessible within Lang ching and in that way connecting open AI with the embeddings and Pinecone and now we have an experiment over here that we can test and validate and then move forward alright and now in this example we are using a text file as you can see over here but the cool thing about flow wise is that we can very easily click on the plus over here and see all the available building blocks that we can use and if we come to the document loaders over here we can see that we can load CSV docx Geto Pages Json files we can link it to notion PDF files so you can very easily swap out this let's say so this is not text file let's just delete it say hey we want to do PDF drag it in here connect the dots so this is the text splitter and then the document over here boom we can now upload the PDF and now again this is all functionality that's already possible in Lang chain but you might not have been aware of that already so if you go to the line chain documentation you can see the document loaders and here you can basically see most of the document loaders that are also integrated within flowwise right now so the cool thing is hey if this works you can just go to Lang chain and see like Hey what how do we load the PDFs and then create it using custom code so you fully understand it that's really how I see flowwise right now let me quickly show you another cool example so let's go to the conversational Ai and this is another example that you can pick from the marketplace and I haven't changed anything about this I've just built in the API keys and this also requires serp API which is a tool that you can use to search the internet so you need an API key for that I also believe that it's free but but here you can see we have a conversational agent and we can say hey these are the tools that they can use so calculator and access to the internet then we have a chat model open Ai and then we also have memory so this conversational agent must remember the conversation basically so if you say something and then two prompts later it should still remember what you said in the first place otherwise it's a pretty stupid conversational AI so that is what we do with buffer memory so the cool thing that we can do over here is let's open up another chat and we can say something like hey who's Dave eblar and how many subscriber does he have so this is not something that would come up if you ask that to chat GPT so right now what's happening behind the scenes like this chat agent is first of all like analyzing this question basically and then determining hey do I need any tools to gather this information and as you can see here's the result Dave abelar is a freelance data scientist with 13.4k subscribers and 42 three videos on his YouTube channel so let's quickly see how accurate that is I'm currently at 13.7 but the 43 videos is correct so I'm not entirely sure where it's getting these numbers from but it's definitely connected to the internet and now the next cool thing that we can do since this is a conversational agent it has memory and it also has a tool like a calculator we could say like hey what is that subscriber count multiplied by four so we don't reference the number we just ask it so it should remember hey this is the subscribers alright boom there's the answer now let's quickly check this because I've been fooled by these calculators before in one of my previous videos so let's take the 13.4 times 4 boom spot on okay that is correct and so now you basically have a really cool sandbox you that you can play around with and just experiment with all of the tools so if I come in here there are even more tools so you can read file API requests web browsing write files there's a lot of stuff in here that you can just like chain together in this visual build folder and then play around with it alright now the last thing that I want to show you and that's also pretty cool is you can click on this embed button over here so here's a simple embed using HTML but what I'm more interested in right now is python so what you can do is you can come over here and just create a simple python file and that's what I did already over here so in the flowwise folder I created a simple Source folder and put in a connect.pi over here and you can see I just copy and paste it everything that is in here and then played around with the queries so what I can do is I spin up this interactive session over here and then run the query so who is Dave abelar and how many subscribers does he has so let's do this now what I've changed is I added a simple print statement so it will also output the result and boom there we go they have bliers of freelance data scientist we have the same answer right now and one good thing to note and this took me some time to figure out is how to deal with the memory key and the input key from the buffer memory so flowwise is very new and if you come to the repository over here you can see like documentation like coming soon so that is currently a drawback I would say of using flowwise AI especially if you want to integrate it into your own applications like this then there is not much documentation available right now so I figured if you just copy and paste this example it won't take the memory into consideration but if you just add the memory key and the input key similar to like you do in Lang chain but like this then it works so now if we for example do the same request say like hey what's the subscriber count multiplied by four so this is good test to make sure that it has access to the previous message and as you can see we get the same result here again so now this is of course on a local Surfer but you can just as well deploy this to a real server and turn this into a real endpoint basically that you can interact with and that is something that I did in my previous video where I showed you how to deploy AI apps to the cloud using Azure so if you're interested in that go check out that previous video so that's flow wise in a nutshell really awesome piece of software and huge shout out to the creators for creating this in such a short time frame and also making it open source so we can all play around with this I think this is very exciting and like I've said how this will fit into my stack and into my workflow will be to quickly test and evaluate ideas for like rapid prototyping so I'm currently doing a lot of AI projects for clients that I work with and this tool will definitely help me to quickly test and evaluate ideas like I said I'm not going to build like full end-to-end applications based on this but just test individual components and then build it my own using Lane chain that's really where I see flow wise right now at least for my workflow and now if you are interested in how you can sell AI services to clients as a freelancer then check out the first link in the description that's it for this video please like this video And subscribe to the channel and then I'll see you in the next one [Music] foreign
Info
Channel: Dave Ebbelaar
Views: 70,206
Rating: undefined out of 5
Keywords: data science, python, machine learning, vscode, data analytics, data science tips, data science 2023, artificial intelligence, ai, tutorial, how to, langchain, llm, openai, gpt4, flowise, chatbot, pdf, document, artificial intelligence course, pinecone, vector database, embeddings, openai embdeddings, langchain tools, langchain agents, langchain memory, ai chatbot, chatbot tutorial, chat with data, ai for business, chatgpt for company data, flowise tutorial
Id: riXpu1tHzl0
Channel Id: undefined
Length: 16min 9sec (969 seconds)
Published: Fri May 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.