Implementation:Elevenlabs Elevenlabs python WorkflowExpressionConditionModelOutputExpression
| Attribute | Value |
|---|---|
| Page Type | Implementation |
| Language | Python |
| SDK | elevenlabs |
| Type | Discriminated Union (type alias) |
| Source File | src/elevenlabs/types/workflow_expression_condition_model_output_expression.py |
| Auto-Generated | Yes (Fern API Definition) |
Overview
Description
WorkflowExpressionConditionModelOutputExpression is a discriminated union type representing an expression to evaluate within a workflow condition node output. It mirrors the input expression union and 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 returned by the ElevenLabs API as part of a workflow definition and represents the evaluated or stored state of conditional expressions. Each variant represents a different kind of expression node in the AST. This is the output (read) counterpart to the input expression type, with output-specific AST node types for operands and children.
Code Reference
Source Location
src/elevenlabs/types/workflow_expression_condition_model_output_expression.py
Type Definition
WorkflowExpressionConditionModelOutputExpression = typing_extensions.Annotated[
typing.Union[
WorkflowExpressionConditionModelOutputExpression_AndOperator,
WorkflowExpressionConditionModelOutputExpression_BooleanLiteral,
WorkflowExpressionConditionModelOutputExpression_DynamicVariable,
WorkflowExpressionConditionModelOutputExpression_EqOperator,
WorkflowExpressionConditionModelOutputExpression_GtOperator,
WorkflowExpressionConditionModelOutputExpression_GteOperator,
WorkflowExpressionConditionModelOutputExpression_Llm,
WorkflowExpressionConditionModelOutputExpression_LtOperator,
WorkflowExpressionConditionModelOutputExpression_LteOperator,
WorkflowExpressionConditionModelOutputExpression_NeqOperator,
WorkflowExpressionConditionModelOutputExpression_NumberLiteral,
WorkflowExpressionConditionModelOutputExpression_OrOperator,
WorkflowExpressionConditionModelOutputExpression_StringLiteral,
],
UnionMetadata(discriminant="type"),
]
Import Statement
from elevenlabs.types import WorkflowExpressionConditionModelOutputExpression
I/O Contract
Union Variants
| Variant Class | type Discriminator |
Fields | Description |
|---|---|---|---|
| _AndOperator | "and_operator" |
children: List[AstAndOperatorNodeOutputChildrenItem] |
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: AstEqualsOperatorNodeOutputLeft, right: AstEqualsOperatorNodeOutputRight |
Equality comparison operator. |
| _GtOperator | "gt_operator" |
left: AstGreaterThanOperatorNodeOutputLeft, right: AstGreaterThanOperatorNodeOutputRight |
Greater-than comparison operator. |
| _GteOperator | "gte_operator" |
left: AstGreaterThanOrEqualsOperatorNodeOutputLeft, right: AstGreaterThanOrEqualsOperatorNodeOutputRight |
Greater-than-or-equals comparison operator. |
| _Llm | "llm" |
prompt: str |
LLM-based evaluation using a prompt string. |
| _LtOperator | "lt_operator" |
left: AstLessThanOperatorNodeOutputLeft, right: AstLessThanOperatorNodeOutputRight |
Less-than comparison operator. |
| _LteOperator | "lte_operator" |
left: AstLessThanOrEqualsOperatorNodeOutputLeft, right: AstLessThanOrEqualsOperatorNodeOutputRight |
Less-than-or-equals comparison operator. |
| _NeqOperator | "neq_operator" |
left: AstNotEqualsOperatorNodeOutputLeft, right: AstNotEqualsOperatorNodeOutputRight |
Not-equals comparison operator. |
| _NumberLiteral | "number_literal" |
value: float |
A numeric literal value. |
| _OrOperator | "or_operator" |
children: List[AstOrOperatorNodeOutputChildrenItem] |
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
Inspecting an output expression
from elevenlabs.types import WorkflowExpressionConditionModelOutputExpression
# After receiving a workflow from the API
expression: WorkflowExpressionConditionModelOutputExpression = ...
# Check the expression type using the discriminant
if expression.type == "boolean_literal":
print(f"Boolean value: {expression.value}")
elif expression.type == "dynamic_variable":
print(f"Variable name: {expression.name}")
elif expression.type == "llm":
print(f"LLM prompt: {expression.prompt}")
elif expression.type == "eq_operator":
print(f"Equals: {expression.left} == {expression.right}")
Constructing an output boolean literal
from elevenlabs.types.workflow_expression_condition_model_output_expression import (
WorkflowExpressionConditionModelOutputExpression_BooleanLiteral,
)
expr = WorkflowExpressionConditionModelOutputExpression_BooleanLiteral(
value=False,
)
Constructing an output number literal
from elevenlabs.types.workflow_expression_condition_model_output_expression import (
WorkflowExpressionConditionModelOutputExpression_NumberLiteral,
)
expr = WorkflowExpressionConditionModelOutputExpression_NumberLiteral(
value=42.0,
)
Related Pages
- WorkflowExpressionConditionModelInputExpression - Input counterpart of this expression union
- WorkflowPhoneNumberNodeModelOutput - Phone number node model for workflow outputs
- WorkflowOverrideAgentNodeModelInput - Override agent node model for workflow inputs