Quantum Minds Flow Operators
Introduction
Flow operators in Quantum Minds are essential for creating dynamic, adaptive minds that can make decisions and control execution paths based on data, conditions, and user inputs. These operators enable you to build sophisticated workflows that respond intelligently to different scenarios, making your minds more powerful and flexible.
Available Flow Operators
Operator | Description | Common Use Cases |
---|---|---|
Flow.Condition | Creates conditional branching based on criteria | Decision making, error handling, content filtering |
Flow.Condition (IfElseThen)
The Flow.Condition operator (formerly IfElseThen) evaluates conditions and directs the flow of execution to different paths based on the result, enabling decision-making capabilities within your minds.
Inputs
Parameter | Type | Required | Description |
---|---|---|---|
prompt | string | Yes | Condition to evaluate or instruction for evaluation |
trigger | string | No | Optional control signal |
Outputs
Parameter | Type | Description |
---|---|---|
type | string | Output format (markdown) |
then_ | string | Path to follow if condition is true |
else_ | string | Path to follow if condition is false |
Example Usage
Prompt: "Check if the quarterly sales figures exceed the target of $500,000"
Output:
- type: "markdown"
- then_: "Path to follow if sales > $500,000"
- else_: "Path to follow if sales <= $500,000"
Condition Evaluation Methods
The Flow.Condition operator supports multiple approaches to condition evaluation:
1. Direct Condition Checking
Using simple comparisons and logic:
Prompt: "Is the average customer satisfaction score from $CustomerFeedback_001.output.content greater than 4.2?"
2. Data-Based Decisions
Evaluating based on data analysis:
Prompt: "Based on the sales trend data in $SQLExecution_001.output.content, determine if there is a statistically significant upward trend (p-value < 0.05)"
3. Complex Logic with Multiple Factors
Combining multiple conditions:
Prompt: "Evaluate if ALL of the following conditions are met:
1. Monthly revenue exceeds $100,000
2. Customer acquisition cost is below $50
3. Churn rate is less than 5%
Based on data in $Analytics_001.output.content"
4. Natural Language Understanding
Processing conditions expressed in natural language:
Prompt: "Is the customer message in $CustomerMessage_001.output.content expressing dissatisfaction or requesting a refund?"
Creating Flow Control Structures
Basic Branching
The simplest use of Flow.Condition creates a two-way branch:
{
"operator": "PandasAi",
"input": {
"prompt": "Analyze customer churn data and calculate the overall churn rate",
"dataframe": "$SQLExecution_001.output.content"
}
}
↓
{
"operator": "Flow.Condition",
"input": {
"prompt": "Is the churn rate calculated in $PandasAi_001.output.content greater than 5%?"
}
}
then_ →
{
"operator": "TextSummarize",
"input": {
"prompt": "Generate an urgent action plan to address the high churn rate of over 5%"
}
}
else_ →
{
"operator": "TextSummarize",
"input": {
"prompt": "Generate a standard churn monitoring report for the acceptable churn rate"
}
}
Multi-Level Conditionals
Flow conditions can be nested to create more complex decision trees:
{
"operator": "Flow.Condition",
"input": {
"prompt": "Is the sentiment in $CustomerFeedback_001.output.content positive?"
}
}
then_ →
{
"operator": "Flow.Condition",
"input": {
"prompt": "Does the feedback in $CustomerFeedback_001.output.content mention our new product features?"
}
}
then_ →
{
"operator": "TextSummarize",
"input": {
"prompt": "Generate a response thanking the customer for positive feedback on our new features"
}
}
else_ →
{
"operator": "TextSummarize",
"input": {
"prompt": "Generate a general thank you response for positive feedback"
}
}
else_ →
{
"operator": "Flow.Condition",
"input": {
"prompt": "Is the sentiment strongly negative (rating 1-2 out of 5)?"
}
}
// Additional branches...
Implementing Loops with Recursion
While there's no explicit loop operator, you can implement iterative processing through recursion and conditions:
{
"operator": "TextToSQL",
"input": {
"prompt": "Get the next batch of 100 unprocessed orders",
"dataset": "order_management"
}
}
↓
{
"operator": "SQLExecution",
"input": {
"sql": "$TextToSQL_001.output.content",
"dataset": "order_management"
}
}
↓
{
"operator": "Flow.Condition",
"input": {
"prompt": "Does the result in $SQLExecution_001.output.content contain any orders (rows > 0)?"
}
}
then_ →
{
"operator": "PandasAiDf",
"input": {
"prompt": "Process each order...",
"dataframe": "$SQLExecution_001.output.content"
}
}
// Continue with saving results and then loop back to the beginning
else_ →
{
"operator": "TextSummarize",
"input": {
"prompt": "Generate processing complete summary"
}
}
Advanced Flow Control Patterns
Error Handling
Use Flow.Condition to implement error detection and recovery:
{
"operator": "CustomPython",
"input": {
"code": "try:\n # Complex operation\n result = process_data()\n error = None\nexcept Exception as e:\n result = None\n error = str(e)"
}
}
↓
{
"operator": "Flow.Condition",
"input": {
"prompt": "Check if error is None in $CustomPython_001.output.result"
}
}
then_ →
{
"operator": "TextSummarize",
"input": {
"prompt": "Continue with normal processing..."
}
}
else_ →
{
"operator": "TextSummarize",
"input": {
"prompt": "Generate error report and recovery plan based on: $CustomPython_001