fix: use empty string instead of "null" for None tool content

When a tool message has content: None, using the literal string "null"
could confuse the model into thinking the tool returned that word.
Empty string is a safer sentinel for "no content".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
stevejaker 2026-03-10 15:09:41 -06:00
parent 5b61b54431
commit 464a5a128e

View file

@ -338,7 +338,7 @@ class SnowflakeConfig(SnowflakeBaseConfig, OpenAIGPTConfig):
# Get content - could be string, list, or None
content = tool_msg.get("content")
if content is None:
content = "null"
content = ""
elif isinstance(content, list):
# Flatten OpenAI multipart tool content to a plain string.
# Filter out empty strings from non-text parts (e.g., images).