Python: FoundryEvals always emits arguments field for tool calls (#7734)

* Python: always emit arguments field for tool calls in AgentEvalConverter

FoundryEvals uploaded tool_call content items without an arguments
field when a tool call had no model-supplied arguments. Foundry's
tool-aware evaluators (task_adherence, tool_output_utilization,
tool_call_accuracy) require the arguments field to always be present,
so zero-argument tool calls caused evaluation to fail with
FAILED_EXECUTION. Default to an empty object instead of omitting the
field.

* Python: only default arguments to {} when None, not on falsy values

Addresses Copilot review feedback: a truthiness check would also
overwrite valid but falsy parsed arguments (e.g. 0, "", False) with
{}. Use an explicit None check so only missing arguments are defaulted.
This commit is contained in:
Sadok Barbouche
2026-08-21 06:51:42 +00:00
committed by GitHub
parent 24a383613b
commit 007a2d7a05
2 changed files with 18 additions and 2 deletions
@@ -797,8 +797,7 @@ class AgentEvalConverter:
"tool_call_id": c.call_id or "",
"name": c.name or "",
}
if args:
tc["arguments"] = args
tc["arguments"] = args if args is not None else {}
content_items.append(tc)
elif c.type == "function_result":
result_val = c.result
@@ -153,6 +153,23 @@ class TestConvertMessage:
assert tc["name"] == "get_weather"
assert tc["arguments"] == {"location": "Seattle"}
def test_assistant_with_zero_argument_tool_call(self) -> None:
msg = Message(
"assistant",
[
Content.from_function_call(
call_id="call_3",
name="get_site_summary",
arguments=None,
),
],
)
result = AgentEvalConverter.convert_message(msg)
tc = result[0]["content"][0]
assert tc["type"] == "tool_call"
assert "arguments" in tc
assert tc["arguments"] == {}
def test_assistant_text_and_tool_call(self) -> None:
msg = Message(
"assistant",