Variables
Learn how to properly leverage variables in your AI Workflows
Variables in MindStudio are dynamic placeholders that store data during workflow execution. They allow you to pass information between blocks and workflows seamlessly.
Example:
Variable Name:
userName
Usage:
"Hello {{username}}! Welcome to our app."
Creating Variables
Variables are created automatically in MindStudio whenever:
A User Input collects data.
A block generates an output (e.g., Generate Text Block, Analyze Image Block).
You manually define them in the Start Block.
Types of Variables
Launch Variables
These are defined in the Start Block of your workflow. Values for these variables are passed in as arguments when a workflow is run via API or via the Run Workflow block.
Runtime Variables
Some blocks, such as Generate Text Blocks or User Input Blocks, assign values for the variable while the workflow is running. For Example, after performing a Google Search, the block can store the results in a variable called google_result
.
Using Variables
To use a variable in any block or prompt, reference it by enclosing the variable name in double curly braces: {{variable_name}}
.
Example Using Variables in a Generate Text Block:
Tips for Working with Large Variables
Variables are replaced with their values before the text is sent to the AI model. You must make sure your message will be coherent and legible after the variables have been substituted with their values. For longer variables, this means using things like XML tags to offset variable content from instructions.
Incorrect:
While AI models are great at parsing text, using simple formatting can make prompts dramatically more effective, as well as easier for you to maintain.
Correct:
To achieve best results, you should strive to make your prompt as easy to read for a human as possible. A handy test is to imagine that you were to print out your prompt on paper (after all variables have been substituted) and give it to someone. Would they be able to understand what you want them to do? Or would it look like gibberish?
Last updated