Executable
Base class of executables
Subclass of Component.
Module: core
Methods and properties
Main methods and properties
__init__
Arguments:
input_class (Type[Input]): Class for input validation.
output_class (Type[Output]): Class for output validation.
name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.
replace (ReplacingScope, optional): Replacing strategy. Defaults to ReplacingScope.INPLACE.
invoke
Main logic. This method should overwritten when custom executable created.
Arguments:
Returns:
Dict[str, Any]: Result of execution.
validate
Validation of input/output
Arguments:
data (Dict[str, Any]): Input/output data.
validation_class (Type[ValidationClass]): Class used for validation.
Raises:
IvalidInputDataValue: If data is invalid.
Returns:
ValidationClass: Validated data.
validate_input
Validation of input
Arguments:
data (Dict[str, Any]): Input data.
Returns:
Input: Validated input.
validate_output
Validation of output
Arguments:
data (Dict[str, Any]): Output data.
Returns:
Output: Validated output.
execute
Validate input, invoke and validate output
Arguments:
input_data (Dict[str, Any]): Data for processing.
evaluator (Evaluator): Evaluator in context of which executed.
Raises:
ExecutableError: If any error occures.
Returns:
Dict[str, Any]: Result of execution.
use
Creates ExecutableExecutor which manages context
Arguments:
get_key (Optional[str], optional): Which key value of input_data will be used. If value equal to None, root dict will be used. Defaults to None.
set_key (Optional[str], optional): Which key will be used to set result value. If set_key value equal to None: - if result of type Dict[str, Any], update root dict; - else, set result to default_key. Defaults to None.
default_key (str, optional): Default key used for results that is not of type Dict. Defaults to "output".
replace (ReplacingScope, optional): Replacing strategy for executor. If equals to None, this executable strategy will be used. Defaults to None.
Returns:
ExecutableExecutor: Wrapper of Executable
ExecutableExecutor
Subclass of BaseExecutor. Wrapper of Executable.
__call__
Component Call
Arguments:
input_data (Transformable): Data for processing
evaluator (Optional[Evaluator], optional): Evaluator in context of which component executed. If equals to None, default evaluator will be created. Defaults to None.
Raises:
ExecutableError: If any error occures.
Returns:
Transformable: Result of executed component.
If get_key is associated with list of inputs and set_key is not specified, result will be seted to default_key (By default equals to "output").
Last updated