From 1db05c881ddf7b3958edda7f99ff02cd49581f5f Mon Sep 17 00:00:00 2001 From: Re-bin Date: Tue, 17 Feb 2026 08:59:05 +0000 Subject: [PATCH] fix: omit empty content in assistant messages --- nanobot/agent/context.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nanobot/agent/context.py b/nanobot/agent/context.py index bed9e36..cfd6318 100644 --- a/nanobot/agent/context.py +++ b/nanobot/agent/context.py @@ -227,10 +227,8 @@ To recall past events, grep {workspace_path}/memory/HISTORY.md""" """ msg: dict[str, Any] = {"role": "assistant"} - # Only include the content key when there is non-empty text. - # Some LLM backends reject empty text blocks, so omit the key - # to avoid sending empty content entries. - if content is not None and content != "": + # Omit empty content — some backends reject empty text blocks + if content: msg["content"] = content if tool_calls: