How to Become an OpenAI Prompt Engineer For Beginners β
Let's become an AI prompt engineerπ
2024-05-30
Transcript β
[00:00] by the end of today's video you're going to have a full idea of what it takes to be an AI prompt engineer the information I'm going to show you today is based off 10 months of me building out my own artificial intelligence integrated software to Showcase how to prompt engineer I'm going to be using open AI dashboard today but this can be applied to any AI provider Gemini anthropic co-pilot everything I have no clue how long this video will be what I can guarantee is by the end you'll have a pretty good idea of how to be an AI prompt engineer let's jump into today's video Welcome Back y'all in today's video I'm going to show you how to create effective prompts in the context
[00:31] of developing software if you want to see how to create effective prompts when talking to different chat bots in that kind of user interface check out this video right here as I go over the best way to craft prompts the title is PR prompt crafting 101 so you can check that out in this video though this is going to be very specific in the context of AI prompt engineering for the development of software what you may or may not know is an expanding field has a ton of opportunity and you're able to create a ton of value all right enough talking let's jump in let's go and discuss the documentation real quick so we can understand where to input our data why it's relevant and how to handle
[01:02] the different types of variables associated with our prompts as just a quick overview when dealing with artificial intelligence in your software you're going to be making completion calls essentially think of it like when you're talking to Chad gbt and you give an input and it gives an output we do this but in the context of software and more specifically in the context of a scalable way that allows us to automate different value points for our underlying consumer now when looking at a completion prompt there is two major things I need you to understand the first major thing you need to understand understand when crafting prompts is the role of system and the role of user how
[01:33] do we leverage this I want you to look at system as that is where you're going to input your instructions we're going to create some instructions together so you can understand how to correctly create instructions that are effective but look at it as that's the prompt that's telling the underlying AI provider what to do I want you to look at user as that is the data we're providing give me a use case Corbin what are we talking about here so in today's video we're going to do an email responder essentially we're going to set up instructions that specific in the system prompt once we set up those instructions the only thing we're
[02:05] putting for the input or the user is going to be the relevant email data no other proctoring no other dictation purely the data so look at this as instructions data that's it this will make more sense as we keep going here second major thing for you to understand is we have a bunch of different variables we can actually call within a API endpoint now this includes stuff like Max tokens presence penalty response format seed stop stream stream options temperature tapy the list goes
[02:36] on but what I want you to care about is only two these other variables have their relevance and use cases but to be honest with y'all depending on your use case most of you are going to only opt for temperature and Max tokens the use case of Max tokens well first off let me take a step back tokens are how you're charged with the AI provider more tokens more cost I believe they said around a th000 tokens equates to around 750 words of output and like input of course as well Therefore your max tokens is going to set a ceiling so that you don't get crazy long prompts or outputs that could
[03:07] detrimentally cost you a ton of money for your operations it's always a good idea to set up your max tokens what's a good number Corbin anywhere between 500 to 1,000 depending on your use case next major option you're going to choose between is temperature and tap p i want you to think of these as your ability to kind of gauges creativity a lower temperature means it's less creative and more consistent on outputs a higher temperature it could go off the rails and give you some crazy outputs knowing this know your use case therefore if you
[03:38] have a use case where you need consistency if a thousand users were to access this endpoint would all a thousand users get the same value point at the end in the context of like this is how you write an email if you want consistency at scale you're going to do a low temperature alternatively if you're dealing with maybe something more creative like an article generator you'd probably go with a higher temperature what I always opt to do is lower temperature is better because we want user 334 to have the same experience as user 2,156 how was your experience good we've
[04:11] given you an overview of what you need to know when even approaching an endpoint like this the same type of logic can be applied to other AI providers let's actually do an example together here we're going to go ahead and use playground and chat within our open AI dashboard to Showcase this in reality When developing your software this would be within whatever you're coding in me personally I use visual code Studio Corbin what are other things I should be using for my back end at my front end check out this video right here it's like a I don't even know how long but it's like six blocks I show you from start to finish everything
[04:41] Encompass with building out an AI software all the tools everything that would be necessary so check that out let's create a prompt here we go so let's go ahead and adjust our settings here in code obviously we wouldn't have a nice little UI like this but we're going to go and set our top P actually we're not going to use top PE we're going to use temperature we're going to set this all the way down to 0.1 we need consistency we need a scalable product 0.1 Max tokens we'll set it to 500 or just 501 everything else we can ignore for now perfect let's go ahead and create our instructions together your instructions are going to have six major
[05:12] parts let's do the first part together the first part here is going to identify context this is going to allow the system to understand its major use case anytime it receives data in the user input I'm going to go and shrink myself down a little bit y'all here we go typically when writing instructions for the system you don't want to over kill it you don't want to write an essay MLA format five paragraphs turn in at 8:00 p.m. on no I'm joking but don't write essays we want to be as concise and very specific of a dictation the less words to get across our point the better so for now we're just going to Simply say
[05:44] you are an email responder I will provide you with an email I received please respond now for example like one thing I just messed up on right now or not really a mess up on is we don't need things like please so you don't have to put please in there there less words better delete you are an email responder I will provide you with an email I received and you respond there we go Section number two is going to be steps steps outline the exact process you want your underlying AI provider to take When approaching the data you provide when I
[06:15] say data I'm referring to whatever is the thing you're going to format reformat or use as context for your output a email a article a video steps are going to be formatted like so one two three four five six seven you know the list goes on but however many steps we our context will go up to three now you don't want to make your steps too lengthy if you're getting up to 10 think of ways to approach your data better EG are we going to do a looping mechanism EG are we going to run this to a prompt
[06:46] before this data is received to this prompt you know be effective here step one understand what is wanted in the email received for this actually we're only going to do two steps so we'll do step two Write a response to this email knowing this let's going to add a little bit more context here my name is and in code obviously if you were actually going to make this into software you know we would use these little uh actually depending on the code you use you'd use little brackets for this these would be input variables we' put into the prompt but for our context we're just going to fix it use fix text so
[07:17] assuming that this is just fix text we can provide you know my name is Corbin I work at otar or otch Solutions if you're writing software these would be variable points that you allow the consumer to put into their settings I work at o te Solutions and I am customer support here we go steps understand what is wanted in the email received reference to subject line ody Write a response to the email let's go to step three or section three section three may have relevance to you or may not have relevance to you is going to be depending on the context of
[07:47] the type of data you're inputting let's just say with the data we're inputting we have identified the subject in the body using semics we're going to go and say full email where the subject is identified with subject is identified with body body semicolon now that it knows the input format it's receiving let's go and identify the output format we're simply going to say when providing an output don't use I'm going do quotation marks here subject semicolon or body body semicolon just
[08:19] output the relevant text for each section section five here we're just going to Simply Give an example output that we like so I'm going to do example output here I'm actually just going to generate one from chat gbt real quick to make my life easy here we go so we have an example output of how we'd want it to look notice how with specific variables that will show up in the input we're going to want to identify that first major one being the high name it's going to now know that if there's a name that shows up in the input data it will reference that instead of just saying High name use this as you will structure this as you will this is going to be
[08:50] more General as you're going to want to basically just give a general idea of how you want it structured one important thing that I'm doing here for example is adding this as fixed text as every email quote unquote email I would respond to would have my name in otch Solutions and the last section we're going to add here is going to be Specific Instructions specific things you want to identify and ensure happen during your outputs so for our example we're just going to say each email body should be Max of four sentences identify stuff that's relevant
[09:21] to you identify stuff that you know you want to make sure shows up at scale and there we go we have our six sections created and we have a functional API end point that we can start referencing with input data for reference the six sections were full context steps input format output format example output Specific Instructions as described before the user message will be the input data when looking at API documation the system is the instructions we just created together and this is where we're going to put in the input data we're going to have an
[09:51] example email that we just received as identified with the import format we're assuming that with the data we receive for some reason subjects and body coin or there still this is just to help you identify if there's like little metrics within your data that you want to identify and make sure it doesn't show up in the output that's kind of why I did it in this context when you see input format we've identified that the subject semicolon and the body semicolon is going to exist with our user message so here's our user message we have the subject semicolon and the body semicolon inquiry about product features hi Corbin
[10:21] I recently came across your website and I'm interested in the new features of your software products could you provide me more details on the key functionalities and available documentation thank you Alex that's all should go into user message it should just be the relevant data we care about let's hit run and there we go y'all we have successfully created a scalable endpoint for the context of email input and email output hi Alex reference up the example output here High name gave the paragraph here and obviously in the context we could add link to documentation or more information that would be relevant for these kind of outputs and then gave us best Corbin
[10:53] otch Solutions customer support perfect y'all if you feel like you learned something me in today's video make sure you leave a like it's completely free at the end here I'm going to leave a playlist called from concept to software that goes over other topics like this I give Niche examples with the software I'm currently developing and a bunch of other stuff so check it out without further Ado though I'll see you in the next video this is the playlist s is referencing when it comes to concept and software that's a random video based off your clicks that's my face I'll see you in the next video