haive.core.graph.branchesΒΆ
Branch system for dynamic routing based on state values.
SubmodulesΒΆ
FunctionsΒΆ
|
Chain multiple branches together, evaluating them in sequence. |
|
Create a Branch with conditional evaluation. |
|
Create a Send mapper branch from a function that returns Send objects. |
|
Create a Branch from a function. |
|
Create a Branch that checks if a key equals a value. |
|
Create a Branch that checks if a key exists in the state. |
|
Create a Branch that checks if the last message contains specific text. |
|
Create a Branch that generates Send objects. |
Package ContentsΒΆ
- haive.core.graph.branches.chain(*branches, default='END')[source]ΒΆ
Chain multiple branches together, evaluating them in sequence.
- Parameters:
branches (branch.Branch)
default (str)
- Return type:
- haive.core.graph.branches.conditional(condition, if_true, if_false, default='END')[source]ΒΆ
Create a Branch with conditional evaluation.
- Parameters:
condition (collections.abc.Callable[[haive.core.graph.common.types.StateLike], bool])
if_true (str | branch.Branch)
if_false (str | branch.Branch)
default (str)
- Return type:
- haive.core.graph.branches.create_from_send_function(mapper_function)[source]ΒΆ
Create a Send mapper branch from a function that returns Send objects.
- Parameters:
mapper_function (collections.abc.Callable[[haive.core.graph.common.types.StateLike], list[Any]])
- Return type:
- haive.core.graph.branches.from_function(function, destinations=None, default='END')[source]ΒΆ
Create a Branch from a function.
- Parameters:
- Return type:
- haive.core.graph.branches.key_equals(key, value, true_dest='continue', false_dest='END')[source]ΒΆ
Create a Branch that checks if a key equals a value.
- Parameters:
- Return type:
- haive.core.graph.branches.key_exists(key, true_dest='continue', false_dest='END')[source]ΒΆ
Create a Branch that checks if a key exists in the state.
- Parameters:
- Return type:
- haive.core.graph.branches.message_contains(text, true_dest='continue', false_dest='END', message_key='messages')[source]ΒΆ
Create a Branch that checks if the last message contains specific text.
- Parameters:
- Return type:
- haive.core.graph.branches.send_mapper(function=None, mappings=None, generators=None)[source]ΒΆ
Create a Branch that generates Send objects.
- Parameters:
function (collections.abc.Callable[[haive.core.graph.common.types.StateLike], list[Any]] | None)
mappings (list[send_mapping.SendMapping] | None)
generators (list[send_mapping.SendGenerator] | None)
- Return type: