Skip to content

Edge

llmfy.flow_engine.edge.edge

Edge dataclass

Represents an edge in the workflow graph

Source code in llmfy/flow_engine/edge/edge.py
@dataclass
class Edge:
    """Represents an edge in the workflow graph"""
    source: str
    targets: Union[str, List[str]]
    condition: Optional[Callable] = None

    def __post_init__(self):
        """Normalize targets to always be a list"""
        if isinstance(self.targets, str):
            self.targets = [self.targets]

source instance-attribute

targets instance-attribute

condition = None class-attribute instance-attribute

__init__(source, targets, condition=None)

__post_init__()

Normalize targets to always be a list

Source code in llmfy/flow_engine/edge/edge.py
def __post_init__(self):
    """Normalize targets to always be a list"""
    if isinstance(self.targets, str):
        self.targets = [self.targets]