BaseNode
Abstract base class for all nodes in the Liman framework.
BaseNode provides the foundation for LLM, Tool, and custom nodes. It handles language configuration, compilation, and execution lifecycle. All concrete nodes must inherit from this class and implement the abstract methods for their specific functionality.
Attributes
attribute__slots__= Component.__slots__ + ('default_lang', 'fallback_lang', '_compiled')attributespecSattributedefault_langLanguageCode= default_langattributefallback_langLanguageCode= fallback_langattributeis_llm_nodeboolattributeis_tool_nodeboolFunctions
func__init____init__(self, /, spec, registry, *, initial_data=None, yaml_path=None, strict=False, default_lang='en', fallback_lang='en') -> NoneInitialize base node with specification and configuration.
Args: spec: Node specification defining behavior and properties registry: Component registry for dependency resolution initial_data: Optional initial data for the component yaml_path: Optional path to the YAML file this node was loaded from strict: Whether to enforce strict validation default_lang: Default language code for localization fallback_lang: Fallback language code when default is unavailable
Raises: LimanError: If language codes are invalid
paramselfparamspecSparamregistryRegistryparaminitial_datadict[str, Any] | None= Noneparamyaml_pathstr | None= Noneparamstrictbool= Falseparamdefault_langstr= 'en'paramfallback_langstr= 'en'Returns
Nonefunc__repr____repr__(self) -> strparamselfReturns
strfuncgenerate_idgenerate_id(self) -> UUIDGenerate unique identifier for this node instance.
Returns: Randomly generated UUID for the node
paramselfReturns
UUIDfunccompilecompile(self) -> NoneCompile the node for execution.
Prepares the node for execution by validating configuration, resolving dependencies, and performing any necessary setup. Must be implemented by concrete node classes.
paramselfReturns
Nonefuncinvokeinvoke(self, *args, **kwargs) -> AnyExecute the node's primary functionality.
Performs the main operation of the node. Implementation varies by node type (LLM calls, tool execution, custom logic).
Args: *args: Positional arguments for node execution **kwargs: Keyword arguments for node execution
Returns: Result of node execution, type varies by implementation
paramselfparamargsAny= ()paramkwargsAny= {}Returns
Anyfuncget_new_stateget_new_state(self) -> NSCreate new state instance for this node.
Returns: Fresh node state object for execution
paramselfReturns
NSLast updated on