Skip to content

Commit d44eb89

Browse files
committed
Fix empty text blocks in Claude API calls
1 parent f93e2e2 commit d44eb89

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ansari/agents/ansari_claude.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,9 @@ def _finish_response(self, assistant_text, tool_calls):
790790
if content_blocks:
791791
message_content = content_blocks
792792
else:
793-
# If no content blocks, use a single empty text element
794-
message_content = [{"type": "text", "text": ""}]
793+
# If no content blocks, use a fallback non-empty text element
794+
# Claude API requires text content blocks to be non-empty
795+
message_content = [{"type": "text", "text": "I'm processing your request."}]
795796

796797
# Create the assistant message for the message history
797798
# Don't include tool_name in the message sent to Claude API

0 commit comments

Comments
 (0)