Add Free Text Inputs to a Flex Prompt Template

Create a flex prompt template that includes free text inputs.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, and Unlimited Editions with the Einstein for Platform, or Einstein or Agentforce for Sales or Service add-on, or Agentforce Foundations
User Permissions Needed
To create and manage prompt templates in Prompt Builder:

Prompt Template Manager permission set

  • Manage Prompt Templates
  • Execute Prompt Templates

OR

Customize Application permission set

Free text inputs are a non-record type of input field consisting solely of text. You can include free text input fields in your flex prompt templates in the same way that you include merge fields or other resources from the resource picker. This functionality allows you to handle scenarios where you want your prompt template to receive free text as an input. For example, customers submitting questions in a form field, reading a file and sending the contents to the prompt, or handling any situation where you want to send arbitrary text to a flex prompt template in Prompt Builder.

Imagine you’re a prompt admin and you want to design a prompt that answers a customer’s question about a specific product on your website. A flex prompt template that handles free text input is an elegant solution for this common situation elegantly. You can even use the opportunity to remind your customer about a current promotion you’re running.

Note
Note User input functionality is available only in flex templates and supports up to 127,000 characters.

To get started, create a prompt template.

  1. In the Prompt Template Type dropdown, select Flex.
  2. For the Prompt Template Name, enter Product Question Response and Promotion.
  3. In the Define Sources section, define three sources.
    1. For the first row, enter Product in the Name field. Select Object as the Source Type. For the Object field, select Product. This row represents the product your customer is asking about.
    2. For the second row, enter User Question in the Name field. Select Free Text as the Source Type. This row represents the text input your customer provides, in the form of a question.
    3. For the third row, enter Promotion in the Name field. Select Object as the Source Type. For the Object field, select Product Service Campaign. This row represents the promotion you'll tell your customer about.
  4. Click Next.
    You’re redirected to the Prompt Template Workspace.
  5. Write a prompt template from scratch, or copy and paste an example template.
    1. If you want to base your prompt template on the template used in this example, copy and paste the example template text provided at the bottom of the page, and then edit it.
    2. Before you can run the template in Prompt Builder, in the Prompt section, click Insert Resource to use the search bar to replace the placeholders with real merge fields. The search field appears the first time you click this option.
    3. When the template is resolved into a prompt, the merge fields are replaced with real data and shown in the Resolved Prompt section.
  6. In the Preview Settings panel, select a product for the Product field, enter a sample question in the User Question field, and select a promotion for the Promotion field.
  7. Click Save & Preview to see the LLM-generated response.
Example
Example

Text from example:


    A customer on our site is asking the following question about {!$Input:Product.Name}. Do your best to answer the customer's question.
    '''
    {!$Input:User_Question}
    '''
    In addition to answering their question, be sure to mention {!$Input:Promotion.ProductServiceCampaignName} to the customer.