| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found related PRs but no direct duplicates of PR #14586: Related PRs:
These are related to content filtering improvements, but none appear to be addressing the exact same issue (filtering empty content blocks for Bedrock specifically with the normalizeMessages() function). No duplicate PRs found |
Sorry, something went wrong.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Sorry, something went wrong.
|
Tested this exact failure pattern in production usage with Bedrock Claude in OpenCode:\n\nundefined: The content field in the Message object at messages.X is empty\n\nI dug into the transform path and confirmed the root cause aligns with this PR: empty text/reasoning filtering currently runs for @ai-sdk/anthropic but not @ai-sdk/amazon-bedrock, so Bedrock Converse receives empty content arrays and rejects the request.\n\nFor Bedrock-only users, this is a hard blocker because there is no config-level workaround that preserves thinking behavior. Disabling thinking reduces frequency but is not an equivalent fix.\n\nWould appreciate prioritizing merge/release of this patch when possible - it unblocks a significant Bedrock Claude workflow. |
Sorry, something went wrong.
| return msgs | ||
| .map((msg) => { | ||
| if (msg.role === "assistant" && Array.isArray(msg.content)) { |
There was a problem hiding this comment.
why change this unrelated stuff?
Sorry, something went wrong.
There was a problem hiding this comment.
Done. Stripped it down to just this change + 1 test. The interleaved block change was addressing a second code path where reasoning-only messages could end up with empty content after stripping, but that's a separate concern. Removed it.
Sorry, something went wrong.
|
|
||
| test("keeps non-text/reasoning parts even if text parts are empty", () => { | ||
| test("drops assistant message that has only reasoning parts", () => { |
There was a problem hiding this comment.
hm im not sure if this one is correct
Sorry, something went wrong.
There was a problem hiding this comment.
Removed. I was trying to cover a second path where the interleaved filter at line 136 could produce empty content arrays after stripping reasoning parts. But you're right, it's unrelated to the core empty content guard fix. Can be a separate PR if needed.
Sorry, something went wrong.
There was a problem hiding this comment.
oh yeah separate would be good, I think I tried to solve this across the board in the past but didn't properly check reasoning_details and reasoning_content fields or something and it broke stuff. Ideally we circle back w/ the across the board solution to prevent these patches for individual providers but I just wanna be very throughout w/ across the board stuff cause it is so finicky
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Issue for this PR
Closes #11210
Type of change
What does this PR do?
normalizeMessages() filters empty text/reasoning parts for @ai-sdk/anthropic but not @ai-sdk/amazon-bedrock. The Bedrock Converse API has the same constraint — empty content arrays cause "content field is empty" and invalid cache point errors that permanently break the session. Extended the existing guard to also cover Bedrock.
Note: this fixes the empty content filtering side of #11210. The separate Bedrock ConverseAPI tool call issues flagged in the thread will need a follow-up.
How did you verify your code works?
Screenshots / recordings
N/A — backend logic change.
Checklist