Add File Inputs to a Flex Prompt Template

Create a flex prompt template that includes file 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

Here’s an example scenario of a flex prompt template that uses a file input. Say you're designing a prompt template to verify product images in an e-commerce listing before publication. Your Flex prompt template compares uploaded product images to the listing description to ensure that colors, sizes, and details are accurately represented. You're interested because this prompt template helps maintain consistency across listings and improves product accuracy and customer trust.

To get started, create a prompt template.

  1. In the Prompt Template Type dropdown, select Flex.
  2. For the Prompt Template Name, enter Image Comparison.
  3. In the description field, enter E-Commerce Product Image Verification
  4. Define three resources. For the first image, enter:
    1. Name: Image1
    2. API Name: Image1
    3. Source Type: Object
    4. Object: File
  5. Click Add.
  6. For the second image, enter:
    1. Name: Image2
    2. API Name: Image2
    3. Source Type: Object
    4. Object: File
  7. Click Add.
  8. For the product description, enter:
    1. Name: Description
    2. API Name: Description
    3. Source Type: Object
    4. Object: Product2
  9. Click Next, and you’re redirected to the Prompt Template Workspace.
  10. Copy and paste the example prompt template
    1. To use the example prompt, copy the E-Commerce Product Image Verification prompt in the Flex Example Templates. Then, paste it into the Prompt Template Workspace.
    2. Before you can run this template in Prompt Builder, in the Prompt section, click Insert Resource.
    3. In the Inputs menu, replace the description placeholder with a real merge field.
  11. Add the related list to the prompt template, from the Resource picker, click Product2, then Notes & Attachments.
    Prompt Builder grounds files in this related list that are Salesforce Files. Classic Attachment records aren’t included in the resolved prompt. See Grounding with Related List Merge Fields.
  12. In Template Settings, under Model, select GPT 4 Omni.
  13. In Preview Settings, click Inputs. In the Inputs section, you see the three objects that you created.
  14. Click Select File to choose a file stored in your org. You can select an existing file or upload a new one.
  15. Select a product for your description grounding data.
  16. After the files and the product description are added, click Save & Preview to test the prompt template. You can also preview attached images in the Resolved Prompt section.

Prompt Builder grounds related-list files that are Salesforce Files. Classic Attachment records aren’t supported. If a file from Notes & Attachments doesn’t appear in the resolved prompt, then convert it to a Salesforce File or upload it from the Files related list, and preview again. File size and system limits aren’t the cause. See Grounding with Related List Merge Fields.

For supported types and conversion behavior, see Grounding with File Inputs.