How to Train ChatGPT on Your Data and Chat via Slack (Chat w/ PDF, Docs + MORE)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to be taking you through step by step how you can chat to your documents your PDFs word docs YouTube video transcripts any document you can imagine you're going to be able to chat to them and ask questions about that through a slack bot what we're going to be building is a custom knowledge chat bot that uses Berry AI in conjunction with creating your own slack bot so that you're able to chat to any of your documents all through slack I'm creating this video today because I got a ton of questions on my custom knowledge chat bot video where people are asking yes this code is great I can create these custom model chat Bots with llama index but how can I attach it to something how can I actually interact with this in a way that's not through a Jupiter notebook or a collab notebook so this has started me on a quest to figure out the easiest ways that you guys can create these custom knowledge tools for your business or for you to use personally and creating a slack bot is just one of those ways that we can integrate a custom knowledge base into a super easy UI that's made for us into an existing application so that you can ask questions and extract value out of your custom knowledge spaces and documents I really think that this integration of custom mode chatbots enter your slack to be so useful for many of you running businesses out there because now you can essentially create a bunch of tools like your company standard operating procedures ingest that into a custom knowledge base or frequently Asked question from your internal team and then you can create a chatbot out of that make it available within slack so that now your team's able to extract value out of those documents in a chat format or even if you have a particular client and there's a ton of information that you have about that client that's scattered all over the place you want it to be in one place so that your entire team can access it easily now you can take all of those documents put it into a custom chat bot and then create a slack bot out of it so your whole team has access to that information in an easy way now if you're not technical please don't get freaked out when you see us working in the code editor here you're going to be able to copy my entire project down in the description so you can steal all of that change a couple things around to work for you and then you're going to have your own custom chat bot if you follow these steps so for the purpose Port it's got a big 500 pages or something ridiculous so we're going to be able to have a chat to that from within slack so let's get started so step one here is to create our custom knowledge base and for that we're going to be using Berry AI which is a a very very handy tool for whipping these custom large spaces up on they allow you plenty of flexibility where you need it so you're going to head to berry.ai and you're going to scroll down here to this section where you can build a demo super simple just add in your email address choose to upload a file so I've added my tester document and then what you can do here is actually add a little bit of a custom prompt so for this instance I'm probably going to add in a little bit about being a financial assistant so I've added a little prompt here which is essentially just saying you're a financial advisor and analyst you analyze documents and can help the user with Investments so whatever you need to put in there you can and put in there for your use case you don't have to put it in but it does help sometimes if you just frame it up and in the sort of mode that you want it to be in for example if you're using this for copywriting you could say you are an expert copywriting bot and then what it would do is draw from your custom knowledge base and be able to expert copywriter on that information that it gets okay so then all you can do is hit build app here and the link should be ready in a second okay so now we're able to click here's your website and it's going to take us to a chat window that we're able to chat with our documents already so if you head to your Berry dashboard you can go chat dot Berry AI dot dashboard when you come here you're going to be able to see all of the different apps you've made you can log in with a username and password if you head to the dashboard which is chat.berry.ai dashboard then you're going to be able to see all of the indexes that you've created as you can see I've got a couple made here so what we're going to do is take the one that we just created here you can see the information about it and then you're able to chat with it already so I can say what is this document about so we can ask you questions like can you summarize this document or can you give us five key points out of this or ask specific things about what is earnings growth like from year to year and so I've asked it a specific question which is what is earnings growth like in Q3 and it's given me a pretty good answer on uh the provision for income taxes increase and so we now have a custom knowledge based chatbot that's working but the magical thing about Berry AI is that you can scroll down here and you can copy this API endpoint which allows you to call it from any different app that you want to use so what we're going to do is copy this and then you're going to head over to replit the link to clone this Ripple is going to be down in the description so what we can do is head to this so I'm going to Fork this Ripple and then I'm going to be able to come in here and start to edit now if you haven't used ripplet before it's super easy you can just create account for free sign up and what we're going to be able to do is edit the code that I've already written and you guys are going to be able to customize this to essentially work super easy out of the box for your own application so now we need to get into actually building our slackbot so what we need to do is come over to uh if you just search create a slack bot and head down here you can click on welcome bot and get started in building your own bot so what I can do up here is go to my apps so you're going to need a slack account of course you can create one for free and then come to this page then you can click up the corner and click on your apps and then you hit this button which is create new app so we go from scratch we call it Tesla but so we can put it into my short form space and then we need to get started and actually doing the setup and config for this bot so we can scroll down here and click on Bots so now we just follow the simple setup procedure that's provided by slack we can come down and click on review Scopes to add come down now this button is grayed out until we add some Scopes so first step is going to be adding Scopes bot token Scopes we need to go message or I am sorry I am history I am read I am right so this is going to allow it to essentially uh write instant messages back and forth between us so this isn't going to allow you to actually chat within channels this is just going to be for anyone in your slack workspace to come down and click on them in the bottom corner send a message and get a response back based on what custom knowledge base you have that attached to so we have IM history I am read and if we go back to basic information and we install this to our workspace we're able to go allow and then once it's installed you can go down and head back to oauth and permissions and you get your Bot user oauth token so now you need to copy this and head back to your replet and now we need to start setting up all of the secrets and config so as you can see here there's a bunch of secrets that are going to be your own specific information for your slackbot so we're just going to start going through those and updating those to be for this latest app that you've just created so to do that you head down to the tools section and click on secret and then this little window will pop up here on the side now we need to start putting in all of this information so now that we have uh our token we can paste that in there as the value and then we can go slack token here so add that new secret and now we need to go through each of these different parts which is a signing secret client secret Etc and start copy and pasting those and adding all of these secrets and so let's start doing that now to find all of these you can get back to basic information again then you have your app credentials right here so we can start with our client ID and hit back client ID so these are matching all of these essentially we have to tick these off one by one so we have a client ID paste the value in there at the secret head back show the client secret here copy this client Secret signing Secret so now we have client ID client secret signing Secrets slack token and our fixed API endpoint you can paste that in there if we go back to Berry we can then go down here and copy this and then paste that in so this is going to be found below your Berry chat bot and you can access it through different parts of the berry app but since you can come down here and copy it from there and paste it into this so now we have all of our secrets set up all of these are working correctly now we have essentially what we need to start installing this and testing it you can close Secrets now get that out of the way I'll basically talk you through this app quickly we have essentially setting up all of the secrets that we've just been over some directory management just saving install locations then you have the authentication process which is taking essentially a lot of the things we've just set up the client ID and the client secret just to authenticate that connection and the install between you as the Creator and the slack itself and then we have the one key functionality that our slackboard is listing for which is the message event so not to get too technical but this is essentially going to be listening for any messages that are sent and if the message is of type IM instant message so we're direct messaging the slackbot then it's going to trigger following logic and this is where our berry API endpoint gets involved so we're going to take the message that the user sent we're going to slap that on the end of the URL that we got from Berry it's going to send it off and it's going to get the reply exact same as when you're chatting away within the the berry chat interface and then we have a quick web server that we whip up that has a few key URLs that the slack app needs to install and work properly so we're going to test those now make sure that everything's working correctly and sorry guys just one little mistake I made here a fixed API endpoint should actually be API endpoint so if you just copy this edit this and replace that then we're all good to go then you can hit this run button up the top and then we can spin up our web server for the first time and so now what we have on the right here is a little web page that we're put spun up so essentially we have our own website web server running now the key thing we want to grab here is this URL because this is going to be where we have all of our routes put off the back of and that's where slack is going to be looking to get things like installation and authentication so if you copy that URL and hit back over to slap then what we can do is head to the event subscriptions and enable events and then you can paste that URL in and then go slash slack slash events and then it's going to test this and it's verified that this URL is working because back here in our code we have the slack slash slack slash events which is uh using the slack Handler so that they're just essentially setting up that it's listening for events and it's ready to receive them from slack and then we can scroll down to the subscribe to bot events add a new user event and then go IM then we can so message.im so my message was posted in the direct message channel so this is what the bot is going to be listing for In order to trigger our functionality and so be sure to click save changes on the bottom corner then we can head back to our basic information and do a little bit of uh customization to make things look a little nicer so we can scroll down I'm going to add a little icon in of the Tesla logo change the background color a little bit maybe a little bit of a dark Navy Tesla bot add a short description chat about tests and then we can save that once you're happy with the look and once you're happy with your styling you can hit back over to oauth and permissions one more time and scroll down to the redirect URLs this time you need to add in your url that you've got from your web server which is available here and then we go back and you know paste in that URL and then go slash slack slash o off underscore redirect so to double check you can head back over here we can actually copy this just to be 100 certain that we're doing it right and take it from the end of that and once you've put that URL in there you can copy it we can get that ready because we're going to need it in a second hit done and then hit save and then head back to your main.pi we're going to stop the web server quickly and then you need to go to start at the top scroll down a little bit to this authentication block and then we're going to replace this with our own one which I've actually had to just insert on this in here because I've done this before so once you've changed this redirect URL to the one you've just put into your slack settings then we can run this again the web app's running okay now again take this URL that's up in this corner paste this here so this is just your the name of the reple with your username for apple.com and then we're going to go slash slack slash install and now it's going to take you to this page which is like the uh the proper installation which is from A Team level rather than from a uh from a developer a user level so this is what you need to do for full permissions to be granted we're going to go through and allow this I'm just going to get this into my content creation slack workspace and open the workspace and here we have Tesla bot sending messages to this app has been turned off we need to change one more setting if we head back to your app home and then you scroll down to the this bit and then you click allow users to send slash commands and messages from the message tab once that's all set up we need to do a quick reinstall to make sure this is updated so if you click onto the Channel with it and click this drop down you can go to configuration and then just scroll down to the bottom and remove the app and then we can go through that install process again really quickly uh head back back and run this uh slack slash slack slash install URL go through this process again really quickly allow open Slack and then once you've reinstalled with that sitting toggled you can come down here and you'll actually need to go command R and refresh your slack for it to work correctly but now you can see we can message the slackbot and we can start asking questions foreign died last night so I'm back this morning to finish this off for you guys so uh what we need to do first is actually update our URL our very URL that we're talking to because the one I showed you before is actually part of the old uh the old services so they've updated to a new method now so we're just going to update that so it's working properly so in order to create the updated URL what you need to do is head to berry.ai and then head over to the documentation so this is the documentation on how we can actually query our endpoint so you can either do it here from within their website or you can scroll down to the bottom part here this gives you a little bit of an explainer of the different parameters that you can make in the API call but this is a new method that they're using so you have a base URL which is api.berry.ai.query and then we're essentially adding a bunch of parameters to the string now doing it through python like this you can sort of break it down and make it a bit easier to look at but we need to get the entire URL so we can be calling it purely from the URL and the parameters inside it so best way to do this and convert it to a single URL is just to copy it take it over to chat gbt this is a good skill for you guys to be learning as well so you can just head to the normal GPT okay so what I've put in here is convert this to a get URL so it's a get request URL which is going to have all of the information that we want from it built into the URL so I'll put it in there and just paste it in the stuff from the documentation but now we need to provide our own details for the church if you can swap it out for you and give you the full the full URL so to get this information we need to head back to chat.berry.ai dashboard then you're able to find the instance URL for the custom Lodge chatbot that you've just made so we can copy this head back to jcpt paste that in there and then put in your email that you use to create your beer account so here I've pasted in my instance URL for the particular customer chatbot that I want to be calling from within our app I put in my email that I created my bear account with and then I've put at the bottom just to make sure it gives us in the right format ensure the query parameter is at the end of the final URL and this is because of the way our apps set up which is since you're going to be adding on the users the user's query to the end of the URL with simple just adding strings together in Python so what we're going to do here is submit that and hopefully we get the correct URL up now if I had to make a couple more tweaks to The Prompt just to make sure this comes out right but essentially we have I've put instance ID here to label it as my instant ID my email to label it as my email and at the end of this sentence here I've said ensure the query parameters at the end of the final URL and the value is blank so the since you leave us for the empty it sort of equals nothing at the end so that we can add our user prompt on the end this is actually quite a long-winded way of doing things but I think it's easiest for you guys if you're not familiar with web servers and how requests and responses work but that's essentially what we're doing here is all you need to do is add a Ampersand in between these different parameters within this query string and that essentially splits them up and you're adding the values in sort of here and here so you could have written this out manually but I think this is a good skill for you guys to have in terms of knowing how you can convert some of this python code into a into a URL that that you can sort of go back and forth between so anyway now that we have the URL you can copy it and head back to your Tesla bot Rebel and now we need to go back to Secrets down the bottom left and head to our API endpoint we need to update that with our new one and save it so now if we run this app again and it's up and running then if I head to my Tesla bot channel here and there we go we have our first response within our slack channel from our Tesla bot which is saying based on the information provided it can't it's not explicitly stated however it mentions Automotive Sales increase and essentially giving me a pretty good breakdown of what I want from this custom knowledge base and I can continue to ask the questions as you can see here are the failed ones up here that we're using the incorrect URL so what you can do now is you have this setup you have a custom knowledge chatbot built into your slack you can allow different people within your organization to use this now this is probably not the the best example using this Tesla bot earning summary and stuff like that but if you have say a standard operating procedures for your company and you want to make them accessible or commonly asked questions that your your employees and staff will be asking and they essentially instead of having a Google Drive filled with all sorts of different information and things spread all over the place then you can have them centralized all through a custom watch chat bot if you feed in a big PDF with all that information then make a a custom launch chat bot within slack as I've just showed you in this video and now all of your employees have super easy access to that information and this same slackbot method could also be applied to things like tools rather than chat bots so say I set up something here one of the the other examples that I made which I can show you guys briefly here is essentially a a short form script writer so this is almost a tool rather than a chat bot and this short form scriptwriter if I provide it with a bunch of information from a tweet say from some interesting AI thread I found on Twitter I can just paste it into the the site Channel and then it's going to send me back a properly formatted Tick Tock uh short form script basically the style that I've wanted and I provided a few examples in the prompt so I'll just show you that now so you guys can see another example so the app here is essentially the same as what we did but it's usually chat GPT API rather than the berry API essentially we're not using a custom mods chat bot we're just using chat gbt in our own slack channel so here you can see I've used the the messages and I've done a bit of prompting here saying you're an assistant okay short form scripts that allow so this is just using the chat TPT API so you can do the same process steal this exact same uh Ripple and then apply it to whatever prompt or prompt use cases you want to use within your own slack so this thing essentially I give it a bunch of examples of the kind of uh short form scripts that I want and then I'm able to create a tool out of this where I'm able to paste in some information on say some interesting AI stuff and it writes a short form script for me so that's the code uh I'll now hop into slack and show you guys this in action I've called it Ghostwriter appropriately so all I need to do is find say an interesting Tweet now here I found an interesting tweet on auto GPD so what I can do is just copy the whole thing now obviously this is not very ethical I'd like to be repurposing you guys quantity like this but essentially if we find an interesting news article that we want to cover we can then take all of this information take it back over to slack paste it in here and then it will write me a short form script with it and as you can see here it's giving me a few verbal hooks to use at the start of the tick tock to hook people in a text hook for what's going to be displayed on screen and then it's got some copy for me to be explaining and then a call to action at the end so this is matching the format that I've provided it with in the prompts so this is just another example of the kind of tools you can create not just chat Bots but using this exact same Ripple that I'm going to be providing to you guys you can have all sorts of functionality and since you're having a range of tools and chat Bots that are accessible to your company and to your employees within your slack so that about wraps up the video guys thank you so much for watching I hope you got something out of this I hope you're able to successfully take this Ripple and take this code that I've written for you to be able to build some interesting tools and improve the productivity of your business because that's what we're all about here is helping build better businesses through AI now I'm always looking for the next interesting video that you guys would like to see so if this has helped you out and you have other things you'd like me to build then be sure to let me know in the comments below because I'll be reading all of those and taking that into account and you might see a new one on that exact Topic in the next couple of weeks now as always if the light bulbs have gone off while you're watching this video and now suddenly you have a big AI idea that you'd like to speak to me about and you can get in touch with me through my Consulting link down in the description and in the pin comment I love hopping on calls with people and helping them talk through their ideas and give them a bit of a feasibility assessment on what they're talking about the rough estimate of how much it will cost and if you choose to go through with my development company we can help you build it too and bring it to life that's all for today guys thank you so much for watching and I will see you next time foreign
Info
Channel: Liam Ottley
Views: 15,299
Rating: undefined out of 5
Keywords: chatgpt tutorial, chat gpt tutorial for beginners, how to use chatbot for business, chatgpt business applicaitons, chat for business use, chat for business applications, chatgpt buisness use, chat for buisness, chat for buisness use, how to teach chatgpt, use chat gpt for business, chatgpt business, chatgpt business use, chatbot tutorial, chatgpt for my business, train chatgpt with your own data, chatbot slack bot, custom knowledge chatbot, train chatbot on custom data
Id: am6PXpTsQiA
Channel Id: undefined
Length: 20min 46sec (1246 seconds)
Published: Wed Apr 19 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.