Conditional Edge
graphorchestrator.edges.conditional
ConditionalEdge
Bases: Edge
Represents a conditional edge in a graph.
A ConditionalEdge directs the flow of execution to one of several sink nodes based on the result of a routing function.
Source code in graphorchestrator\edges\conditional.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
__init__(source, sinks, router)
Initializes a ConditionalEdge.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source
|
Node
|
The source node of the edge. |
required |
sinks
|
List[Node]
|
A list of sink nodes. |
required |
router
|
Callable[[State], str]
|
A routing function that takes a State object and returns the ID of the sink node to which the edge should route. |
required |
Raises:
Type | Description |
---|---|
RoutingFunctionNotDecoratedError
|
If the router function is not decorated with @routing_function. |
Source code in graphorchestrator\edges\conditional.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|