Skip to content

fix: send null content for tool-only assistant messages#506

Merged
robert-j-y merged 2 commits into
mainfrom
robertyeakel/sdk-443-send-null-content-for-tool-only-assistant-messages
Jun 10, 2026
Merged

fix: send null content for tool-only assistant messages#506
robert-j-y merged 2 commits into
mainfrom
robertyeakel/sdk-443-send-null-content-for-tool-only-assistant-messages

Conversation

@robert-j-y

Copy link
Copy Markdown
Contributor

Description

Fixes SDK-443: Assistant messages that contain only tool calls (no text parts) were sending content: "" (empty string), which breaks AWS Bedrock Nova with The text field in the ContentBlock object ... is blank.

The fix changes content: text to content: text || null in the assistant message handler of convertToOpenRouterChatMessages, so tool-only assistant messages emit content: null instead of an empty string. This matches the fix Vercel shipped for the same issue in @ai-sdk/openai-compatible.

Checklist

  • I have run pnpm stylecheck and pnpm typecheck
  • I have run pnpm test and all tests pass
  • I have added tests for my changes (if applicable)
  • I have updated documentation (if applicable)

Changeset

  • I have run pnpm changeset to create a changeset file

Made with Cursor

robert-j-y and others added 2 commits June 10, 2026 15:26
Assistant messages that contain only tool calls (no text) were sending
`content: ""` which breaks AWS Bedrock Nova with "The text field in
the ContentBlock object is blank." Send `content: null` instead.

Fixes SDK-443

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@robert-j-y robert-j-y merged commit e9cff3a into main Jun 10, 2026
2 checks passed
@robert-j-y robert-j-y deleted the robertyeakel/sdk-443-send-null-content-for-tool-only-assistant-messages branch June 10, 2026 22:35
@github-actions github-actions Bot mentioned this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant