Skip to main content

Template Variables

Template variables let you create dynamic prompts that change based on variable values. Instead of writing a separate prompt for every variation, you define placeholders using the {{variable_name}} syntax and swap values at generation time — ideal for batch generation across different products, names, or descriptions.

What Are Variables?

A template variable is a named placeholder inside a prompt. When you run a generation, XainFlow replaces each placeholder with the value you provide. This turns a single prompt template into a reusable blueprint for many outputs.

Example prompt with variables:

A professional photo of {{product_name}} on a {{background_type}} background,
studio lighting, {{style}} style

When you generate, you provide values like product_name = "running shoes", background_type = "white marble", and style = "minimalist", and the AI receives the fully substituted prompt.

Variable Types

TypeDescriptionExample Value
TextFree-form text input"running shoes", "sunset beach"
NumberNumeric values3, 1080, 0.5
ImageReference to an image assetAn uploaded product photo

Image Variables

Image variables let you reference visual assets directly in your prompts. When you use an image variable, the referenced asset is included as a generation input alongside the text prompt.

You can add an optional description field to guide how the AI interprets the image. For example, if the image is a photo of a person wearing a specific outfit, you might set the description to "Focus on the outfit style, ignore the person" to direct the AI's attention.

Creating Variables

  1. Open a workflow in Flow Studio.
  2. Select a node that accepts prompts (such as the Prompt Generator Node).
  3. In the prompt field, type {{ to start a variable placeholder, then enter the variable name and close with }}.
  4. The variable appears in the Variables Panel on the side, where you can set its type and default value.

Execution Modes

When you provide multiple values for your variables, XainFlow can combine them in two ways:

Combinatorial Mode

Generates all possible combinations of variable values. If you have 2 products and 3 backgrounds, you get 2 × 3 = 6 prompts.

Example:

VariableValues
product_nameshoes, bag
background_typewhite, wood, marble

Result: 6 generations — shoes/white, shoes/wood, shoes/marble, bag/white, bag/wood, bag/marble.

Sequential Mode

Pairs variable values by index. The first value of each variable is combined, then the second, and so on. All variables must have the same number of values.

Example:

VariableValues
product_nameshoes, bag, watch
background_typewhite, wood, marble

Result: 3 generations — shoes/white, bag/wood, watch/marble.

warning

XainFlow limits batch generation to 50 expanded prompts per run. If your variable combinations exceed this limit, reduce the number of values or switch to sequential mode.

Variable Management

You can manage all variables for a workflow from the Variables Panel:

  • Edit — change a variable's name, type, or default value.
  • Delete — remove a variable you no longer need. Any prompt references to that variable will show as unresolved.
  • Reorder — drag variables to change their display order in the panel.
tip

Use descriptive variable names like {{product_name}} or {{scene_description}} rather than generic names like {{var1}}. This makes your templates easier to understand and maintain, especially when sharing workflows with team members.