yasmin.cb_state module

class yasmin.cb_state.CbState(outcomes: Set[str], cb: Callable, *args: Any, **kwargs: Any)

Bases: State

CbState is a subclass of State that encapsulates a callback function which can be executed in response to a specific state.

Attributes:
_cb (Callable): A callback function that defines the action to take

when the state is executed.

_args (tuple): Positional arguments passed to the callback. _kwargs (dict): Keyword arguments passed to the callback.

Parameters:

outcomes (Set[str]): A set of possible outcomes for this state. cb (Callable): A callable that will be invoked when the state is executed.

execute(blackboard: Blackboard) str

Executes the callback function with the blackboard and provided arguments.

Args:
blackboard: The context in which the callback will be executed.

This is typically an object that holds the necessary state or data for the callback.

Returns:

str: The result of the callback function execution.

Raises:

Exception: Propagates any exceptions raised by the callback function.