trinity.common.workflows.agentscope_workflow module#
- class trinity.common.workflows.agentscope_workflow.AgentScopeWorkflowAdapter(*, task: Task, model: ModelWrapper, auxiliary_models: List[ModelWrapper] | None = None)[source]#
Bases:
WorkflowAdapter to wrap a agentscope trainable workflow function into a Trinity Workflow. Only for agentscope versions between 1.0.7 and 1.0.11. For agentscope >= 1.0.12, please use AgentScopeWorkflowAdapterV1.
- is_async: bool = True#
- __init__(*, task: Task, model: ModelWrapper, auxiliary_models: List[ModelWrapper] | None = None)[source]#
Initialize the adapter with the task and model.
- construct_experiences(reward: float) List[Experience][source]#
Construct experiences from the agent’s interaction history.
- Parameters:
reward (float) – The reward value to assign to each experience.
- Returns:
A list of Experience objects.
- Return type:
List
- async run_async() List[Experience][source]#
Run the workflow asynchronously and return experiences.
- class trinity.common.workflows.agentscope_workflow.AgentScopeWorkflowAdapterV1(*, task: Task, model: ModelWrapper, auxiliary_models: List[ModelWrapper] | None = None)[source]#
Bases:
WorkflowA more general adapter to wrap agentscope trainable workflow and judge functions into a Trinity Workflow. Only for agentscope versions >= 1.0.12.
- is_async: bool = True#
- __init__(*, task: Task, model: ModelWrapper, auxiliary_models: List[ModelWrapper] | None = None)[source]#
Initialize the adapter with the task and model.
- construct_experiences(reward: float, metrics: Dict) List[Experience][source]#
Construct experiences from the agent’s interaction history.
- Parameters:
reward (float) – The reward value to assign to each experience.
metrics (Dict) – A dictionary of metrics to be attached to the last experience.
- Returns:
A list of Experience objects.
- Return type:
List
- async run_async() List[Experience][source]#
Run the workflow asynchronously and return experiences.