trinity.common.workflows.customized_toolcall_workflows module#

We include the customized toolcall workflows in this file. Code adapted from NVlabs/Tool-N1 Reference Paper https://arxiv.org/pdf/2505.00024 for further details.

trinity.common.workflows.customized_toolcall_workflows.construct_prompt(dp)[源代码]#
trinity.common.workflows.customized_toolcall_workflows.validate_result(result, answer)[源代码]#
trinity.common.workflows.customized_toolcall_workflows.validate_format(tool_call_list)[源代码]#
trinity.common.workflows.customized_toolcall_workflows.extract_solution_v0_toolN1(tool_call_str)[源代码]#
trinity.common.workflows.customized_toolcall_workflows.compute_score_v0_toolN1(solution_str, ground_truth, do_print=False)[源代码]#
trinity.common.workflows.customized_toolcall_workflows.compute_toolcall_reward(solution_str: str, ground_truth: str) float[源代码]#
class trinity.common.workflows.customized_toolcall_workflows.ToolCallWorkflow(*, task: Task, model: ModelWrapper, auxiliary_models: List[ModelWrapper] | None = None)[源代码]#

基类:SimpleWorkflow

A workflow for toolcall tasks. Prompt construction and reward function from NVlabs/Tool-N1

Only support qwen model for now. You can change the prompt construction and reward calculation by yourself for other models.

is_async: bool = True#
reset(task: Task)[源代码]#

Reset the workflow.

format_prompt()[源代码]#
async run_async() List[Experience][源代码]#

Run workflow in async and return a list of experiences.