fix: filter empty content blocks for Bedrock provider

Merged
TO
8mo ago
+33-1

Issue for this PR

Closes #11210

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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?

  • bun turbo typecheck passes
  • Added 6 tests mirroring the existing anthropic empty content filtering suite, all pass
  • Existing tests unchanged and passing

Screenshots / recordings

N/A — backend logic change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR