Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions python/packages/core/agent_framework/_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,8 @@ def convert_message(message: Message) -> list[dict[str, Any]]:
"type": "tool_call",
"tool_call_id": c.call_id or "",
"name": c.name or "",
"arguments": args if args is not None else {},
}
if args:
tc["arguments"] = args
content_items.append(tc)
elif c.type == "function_result":
result_val = c.result
Expand Down
20 changes: 20 additions & 0 deletions python/packages/foundry/tests/test_foundry_evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,26 @@ def test_assistant_with_tool_call(self) -> None:
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_1", name="get_site_summary", arguments=None)],
)

result = AgentEvalConverter.convert_message(msg)

assert result[0]["content"][0]["arguments"] == {}

def test_assistant_with_empty_argument_object_tool_call(self) -> None:
msg = Message(
"assistant",
[Content.from_function_call(call_id="call_1", name="get_site_summary", arguments={})],
)

result = AgentEvalConverter.convert_message(msg)

assert result[0]["content"][0]["arguments"] == {}

def test_assistant_text_and_tool_call(self) -> None:
msg = Message(
"assistant",
Expand Down
Loading