trinity.common.workflows.customized_toolcall_workflows module

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

trinity.common.workflows.customized_toolcall_workflows.construct_prompt(dp)[source]
trinity.common.workflows.customized_toolcall_workflows.validate_result(result, answer)[source]
trinity.common.workflows.customized_toolcall_workflows.validate_format(tool_call_list)[source]
trinity.common.workflows.customized_toolcall_workflows.extract_solution_v0(tool_call_str)[source]
trinity.common.workflows.customized_toolcall_workflows.compute_score_v0(solution_str, ground_truth, do_print=False)[source]
trinity.common.workflows.customized_toolcall_workflows.compute_toolcall_reward(solution_str: str, ground_truth: str) float[source]
class trinity.common.workflows.customized_toolcall_workflows.ToolCallWorkflow(*, task: Task, model: ModelWrapper, auxiliary_models: List[OpenAI] | None = None)[source]

Bases: SimpleWorkflow

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

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

reset(task: Task)[source]

Reset the workflow.

format_prompt()[source]
run() List[Experience][source]

Run workflow and return a list of experiences.