[Bug] OpenAI Chat drops file parts when message content is None
Author: MohammadHijjawi97Created Sep 17, 2026Updated Sep 17, 2026
Description
OpenAI Chat (and the DeepSeek copy of the same formatter) inserts file parts into message_dict["content"], then overwrites that list with "" whenever message.content is None. File-only user messages therefore lose every file part before the request is sent.
Steps to Reproduce
from agno.media import File
from agno.models.message import Message
from agno.models.openai.chat import OpenAIChat
model = OpenAIChat(id="gpt-4o-mini")
msg = Message(role="user", content=None, files=[File(url="https://example.com/doc.pdf")])
print(model._format_message(msg)["content"])Expected Behavior
The formatted message keeps the file part list.
Actual Behavior
content is reset to "", so the file is dropped.
Environment
- OS: Windows 11
- Agno Version: current main
- Additional Environment Details: Python 3.13
Possible Solutions (optional)
Only force content to "" when the formatted content is not already a non-empty part list.
Source: agno-agi/agno