docs/integrations/block-integrations/ai_condition.md
The AI Condition Block is a logical component that uses artificial intelligence to evaluate natural language conditions and produces outputs based on the result. This block allows you to define conditions in plain English rather than using traditional comparison operators.
This block takes an input value and a natural language condition, then uses AI to determine whether the input satisfies the condition. Based on the result, it provides conditional outputs similar to a traditional if/else statement but with the flexibility of natural language evaluation.
The block uses a Large Language Model (LLM) to evaluate the condition by:
| Input | Description |
|---|---|
| Input Value | The value to be evaluated (can be text, number, or any data type) |
| Condition | A plaintext English description of the condition to evaluate |
| Yes Value | (Optional) The value to output if the condition is true. If not provided, Input Value will be used |
| No Value | (Optional) The value to output if the condition is false. If not provided, Input Value will be used |
| Model | The LLM model to use for evaluation (defaults to GPT-4o) |
| Credentials | API credentials for the LLM provider |
| Output | Description |
|---|---|
| Result | A boolean value (true or false) indicating whether the condition was met |
| Yes Output | The output value if the condition is true. This will be the Yes Value if provided, or Input Value if not |
| No Output | The output value if the condition is false. This will be the No Value if provided, or Input Value if not |
| Error Message | Error message if the AI evaluation is uncertain or fails (empty string if successful) |
"[email protected]""the input is an email address"true"[email protected]" (or custom Yes Value)"San Francisco""the input is a city in the USA"true"San Francisco" (or custom Yes Value)"Error: Connection timeout""the input is an error message or refusal"true"Error: Connection timeout" (or custom Yes Value)"This is a detailed explanation of how machine learning works...""the input is the body of an email"false (it's more like article content)