Skip to main content

Process a Prediction with Prompt Builder

Learning Objectives

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

  • View predictive outputs from a model.
  • Create a prompt in Prompt Builder that processes the raw predictive output into readable text.

View Predictive Outputs

In this unit, you learn why and how to use Prompt Builder to transform predictive outputs from Model Builder into a readable and conversational paragraph.

First, to understand why you need to use Prompt Builder, let’s look at the predictive output for the lead Andy Doe from Unit 1.

Note

Access the unprocessed predictive output with Data Cloud Connect REST API, or print it using a screen flow.

Unprocessed predictive output for lead conversion.

Predictive Score

This is the predicted likelihood to convert. For Andy, we got 43.478, meaning he has a 43% likelihood to convert.

Top Predictors

Here’s a top predictor for Andy.

  • name: The field name, Positioned_Product_c__c.
  • inputValue: The current value of the field, GC5000 Series.
  • value: How many percentage points this field contributed to the predicted outcome, -7.27.

The GC5000 Series positioned product decreased Andy’s likelihood to convert by 7%.

Recommendations

Here’s a recommendation for Andy.

  • name: The field name, Positioned_Product_c__c.
  • prescribedValue: The prescribed value of the field, or what you should change the value to, GC1000 Series.
  • value: How many percentage points the change could contribute to the outcome, 24.2.

Changing Andy’s positioned product to GC1000 Series can increase his likelihood to convert by 24%.

We know how powerful this prediction is but it’s certainly not easy to understand. Remember how readable Andy’s prediction was in Unit 1? With an unprocessed output from Model Builder, it can feel like we’re doing rocket science to glean the same insights. That’s where Prompt Builder comes in. Follow along with the following steps to ensure you can pass the challenge at the end of this unit.

Note

Learn more about Prompt Builder in Prompt Builder Basics.

Turn on Einstein Generative AI

To use Prompt Builder, you must turn on Einstein Generative AI.

  1. Click the gear icon and launch Setup.
  2. In the Quick Find box, search for and select Einstein Setup.
  3. Turn on Einstein.
  4. Refresh the page.

Create a Prompt Template

Next, you’ll create a prompt template that takes the prediction result from Model Builder and formats it into an easy-to-read list.

The prompt template should describe how to interpret unprocessed predictions from Model Builder. For example, the template should explain how to identify the field name, value, and percentage points for top predictors and top recommendations. The prompt template should also specify a friendly and conversational tone and a list format. This ensures that you don’t give your sales agents a paragraph full of technical jargon.

  1. From Setup, in the Quick Find box, search for and select Prompt Builder. If you can’t find Prompt Builder, refresh the page.
  2. Click New Prompt Template.
  3. Select Flex for the Prompt Template Type.
  4. Name the prompt template: Explain Conversion and Give Recommendations.
  5. Make sure the API name is Explain_Conversion_and_Give_Recommendations. Leave the description blank.
  6. Define three free-text sources for your template.
    1. Name the source: Predicted Outcome. Make sure the API name is Predicted_Outcome. Select Free Text for the source type.
    2. Name the source: Top Predictors. Make sure the API name is Top_Predictors. Select Free Text for the source type.
    3. Name the source: Top Recommendations. Make sure the API name is Top_Recommendations. Select Free Text for the source type.
  7. Click Next.
  8. The following prompt template explains how to transform the JSON input into a readable format. Review the prompt template, then copy and paste the template into the Prompt Template Workspace.
You are a data analyst trying to help a seller convert a lead. {!$Input:Predicted_Outcome} is the likelihood of converting this lead.


A moderate likelihood has a score between 50 and 70.
A high likelihood has a score above 70.
Anything with a score less than 50 requires attention.


{!$Input:Top_Predictors} are the key drivers of the conversion likelihood. Positive values increase the likelihood to convert which is good and negative values indicate less likelihood of conversion which is bad.


{!$Input:Top_Recommendations} are the actions the user can take to improve the likelihood of converting.


An example of a JSON response for predictors is:


[{ "fields" : [ { "customText" : null, "inputValue" : "3", "label" : null, "name" : "fare__c", "prescribedValue" : "" } ], "value" : 6.680652684719895 }]
This means that having a fare of 3 increases the predicted value by 6.68 percentage points.


If any values have No, make sure to interpret those. For example, if you get { "customText" : null, "inputValue" : "No", "label" : null, "name" : "Streaming TV", "prescribedValue" : "" }, respond that not having streaming TV affects the prediction, NOT Streaming TV is No.
If any values have False, make sure to interpret those. For example, if you get { "customText" : null, "inputValue" : "False", "label" : null, "name" : "Partner", "prescribedValue" : "" }, respond that not being a Partner affects the prediction, NOT Partner is No.


Sometimes you might have something like "fields" : [ {"customText" : null, "inputValue" : "3.0", "label" : null, "name" : "sibsp__c", "prescribedValue" : "" }, {"customText" : null,"inputValue" : "3.0", "label" : null, "name" : "pclass__c", "prescribedValue" : ""} ], "value" : -6.326304223287199


This means that having a sibsp value of 3 AND a pclass value of 3 decreases the predicted value by 6.36 percentage points. Drop the __c from any variables that have them.


An example of a JSON response for prescriptions is:
[{ "fields" : [ { "customText" : null, "inputValue" : "", "label" : null, "name" : "Response_Time_From_Assignment_c__c", "prescribedValue" : "0 to 0.12" } ], "value" : 6.680652684719895 }]


In the above example, "name" refers to the name of the field that can be changed and the "prescribedValue" is what should be done to improve the outcome. The data type of the field is number, the "prescribedValue" will be a number range in the format lower value "to" upper value. "Value" represents how much the score will be improved if the field is changed to the prescribedValue.


First, state the {!$Input:Predicted_Outcome}. Now, given {!$Input:Top_Predictors} and {!$Input:Top_Recommendations}, explain conversationally to the user what their top predictors are and what recommendations you have for improving. If there are more than two predictors or recommendations, format in list form by numbering them. DO NOT mix up top predictors and recommendations. Don’t end with a question.


DO NOT use quotation marks. Be friendly and conversational.
  1. Click Save.
  2. Click Activate.

You now have a prompt template that’s ready to transform your predictions!

It’s time to check your work to double-check that you’ve set up Einstein and created your prompt template successfully to move on to the next unit. There, you’ll wrap up all the work you’ve done and display your prediction on a lead record.

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