feat(testing): add fixed tool simulations

This commit is contained in:
Xin Wang
2026-08-26 09:36:37 +08:00
parent 26582bfb87
commit 239b9027ca
16 changed files with 1525 additions and 237 deletions
+8
View File
@@ -154,6 +154,14 @@ async def create_test_run(
raise HTTPException(422, f"用例“{row.name}”校验失败: {exc}") from exc
definitions_by_id[row.id] = definition
has_image_input = has_image_input or bool(image_asset_ids(definition))
for simulation in definition.tool_simulations:
tool = tools_by_id.get(simulation.tool_id)
if tool is None or tool.function_name != simulation.function_name:
raise HTTPException(
422,
f"用例“{row.name}”引用的工具 {simulation.function_name} "
"不属于当前被测助手",
)
for turn in definition.turns:
for behavior in turn.behaviors:
if behavior.type != "tool_call":