Hi!
In this week’s guest post, Kevin is sharing with us his formula to create better ChatGPT prompts.
Kevin is a data scientist who runs Unfiltered Data, a weekly Substack newsletter that is all about data science, Python and ML. Highly recommended for data professionals and tech enthusiansts who want to learn the tech stuff behind AI.
I have spent hundreds of hours in various prompt engineering courses and constantly tested different possible structures to build a formula that can bring me closer to high-quality responses from AIs such as ChatGPT, Bard, and Claude.
Hera are 6 basic elements that a good prompt should have.
The 6 Prompt Components
The first thing we need to understand is that the following elements are listed in descending order based on their importance. These elements are task, context, exemplar, persona, format, and tone.
Let’s look at it with a simple example.
The first half of the entire example is the context, and the remainder is the task, where the latter is the most important (more than the context).
Thus, if we only input tasks individually into ChatGPT, we will still get some meaningful results. Let’s look at the following example:
The opposite happens if we only provide the context to ChatGPT. Let’s look at the following example:
So, we can say that every time we need to build a prompt, it is almost a duty to include a task, which should be complemented with context and examples. The persona, format, and tone are like the ornaments on the Christmas tree (of course they are important, but without the tree to support them, they wouldn’t be as relevant).
When you build your next prompt, I recommend that you create a mental checklist, which would be as follows:
You can also review the formula to include the outlined points or directions. Likewise, include sufficient relevant information. Later in this article, we will see that a good prompt doesn’t necessarily have to include these 6 elements.
Now let’s start analyzing each of these six elements in detail.