Plan Your Prompt Template
Learning Objectives
After completing this unit, you’ll be able to:
- Use prompt design to create effective prompt templates.
- Use prompt templates to improve content creation processes.
- Identify ways to iterate on the prompt design process for better results.
Dawn of a New Day
Ursa Major Solar is a rising star in the booming business of home and commercial solar. It sells panels and related hardware, does installations, and offers maintenance and support. Business is great, and it’s about to get better! Ursa Major Solar is about to go live with a new solar panel cleaning service.
[AI-generated image using DreamStudio at stability.ai with the prompt, “A house with solar panels. Drawn in 2D vector art style.”]
Ursa Major Solar is excited to share the news with its existing customers, but the company wants this campaign’s messaging to be more than a one-size fits all email. It wants each customer to get a tailored email that’s grounded in CRM data, like how long they’ve been a customer and where they’re located. At the same time, Ursa Major Solar wants the messaging to reflect the brand’s voice and tone.
This is the perfect time for Lara, an admin, to get started with prompt templates. She needs to generate messaging for the new service targeted to existing customers. This narrow focus lets her start small and learn how to best use prompt templates for future, bigger campaigns.
In this unit you see how Lara designs her first prompt template, and how she improves the template over time.
Ask the Right Questions
As you learned in the first unit, a great prompt gives an LLM the directions it needs to create a good output. But what makes a great prompt template? It mostly boils down to having good answers to four big questions.
Who is involved, and how are they related?
[Key Ingredients: Participants, relationships, data]
“Know your audience” is a familiar adage for anyone who writes or presents for a living. It just means that you usually have to change the way you communicate depending on who's reading, watching, or listening. In order for the LLM to know the audience, you must tell it! But even more, you have to tell the LLM who to role-play as. In this case, Lara wants the messaging to sound like it’s written by the account executive to the customer. With the players in mind, she starts the prompt template with this:
You are an account executive named {!user.firstname}
{!user.lastname}
from a company named Ursa Major Solar. You are writing to {!contact.firstname}
{!contact.lastname}
, who is a {!contact.title}
at {!account.name}
. They have been a customer of yours since {!account.creationdate}
.
Notice that Lara is already grounding her prompt template with CRM data by including merge fields. Now the LLM can use the length of the customer relationship to guide the contents. Lara also included the names and roles of the people involved. That brings us to the second major question to answer.
What are you trying to accomplish?
[Key Ingredients: Goal, instructions]
There’s a reason Lara is creating a prompt template, and it’s not just to get a great marketing message generated. At the core of it, Ursa Major Solar wants to persuade existing customers to sign up for the new service. That underlying goal is important information the LLM should know. So Lara continues her prompt template by describing the goal in general terms.
You are attempting to persuade {!contact.firstname}
{!contact.lastname}
to sign up for {!product.name}
, which is described as {!product.description}
.
This is also a good time to include some direction for how to meet the goal. This might be a known strategy for crafting the kind of message you typically send. To that end, Lara includes this:
Describe the business value of {!product.name}
in the context of organizations based in {!account.location}
.
Lara uses “describe” as a direct command along with even more CRM data to influence the output. Ursa Major Solar has a lot of proprietary data at hand to work with, so this first template with its few merge fields is a modest beginning to a whole new way of using CRM data to provide useful business context to the LLM. And now she’s ready for the next question.
What is the context?
[Key Ingredients: Setting, tone & style, language]
There are a lot of modes of communication, and each has some expectations tied to it. For example, text messages are usually short, while emails can be a variety of lengths. So, to best guide the LLM, Lara will describe the setting in which the content will be used.
Write the message in the form of an email directed toward a single individual, written in English.
Lara is ever mindful of international audiences. When Ursa Major Solar begins operations in other countries, Lara can replace “English” with a merge field.
Context also determines the style of output, too. Some situations call for a formal writing style, while others benefit from a conversational tone. Lara can describe some linguistic qualities so the output matches Ursa Major’s excitement.
The message should evoke enthusiasm with intensifiers, but limit the use of exclamation points. Express casualness using contractions, referring to the recipient in second person, and using discourse markers.
There are a lot of style cues Lara can try. Discourse markers, like “Oh,” “well,” or “so” will make the output seem more conversational. Later, Lara can tweak the template, but for now she has one last question to answer.
What are the constraints?
[Key Ingredients: Limits, instructions]
It’s very important to include a few guardrails to tell the LLM the limits of what it can do. For example, you should indicate that the content should not contain guesses if information is missing. It’s worth defining how long the content should be too. Lara does this by adding:
Limit the message to about 500 words, and do not address any content or generate answers that you don’t have complete data on.
Finally, there’s one more instruction that’s meta. Tell the prompt to only write the email message, and nothing else. This may seem odd, but it will help prevent the LLM from generating a response about the task of writing, instead of just doing the writing. Lara finishes the prompt template like so:
Follow these instructions strictly to generate only the message to be sent to the customer.
And with that, the prompt template is complete! Lara did a great job with her first attempt by considering these four important questions.
- Who is involved, and how are they related?
- What are you trying to accomplish?
- What is the context?
- What are the constraints?
Altogether, her prompt looks like this:
You are an account executive named {!user.firstname}
{!user.lastname}
from a company named Ursa Major Solar. You are writing to {!contact.firstname}
{!contact.lastname}
, who is a {!contact.title}
at {!account.name}
. They have been a customer of yours since {!account.creationdate}
.
You are attempting to persuade {!contact.firstname}
{!contact.lastname}
to sign up for {!product.name}
, which is described as {!product.description}
. Describe the business value of {!product.name}
in the context of organizations based in {!account.location}
.
Write the message in the form of an email directed toward a single individual, written in English.
The message should evoke enthusiasm with intensifiers, but limit the use of exclamation points. Express casualness using contractions, referring to the recipient in second person, and using discourse markers.
Limit the message to about 500 words, and do not address any content or generate answers that you don’t have complete data on.
Follow these instructions strictly to generate only the message to be sent to the customer.
Her job is not done yet though. Lara knows that prompt designers must test their work, review the LLM output, and revise accordingly.
Test and Iterate
Anyone who’s played with generative AI tools knows that creating a prompt is a bit of an artform. It’s very common to get generated content that’s not quite right, even if the prompt seems clear. When Lara tries her prompt template, she gets a good result because she considered the four big questions thoroughly.
Subject: Keep Your Solar Panels in Top Shape with Alpha Solar
Hi Denise,
I hope this email finds you well. As an account executive at Ursa Major Solar, I have been working with Northern Trail Outfitters for quite some time now, and I have always admired your company’s commitment to sustainability and environmental stewardship. I am reaching out to you today because I believe I have an offer that aligns perfectly with your values and goals.
I am excited to introduce you to Alpha Solar, our monthly subscription cleaning service for solar panels. Alpha Solar ensures that your solar panels are in proper condition to maximize energy conversion, which means that you can enjoy higher energy yields and lower electricity bills. Our service is designed to keep your solar panels in top shape, even in the harsh weather conditions that are common in Des Moines, Iowa.
What sets Alpha Solar apart from other solar panel cleaning services is our commitment to quality and reliability. We use only the best equipment and cleaning agents to ensure that your solar panels are cleaned thoroughly and safely. Our team of experts is trained to handle all types of solar panels, regardless of their size or complexity. We also offer flexible scheduling options to ensure that our service fits seamlessly into your busy schedule.
By signing up for Alpha Solar, you can enjoy a number of benefits that will help your organization save time and money. For example, our service can help you avoid costly repairs and replacements by identifying and addressing potential issues early on. Our cleaning process can also help extend the lifespan of your solar panels, which means that you can enjoy the benefits of solar energy for years to come.
I’m confident that Alpha Solar would be a great addition to your organization’s sustainability efforts. If you’re interested in learning more about our service, please don’t hesitate to get in touch. I’d be happy to answer any questions you may have and provide you with a customized quote based on your specific needs.
Thank you for your time and consideration. I look forward to hearing back from you soon.
Best regards,
Cassiopeia Mars
Account Executive
Ursa Major Solar
[Generated with gpt-3.5-turbo-0301]
After a careful review, Lara shows examples of the generated content to stakeholders to see what they think. Their overall opinion is that it’s good, but they would like it to include a call to action at the end. So Lara updates the template to include the following instructions as part of the goal:
Recommend that the customer attend one of the free webinars offered at {!company.trainingURL__c}
.
The new output from the updated template is now exactly what management was looking for. And since it’s easy for Lara to create different versions of the template, she can even run her own comparison tests on the output. The information Lara gathers from those tests will help her when it’s time to create a prompt template for the next big marketing campaign.
Keep Humans in the Loop
At this point, Lara briefs her account executives on how to use the template. She reminds them that when they use the template to generate output, they must review the responses every time. This is a best practice known as “human-in-the-loop,” and it’s a requirement for trusted generative AI.
The execs acknowledge their role in keeping the responses relevant and unbiased, and they’re eager to start their messaging campaign with highly personalized emails for each customer.