trinity.buffer.operators.experience_operator module

class trinity.buffer.operators.experience_operator.ExperienceOperator[source]

Bases: ABC

Base class for all experience operators in the Trinity framework. Operators are used to process experiences and perform some transformations based on them.

abstract process(exps: List[Experience]) Tuple[List[Experience], Dict][source]

Process a list of experiences and return a transformed list.

Parameters:

exps (List[Experience]) – List of experiences to process, which contains all experiences generated by the Explorer in one explore step.

Returns:

A tuple containing the processed list of experiences and a dictionary of metrics.

Return type:

Tuple[List[Experience], Dict]

classmethod create_operators(operator_configs: List[OperatorConfig]) List[ExperienceOperator][source]

Create a list of ExperienceOperator instances based on the provided operator configurations.

Parameters:

operator_configs (List[OperatorConfig]) – List of operator configurations.

Returns:

List of instantiated ExperienceOperator objects.

Return type:

List[ExperienceOperator]

close()[source]

Close the operator if it has any resources to release.