Official ChatGPT Prompt Engineering Guide From OpenAI

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
open aai has finally released an official prompt engineering guide for getting better results out of chat GPT and this official guide is technically for developers when using the API but I wanted to simplify it and give you practical prompts even if you're not a developer and if you just want to get better results out of chat GPT and the whole concept of prompt engineering is to give chat GPT and other AI models like it the right set of instructions so you get better answers and this document here is broken up to six broad Strat for improving prompts and within each strategy there are these practical tactics including prompts too but I'll give you better prompts that are more relevant for when using chat GPT and not just the API when you're building apps so that's for the developer side but for everyday people just using chat GPT I'll make the prompt and the explanation a little bit more relevant and even though I've spent over a year now improving my prompting technique I still found a lot of these useful so I think you will too and I wish they just released this with chat G over a year ago now the first broad strategy is write clear instructions and this sounds simple enough but a lot of people they get frustrated with chat GPT because it just doesn't do what you want out of the first initial prompt or the question that you give it so this tactic is recommended for giving chat GPT as much detail and context as possible and here they use bunch of different tactics here that I'll go over one at a time for actually getting better results by giving it more information so the very first tactic under that strategy is include details in your question to get more relevant answers pretty straightforward this is the simplest and it gets more advanced as we go from here so instead of saying how do I add numbers to excel it's saying give it more context how do I add a row of dollar amounts in Excel I want to do this automatically right so you get the idea this is again very straightforward but most people stay on the left side of the column and just use one sentence as the instructions and this says multiple times in this document these models cannot read your mind at least they can't yet and because of that we need to give it as much information as possible and if we just give it one sentence prompt we're not going to get good answers here and the second tactic under that broad strategy of giving clear instruction is asking the model to adopt a Persona so this is one of my favorites I don't think they did a great job here with the example but it's saying to ask the document to contain at least one joke in every paragraph when responding and this is designed if you look at this document it says system and user because this is designed again for developers to train a model inside of this thing called playground so I'll just open this for a second so this takes place inside of the API assistant this is not where we're going to use it again I'm simplifying this for non-developers so inside of chat GPT you could get the same type of an answer if you prompt it correctly now there's a bunch of different ways you could use these type of prompts one of my favorites is like this imagine yourself as a business consultant or act as a business consultant now you're giv it a Persona this is with a specific background and here's one more explain to me how a rainbow is formed in a style of a friendly scientist who adds fun scientific facts and you could train these personas with these prompts in a couple different ways so act as again one of my favorites like act as an investment banker or you could just give it more specific things to say like add fun facts or add a joke like the example they gave us and at the end of the video I'll also give you more resources and more prompts that you could simply download but right now let me just get through some of these really useful tactics now this next one's interesting use delimiters to clearly indicate distinct parts of the input so these delimiters they give you three different examples here one is this triple quotation mark the other one is this format where you put article basically this HDML type format or XML tags where you put an intro and outro in a bracket and there's another version of it where you just tell it insert the title over here now these are not that relevant when it comes to simpler prompts So when you say summarize this paragraph in one sentence you don't need to put triple quotation marks or ask it to format a specific way but when your prompts start to get longer this lets you really refine your output so I'll give you a good prompt example here plan an event outlining both the mandatory and the optional references and then you could give it this format so requirements list of requirements here and then preferences list of preferences here and you could see how you could keep going with this that way when you give it more context on what you're looking for here the format is going to follow whatever format you put over here and same thing with some of the examples they give you so summarize the text here in ha cou and you put triple quotation mark and insert the text now this is not going to be any different if this is your entire higher prompt but as your prompt get more complex and maybe you want a summary first then a ha cou then something else then these triple quotation marks really help now this next tactic is also very useful specify the steps required to complete a task so sometimes I've seen people just copy and paste an entire page as a prompt and it doesn't really know what the most important steps are or the order of the steps so this allows you to tell it this is step one so in the case of this example it says step one the user will provide you a text with triple quotes So This is using a tactic from earlier that we just talked about and it's asking you for step two then translate that into Spanish so step one is going to summarize step two is going to do a translation so here's an example step one analyze the key themes of this movie plot and then you insert the movie plot in triple quotations like it recommended and then it says step two based on the analysis recommend a similar IL movie and you could see this could be many many steps right but this is really going to craft your prompt in a way where it understands let me finish step one let me finish step two it's going to give you the output all at once but it could again work in the background more efficiently than when it doesn't really know what's more important or the step-by-step guide of achieving a specific task now this tactic I like providing examples so you could ask it a question and say this is the exact type of a format I want out of an answer here's an example Now give me the next question in that format too and again the example they give us is again designed for the developer on the API side so if you're a developer this tells you exactly how to do it but on the chat GPT prompting side here's an example of how you use this tactic respond to these questions in a philosophical style similar to this example given so example teach me about time respond time is like a river constantly flowing right so then the next question question this is where your prompt would go again teach me about happiness and then it's going to know based on this example that you wanted to respond this way because now it has an example and a response so if I ask it about happiness and use that same technique here so giving it an example of a response that you want when prompting could get you very close of getting the output on the next set of prompts too now this next tactic a lot of people use already but specify the desired length of the output so if you don't give it any kind of instructions on what kind of output sometimes it gives you two pages sometimes it gives you one sentence you really never know but this way you could tell it use 50 words or two paragraphs or three bullet points and it's telling you right over here that 50 words is the least accurate actually out of these other two so if you say two paragraphs or three bullet points he knows how to do that more accurately than he knows what 50 WS are for some reason so it is telling you that is an option but if you want it to be more precise this paragraph or three points are an option that you could use instead so all those tactics were under the first strategy of clear instructions the second strategy is providing reference text so let's go through the tactics of exactly how to use this one instruct a model to answer using reference text now this is a great way of using chpt right you want to give it a specific resource and the output needs to make references to that resource that could be an article it could be something you upload it could be something you use in the custom gpts but it needs to have some reference to some Source it could be a website as well if you're using a version of GPT that has browsing access with Bing so what do we do exactly for that inside a chat GPT here's a prompt formula here you could use using the information in the provided health article answer the question below so if you want to take a paragraph or an entire page you could copy and paste it here and then it says then you ask your question what's the benefit of the Mediterranean diet which I'm assuming it would be part of that health article that's why I would ask something like that so if you craft your prompt this way it would only have that to reference which is the article you insert here again you could use web browsing with this you could just copy and paste from a specific website or a specific article and then that's what it's going to make reference to not is internal knowledge based so this is a really good use case if you need that source to be from a very specific place and this is building on top of that instruct a model to answer with citations from a reference text so similar to what we talked about but you just add a little bit here for the citation so then when you ask it a question it will actually give you that as the output and I'm going to give you some of these prompts here in a bet so you don't have to actually write any of this down but you basically tell it that you're going to give it a document this time in triple quotations and then your task is to provide an answer and cite the passage or where you got that answer so this one if it doesn't know you tell it say in sufficient information for example or I don't know the answer a lot of times you're using chat GPT to kind of do more official research this type of prompting could really help you there now the third big strategy is splitting complex tasks into simpler subtasks now this is very useful because a lot of times again when you use a big prompt with multiple different layers even sometimes when you use that step one step two kind of format we looked at sometimes you could hallucinate or just skip something that you gave it in the middle it does a good job with the beginning and end of a prompt but sometimes the middle part gets lost in the shuffle so this time you could break it up into smaller subtasks again as one single prompt or you could do a multisequence prompting which is when you wait for an answer and then give it another prompt but let me show you some of the tactics here use intent classification to identify the most relevant instructions for user so this is the example they're given us if we're building a chatbot again as a developer this is useful but for everyday person this is also useful let me show you what it's telling you to do so it's saying right here if someone uses a chatbot that we built on our website and they say I need to get my Internet working again now this chatbot needs to figure out well what does that mean exactly well it says break it down into two different categories one is first figure out what primary category This falls into so billing technical support account management so in this case it would be obviously technical support but then within technical support this is where the subtasks comes in it says tell what technical support can have in secondary categories troubleshooting device compatibility software update okay then it will just make the Judgment again using AI to figure out what does internet not working mean well first it means technical support then secondary means device compatibility or troubleshooting depending on which way he wants to go with that right so you have to figure this out when you're building chat Bots but let's look at it as a simple prompt inside of chat gpt2 I used the prompt example as travel book impr prompt so it says classify this travel related question and outline the steps to assist so can I change the date of my flight booking again this is relevant for building a chatbot but if someone asks you that question and you could use chat GPT to answer it this way so it says what's the first step well check if the ticket is changeable then check if there is any potential fees and inform about that and then guide them through the date change process so you can see how this broken down to multiple different steps again if you're not using a chatbot this prompt is not that practical when it comes to using chat gpts but when you're building chatbot for example zapier AI has a chatbot Builder if you're using that as just a everyday non-developer you could use this kind of tactic as well now this is an interesting one for dialogue applications that require very long conversation summarize or filter the previous dialogue chat GPT doesn't have infinite memory all these chat Bots actually don't have that long of a memory so at some point they're going to forget what happened earlier in that conversation this is basically saying after a new prompt is given summarize the previous answer so it knows where it left off every single time it says this is a workaround for this problem so that's a way where it summarizes the last thing so then when it's answering the next thing it keeps having a memory of a previous conversation and this one is one of those where it's really more relevant when you're kind of Designing chat Bots and things like that for the prompting but it's basically saying provide a brief summary of our previous conversation regarding a technical issue in this case summary of the previous chat will go over here and then the next question will go over here so this type of formatting would be useful again if you're building a chatbot as a non-technical person or even a developer when building chatbots would use this kind of format now the next tactic is useful summarize long documents piece-wise and construct a full summary so it's saying if you want chat GPT to summarize a whole book it's just going to not be able to do that right the context window or the context length that it keeps referring to depending on which version chat GPT or even inside of the API which version you're using maybe GPT 4 Turbo they have a limit of how much text you could input right you can't still do an entire book for example in any model so what it's telling you is ask it for very specific sections one prompt at a time so it summarizes that specific section depending on the length of the input so here's how a prompt like that would look Summarize chapter one of the book and then you will put the book title here or again you could if you're using GPT 4 you could upload different sections of different text documents to it you could also build custom gpts that I covered in a different video as well all about gpts those are basically mini chat gpts that have your knowledge base so in this case it could be this book title highlight the introduction the main characters outline any key events and set the stage for the story so you could see this is just going to reference that one chapter and then you have to build on it and maybe eventually when you do all the 10 chapters you could take the summaries and then say summarize now all these together but this is just telling you hey don't try to give chat GPT more than it could handle it's just going to give you an error message so using this tactic piecewise tactic basically helps you get over the length the context length Okay let's get to the next big strategy which is giving models time to think so a tactic for that is instruct a model to work out its own solution before rushing to a conclusion I really like how they they laid this out basically they're using an example of a teacher using it here and basically the teacher says is this student solution correct and then they're pasting a solution to a problem and chat GPT in this case will do a incorrect job it says a student solution is correct but it turns out it's not correct so how do you get around that well here first work out your own solution to the problem this is the prompt then compare Your solution to the students solution and evaluate if the student solution is correct or not don't decide if the student solution is correct until you have done the problem yourself this is fantastic right it's basically saying if you don't give it enough context there and if it doesn't work through any type of problem is going to most likely give an incorrect output now this next tactic about giving these chat GPT models time to think use inner monologue basically is saying a lot of times it doesn't make sense for the user to see the thought process in the answer right we just want the answer maybe the thought process doesn't make sense as the output so it's telling us there is a way where we could actually prompt it in a way where it doesn't do that it just kind of gives us the answer and the example they gave us actually is using some of the tactics we've learned so far so it's using that step by-step guide It's using that triple quotation mark but it says first work out the problem don't rely on the student solution since it may be correct compare the solution and then to the student solution as the second step and then enclose all your work in this step with a triple quotation mark if the student made a mistake determine what hint you need to give the student and then step four if the student made a mistake provide a hint from a previous step this whole concept of prompt engineering a lot of times as you get better you're using multiple different things from what we've learned so far so that stepbystep sequence the triple quotation mark all it comes into play and this one's one of my favorites I've been using this for a long time asked the model if it missed anything in the previous pass basically having chat GPT models check their own work to see if they find anything else they missed in the first go around and again this is going to be a little complicated this is again designed for developers because it's asking you to Output things in Json format great if you're using this API assistant to build apps but for non-technical people I have a simpler version of it having gone through the scientific paper in this case is a scientific paper identify more quotes and answer what are the key findings of the research again the title of the scientific paper avoid repeating previously listed quotes and provide full context okay so this could be listed not just quotes sections or things like that and this way it will redo its own work so this is a kind of a follow-up prompt that is really useful a lot of times it's going to miss things in the first goal especially if your prompt doesn't have enough context okay this next strategy I'm going to rush through so we could get to the next one but this one is designed for developers using external tools and is telling you to use things that will help you with better knowledge retrieval so inside of What's called the API cookbook there is a whole directory of knowledge bases that are basically embedding these knowledge bases into your API so you could get access to information that otherwise you wouldn't have access to for everyday people though what we could do is with the paid version of GPT we could build our own gpts our little mini gpts and our knowledge base could be whatever we give it so it could be our own documentation again I covered that in the GPT video but if you do it that way you're basically doing this but for non-developers if you're a developer these external tools are going to make a lot of sense to you so you could also do API calls external API so apis again are a key to someone else's knowledge base and you could basically use them to communicate between multiple different apps inside of gpts there is a more advanced version called actions you could Implement that again covered in a different video and you have things called functions again related to apis but this next strategy is relevant for everyone test changes systematically so usually I have a task in any given day right it could be writing email it could be creating a blog post or it could be creating a social media ad for example for all of that I need a perfect prompt that gets me started and I don't want to start every time coming up with that prompt I want to save that prompt so every time I make changes to that prompt based on everything we've talked about so far with prompt engineering I want to be able to compare the two prompts the previous and the new one and see which one's giving me better output so systematically means well change something you could keep track of so you know exactly what you changed and was the result better or was it not better and then go back and do it again if you just write an entirely new prompt and you're not systematically keeping track of these changes again this is made for developers but Everyday People this basic AB testing is this better or is this better let me change something that I know would result in something better and if it doesn't I go back and then do it again and he also says that do multiple tests don't just change something about your prompt and go about your way and again for developers it says make sure this is a repeatable test in the case of just using chat GPT just make sure you save that prompt so you don't have to always start from scratch and go through these testing just save your result I have different prompt books for different things I do so if I'm doing sales copy I just refer to that and use the same prompts that are really perfected over the course of time so I don't have to think about it every time and what I did was I took these six strategies the tactics under each strategy and I basically created a nice and easy PDF with all the prompts that I included too so for each one I simplifi the PRS for non-technical developer type people so that is also available on my website is free you could download it and I'll also send you other free resources as well and if you want to learn more about prompt engineering or just chat GPT and all the top AI tools we have an entire platform called skill leap AI we have well over 15 AI courses all complete courses and you could access them right now and we released two to three new courses every single month so if you want to learn about chat GPT prompt engineering more advanced chat GPT course mid Journey basically all the top AI tools we cover with full courses on this platform and it's a allinone Netflix style subscription so you don't actually ever have to buy individual courses all the new ones you just get access to we have a GPT course coming up for example next week and it also includes a free 3-day trial just to make sure it's a good fit for you so I'll link that below again if you want to learn more about that share this with anyone that wants to get more out of chat GPT I hope you found it useful I'll see you next time
Info
Channel: Skill Leap AI
Views: 31,942
Rating: undefined out of 5
Keywords: howfinity, app of the day, iphone app, ChatGPT Prompt Engineering Guide, prompt engineering, chat gpt, chatgpt explained, prompt engineer, chatgpt tutorial, chat gpt prompts, chatgpt prompt, gpt 4, chatgpt prompts, chatgpt examples, large language models, how to use chatgpt, chatgpt perfect prompt formula, what is prompt engineering, prompt engineering tutorial, prompt engineering course, chatgpt prompt engineering
Id: lTI4FyO0ul8
Channel Id: undefined
Length: 22min 54sec (1374 seconds)
Published: Wed Dec 20 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.