custom gpts are awful at answering specific questions about your documents especially the complex ones this isn't just annoying but it defeats the entire purpose of using AI which is to get to your end results faster in the most accurate way possible it's easy to ask questions but it's hard to get very accurate answers in this video I'm going to show you how to make your custom gpts that much better and that much more accurate using something called pine cone assistant I'm going to first walk through how applications like chat gbt read your documents so you understand where they fall short and where the status quo is I'll also demo a few use cases using pine acin assistant so you can appreciate the different level of precision that you can achieve with it and then I'm going to bring everything together to show you how to build a very basic app that you can hook up to any custom GPT to make them smarter in literal minutes if you stick around to the very end I'll show you a very cool and very simple automation that I put together that will let you drag and drop files directly into your Google Drve and have them automatically update your new and improved AI brain if you're new to the channel my name is Mark and I run my own AI automation agency called prompt advisers for the past 2 years we help companies in every industry better understand where to use AI in their workflows I'm going to first jump into some slides so we can set the tone for how applications like chat gbt actually read your documents let's Dive Right In now why should we care to even solve this problem to begin with well the truth of the matter is whether you're an entrepreneur whether you're a business owner and employee or just a party of one leisurely using chat gbt you've probably uploaded some form of PDF Excel file or dock file at some point or another now if you're looking for overall summaries of documents or tldrs of the main bullets then things like chbt Claude or chatbot knowledge bases will work fine for that use case the problem arises when you have a very specific question that you need a very specific and more importantly an accurate answer a lot of these softwares truly let you down when it comes to finding that needle in the hstack response now if you wanted a 50,000 foot view of how documents are processed and prepared so that AI can answer these questions this is a very short and very oversimplified crash course for anyone that's not familiar so Step One is these documents are broken down into what are called chunks so imagine you have a one-page article you could break down that article in terms of sentences in terms of paragraphs or double paragraphs completely up to your Cho you're then left with shards of this document these shards are then turned into numbers and that's called vectorizing and this is basically converting the format of text into something that a computer can better understand which are numbers and in this case it's groups of numbers these groups of numbers create a special code or language that allow the AI to associate a word to a definition in its own brain and when I say Vector it probably looks very similar to the very first portion of this image where you have a square bracket and some form of numeric definition so the word cat could be -1 comma 1 comma 3 that might mean nothing to you but to a computer that is the translated version of that word based on the different ways it's been trained to understand groups of words or bags of words in this case all right so you now have groups of different vectors Each of which is representative of some Corpus of your text you then take these vectors and then you create some form of map where you plot all these different vectors that are all Associated to different words phrases sentences Etc this is the part that confuses people which is why I'm going to try to oversimplify it as much as possible to make this a lot simpler to understand imagine you're asking a basic question like what are the hours of operation for a given restaurant and let's assume that we had the entire menu that had the hours of operation and all the dishes as a PDF that we then chunked we created chards from we created vectors from where we translated those menu items to actual numbers to represent those menu items and then all of that was in this map that we see on screen if you say what are the hours of operation it will try to look through this map for the closest words or sentences that are similar to the meaning of the question that I asked so it will look for something that's like the word office or like the word office hours or like hours of operation and find the most similar ways to refer to my question as possible and provide me with the top x amount of matches the more detailed and comprehensive my map the higher the likelihood that I'll find the response I'm looking for and the top matches that are returned are typically based on the distance of different points on this map and the proximity to those words to the very question that I asked so again if I ask a different question which is do you have gluten-free options and there's three different items that are gluten-free then the highest likelihood keywords that will match my question are the words gluten-free so anything Associated to those points on this map will most likely end up in my top matches now if this is still fuzzy I like to use the example or analogy of something like the predictive text of Google Maps so when you go into Google Maps ways Apple Maps whatever your map of choice and you start writing the name of your location assuming it's not bookmarked anywhere it'll start to predict what you're trying to actually write so if you write the word PA are as you can see here it's recommending parata maybe based on the proximity of the location to your IP address Paris pan Etc now it's doing this in real time and the way these softwares work is that you actually have to submit the question or upload the file to be suggested an answer when you upload a file to chat gbt it's going to try to do this similar operation but again not in real time where tries to look through the file very quickly seeing the different hierarchy of the different meanings in that document and try to associate what is the highest likelihood answer based on all the keywords sentences and Associated context to that actual question you're asking to add a further analogy let's go back to the map before let's assume that the question you're asking acts as one small point on this map that acts as the core destination you ideally want to find the closest matches to that destination as possible so that proximity little word or keyword could be here another one could be here and this one could seem more similar to the destination you're looking for because it's a is a shorter distance to that X and then this one could be a little bit more vaguely Associated to that destination which is your end question and you can imagine this can keep going over and over and that's how you start ranking the different responses to your question now you might be asking the question still Mark I repeat why should I care well you should care because most Tools in including chat Claude and the rest all try to use very lower level fast and cheap versions of this principally because and most likely because they serve millions of people and there's millions of files so they've had to probably find the most cost-efficient way to process them now the inevitable consequence of that is that when you ask a very specific needle in the Hast stack question odds are you won't get the response you're looking for and if you're uploading something like an RFP or a financial document and you're relying on it being able ble to grab those small details to create something like an email to your boss a presentation for your board or a some form of brief that's very important you don't want to have to double and triple check that the AI did what it's supposed to do you can liken a lot of these tools to something like a scanner or a glorified command F or control F depending on whatever system you use where you're literally just kind of searching for related keywords and not really getting into the meaning let alone truly referencing where your responses are coming from in terms of which page which paragraph so you can actually identify and verify that the response you get from these tools is accurate now what's even worse is sometimes you can not only receive the wrong response from the control F or the search it did but the llm underlying it can also hallucinate at the same time so you can have GPT create some BS response on top of retrieving the BS answer from your document which is the worst combination and it happens a lot more often especially with much larger files that span hundreds of pages where this becomes a lot more of an issue now I've shown you at a high level how these work and what the status quo is and now I'm going to show you my solution to it or at least the one that I found until these Technologies are going to catch up inevitably and become way better at making more meaningful analysis when you upload any form of file and ask a question Pine con assistant is a framework that can help your assistant or in this case the AI actually speak to and read the documentation you provide it before it even sends it to any form of large language model to come up with a response so you have an extra layer of defense that if the answer doesn't actually exist or doesn't find quote unquote a match in your document it won't respond at all instead of making some form of half-baked response or a completely hallucinated response it just won't answer and if it does answer it'll reference exactly where in that document it's getting that response from so you can double check that it got the response you're looking for and expect ultimately the result is either response directly from your document or it just says I don't know which as you know is one of my favorite things from llms is if they say I don't know I can trust them more now I've done more than enough talking so let's actually jump in and try Pine qu assistant so you can better understand what I'm referring to all right so let's say we take some form of credit card coverage plan and I'm in Canada so we have a bank called TD here and this is the benefits for one of their credit cards it's the TD airoplan Visa infinite card so we have things in here like your travel medical insurance certificate trip cancellation trip Interruption common car travel accent and all these different things that are pretty common to all credit card statements all right so if we go down to a random page here and we say what are the maximum number of covered days for hospitalization okay the barer date Etc okay so if if we ask this question to something like chat gbt sometimes it could get the right answer but if we were to download this and upload it into Pine con assistant you'll see exactly what it'll do so if we go into pine cone and you can create a free account um you can even test this out for free to the best of my knowledge you'll see something like this when you log in if you go to this tab called assistant you'll be able to create your own assistant so you can call this something like uh my trial and then you can click on create assistant you'll get some form of chat interface like this which you'll be very familiar with and if you go to the right hand side you can click on here and you can upload the file so if you upload this PDF as long as it's below 10 megabytes it'll be eligible to be imported and when you import it it's going to do something pretty special now pine cone if I haven't gone over is a vector database company so that whole process I broke down for you up until now I've had to build it myself manually using a lot of python and I use one of the providers called pine cone here to help do that part where it converts text into numbers now what's cool here is that entire process that I broke down for you typically again I'd have to do manually using some form of Frameworks like Lang chain llama index stuff that you might not have heard of and you might not need to ever hear of in this case it did that entire process of finding the best way to break down that file breaking down and chunking that file into the best sizes it deemed appropriate then it converted those chunks to numbers those numbers to vectors those vectors to that map we looked at which is called like an embedding space and then it categorized all that and finished in literally under a minute all right so if we go down here to a random page um let's see here emergency relief of dental pain treatment for emergency relief of dental pain is covered up to a maximum of $200 all right so if we go back here let me say how much am I covered for dental pain if I travel it should come back with a response and an actual page number of where to find that so if we go here if you experien Dental plane while traveling dental pain rather you covered for emergency relief up to $200 and then it'll say first paragraph of page six so if we go here Page Six I think it's considering this whole thing a paragraph cuz it's all muched together but it gets the page right and you can see it's getting that perfectly fine if you go to a different page here let's say near the bottom what is a number to submit a claim let's ask that number to submit claim it references page 11 to 12 23 to 24 so everywhere where it actually finds that response and in this case we're looking at page 11 which is here between Pages 11 to 12 and what's cool is it finds the fact that there might be an overflow of this paragraph onto the next page because it's mentioned here as well and actually instead of just saying individually 11 comma 12 it says both of them are kind of connected in terms of meaning and they both have this number that you can refer to now you might look at this and say well I think I could upload this file to GPT and it would get those answers right too and you might be right but what happens when you get a file like this which is the future of growth report from the world economic forum for 2024 and if you go to this file and download it for free it's 291 pages so when I went down I went through a bunch of random Pages here and I asked a question which is in Germany what is the score for Trans Transportation so it went through all these countries and it scored all these different components so you can see here Australia it looks for availability of talent and it scores it out of 100 if we look at mobile network coverage it also scores that so if we go to my question here what is the core score rather for transportation it says it's 60. 9 it's on page 106 so if we go to the document and we go to page 106 let's put that here and then we zoom out just a tad and we scroll down and you can see here it took me literally a minute myself to find it access to transport and housing is indeed 60. 9 now notice how this is one of hundreds of thousands of needles and haast stacks as you go from country to Country and when we gave this exact same question to GPT uploading the PDF as is it said that the uh for Germany the access to transport and housing is 72.
9 3 which is not the correct answer and if we test another one here let's test something a bit more bespoke so let's say gree sustainability score what what's gree's sustainability score there we go let me misspell it on purpose that might help you'll see that it's 45. 8 and I can find it on page 110 and would you look at that it's on here 45. 8 and let's see if there's anything on one 10 it might be actually referring to it off of this table because it trusts this table more and it'll take me a second to find it myself all right and there it is 45.
8 so it wasn't wrong it just probably found the most trusted portion so let's ask the same thing to GPT and it totally could get it right but it's the idea of being right 99% of the time is ideal so what is gree's sustainability score now the interesting thing here is it said that re's sustainability score is 45. 7 eight even though in the file itself it says 45. 8 it says 45.
8 and it's all rounded to the first decimal so I don't know where it got that seven from now the answer again is technically correct but it's about how correct is it at some point and hopefully you get the general idea here that pine cone assistant is designed to have what's called grounded generation meaning it tries to come up with the response only if it exists exactly as you ask for it in the document itself so it didn't come back with 45. 7 eight it said exactly 45. 8 as it literally is carbon copy in the document itself and again if you're doing something like number crunching or very large financial documents that can span hundreds of pages I literally loaded the Canadian federal budget which has over 500 pages full of dense information and if I pull it up for you and double click here you'll see exactly how detailed it is if you go on a very random page here like this table one thing that pine cone assistant does a lot better than typical applications is it's really good at processing tabular data now it's not perfect but it's really accurate a lot for a lot of these questions so if I take the risk of actually demoing this to you live what I can do is here I can go back to the files I can click on upload I can go to here and go to the budget and then it's under 10 megabytes so I should be good to go from that angle and what I'll do is I'll clear the chat there we go and what's cool is as of I think a week ago when you go to settings you can switch which agent you're speaking to so you can make it into Claud 3.
5 Sonet if you want then if you go back to files here this one's a lot more beefy so this will take around 2 minutes to actually process and that's one thing to keep in mind is that you have a very big file because it's doing that manual process that you would have had otherwise to use something like python to do a lot more comprehensively this will do it for you and you can just wait for a couple minutes to have it do its thing all right so it finished a minute and a half later and if we ask a specific question from this table let's say strengthening Canada's Advantage okay safe and responsible use of AI let's say how many millions of dollars the Canadian government's budgeting to allocate to that initiative so even though there's two files here that are both pretty beefy how much is the Canadian gov going to spend on AI responsibility in 2028 very vague question misspelled let's see how it does and you can see here it gets the answer perfectly and it says the Canadian government plans to spend $10 million on the safe and responsible use of AI and it references page 226 so if we go to here page 2 26 yes it is and it says 10 million and it is 10 million and a lot of different clients that have come our way at prompt advisors work for different government entities whether it be in the US or Canada that have very big files like this where they need those pinpoint answers this is a Heavenly Sent tool that you can use to actually start doing that analysis with much more confidence now let's go to GPT upload the file and let's ask the exact same thing so if we go to here and we go to budget and let's take the exact question that I asked and upload it here it's now going to read the document and you can see did a very quick scan and it said is expected to spend 2. 4 million 2. 4 billion in 2028 on AI safety adoption skills training so it must have gotten that from perhaps the overall sum if that's somewhere but it's definitely not the pinpoint question we're asking which is the safe and responsible of AI so you can see there just that small different detail is answered very vastly differently between those two different tools so you might be looking at this and saying okay you got me this seems way better how do I actually hook it up to my GPT say no more I'm going to open a brand new custom GPT that I'll build with you to show you how easily we can set this up so that you can start using this instantly now we'll go to this custom gbt and we'll call it smarter brain and let's add a pretty picture here hopefully creates a picture our brain and we'll say this helps us get better responses to questions and then we'll leave the instructions for now that's the less important part and there you go a pretty little brain and then what we're going to need to do is add an action so this action lets you connect to code and a microservice and again if you are now scared that I said the word code I'm literally going to give you everything you need to copy paste and tell you what you need to change step by step you don't need to do much from your you don't need to go search on your own it's all done for you now all you have to copy here is what is in this text file that I'm going to make available to you in the gumroad link in the description below as usual if you love this content if it's helpful for you would love if you could support the channel otherwise have it on the house and enjoy so we'll just take this and we will paste it directly here and then if it works then you should see something like this where it says exactly what action is now possible because of this new schema and this part which is the URL schema is the part that you'll need to swap for your own use case at the very bottom here we're just going to for the privacy policy we're going to click on just add reit.
com site. privacy you need to put something as a placeholder here as long as you're not sharing this to the public this really doesn't need to matter right now so if we go back up we're going to create a brand new service together so I call this pine cone assistant demo and I'm going to go into the secrets and what we're going to do is we're going to find our API key for pine cone that you'll have in your account and again you can start using this for free you shouldn't need to actually pay for anything for a while using pine cone assistant and then you just need to call your assistant name so if we go back to here our assistant name like we called it if we go back to assistant is demo Das assistant so I'll just take this we'll go into here and then we'll just edit it there we go we'll update that secet and then we just have to go to Pine Cone and then go to the API Keys Tab and copy one of our API keys go here edit paste update secret and then pretty much you should be good to go this rest of the code I've done for you and this will also be in the g Road Link in the description below and what you can do is when you receive the link you can do what's called forking where I'll just share it like this and then when you paste it into your browser you'll be able to click on this Fork which will replicate this fork in your repet account and again you can create a repet account yourself rep. com it'll be free to build it and to deploy it it'll be literally a couple dollars maybe in a month if you use it a lot um and if you're using it a lot and you want other people in your team if you have a team to share it then you can start spending a bit more money to make it a lot more available and run quicker but for now if you're just starting out you'll be able topl deploy it very easily and I'll show you now how to do that so you want to click on run and you want to make sure it looks okay if you get this response here the 404 and this little warning thing most likely things are going well otherwise you'll get a small error which you shouldn't if you use my code Asis and if you get this not found it's totally fine and if you get this not found it's totally fine what you want to do next is you want to go to deploy and then click on auto scale and then scroll down and then click on approve and then then name this app something so let's say smart brain there we go that seems to be available and then scroll down these are the keys that we just set up well then just click on deploy then after this is done deploying if it's successful you'll get a link that ends inapp we're going to take that link and we're going to swap it in place of the existing URL that's going to be in the schema that I provide you all right so we have this URL now with this domain sm- brain.
rep. we'll take this we'll copy it we'll swap it here and then we'll paste if you get this little indent we want to go back and make sure there's no indent we'll scroll all the way down and then we'll click test now this test will send a random question so you might totally not get a response the idea is if this says talking and it doesn't say stopped or error talking to then it's working fine so you can see here if I ask a different question um what let's ask the same question as before let's go to chat gbt and let's say here how much is the Canadian budget because I'm referencing the same assistant it should be able to reference that exact same collateral you'll see here I made a mistake one key fundamental error now I sent the response but there's no actual prompt here so um let's go back and I'm going to copy paste this name here and you'll see why so we have no prompt which is why when I sent that question and went and searched the internet instead of actually accessing saying pine cone so you can write whatever instructions you want for your custom GPT and if it's an existing one this is all you have to do when I ask you a specific question about the Canadian budget use and then put a single quote and then ask question the name of the actual function that's going to execute the search and then do a close quotation to answer the question so now if we ask that exact same question from before let's copy paste it from here and now let's paste it here this should automatically invoke that action that smart action and then it's going to start send that question to Pine con assistant go through the files that we just saw and then come back with a response and you'll see here it says the Canadian government plans to allocate $10 million in 2028 for the safe and responsible use of AI so that got it perfect perfectly right and if we go to here you can always see what the app responded with and this is the actual raw text it responded with and you can see here it says the page so if I said what page was this from now you can see it's page 226 and what we could say is in the actual instructions here when I ask the question respond back with the exact page it came from so if we ask another question here from the other document which is what is the sustainability score from gree and we click on confirm it should come back with I think it was 45. 8 as our answer and there we go it says 45.
8 and now it says refer to page 110 so we add the small custom instruction here and then you should be good on this front as well and just for fun I will give you this custom instruction just so you have a little crutch there so you can just take it and Tinker it to your exact use case now one pro tip I want to show you is that if we go back to Pine Cone I tested both gb40 and 3. 5 Sonet and it seems that gbd4 is much better at working with the pine con assistant to find the perfect answers with 3.