Overview

The Decision Block leverages AI capabilities to make binary decisions based on input values and natural language prompts. It acts as an AI-powered equivalent of a traditional switch block, evaluating whether a condition is true or false and directing the flow accordingly.

Inputs

System Prompt
string

The system prompt to send to the model. Optional. Used to provide high-level guidance to the AI model.

Condition Prompt
any
required

A prompt outlining a TRUE/FALSE decision criteria. Required. The prompt must satisfy a condition to be satisfied.

Value
any
required

The value to pass through the True or False port. Required. If unconnected, it will be undefined.

Outputs

True
any

The value passed through if the condition is truthy.

False
any

The value passed through if the condition is falsy.

Cost
number

The total cost of the AI operations in USD.

Duration
number

The time in milliseconds that the block took to execute.

Editor Settings

Don't run unconnected value
boolean
default:true

When enabled, unconnected values will be excluded from control flow.

AI Model
string
default:"gpt-3.5-turbo"

The AI model used to evaluate the decision. Available models are dynamically populated based on the LLM provider configuration. Uses a custom LLM dropdown element.

Error Handling

The block will retry failed attempts up to 3 times with exponential backoff:

  • Minimum retry delay: 500ms
  • Maximum retry delay: 5000ms
  • Retry factor: 2.5x
  • Includes randomization
  • Maximum retry time: 5 minutes

Error messages will be logged for:

  • Invalid responses (must contain TRUE or FALSE)
  • Missing LLM provider configuration
  • Token limit exceeded errors
  • API errors and timeouts

Example: Categorizing Customer Feedback

  1. Add a Decision block to your flow.
  2. Connect your input text (customer feedback) to the Value input of the Decision block.
  3. Add a Text block with a prompt like “Determine if this customer feedback is positive” and connect it to the Condition Prompt input.
  4. Connect the True output to a block that handles positive feedback.
  5. Connect the False output to a block that handles negative feedback.
  6. Run your flow. The Decision block will evaluate each piece of feedback and direct it to the appropriate handling process.

Notes

  • Token counts are checked against model limits before execution
  • Costs are calculated per-token based on model pricing
  • Responses are case-insensitive but must contain TRUE or FALSE
  • System prompts are optional but can help guide the model
  • Cache can be enabled/disabled per model configuration

While the Decision block can handle complex decision-making tasks, it’s important to validate its decisions for critical applications and provide clear, unambiguous prompts.

FAQ

See Also