lifecycle.api.EdgeConnectionHook¶
- class hamilton.lifecycle.api.EdgeConnectionHook¶
Implement this to customize edges that are allowed in the graph. You can do customizations around typing here.
- abstract check_edge_types_match(type_from: type, type_to: type, **kwargs: Any) bool ¶
This is run to check if edge types match. Note that this is an OR functionality – this is run after we do some default checks, so this can only be permissive. Reach out if you want to be more restrictive than the default checks.
- Parameters:
type_from – The type of the node that is the source of the edge.
type_to – The type of the node that is the destination of the edge.
kwargs – This is kept for future backwards compatibility.
- Returns:
Whether or not the two node types form a valid edge.
- final do_check_edge_types_match(*, type_from: type, type_to: type) bool ¶
Wraps the check_edge_types_match method, providing a bridge to an external-facing API. Do not override this!
- final do_validate_input(*, node_type: type, input_value: Any) bool ¶
Wraps the validate_input method, providing a bridge to an external-facing API. Do not override this!
- abstract validate_input(node_type: type, input_value: Any, **kwargs: Any) bool ¶
This is run to check if the input is valid for the node type. Note that this is an OR functionality – this is run after we do some default checks, so this can only be permissive. Reach out if you want to be more restrictive than the default checks.
- Parameters:
node_type – Type of the node that is accepting the input.
input_value – Value of the input
kwargs – Keyword arguments – this is kept for future backwards compatibility.
- Returns:
Whether the input is valid for the node type.