fix: skip empty content in _convert_messages to prevent errors

Alessandro committed Feb 19, 2026 at 15:04 UTC a7df75a9dd4908798c826f7d1cedca6c0da741a8
1 file changed +5
models.py
+5
@@ -361,6 +361,11 @@ class LiteLLMChatWrapper(SimpleChatModel):
361 if tool_call_id:
362 message_dict["tool_call_id"] = tool_call_id
363
364 + # Skip messages with empty content
365 + content = message_dict.get("content")
366 + has_content = bool(content) if not isinstance(content, list) else len(content) > 0
367 + if not has_content:
368 + continue
369 result.append(message_dict)
370
371 if explicit_caching and result: