Skip to main content

Get Started with Prompts

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain what prompts and prompt design are.
  • Identify the different parts of an effective prompt.
  • Describe how one prompt can produce different outputs.

What’s a Prompt?

If you completed Generative AI Basics, you learned that large language models (LLMs) can help businesses and teams with all sorts of language-based tasks. For example, they can generate a personalized email to a customer, or analyze customer feedback and extract key insights. But LLMs can’t create great content by themselves. They need some guidance from us in the form of a prompt.

To understand how prompts work, imagine you are head chef at a popular bakery. You hire a super-smart assistant to speed things up. The assistant was trained by culinary experts and can use what they’ve learned to create delicious cakes at lightning speed. But they need guidance to create the specific cakes your customers want. So you give them detailed instructions that include all the information they need, such as the cake’s ingredients, the occasion the cake is for, and the steps to make the cake.

And that’s what prompts are: detailed instructions that help LLMs generate great output.

[AI-generated image using DreamStudio at stability.ai with the prompt, “A friendly robot is wearing a chef's hat. The robot is standing by a table that has a fancy cake on it. Drawn in the style of 2D vector art.”]

So, what type of prompts can you give an LLM? Say, as chef, you want to spread the word about your cakes. Here are some simple instructions that you could give an LLM to get a head start.

Use Case

Instruction

Drafting a customer email

Write an email to follow up on a cake order.

Summarizing a conversation

Summarize the key takeaways from a recently recorded conversation about a potential business partnership.

Brainstorming names for a new product

Create a list of names for a new gluten-free cake.

Instructions are a good starting point, but they leave many unanswered questions that can lead to less-than-ideal output. For the examples above, what did the cake order include? What do you consider a key takeaway from a conversation? What brand guidelines do you want the cake names to follow? Instructions are only one part of an effective prompt. To ensure high-quality output, you also need to add concrete information and clear constraints to your prompts. This is all part of prompt design, and without it your cake, er output, will definitely fall flat.

Add Designer to Your Title

Marketer/Designer. Small Business Owner/Designer. Admin/Designer. When it comes to prompts, we’re all designers.

Prompt design is the process of creating and iterating on your prompts. Just as chefs perfect their recipes by testing and making adjustments, you must review LLM responses and iterate on prompts until you get accurate, high-quality output.

Why bother? Well, vague or inaccurate instructions can lead LLMs to produce irrelevant or even biased responses.

One way to help ensure effective LLM responses is to “ground” prompts in reality. You do this by giving the LLM data that’s specific to the request you’re making. The data you provide is in addition to the original, generic data that the LLM was trained on. Grounding a prompt with your specific data provides the LLM with information relevant to your business, your products, and your customers. Without that data, an LLM is likely to create content, like your follow-up email, that includes generic or irrelevant details. With that data, your prompts will be truly personal.

It’s not only prompts that can influence an LLM’s output. LLMs have settings that influence their responses, too. As you design your prompts, make sure to experiment with the LLM settings to see how different values affect the output.

For example, did you know that LLMs are not “deterministic”? That means that their responses will usually vary at least a little, even if you give the same LLM the same prompt twice in a row. But you can use an LLM’s “temperature” settings to reduce or increase the variability of its output. This way an LLM’s responses to the same prompt might be more or less similar, depending on your preference.

Finally, keep in mind that LLMs aren’t one-size-fits-all. Different LLMs can and do respond differently to a single prompt. Like culinary assistants, each LLM is trained by different experts, on different data, and using different teaching techniques. For optimal results, always get to know the LLM you’re working with and tailor your prompts to it.

Basic Ingredients of a Prompt

Like a good recipe, effective prompts include both ingredients and instructions. They work together to help LLMs generate great output.

The following are some key ingredients you’ll want to include in your prompts. Let’s see how you can use these ingredients to create a blog post.

Ingredient

Description

Example

Participants

Describe who’s sending and receiving the model’s output.

You are a world-renowned cake decorator. Your customers include families, newlyweds, and children.

Setting

Give the model contextual information.

You have a well-loved bakery known for its cakes. You also have a popular blog read by your customers. You are writing your latest blog post.

Goal

Describe what you hope to achieve with the model’s output.

You want to capture customers’ attention while teaching them about novel decorating techniques.

Relationships

Describe the relationship between the participants involved. Also mention how the model’s output relates to the participants.

Your customers have a sweet tooth and are always curious about new cakes you make with fresh methods.

Data

Give the model data to work with.

Your bakery has a new line of cakes that you’d like to advertise to customers.

After you mention the ingredients, give the LLM clear instructions to follow.

Instructions

Tell the LLM what type of content you want and what it must include.

Write an informative article about cake decorating fundamentals. Include a comprehensive analysis of different cake decorating techniques. Discuss the tradeoffs and explore the challenges of different techniques. Include a call to action to see the techniques in action by trying my new cake that incorporates all of the techniques discussed in the blog post.

Finally, you’ll want to add details to your prompt that clarify or constrain how the LLM responds. This includes any limits, languages, and style guidelines you want the LLM to follow. The more details you add, the more customized the LLM's response will be.

Limits

To prevent hallucinating, give the model guardrails that it must stay within.

You must follow the given instructions. You must not address any content or generate answers that you don’t have data on or basis for.

Language

Tell the model what language to generate output in.

Write the blog in English.

Style & Tone

Give the model style and tone guidelines to follow.

The blog must be written at an 8th grade reading level and use adjectives to evoke imagery in the prose. Use brief, declarative sentences in an active voice. Strictly avoid using filler words, slang, and redundant language. The blog must be less than 600 words.

When you put the ingredients, instructions, and additional information together, you get a prompt that looks like this.

You are a world-renowned cake decorator and you have a well-loved bakery known for its cakes. You also have a popular blog read by your customers. Your customers include families, newlyweds, and children. Your customers have a sweet tooth and are always curious about new cakes you make with fresh methods. You are writing your latest blog post. You want to capture customers’ attention while teaching them about unique decorating techniques.

You must follow the given instructions. You must not address any content or generate answers that you don’t have data on or basis for.

Instructions:

Write an informative article about cake decorating fundamentals. Include a comprehensive analysis of different cake decorating techniques. Discuss the tradeoffs and explore the challenges of different techniques. Include a call to action to see the techniques in action by trying my new cake that incorporates all of the techniques discussed in the blog post.

Write the blog in English. The blog must be written at an 8th grade reading level and leverage adjectives to evoke imagery in the prose. Use brief, declarative sentences in an active voice. Strictly avoid using filler words, slang, and redundant language. The blog must be less than 600 words.

Now, write the blog post.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback