trinity.common.workflows.agentscope.react.react_workflow module#

An example workflow using AgentScope's ReAct agent to solve tasks.

This workflow is a demonstration of how to integrate the AgentScope framework within the Trinity-RFT workflow system with minimal modifications.

class trinity.common.workflows.agentscope.react.react_workflow.AgentScopeReActWorkflow(*, task: Task, model: ModelWrapper, auxiliary_models: List[ModelWrapper] | None = None)[源代码]#

基类:Workflow

is_async: bool = True#
__init__(*, task: Task, model: ModelWrapper, auxiliary_models: List[ModelWrapper] | None = None)[源代码]#
async run_async()[源代码]#

Run the workflow asynchronously.

async calculate_reward(response) float | Dict[str, float][源代码]#

Calculate the reward for the workflow.

返回:

The reward value or a dictionary of reward value.

返回类型:

Union[float, Dict[str, float]]

construct_experiences(reward: float | Dict[str, float]) List[Experience][源代码]#

Construct experiences from the agent's interaction history.

参数:

reward (Union[float, Dict[str, float]]) -- The reward value to assign to each experience.

返回:

A list of Experience objects.

返回类型:

List