fix(converters): handle empty list content as null, clean up test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
rayhpeng
2026-04-04 09:04:37 +08:00
parent bfbb3e1b8d
commit 17c8dbd9aa
2 changed files with 1 additions and 5 deletions
@@ -56,7 +56,7 @@ def langchain_to_openai_message(message: Any) -> dict:
},
})
# If no text content, set content to null per OpenAI spec
result["content"] = content if (isinstance(content, list) or content) else None
result["content"] = content if (isinstance(content, list) and content) or (isinstance(content, str) and content) else None
result["tool_calls"] = openai_tool_calls
else:
result["content"] = content