Variable Groups

Centralized variable management for consistent and reusable prompt inputs

Variable Groups

Variable Groups in PromptCompose provide centralized management of variables that can be shared across multiple prompts and templates. They ensure consistency, reduce duplication, and make it easy to maintain common variables across your entire project.

What are Variable Groups?

Variable Groups are collections of related variables that can be:

  • Reused across multiple prompts and templates
  • Shared with team members and across projects
  • Validated with type checking and constraints
  • Standardized to ensure consistent naming and formatting

Think of them as libraries of common inputs that your prompts might need.

Why Use Variable Groups?

Consistency

Ensure all prompts use the same variable names and formats:

  • user_name instead of mixing userName, name, customer_name
  • Standardized options for select variables
  • Consistent validation rules

Efficiency

Reduce repetitive work:

  • Define variables once, use everywhere
  • Bulk import into new prompts
  • Update definitions across all prompts simultaneously

Quality Control

Maintain data quality with:

  • Type validation (text, number, boolean, select)
  • Required field enforcement
  • Default value provision
  • Input constraints and rules

Creating Variable Groups

Basic Group Setup

  1. Navigate to Variable Groups

    • Click “Variable Groups” in the sidebar
    • Click “Create Variable Group”
  2. Group Information

    • Name: Descriptive name (e.g., “Customer Information”)
    • Description: Explain the purpose and usage
    • Tags: Add relevant tags for organization
  3. Add Variables Define each variable with:

    • Name: Variable identifier (use lowercase with underscores)
    • Label: User-friendly display name
    • Type: Text, Select, Number, Boolean
    • Description: Help text and usage examples
    • Required: Whether the variable must be provided
    • Default Value: Optional fallback value

Variable Types

Text Variables

For open-ended text input:

Variable Name: customer_message
Label: Customer Message
Type: Text
Description: The customer's inquiry or message
Required: Yes
Default Value: (none)

Use for:

  • Names and titles
  • Messages and descriptions
  • Free-form content
  • URLs and identifiers

Select Variables

For predefined options:

Variable Name: priority_level
Label: Priority Level
Type: Select
Options: ["High", "Medium", "Low"]
Description: Urgency level of the request
Required: Yes
Default Value: Medium

Use for:

  • Categories and classifications
  • Status values
  • Predefined responses
  • Configuration options

Number Variables

For numeric values:

Variable Name: order_amount
Label: Order Amount
Type: Number
Description: Total order value in USD
Required: Yes
Min Value: 0
Max Value: 10000
Default Value: 0

Use for:

  • Quantities and amounts
  • Scores and ratings
  • Dates and times (as timestamps)
  • Measurements

Boolean Variables

For true/false values:

Variable Name: is_premium_customer
Label: Premium Customer
Type: Boolean
Description: Whether the customer has premium status
Required: No
Default Value: false

Use for:

  • Feature flags
  • Status indicators
  • Yes/no questions
  • Enable/disable settings

Common Variable Groups

Customer Information

Essential customer data for personalization:

customer_name (Text, Required)
- Customer's full name for personalization

customer_email (Text, Required) 
- Email address for communication

customer_id (Text, Required)
- Unique customer identifier

account_type (Select: ["Free", "Premium", "Enterprise"])
- Customer's subscription level

signup_date (Text, Optional)
- When the customer joined

preferred_language (Select: ["English", "Spanish", "French"])
- Customer's language preference

contact_preference (Select: ["Email", "Phone", "Chat"])
- How customer prefers to be contacted

Company Information

Organization details for branding:

company_name (Text, Required)
- Your company or organization name

support_email (Text, Required)
- Support contact email address

website_url (Text, Optional)
- Company website URL

phone_number (Text, Optional)
- Support phone number

business_hours (Text, Optional)
- Operating hours for support

company_address (Text, Optional)
- Business address for formal communications

Product Information

Details about your products or services:

product_name (Text, Required)
- Name of the product or service

product_category (Select: ["Software", "Hardware", "Service"])
- Product classification

version_number (Text, Optional)
- Current product version

feature_list (Text, Optional)
- Key product features

pricing_tier (Select: ["Basic", "Standard", "Premium"])
- Product pricing level

release_date (Text, Optional)
- Product launch or update date

Communication Settings

Preferences for tone and style:

communication_tone (Select: ["Professional", "Friendly", "Casual"])
- Tone of voice for responses

urgency_level (Select: ["Low", "Normal", "High", "Critical"])
- How urgent the matter is

response_length (Select: ["Brief", "Standard", "Detailed"])
- How much detail to include

include_next_steps (Boolean, Default: true)
- Whether to include action items

personalization_level (Select: ["Minimal", "Standard", "High"])
- How much to personalize the response

Using Variable Groups

In Prompt Creation

When creating a new prompt:

  1. Import Variables

    • Select relevant variable groups
    • Choose which variables to include
    • Variables are automatically added to your prompt
  2. Customize if Needed

    • Override default values
    • Make group variables optional/required
    • Add prompt-specific variables
  3. Reference in Content Use variables in your prompt content:

    Hello {customer_name},
    
    Thank you for contacting {company_name}. We received your message about {product_name}.
    
    Based on your {account_type} account, here's what we can do...
    

In Template Creation

When building templates:

  1. Select Base Groups

    • Choose relevant variable groups
    • Import common variables
    • Maintain consistency across templates
  2. Add Template Variables

    • Include template-specific variables
    • Build on the foundation of group variables
    • Keep templates flexible but standardized

Variable Inheritance

Variables flow from groups to prompts/templates:

  • Group Level: Define once, use everywhere
  • Template Level: Add template-specific variables
  • Prompt Level: Customize for specific use cases

Managing Variable Groups

Group Organization

Naming Strategy

  • Use descriptive, specific names
  • Group related variables together
  • Examples: “Customer Info”, “Order Details”, “Email Settings”

Logical Grouping

  • By Domain: Customer, Product, Company
  • By Use Case: Support, Sales, Marketing
  • By Data Type: Contact Info, Preferences, Metrics

Sharing and Permissions

Visibility Levels

  • Private: Only you can see and use
  • Team: Available to team members
  • Project: Available to all project users
  • Global: Available across multiple projects (if enabled)

Collaboration

  • Comments: Discuss variable definitions and usage
  • Change History: Track modifications over time
  • Usage Tracking: See which prompts use which variables

Maintenance Best Practices

Regular Reviews

  • Check variable usage across prompts
  • Remove unused or obsolete variables
  • Update descriptions and constraints
  • Validate default values

Version Control

  • Document significant changes
  • Maintain backward compatibility
  • Communicate updates to team

Quality Assurance

  • Standardize naming conventions
  • Validate data types and constraints
  • Test variables in different contexts

Advanced Features

Variable Validation

Set validation rules to ensure data quality:

Text Validation

  • Minimum/maximum length
  • Pattern matching (regex)
  • Required format (email, phone, URL)

Number Validation

  • Minimum/maximum values
  • Decimal places
  • Integer vs. decimal

Select Validation

  • Fixed option lists
  • Hierarchical options
  • Dynamic option loading

Conditional Variables

Create variables that depend on other variables:

If account_type = "Premium":
  Show: premium_features (Select)
  Show: priority_support (Boolean)

If urgency_level = "Critical":
  Require: escalation_contact (Text)
  Show: immediate_response (Boolean)

Variable Dependencies

Link related variables:

country (Select: ["US", "UK", "CA"])

state_province (Select: depends on country)

timezone (Select: depends on location)

Integration with Other Features

A/B Testing

Variables can be used in A/B test configurations:

  • Test different variable combinations
  • Measure impact of personalization
  • Optimize variable usage

API Integration

Variable groups translate to API parameters:

  • Consistent parameter names
  • Type validation at API level
  • Default value handling

Analytics

Track variable usage and performance:

  • Most used variables
  • Conversion impact of personalization
  • Variable validation error rates

Best Practices

Variable Design

  1. Clear Naming: Use descriptive, consistent names
  2. Logical Grouping: Group related variables together
  3. Appropriate Types: Choose the right data type for each variable
  4. Good Defaults: Provide sensible default values
  5. Helpful Descriptions: Write clear usage guidance

Data Quality

  1. Validation Rules: Set appropriate constraints
  2. Required vs. Optional: Mark required fields appropriately
  3. Consistent Formats: Standardize data formats (dates, phone numbers)
  4. Error Handling: Plan for invalid or missing data

Team Collaboration

  1. Documentation: Document variable purposes and usage
  2. Naming Conventions: Establish team standards
  3. Regular Reviews: Periodically audit and clean up variables
  4. Training: Help team members use variables effectively

Common Use Cases

Customer Support

  • Customer identification and contact info
  • Issue categorization and priority
  • Resolution tracking and follow-up

Marketing Campaigns

  • Audience segmentation variables
  • Campaign personalization data
  • Performance tracking parameters

E-commerce

  • Product and inventory information
  • Order and payment details
  • Customer preferences and history

Content Creation

  • Author and publication info
  • Content categorization and tags
  • SEO and metadata variables

Troubleshooting

Common Issues

Variables Not Appearing

  • Check variable group sharing settings
  • Verify you have access to the group
  • Ensure group is not archived

Validation Errors

  • Check variable type requirements
  • Verify required fields are provided
  • Review format constraints

Import Problems

  • Check for naming conflicts
  • Verify variable group permissions
  • Review import settings

Performance Tips

  1. Group Size: Keep groups focused and reasonably sized
  2. Variable Count: Don’t overload prompts with too many variables
  3. Default Values: Provide defaults to reduce required inputs
  4. Caching: Leverage caching for frequently used variables

Next Steps

With Variable Groups configured:

Variable Groups are the foundation of scalable prompt management - use them to ensure consistency, quality, and efficiency across all your AI interactions.