Liman

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')
attributespecS
attributedefault_langLanguageCode
= default_lang
attributefallback_langLanguageCode
= fallback_lang
attributeis_llm_nodebool
attributeis_tool_nodebool

Functions

func__init____init__(self, /, spec, registry, *, initial_data=None, yaml_path=None, strict=False, default_lang='en', fallback_lang='en') -> None

Initialize 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

paramself
paramspecS
paramregistryRegistry
paraminitial_datadict[str, Any] | None
= None
paramyaml_pathstr | None
= None
paramstrictbool
= False
paramdefault_langstr
= 'en'
paramfallback_langstr
= 'en'

Returns

None
func__repr____repr__(self) -> str
paramself

Returns

str
funcgenerate_idgenerate_id(self) -> UUID

Generate unique identifier for this node instance.

Returns: Randomly generated UUID for the node

paramself

Returns

UUID
funccompilecompile(self) -> None

Compile 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.

paramself

Returns

None
funcinvokeinvoke(self, *args, **kwargs) -> Any

Execute 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

paramself
paramargsAny
= ()
paramkwargsAny
= {}

Returns

Any
funcget_new_stateget_new_state(self) -> NS

Create new state instance for this node.

Returns: Fresh node state object for execution

paramself

Returns

NS

Last updated on