trinity.common.workflows.agentscope_workflow module#

class trinity.common.workflows.agentscope_workflow.AgentScopeWorkflowAdapter(*, task: Task, model: ModelWrapper, auxiliary_models: List[OpenAI] | None = None)[source]#

Bases: Workflow

Adapter to wrap a agentscope trainable workflow function into a Trinity Workflow.

is_async: bool = True#
__init__(*, task: Task, model: ModelWrapper, auxiliary_models: List[OpenAI] | None = None)[source]#

Initialize the adapter with the task and model.

workflow_func: Callable[[Dict, TrinityChatModel], Awaitable[float]]#
chat_model: TrinityChatModel#
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.