Nodes
HyperNode
Cannot Be Instantiated Directly
from hypergraph import HyperNode
HyperNode() # TypeError: HyperNode cannot be instantiated directlyCore Attributes
node.name: str # Public node name
node.inputs: tuple[str, ...] # Input parameter names
node.outputs: tuple[str, ...] # Output value names
node._rename_history: list[RenameEntry] # Internal: tracks renames for error messagesPublic Methods
with_name(name: str) -> HyperNode
with_name(name: str) -> HyperNodewith_inputs(mapping=None, /, **kwargs) -> HyperNode
with_inputs(mapping=None, /, **kwargs) -> HyperNodewith_outputs(mapping=None, /, **kwargs) -> HyperNode
with_outputs(mapping=None, /, **kwargs) -> HyperNodeImmutability Pattern
Type Checking
FunctionNode
Constructor
Creating from a function
Creating from existing FunctionNode
Properties
func: Callable
func: Callablename: str
name: strinputs: tuple[str, ...]
inputs: tuple[str, ...]outputs: tuple[str, ...]
outputs: tuple[str, ...]data_outputs: tuple[str, ...]
data_outputs: tuple[str, ...]wait_for: tuple[str, ...]
wait_for: tuple[str, ...]cache: bool
cache: booldefinition_hash: str
definition_hash: stris_async: bool
is_async: boolis_generator: bool
is_generator: boolSpecial Methods
__call__(*args, **kwargs)
__repr__() -> str
@node Decorator
Signature
Usage Without Parentheses
Usage With Parentheses
With All Parameters
Warning on Missing output_name
RenameError
Error Messages Include History
Exception Details
Execution Modes
1. Synchronous Function
2. Asynchronous Function
3. Synchronous Generator
4. Asynchronous Generator
Complete Example
GraphNode
Creating GraphNode
Overriding the Name
Properties
name: str
name: strinputs: tuple[str, ...]
inputs: tuple[str, ...]outputs: tuple[str, ...]
outputs: tuple[str, ...]graph: Graph
graph: Graphis_async: bool
is_async: booldefinition_hash: str
definition_hash: strType Annotation Forwarding
Nested Composition Example
Rename Methods
map_over()
map_config Property
Error: Missing Name
NodeContext
Usage
Properties
stop_requested: bool
stop_requested: boolMethods
stream(chunk: Any) -> None
stream(chunk: Any) -> NoneInjection Mechanism
Testing
InterruptNode
@interrupt Decorator
@interrupt DecoratorConstructor
Properties
Property
Type
Description
Methods
Inherited: with_name(), with_inputs(), with_outputs()
with_name(), with_inputs(), with_outputs()Example: Pause and Resume
Last updated