Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Elevenlabs Elevenlabs python WorkflowExpressionConditionModelInputExpression

From Leeroopedia
Attribute Value
Page Type Implementation
Language Python
SDK elevenlabs
Type Discriminated Union (type alias)
Source File src/elevenlabs/types/workflow_expression_condition_model_input_expression.py
Auto-Generated Yes (Fern API Definition)

Overview

Description

WorkflowExpressionConditionModelInputExpression is a discriminated union type representing an expression to evaluate within a workflow condition node input. It supports 13 expression variants including logical operators (AND, OR), comparison operators (EQ, NEQ, GT, GTE, LT, LTE), literal values (boolean, number, string), dynamic variable references, and LLM-based evaluation prompts. The union is discriminated on the type field.

Usage

This type is used when defining conditional branching logic within a workflow input. Each variant represents a different kind of expression node in an abstract syntax tree (AST). Logical operators can nest child expressions, comparison operators take left and right operands, and literals provide constant values. The LLM variant allows conditions to be evaluated using a language model prompt.

Code Reference

Source Location

src/elevenlabs/types/workflow_expression_condition_model_input_expression.py

Type Definition

WorkflowExpressionConditionModelInputExpression = typing_extensions.Annotated[
    typing.Union[
        WorkflowExpressionConditionModelInputExpression_AndOperator,
        WorkflowExpressionConditionModelInputExpression_BooleanLiteral,
        WorkflowExpressionConditionModelInputExpression_DynamicVariable,
        WorkflowExpressionConditionModelInputExpression_EqOperator,
        WorkflowExpressionConditionModelInputExpression_GtOperator,
        WorkflowExpressionConditionModelInputExpression_GteOperator,
        WorkflowExpressionConditionModelInputExpression_Llm,
        WorkflowExpressionConditionModelInputExpression_LtOperator,
        WorkflowExpressionConditionModelInputExpression_LteOperator,
        WorkflowExpressionConditionModelInputExpression_NeqOperator,
        WorkflowExpressionConditionModelInputExpression_NumberLiteral,
        WorkflowExpressionConditionModelInputExpression_OrOperator,
        WorkflowExpressionConditionModelInputExpression_StringLiteral,
    ],
    UnionMetadata(discriminant="type"),
]

Import Statement

from elevenlabs.types import WorkflowExpressionConditionModelInputExpression

I/O Contract

Union Variants

Variant Class type Discriminator Fields Description
_AndOperator "and_operator" children: List[AstAndOperatorNodeInputChildrenItem] Logical AND operator with child expressions.
_BooleanLiteral "boolean_literal" value: bool A boolean literal value.
_DynamicVariable "dynamic_variable" name: str A reference to a dynamic variable by name.
_EqOperator "eq_operator" left: AstEqualsOperatorNodeInputLeft, right: AstEqualsOperatorNodeInputRight Equality comparison operator.
_GtOperator "gt_operator" left: AstGreaterThanOperatorNodeInputLeft, right: AstGreaterThanOperatorNodeInputRight Greater-than comparison operator.
_GteOperator "gte_operator" left: AstGreaterThanOrEqualsOperatorNodeInputLeft, right: AstGreaterThanOrEqualsOperatorNodeInputRight Greater-than-or-equals comparison operator.
_Llm "llm" prompt: str LLM-based evaluation using a prompt string.
_LtOperator "lt_operator" left: AstLessThanOperatorNodeInputLeft, right: AstLessThanOperatorNodeInputRight Less-than comparison operator.
_LteOperator "lte_operator" left: AstLessThanOrEqualsOperatorNodeInputLeft, right: AstLessThanOrEqualsOperatorNodeInputRight Less-than-or-equals comparison operator.
_NeqOperator "neq_operator" left: AstNotEqualsOperatorNodeInputLeft, right: AstNotEqualsOperatorNodeInputRight Not-equals comparison operator.
_NumberLiteral "number_literal" value: float A numeric literal value.
_OrOperator "or_operator" children: List[AstOrOperatorNodeInputChildrenItem] Logical OR operator with child expressions.
_StringLiteral "string_literal" value: str A string literal value.

Common Configuration (all variants):

  • Frozen (immutable) models
  • Allow extra fields
  • Support both Pydantic v1 and v2
  • Forward references resolved via update_forward_refs

Usage Examples

Creating a boolean literal expression

from elevenlabs.types.workflow_expression_condition_model_input_expression import (
    WorkflowExpressionConditionModelInputExpression_BooleanLiteral,
)

expr = WorkflowExpressionConditionModelInputExpression_BooleanLiteral(
    value=True,
)

Creating a dynamic variable expression

from elevenlabs.types.workflow_expression_condition_model_input_expression import (
    WorkflowExpressionConditionModelInputExpression_DynamicVariable,
)

expr = WorkflowExpressionConditionModelInputExpression_DynamicVariable(
    name="user_is_authenticated",
)

Creating an LLM-based condition expression

from elevenlabs.types.workflow_expression_condition_model_input_expression import (
    WorkflowExpressionConditionModelInputExpression_Llm,
)

expr = WorkflowExpressionConditionModelInputExpression_Llm(
    prompt="Has the user expressed intent to make a purchase?",
)

Creating a string literal expression

from elevenlabs.types.workflow_expression_condition_model_input_expression import (
    WorkflowExpressionConditionModelInputExpression_StringLiteral,
)

expr = WorkflowExpressionConditionModelInputExpression_StringLiteral(
    value="expected_value",
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment