Skip to main content

Variables & Presets

Create dynamic prompts with variables and save commonly used input combinations as presets for efficient testing.

Variable Syntax#

Variables allow you to create reusable prompt templates with dynamic content. Use double braces to define variables in your prompts:

Basic Variable Syntax
text
Hello {{name}}, welcome to {{company}}!

Your role is {{role}} and you specialize in {{domain}}.

Variables are automatically detected when you save a prompt. They appear in the Playground as input fields that you can fill in before running.

Variable Types#

PromptReports supports different variable types for various use cases:

TypeSyntaxDescription
Text{{variable}}Single-line text input
Long Text{{variable:textarea}}Multi-line text input
Number{{variable:number}}Numeric input with validation
Select{{variable:select:opt1,opt2,opt3}}Dropdown with predefined options
Boolean{{variable:boolean}}True/false toggle
Typed Variables Example
text
Analyze the {{product:select:software,hardware,service}} for {{company}}.

Budget constraint: ${{budget:number}}

Detailed requirements:
{{requirements:textarea}}

Include competitor analysis: {{include_competitors:boolean}}

Presets#

Presets are saved collections of variable values that you can quickly load in the Playground. They're useful for:

Quick Testing

Reload common test scenarios with one click.

Reproducibility

Save exact inputs that produced good results.

Dataset Creation

Convert presets into test dataset rows.

API Examples

Use presets as reference for API integration.

1

Fill in Variables

Enter values for all variables in the Playground.
2

Click Save Preset

Use the "Save as Preset" button above the variable form.
3

Name Your Preset

Give it a descriptive name like "Customer Support - Refund Request".
4

Load Anytime

Select your preset from the dropdown to instantly fill all variables.

Default Values#

You can specify default values for variables using the colon syntax:

Default Value Syntax
text
You are a {{role:helpful assistant}} working for {{company:PromptReports}}.

Response length: {{length:medium}} (short, medium, or long)
Tone: {{tone:professional}}

Default values are used when:

  • Running the prompt without explicitly setting the variable
  • Making API calls without providing all variables
  • Creating test datasets with partial data

API Integration#

When calling prompts via the API, pass variable values in the request body:

API Request Example
json
{
  "promptId": "prompt_abc123",
  "variables": {
    "name": "John Doe",
    "company": "Acme Corp",
    "role": "Software Engineer"
  },
  "model": "gpt-4",
  "temperature": 0.7
}

The API will substitute all variables before sending to the AI model. Missing required variables will return a 400 error with details about which variables are missing.

Best Practices#

Follow these guidelines for effective variable usage:

  • Be descriptive: Use clear variable names that indicate expected content
  • Group related variables: Place related variables together in the prompt
  • Use defaults wisely: Set sensible defaults for optional parameters
  • Document expectations: Add comments in your prompt about expected variable formats
  • Test edge cases: Create presets for unusual or edge case inputs
  • Keep it simple: Don't over-parameterize; only use variables for truly dynamic content