If/Else Node
The If/Else Node is a logic node that lets you route the flow of your workflow based on conditions. It checks the output of a previous node (or nodes) and, depending on whether the condition is true or false, sends the data down different branches.

How It Works in Your Workflow

Condition Setup
In your workflow, the If/Else node always takes an input from the left side. The input allows you to define the conditions. Each condition is then routed to its corresponding output according to the branching logic defined.
The available condition operators you can use in the If/Else node are:
equals: Checks if the left variable is exactly equal to the right variable.
not equals: Checks if the left variable is not equal to the right variable.
contains: Checks if the left variable (usually a string or list) contains the right variable.
not contains: Checks if the left variable does not contain the right variable.
greater than: Checks if the left variable is greater than the right variable (for numbers).
greater than or equal: Checks if the left variable is greater than or equal to the right variable.
less than: Checks if the left variable is less than the right variable.
less than or equal: Checks if the left variable is less than or equal to the right variable.
is empty: Checks if the left variable is empty (no value, empty string, or empty list).
is not empty: Checks if the left variable is not empty.
You can combine multiple conditions using logical operators like and or or to create more complex branching logic.
Example usage:
{llm-0} contains "DONE"
{in-0} equals "yes"
{llm-1} is not empty
Adding Branches
Add another branch by choosing "+ Add IF/ELSE Branch"

Typical Use Cases
Quality control: Only output results that meet a certain criteria.
Multi-step reasoning: If the first LLM’s answer isn’t “final,” send it to another LLM for more processing.
Dynamic routing: Route user queries to different tools or models based on their content.
Key Points
The If/Else node does not process or change the data itself; it only checks the condition and routes the data.
You can set up multiple conditions and even use "elif" branches for more complex logic.
The left and right variables can reference any previous node’s output.
Last updated
Was this helpful?