Skip to content

fix: handle content_block_delta streaming deserialization fallback#1467

Open
nightcityblade wants to merge 1 commit intoanthropics:mainfrom
nightcityblade:fix/issue-941
Open

fix: handle content_block_delta streaming deserialization fallback#1467
nightcityblade wants to merge 1 commit intoanthropics:mainfrom
nightcityblade:fix/issue-941

Conversation

@nightcityblade
Copy link
Copy Markdown

Fixes #941

Summary

  • add a targeted fallback when a streamed content_block_delta event remains a raw dict after the generic union deserialization path
  • apply the same fallback in the beta streaming accumulator
  • add regression tests covering dict-shaped content_block_delta events in both standard and beta streaming paths

Testing

  • uv run ruff check src/anthropic/lib/streaming/_messages.py src/anthropic/lib/streaming/_beta_messages.py tests/lib/streaming/test_messages.py tests/lib/streaming/test_partial_json.py
  • uv run pytest tests/lib/streaming/test_messages.py tests/lib/streaming/test_partial_json.py -q -n 0

@nightcityblade nightcityblade requested a review from a team as a code owner April 29, 2026 03:14
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.

content_block_delta event not deserialized correctly during streaming

1 participant