Fix empty list in content on tool calls causing ollama parse error (#102)

This is related to google/adk-python#49
This commit is contained in:
Selcuk Gun 2025-04-12 17:34:57 -07:00 committed by GitHub
parent 089c1e6428
commit cfbcc17644
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -178,7 +178,7 @@ def _content_to_message_param(
return ChatCompletionAssistantMessage(
role=role,
content=_get_content(content.parts),
content=_get_content(content.parts) or None,
tool_calls=tool_calls or None,
)

View File

@ -536,7 +536,7 @@ def test_content_to_message_param_function_call():
content.parts[0].function_call.id = "test_tool_call_id"
message = _content_to_message_param(content)
assert message["role"] == "assistant"
assert message["content"] == []
assert message["content"] == None
assert message["tool_calls"][0].type == "function"
assert message["tool_calls"][0].id == "test_tool_call_id"
assert message["tool_calls"][0].function.name == "test_function"