trinity.buffer.operators package#
Subpackages#
Submodules#
Module contents#
- class trinity.buffer.operators.ExperienceOperator[源代码]#
基类:
ABCBase class for all experience operators in the Trinity framework. Operators are used to process experiences and perform some transformations based on them.
This interface will be deprecated in the future in favor of ExperienceOperatorV1, which supports asynchronous processing and access to auxiliary models. Do not implement new operators based on this interface. Please use ExperienceOperatorV1 instead.
- abstractmethod process(exps: List[Experience]) Tuple[List[Experience], Dict][源代码]#
Process a list of experiences and return a transformed list.
- 参数:
exps (List[Experience]) -- List of experiences to process, which contains all experiences generated by the Explorer in one explore step.
- 返回:
A tuple containing the processed list of experiences and a dictionary of metrics.
- 返回类型:
Tuple[List[Experience], Dict]
- class trinity.buffer.operators.ExperienceOperatorV1[源代码]#
基类:
ABCAn enhanced version of ExperienceOperator that runs asynchronously and has access to auxiliary models.
- abstractmethod async process(exps: List[Experience]) Tuple[List[Experience], Dict][源代码]#
Process a list of experiences and return a transformed list.
- 参数:
exps (List[Experience]) -- List of experiences to process, which contains all experiences generated by the Explorer in one explore step.
- 返回:
A tuple containing the processed list of experiences and a dictionary of metrics.
- 返回类型:
Tuple[List[Experience], Dict]
- trinity.buffer.operators.create_operators(operator_configs: List[OperatorConfig], auxiliary_models: Dict[str | int, List['AsyncOpenAI']] | None = None) List[ExperienceOperatorV1][源代码]#
Create a list of ExperienceOperatorV1 instances based on the provided operator configurations.
- 参数:
operator_configs (List[OperatorConfig]) -- List of operator configurations.
auxiliary_models (Dict[str | int, List["AsyncOpenAI"]], optional) -- A dictionary of auxiliary models that can be used by the operators. The keys are model identifiers and the values are lists of openai.AsyncOpenAI instances. Defaults to None.
- 返回:
List of instantiated ExperienceOperatorV1 objects.
- 返回类型:
List[ExperienceOperatorV1]