The usefulness of prompt templates
In an era where AI technology is getting integrated in many aspects of our lives, being able to properly externalize what we need is a must. The time when AI models can read our brain to know exactly what we want hasn’t come yet and it’s crucial to be able to craft meaningful prompts to achieve the task at hand.
Since it can be time consuming to write long walls of text for everything we need to be done by an artificial intelligence, prompt templates can save you a lot of time. By looking back at conversation history between you and a conversational AI model (such as ChatGPT, Claude, etc.), repeating patterns often emerge. It can be surprising to see how often we end up rewriting the same thing over and over again but only using different words. In those kinds of situations, a lot of effort could be saved only by crafting and keeping a template tailored for the task we are trying to accomplish.
A prompt template, by its definition, is a way to reproduce a prompt tailored for a specific situation. It often contains instructions, examples and guidelines. It is shaped as a frame where you can insert situational content to execute the task in a standard way. This approach standardizes not only how we interact with AI models, but also what we receive as an outcome. To better illustrate how this works, let's take a look at generic situations often encountered when prompting.
Content generation
For this situation, let's take a look at text generation such as a blog article, an email, a notice, etc. It can easily be achieved with really simple prompts such as :
I need you to write a blog article about cats and their love for catnip. It needs to talk about what catnip is and why cats are attracted to them. Also give recommendations on how catnip can be used to train cats.
If you send this prompt to any general AI models such as ChatGPT, you will probably get a good article on cats and catnip. It's great for a one time shot that doesn't really need a follow-up. The catch is when you have to fill a cat blog with content. This article is fine by itself but will it fit with the rest? The style, the length, the literacy level, will it be ok? For example, the moment you want to write another one about cats and how they love to get into boxes, you might get a totally different writing style that doesn't fit.
Remember the definition of a prompt template? It contains instructions, examples and guidelines. Let's add some of those to our original prompt and see where it gets:
I need you to write a blog article for my cat themed blog. The article must contains the following: - Between 500 and 1000 words - Aimed at kids aged between 8 and 10 years old - Written with a humorous tone - Ideas separated in small paragraphs, sections with a subtitle - Avoid bullet points at all costs - Catchy title, 50 characters maximum Subject: What catnip is and why cats are attracted to them. Also give recommendations on how catnip can be used to train cats.
As you can see, the instructions are much clearer. If you give this prompt to 5 different professional writers, you might get similar results for each article. The same applies for AI technology. In the case you need something even more specific, you can add more instructions or guidelines to make sure the end result is what you're expecting.
Let's take that last prompt, and transform it into a reusable template. To do so, only the situational content needs to be replaced with a placeholder, like this:
I need you to write a blog article for {CONTEXT}. The article must contains the following: - Between 500 and 1000 words - Aimed at kids aged between 8 and 10 years old - Written with a humorous tone - Ideas separated in small paragraphs, sections with a subtitle - Avoid bullet points at all costs - Catchy title, 50 characters maximum Subject: {CONTENT}
Everytime this template needs to be used to generate a new article, only the {CONTEXT} and {CONTENT} placeholders are to be manually replaced with what needs to be done.
I like to store these templates on an easily accessible drive on the cloud (ex: Google Drive, DropBox, etc.) as I can easily copy/paste them from any device into any AI conversation.
Image drawing
The more AI technologies progress, the better they get. This is also true for image generation. It's impressive for some models such as MidJourney or Dall-E to see the quality of the picture they generate. Some of them can hardly be distinguished from real pictures drawn by physical artists.
As impressive as they get, it can be hard to get consistency between two different renders. I've seen countless people trying to generate images to be sitting in front of their computer puzzled at the AI model wondering why it's not listening to what they're saying. The fact is that it's often the other way around. The AI model is in fact listening to what it's being told but the lack of instructions or guidelines sends it flying in every direction.
When people are asking why it's not producing what they want, I reply with the following question: Can you describe what you want? More often than not, it ends up being very vague with only two or three specific key points while the rest is completely open. I then follow-up with specific questions such as:
- What style do you have in mind
- What's the dominant color(s)?
- What feeling should be felt when we look at the picture?
- etc.
By answering those, it gets much clearer about what's to be done. Appending this newly thought info to the prompt will force the AI model to design inside those boundaries thus greatly increasing the chances of getting an acceptable result.
Closing thought
Good prompt engineers are pro descriptors. They are skilled at translating in words what's seen or heard. They must still get a hold of their subject but they don't have to be experts in every field. As a general rule of thumb, being verbose about instructions, examples and guidelines are a must to standardize and get better chances of landing on what's expected. The more effective templates you create, the bigger your toolbox will grow and the more productive you will get.
Possibilities are endless but remember, creativity is the key.
Disclaimer: No AI models were used in the writing of this article. The text content was purely written by hand by its author. Human generated content still has its place in the world and must continue to live on. Only the image was generated using an AI model.