Be Release Ready Spring '24 | The Ultimate Guide to Prompt Builder.

The Ultimate Guide to Prompt Builder | Spring ’24

By

Artificial intelligence (AI) is not a new concept to Salesforce or to Salesforce Admins. Over the years, Salesforce has empowered admins with a user-friendly interface for the setup and configuration of predictive AI features such as Opportunity Scoring, Lead Scoring, Einstein Bots, and more. The introduction of generative AI in Salesforce brings even more possibilities for admins to build trusted solutions, supercharge productivity, and empower users with AI.

In this post, we’ll focus on Prompt Builder, a groundbreaking generative AI tool admins can use to activate prompts in the flow of work to augment business tasks. We’ll discuss the fundamental AI concepts that provide the foundation for Prompt Builder, and share best practices and tips to create, manage, test, and refine prompt templates. Before we dive into the new product innovation, let’s take a step back and look at what generative AI means for admins.

Which opportunities does generative AI bring for admins?

In the ever-evolving landscape of Salesforce Administration, staying ahead of the curve is paramount. As the demand for AI embedded with the Salesforce Platform continues to soar, admins find themselves facing new challenges in using such technologies. Some of the questions that admins must ask themselves are:

  • How can I easily ground a large language model (LLM) with the context and business data from my Salesforce org that’s needed to generate the content most meaningful to my users?
  • How can I include data in a prompt that’s not sitting inside my Salesforce org?
  • How will I ensure that my customer-sensitive data, such as personally identifiable information (PII), is secured by Salesforce?
  • How will I be able to test, refine, and enhance the prompts?
  • What can I do to ensure that the responses generated are without hallucinations?
  • How can I easily deploy such technologies to my users without building out custom Lightning components?

Good news! With the Spring ’24 release, we’re introducing a groundbreaking tool that not only addresses these challenges but propels admins into a new era of efficiency and innovation — Prompt Builder!

Before we dive into Prompt Builder, let’s review a few important terms.

  • Prompt: a set of detailed instructions that you give an LLM. A great prompt provides specific contextual information, data, instructions, and constraints that help the model generate accurate and personalized output.
  • Response: the output that an LLM generates. The more context and background you provide the LLM with your use case, the better quality response you receive back.
  • Grounding: the process by which your specific domain knowledge and context (such as CRM data) is provided to the LLM to get the response most meaningful to you. Without grounding, a model’s response can contain generic or irrelevant details.
  • Hallucination: a type of response from an LLM that seems plausible but is not accurate or factual. This usually happens because the model cannot access real-time or factual data.

Create Trusted Ai Prompts Through the Einstein Trust Layer.

How will Prompt Builder help admins?

As part of the Einstein 1 Platform, Prompt Builder will help users generate contextual content right within the flow of work through customized prompts. When tapping into your CRM and External data, the customized prompts built out by admins leverage the Einstein Trust Layer to mask sensitive data, thereby ensuring your data is secured safely within the Salesforce trust boundaries.

Prompt Builder will help you:

  • Enable users to finish tasks faster by building no-code, reusable prompt templates secured within the Einstein Trust Layer
  • Create more accurate and personalized prompts grounded in your business data from CRM, flows, and MuleSoft APIs
  • Deploy generative AI across your CRM by customizing standard templates, creating single-click actions on record pages, or using prompt templates in copilots

These templates will make your users’ daily workflows easier and your business smarter. Its easy-to-use user interface (UI) will help admins craft effective prompts that safely connect data with LLMs. Admins will be able to ground a prompt not only using native Salesforce data but also through information found in Data Cloud (more details on this in the section below).

Crafting and refining a novel prompt to yield a single, top-notch response can be a time-intensive endeavor. Designing numerous unique prompts, each tailored with distinct data and specifications, poses an even greater challenge. Additionally, prompts authored by different individuals may result in inconsistent outputs due to variations in writing styles.

To streamline prompt design effectively, employing a prompt template is recommended. At its core, it’s nothing more than a reusable prompt. It incorporates placeholders for specific details such as customer information, product details, and more, facilitating efficient scaling. These templates are use case driven and include the information that helps the LLM generate a high-quality response, such as a goal, constraints, and brand guidelines. Once those placeholders are filled with real, relevant data (through grounding), the prompt template becomes a truly personalized prompt.

Diagram depicting the four steps of grounding, creating, testing, and deploying prompt templates.

What are the key components of using Prompt Builder?

There are four key components of effectively setting up Prompt Builder.

  1. Grounding of data
  2. Creating and managing prompt templates
  3. Testing and fine-tuning prompt templates
  4. Deploying prompts

Let’s explore how admins will navigate these areas.

1. Grounding of data

The first step to using Prompt Builder is to ask yourself: “Will the prompt need to leverage data within my Salesforce org to generate a meaningful, contextual, and personalized response that my users will be able to use?”

More often than not, the answer to this question will be yes! And here’s where grounding comes into play.

Admins using Prompt Builder will be able to dynamically ground prompt templates with Salesforce or Data Cloud data. This connection enables the LLM to understand the context, allowing it to generate personalized responses using your current and precise information. Confidential data remains within Salesforce and is not transmitted to an LLM. PII is obscured and remains securely stored in Salesforce. The zero-retention agreement within the Einstein Trust Layer guarantees that any information shared with the LLM is neither stored nor utilized for training purposes.

As we look to launch Prompt Builder in Spring ’24, there will be a few different types of resources that can be used for grounding data, including:

a. Merge fields
Merge fields connect your prompt templates to Salesforce object fields. The prompt template type and the objects that you associated with your prompt template determine which merge fields are available.

b. Flows
Admins can increase the usefulness of prompt templates beyond using record merge fields by tapping into the power of flows. An example of using flows would be to ground a prompt with data that’s related to other related records (think Related Lists) for which the prompt is created, such as getting details of cases or opportunities related to an Account.

A new flow type called Template-Triggered Prompt Flow will be offered to admins to build such flows. This new flow type will be similar to the flows that admins are already using, with the exception of writing back the grounded data to an element called Create Prompt Instructions. Flows can be leveraged to ground data from two sources, including:

  • Salesforce: Admins will be able to reference standard and custom objects within the confines of their Salesforce org.
  • Data Cloud: By referencing Data Cloud data, admins can use real-time information that was consolidated across multiple data sources.

c. Apex
Use Apex in Prompt Builder to return data from a Salesforce Object Query Language (SOQL) query or to return data from an external application programming interface (API). Apex is also effective if you want to generate well-formatted JavaScript Object Notation (JSON) or do programmatic data filtering. An example of why you’d want to ground your prompt with Apex would be if you were trying to get data in real time from an external system and you don’t have Data Cloud implemented yet.

Flow Grounding on open cases

2. Creating and managing prompt templates

Now that you’ve defined your resources for grounding, let’s see how you would use them using prompt templates! With Spring ’24, admins will have the ability to create three types of prompt templates in Prompt Builder.

Sales Email prompt templates

  • Admins will be able to build a custom prompt to automatically create emails for users, with a click of a button, by incorporating the grounding defined by the admin from the previous section.
  • This template type will render for users in Email Composer to draft personalized emails to Contacts, Leads, or Person Accounts; it will only be available to users with the Sales Emails permissions.
  • Fun fact: The feature of AI-generated Sales Emails was initially launched by Salesforce in July 2023 where five email templates were provided out of the box (OOTB). Since then, we’ve allowed admins to leverage the same concepts and build their own custom email templates within Prompt Builder.
  • Example set of prompt instructions:You are a sales representative working for a solar panel manufacturer and your name is {!$sender.Name} working for {!$sender.Company}. Your client is {!$recipient.FirstName}. You need to draft up an email to improve your relationship with them and tell them about your new products that will help them achieve their sustainability goals. When I ask you to generate an email, you must strictly follow my instructions below.”

Field Generation prompt templates

  • This template type enables your users to populate a single field on a single record with a summary or description created by an LLM. Once again, the grounding for this template type was done in the previous section.
  • To use this capability, the user would click the Einstein button located next to the field.
  • Note: If you haven’t already, you’ll need to migrate an existing Lightning record page to Dynamic Forms.
  • Optional: If you want to use Dynamic Forms on your Salesforce mobile app, you’ll need to enable the Dynamic Forms on Mobile setting.
  • Example set of prompt instructions:You’re a customer support representative and need to create a short summary of all open cases for {!$Input:Account.Name}. When I ask you to summarize the open cases, you must strictly follow my instructions below.”

Flex prompt templates

  • With Flex templates, admins can create a customized prompt template that incorporates records from multiple objects simultaneously.
  • These prompt template types can be called via an invocable action anywhere on the Salesforce Platform, through any existing business workflow such as a flow, Lightning web component, or Apex class.
  • Admins will have the ability to incorporate up to five objects (standard or custom) into this template type.
  • Example use case: Using a screen flow, a user could select multiple opportunities and have an LLM provide a comparison between the opportunities, or a user could have an LLM create a personalized product recommendation based off an Einstein Next Best Action.

No matter which of the above prompt template types an admin chooses to leverage, they will be able to add grounding to the prompt template instructions using the Resource dropdown in the Prompt Template Workspace.

Screen capture from Prompt Template Workspace and how resources can be added to a prompt template.

After an admin has built out the prompt template, they would need to activate it so it’s available for use. In the next section, we’ll learn more about recommended practices when creating prompt templates and how to iterate on them.

3. Testing and refining prompt templates

Generative AI utilizes LLMs to produce responses. Since these models are trained by external entities, it’s typical to initially get a response that may not fully align with your expectations, even if the prompt is well-defined. If the outcome doesn’t meet your criteria, you can create a fresh response by recreating the prompt and instructions. The result from the prior attempt is not retained and the new output takes its place. Using Prompt Builder simplifies the process of refining your prompt template until you achieve a response that fully meets your satisfaction.

Admins will have the flexibility to not only specify which LLM model they’d like to leverage but also bring their own model (BYOM) to further contextualize prompts with their organization’s proprietary data and processes.

As an admin, you’ll be able to preview a generated response within the Prompt Template Workspace. Specifically, you can review a response that’s grounded with your actual data (CRM or Data Cloud). Every time you select the Preview button, a fresh response is generated by the LLM even if your prompt template remains unchanged.

How an admin can test responses from an LLM using data from their org.

As an admin, you should be reviewing generated responses and assessing if it’s meeting the objectives set out by you (and your stakeholders). Ensure that the response doesn’t contain misleading information or bias. To gauge the response’s effectiveness, consider the following dimensions.

  • Goal completion: Does the response fulfill the prompt’s objectives comprehensively?
  • Style and tone: Is the response’s style, voice, and tone suitable, with correct vocabulary and punctuation?
  • Toxicity: Is the response safe and free from potentially harmful content, such as offensive or disrespectful language? Given the vast data LLMs are trained on, there’s a risk of toxic language infiltrating responses.
  • Relevance: Does the response fit the context and align with the surrounding conversation or content?
  • Consistency: How consistent is the response? When regenerated without altering the prompt template, how does it vary? How does it change when grounded with different data?
  • Bias: Does the response demonstrate fairness and inclusivity, avoiding assumptions based on names or perpetuating biases related to gender, disability, race, or socioeconomic status? LLMs, trained on extensive data, may inadvertently produce biased language in responses.
  • Factual accuracy: Is the response grounded in accurate data, presenting complete and precise information without redundancy or errors?

Refining a prompt template is an ongoing cycle: You adjust the template, generate a resolved response, and refine the template further based on the updated response. Each time you execute a prompt template in Prompt Builder, it triggers a distinct request to the LLM, resulting in potentially varied responses for the same prompt. It’s important to verify the accuracy of each response, even if you’ve previously run the template. As with all features you’re building with in Salesforce, it’s important to always build and test in a Sandbox. This will help ensure that you aren’t introducing potential risk to your production org as you experiment and build new prompts before deploying them across your organization To edit a prompt template, directly modify the text within the Prompt Template Workspace. Then, regenerate the response by selecting Save & Preview.

4. Deploying prompts

As an admin, you’ll have complete control over which Salesforce user can leverage the custom prompts you’ve built. Through a combination of assigning out the appropriate permission sets, the activation of Dynamic Forms, or even invoking the prompt templates via flows, Apex, or Lightning web components, you can deploy your custom prompts to your users!

Sales Email prompt templates

  • These template types are available to deploy onto Lead, Contact, or Person Account Lightning record pages.
  • Enable the Einstein for Sales feature in Setup (which may take a few minutes to complete).
  • Next, assign out the Einstein Sales Emails permission set to the users that need this capability.
  • When users click into Email Composer on a Lightning record page, they should see the newly crafted prompt template under the Custom section.

The area where a user can access a custom Sales Email prompt template when composing an email off a Contact record.

Field Generation prompt templates

  • If not done already, migrate existing Lightning record pages onto Dynamic Forms.
  • Edit the Lightning record page and click into the field where the prompt will be initiated from.
  • In the Einstein Generative AI section of the right-side panel, select the prompt template that was aligned to this field.
  • Save and Activate the Lightning record page.

How to define the prompt template for a field on a Lightning record page.

  • Now when users access this field in their flow of work, they can click into the sparkle icon and launch Einstein.

The Einstein sparkle icon on a record field tied back to a prompt template.

  • Within the Einstein modal, review the drafted responses coming back from the LLM.

An LLM response after a user has invoked a Field Generation prompt template.

  • To add the drafted response to the field, click the Use button. Alternatively, if the user is unsatisfied with the initial response, they can use natural language to converse back with Einstein to have the response regenerated.

How a generated response is easily captured back into a field by clicking a button.

  • Save the record.

Flex prompt templates

  • As its name suggests, admins can use Flex prompt templates to create a variety of customized prompt templates that ground data from multiple objects simultaneously, whether those objects are related or not.
  • All prompt templates, including Flex, can be invoked using a variety of platform tools such as Lightning web components, flows, or Apex.
  • This means an admin can call a prompt template in any manner that’s most suitable to their organization’s needs and can use them to augment an existing business process.
  • As an example, an admin could create:
    • A Flex prompt template that instructs an LLM to create a personalized product recommendation for a Contact. The input objects for the Flex prompt template would be Product and Account along with the Product Description merge field.
    • A screen flow (launched off an Account record page) to allow their users to have generative AI create a customized message. The screen flow would ask the users to select a Product through a lookup field. The flow could end with displaying the generated response back on a final screen.
    • A custom Quick Action on the Account object which would launch the aforementioned screen flow. The admin would also need to add this custom action to the page layout or Lightning page.

What makes a good prompt and prompt template?

Below are a few key considerations when designing prompts and prompt templates.

  • Specificity and clarity
    • The more clearly you state in the prompt what you want, the better the result you get.
    • Clearly communicate the task you want the LLM to perform.
    • Examples include “Write a summary”, “Give me a list”, “Draft an email”, etc.
  • Contextual information
    • Include relevant context in the prompt to help the model understand the problem or question.
    • Contextual information can significantly impact the quality of the generated response.
    • Examples include merge fields from the driving record or even fields coming in via a flow.
  • Tone and style
    • Specify linguistic parameters for the content style/tone. Avoid using slang, proprietary language, industry vernacular, or technical terms and instead use natural language.
    • Define the instructions as you would describe them to a friend, not a computer system.
    • When you use a consistent writing style in your prompt templates, the LLM generates consistent responses.
    • Example: “Use clear, concise, and straightforward language using the active voice and strictly avoiding the use of filler words and phrases and redundant language.
  • Task-specific guidance and goal
    • Outline exactly what you’re looking for from a desired response from the LLM. Tell the LLM the type of content you want, what it must include, and what it must not include.
    • Clearly mention the expected format for the response, whether it’s a list, paragraph, email, etc.
    • Example: “Generate an introduction email to your prospect. Indirectly encourage the prospect to respond to your email by showing that you are willing to answer any questions they may have.
  • Role
    • Describe who’s sending and receiving the model’s response. Ask the LLM to role play as a character, such as a support agent or sales representative, and define the character’s objective.
    • You can add the participant information using merge fields, flows, and Apex.
    • Example: “You are a marketing executive who wants to invite major customers to a live event.
  • Limits and guardrails
    • Give the model rules it must follow to ensure elimination of hallucinations.
    • Example: “You must treat equally any individuals or persons from different socioeconomic statuses, sexual orientations, religions, races, physical appearances, nationalities, gender identities, disabilities, and ages. When you do not have sufficient information, you must choose the unknown option, rather than making assumptions based on any stereotypes.

Innovate and transform using generative AI with Prompt Builder

Salesforce is ushering in a new era of efficiency and innovation with the general availability of Prompt Builder coming soon in Spring ’24. This powerful tool will empower Salesforce Admins to seamlessly integrate generative AI into their users’ workflows, addressing challenges and propelling them into the forefront of AI-driven advancements. From securely grounding data to crafting and refining prompt templates, Prompt Builder provides a comprehensive solution to the unique challenges posed by generative AI, ensuring that admins can harness the technology to its full potential.

As we move forward, the transformative capabilities of Prompt Builder are set to redefine how businesses leverage AI within the Salesforce Platform. Whether you’re a seasoned Salesforce Admin or just beginning to explore the possibilities of AI integration, Prompt Builder opens up a world of opportunities.

Stay tuned for announcements and information about Prompt Builder coming at TrailblazerDX.

Discover more AI and Spring ’24 resources

Each release brings tons of amazing new functionality and it can be a lot to digest. Over the next 2 months, we’ll publish blogs and videos to help you prepare to get the most out of this release! Bookmark Be Release Ready and check back regularly as we continue to add new Spring ’24 resources for Salesforce Admins.

10 Important Takeaways for Salesforce Admins from 2023

10 Important Takeaways for Salesforce Admins from 2023

As we approach the end of 2023, it’s the perfect time to reflect on what we’ve learned as a Salesforce Admin community and to prepare for the exciting year ahead. In this blog post, we’ll recap essential insights that will help you walk away from this year ready to tackle 2024. Let’s dive into our […]

READ MORE
Upgrade to Hyperforce with Confidence Using Hyperforce Assistant

Upgrade to Hyperforce with Confidence Using Hyperforce Assistant

Demystifying Hyperforce for admins As a Salesforce Admin, you might be wondering, what is Hyperforce? Put simply, Hyperforce is Salesforce’s new public cloud-based infrastructure designed to support Salesforce services for the future. A cloud-native architecture, Hyperforce will replace our existing first-party infrastructure and provide significant benefits to our customers, including data residency, enhanced security, availability, […]

READ MORE

AI for Admins: What You Need to Know to Make Einstein Bots a Success

Einstein Bots interact with your customers quickly and accurately with automation and artificial intelligence (AI) capability. In terms of AI initiatives, the biggest challenge is measuring business impact. One reason most AI projects fail is that people are looking at “model performance” instead of business value, such as how much money, in either additional revenue […]

READ MORE