00:00We will be exploring prompt engineering inside ChatGBT in this video
00:05We are going to learn about four different types of prompting techniques: zero-shot prompt engineering, role prompt engineering, few-shot prompt engineering, and chain prompt engineering
00:19As we work through each prompting technique, notice how each technique helps elicit specific responses from large language models, i.e., ChatGBT
00:26I want to explain the basics of prompting before diving into each technique
00:35It will help us learn how to write for ChatGBT and other large language models
00:41Therefore, I want to begin by deconstructing
00:44Free basic prompts into the four components of a prompt: task, input, output, and context
00:54Now, here is the first basic prompt I want to deconstruct into the four components: summarize this article about renewable energy sources, and below that, I'm going to place an article placeholder in between triple quotations
01:18If we had an article, we would paste it below the prompt inside triple quotes or hashtags
01:24The OpenAI documentation recommends this to separate instruction and context
01:31Now, this prompt can be deconstructed into the four components of a prompt as follows: number one, task: summarize this article
01:43You input the article on renewable energy sources, which we will be able to see here, free output a summary of the article for context, none in this prompt
02:00Now comes the second basic prompt that I want to deconstruct: classify this news article as either sports or politics, and we will place a placeholder for the article below that, and that will be inside triple quotations
02:20So again, if we had an article or headline, we will paste it below the prompt inside triple quotes or hashtags
02:29Open AI recommends this to separate instruction and context
02:37Here is the prompt deconstructed: one task, classify this news article
02:45Two, input the article or headline to classify, free output either a sports or politics label
02:58For context, again, none in this prompt
03:02I hope that the components forming a prompt are now becoming familiar
03:07The majority of prompts follow this or a similar structure
03:12Here is the final basic prompt I want to deconstruct before the prompting techniques: Translate this sentence from English to French, and again below that, inside triple quotations, I will put a placeholder for the input
03:36If we had a sentence, we would paste it below the prompt inside the triple quotes or hashtags
03:40Again, OpenAI recommends this too
03:44Separate instruction and context
03:48Here is the prompt deconstructed: one, task, translate this sentence to input the sentence to translate free output, the translated sentence for context
04:05Again, none in this prompt, but a conversation thread where previous sentences also need translating could be considered context
04:17We have now deconstructed the three basic prompts, and more importantly, we understand how prompts are constructed to elicit specific responses from Chat GPT
04:29Clear writing is the foundational skill, and depending on all of those and every other prompt, the output of a prompt is correlated
04:37With the clearness of the pros in the prompt, be as specific as required, and start prompts with instructions, not context
04:47That is how we can increase the probability of an accurate output
04:52Responses from large language models should still not be trusted blindly, verify the response
04:57That is especially true of critical information
05:03We will now cover the first of four prompting techniques: zero-shot prompting
05:09Zero-shot prompting is considered one of the most basic prompting techniques, but it is still powerful because of the breadth of training data that went into chat GPT
05:18I'm going to explain zero shot
05:28Prompting by deconstructing two examples, I will deconstruct them as we did previously into the four components of a prompt: task, input, output, and context
05:37Here is the first zero-shot prompt I want to deconstruct into the components: create a list of 10 books similar to 1984 by George Orwell
05:55Chat GBT will output some fantastic suggestions in seconds
06:01Here is the prompt deconstructed: one, task, create a list of 10 books similar to 1984; two, input, none in this prompt; three, output, a list of 10 books; four, context, none, however, mentioning George Orwell could be classed as context
06:33That is because we are directing GBT
06:36towards 1984 by George Orwell, thus minimizing errors, whereby there is a book of a similar title
06:47Now comes the second zero-shot prompt that I want to deconstruct: convert the output into a table, column one for index, column two for title, column three for author, column four for book description, and column five for emoji related to the book
07:29ChatGPT will now transform its previous output into a table format
07:37Here is the prompt deconstructed: one, task: convert the output into a table; two, input: the previous output, i.e., the list of 10 books similar to 1984; free output: a table with five columns populated using
08:00The previous output for context, none
08:04In this prompt, we have now covered zero-shot prompt engineering
08:13Now we can discuss the second of four prompting techniques: role prompting
08:20Role prompting is a technique whereby we can get a large language model, i.e., ChatGPT, to act as a fictional or non-fictional character
08:31We can even get it to act as a thing, i.e., the terminal on a machine
08:35Role prompting is a valuable technique to deploy when our goals require more consistent outputs
08:42I'm going to explain role prompting by deconstructing two examples
08:45I will deconstruct them as we did previously into the four
08:50Components of a prompt: task, input, output, and context
08:57Here is the first role prompt that I want to deconstruct into the components: "Act as a Mac terminal
09:09I will type commands, you will reply with the output from the terminal
09:21Outputs should be inside code blocks, do not write explanations." ChatGPT will now understand the role we want it to play
09:38Now we will enter the second row prompt with ChatGPT acting as a terminal
09:44Paris wtdr is a free console orientated weather forecast service, and we will see that ChatGPT recognizes this and mimics a real terminal with its output
10:05Here are the two prompts we entered
10:07Deconstructed in one task, the task is in the first prompt
10:10I act as a Mac terminal
10:19Two, input, the input is in the second prompt, I.E., curl w t t r dot i n forward slash Paris
10:31Free output, this is again in the first prompt
10:34I output should be inside code blocks for context
10:40Both prompts we entered serve as the context for future outputs
10:48We will now enter two final role prompts, but we will not deconstruct these
10:55The first of the final two role prompts is the following: curl wttr
11:01dot i n forward slash green horn
11:06Green Horn is a fictional place
11:11Chat GPT is aware of that, and therefore does not return any data that demonstrates
11:15The power of context in prompt engineering, the final role prompt is the following: rewrite the previous output in the style of Darth Vader
11:37It is a fun prompt which demonstrates how GPT uniquely adjusts its role
11:44We have now covered role prompt engineering, now we can discuss the third of four prompting techniques: few-shot prompting
11:56Few-shot prompting expands the capabilities of zero-shot prompting
12:01Few-shot prompting is helpful when we need to guide Chat GPT or another large language model towards more specific outputs using examples
12:12I'm going to explain few-shot prompting by deconstructing two
12:14examples, I will deconstruct them as we did previously into the four components of a prompt: task, input, output, and context
12:28Here is the first few-shot prompt I want to deconstruct into the components: assign a sentiment to the texts with no sentiment in between brackets
12:46I will label the first phrase output, all strings of text, do not provide an explanation below that
13:01Inside triple quotes, I will enter the strings of text
13:08The few-shot prompt is evident in the sentiment labels we have and have not provided
13:12We provide the first three, we then leave the final two blank and nudge ChatGBT to learn what we want to
13:22achieve, this is how a few-shot prompt works
13:24We provide some guidance, the model, I.E., ChatGBT, then outputs what we are trying to achieve
13:36Here is the prompt deconstructed: one, task, assign a sentiment to the texts with no sentiment in between brackets; two, input, the inputs are the five strings that we provided, three of which we labeled; free, output, output all strings of text for context
14:03The context in this prompt is the free strings of text we labeled
14:11This was a basic example of a few-shot prompt
14:14Chat GPT will likely have been able to assign labels without the context, but providing context becomes more
14:22Important when working with unique data that ChatGBT is unfamiliar with
14:29Now comes the final few-shot prompt that I want to deconstruct: assign a sentiment reliability score to each string of text, convert the output into a JSON file, key one for index, key two for text, key three for sentiment, key four for score, output the JSON file inside a code block with no explanations
15:23This few-shot prompt first assigns a reliability score to the sentiment labels, and it then converts the data into a JSON file
15:34Here is the prompt deconstructed: one task
15:38There are two tasks in this prompt
15:41The first is to assign a sentiment
15:45reliability score to each string of text, and the second is to output the JSON file inside a code block with no explanations
15:57Two, input: the input for this prompt is the previous output from Chat GPT
16:05Chat GPT remembers the conversation in the current chat; each chat is like a brain
16:12Free output, we instruct GPT to output a JSON file with our defined keys for context, none in this prompt
16:26Chat GPT becomes more powerful when we incorporate few-shot prompting
16:31We have now covered few-shot prompt engineering; now we can discuss the final prompting technique: chain prompting
16:41Chain prompting is a technique that Involves creating a sequence of prompts
16:47It is useful when we are trying to generate detailed outputs
16:52Chain prompting can also incorporate other techniques like role prompting
16:58I'm going to explain chain prompting by deconstructing five examples
17:00I will deconstruct them as we did previously into the four components of a prompt: task, input, output, and context
17:13Here is the first chain prompt I want to deconstruct into the components: write an outline for a blog post about visiting Paris (France) in December
17:34Chat GPT will return an excellent foundation for the blog post in seconds
17:41This is the First prompt in the sequence of five that we will create, and here is the prompt deconstructed: one, task: write an outline for a blog post; two, input: the input is where we mention the topic, "Visiting Paris, France in December"; three, output: we instruct the prompt to provide us with an outline for a blog post; four, context: none in this prompt
18:19Now comes the second chain prompt that I want to deconstruct: shorten the outline to key points
18:31ChatGPT will condense the outline to the key points in seconds
18:36Here is the prompt deconstructed: one, task: shorten the outline; two, input: the input is the outline previously generated by ChatGPT free output, we want ChatGPT to provide us a shorter outline for context
19:02The previous output by ChatGPT is the context in this situation
19:10We can now enter the third chain prompt that I want to deconstruct: write one paragraph for the introduction
19:25We will now see ChatGPT write an introduction using the outline it generated, and here is the prompt deconstructed: one task, write one paragraph; two, input the shorter outline which ChatGPT generated serves as the input here; free output, we want one paragraph for the introduction, not multiple
20:03For context, again, the previous output by ChatGPT is the
20:07context
20:11In this situation, we have now created a sequence of three prompts
20:18Here is the fourth chain prompt
20:25I want to deconstruct, condense the introduction paragraph using shorter sentences
20:32The previous introduction that Chat GPT wrote seems too wordy, and that is why we created this prompt
20:38We want Chat GPT to improve its own writing, and here is the prompt deconstructed: one, task: condense the introduction paragraph; two, input: the input for this prompt is the introduction paragraph GPT generated; three, output: we want Chat GPT to improve the introduction paragraph; four, context: again, the previous
21:09Output is the context
21:16We can now enter the final chain prompt
21:18I want to deconstruct, write one short paragraph about my company inside brackets, and inside triple quotations, "Historical Walkers, I offer walking tours," inside triple quotations, "for 40 dollars." This paragraph will go after the introduction paragraph
21:56Use the AIDA in brackets—attention, interest, desire, and action—copywriting formula
22:12GPT will now generate a paragraph using the unique information we provided, i.e., company name and pricing
22:21This paragraph we can then use in the blog post
22:25Here is the prompt deconstructed: one task, write one
22:30short paragraph about my company, two input
22:35We provide unique information in this prompt, I company name and pricing free output
22:46We want ChatGBT to provide a captivating paragraph using ADA for context
22:56Again, the previous output is the context
23:03I will not walk through the remainder of the blog post, it will be repetitive, but I would repeat what I have demonstrated to complete the blog post
23:13We have now covered chain prompt engineering, and that means we have covered all four of the prompting techniques: zero shot prompt engineering, role prompt engineering, few shop prompt engineering, and chain prompt
23:27engineering
23:30There are many ways we can use these techniques
23:32We can use them professionally and non-professionally, but there is only so much we can learn by watching videos
23:39It is time to deploy these techniques wherever assistance is required.