8000 Fix empty list in content on tool calls causing ollama parse error (#… · DyProgrammerDy/adk-python@cfbcc17 · GitHub
[go: up one dir, main page]

Skip to content

Commit cfbcc17

Browse files
authored
Fix empty list in content on tool calls causing ollama parse error (google#102)
This is related to google#49
1 parent 089c1e6 commit cfbcc17

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/google/adk/models/lite_llm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def _content_to_message_param(
178178

179179
return ChatCompletionAssistantMessage(
180180
role=role,
181-
content=_get_content(content.parts),
181+
content=_get_content(content.parts) or None,
182182
tool_calls=tool_calls or None,
183183
)
184184

tests/unittests/models/test_litellm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def test_content_to_message_param_function_call():
536536
content.parts[0].function_call.id = "test_tool_call_id"
537537
message = _content_to_message_param(content)
538538
assert message["role"] == "assistant"
539-
assert message["content"] == []
539+
assert message["content"] == None
540540
assert message["tool_calls"][0].type == "function"
541541
assert message["tool_calls"][0].id == "test_tool_call_id"
542542
assert message["tool_calls"][0].function.name == "test_function"

0 308D commit comments

Comments
 (0)
0