Skip to main content

Prompt Builder & Template Testing

Test and preview your prompt templates with live execution, see exactly what the AI receives, and track template performance over time.

Prompt Builder

The Problemโ€‹

Building effective prompts requires rapid iteration, testing with real variables, and understanding how prompts perform in production.

Teams need to:

  • ๐Ÿงช Test Before Deploying: Preview prompts with sample data before agents use them
  • ๐Ÿ” Debug Variable Issues: See how variables are populated in the final prompt
  • ๐Ÿ“Š Track Performance: Know which templates work best and why
  • ๐ŸŽฏ Validate Inputs: Ensure required fields are properly defined
  • ๐Ÿ“ˆ Monitor Usage: See how often templates are called and their token costs
  • ๐Ÿ”„ Version Management: Track changes across template versions

In short: You need a safe environment to test prompts, verify variable substitution, and monitor real-world performance.


How GenAI Explorer Solves Thisโ€‹

GenAI Explorer provides complete prompt testing with:

โœ… Live Preview: Test templates instantly

  • Fill in variables with test data
  • Execute against real AI models
  • See the actual LLM response
  • Verify token counts

โœ… Variable Editor: Interactive input form

  • Auto-generated from template schema
  • Type-safe input validation
  • Required field indicators
  • Default value support

โœ… Template Inspector: See the final prompt

  • View complete prompt text
  • Verify variable substitution
  • Check formatting and structure
  • Copy for external testing

โœ… Execution History: Track real usage

  • Last 10 executions from production
  • Token usage per call
  • Response times
  • Model and version info

โœ… Version Comparison: Test different versions

  • See what changed between versions
  • Compare performance metrics
  • Validate before activation

Impact: Test prompts safely, catch variable issues before production, and optimize token usage with real data.


How It Worksโ€‹


Quick Startโ€‹

Step 1: Open a Templateโ€‹

GenAI Explorer โ†’ Object List โ†’ Search "GenAiPromptTemplate" โ†’ Select Template

Step 2: Test Your Templateโ€‹

  1. Review the template content in the editor
  2. Fill in the variable form with test data
  3. Click "Preview Template"
  4. Review the generated output
  5. Check token count

Step 3: View Historyโ€‹

  1. Scroll to "Execution History" panel
  2. Click on any execution to see details
  3. Review variables used
  4. Check response quality

Key Featuresโ€‹

Execution Historyโ€‹

Track the last 10 executions from production with token costs and performance metrics.

See: Execution History for monitoring guide

Token Optimizationโ€‹

Analyze token usage across versions and identify cost reduction opportunities.

See: Token Optimization for strategies


Common Use Casesโ€‹

1. Testing Before Deploymentโ€‹

Test your template with sample data, verify variable substitution, and check output quality before activating.

2. Debugging Variable Issuesโ€‹

When agents get wrong data, check execution history to see actual variable values and identify issues.

3. Optimizing Token Usageโ€‹

Review history to find high-token executions and optimize template length for cost savings.

4. Version Comparisonโ€‹

Compare token counts and performance between template versions before switching.

5. Prompt Engineeringโ€‹

Rapidly iterate on prompts, test variations, and monitor consistency across multiple runs.


UI Componentsโ€‹

Template Editorโ€‹

  • Syntax Highlighting: Easy to read template syntax
  • Read-Only View: See the template structure
  • Variable Markers: {!Variable_Name} clearly highlighted

Input Formโ€‹

  • Auto-Generated: Built from template schema
  • Type Validation: Correct input types enforced
  • Required Indicators: * marks required fields
  • Default Values: Pre-populated where defined

Execution Historyโ€‹

  • Last 10 Calls: Most recent production usage
  • Version Badge: Which template version was used
  • Token Count: Cost visibility
  • User Info: Who triggered the execution
  • Expandable Details: Full request/response

Template Structureโ€‹

Metadata Fieldsโ€‹

FieldDescription
developerNameAPI name of template
masterLabelDisplay name
descriptionWhat the template does
activeVersionIdentifierCurrent active version
typeTemplate type
visibilityWho can use it

Version Fieldsโ€‹

FieldDescription
versionIdentifierVersion number
contentTemplate text
inputsVariable definitions
primaryModelAI model to use
statusActive/Draft/Archived

Documentationโ€‹

Guidesโ€‹


FAQsโ€‹

Q: Can I edit templates in GenAI Explorer?
A: No, GenAI Explorer is read-only. Use Salesforce Setup to edit templates.

Q: How many executions are stored in history?
A: The last 10 executions are shown. Full history is in Data Cloud.

Q: Does preview count against my AI credits?
A: Yes, preview executions use real AI calls and count toward your limits.

Q: Can I test with production data?
A: Yes, if you have access. Use caution with sensitive data.

Q: What if a required variable is missing?
A: The preview will fail with a validation error.


Test prompts safely, catch issues early, and optimize for production success.