Commit 4f22b56
authored
fix: emit native Bedrock invoke stream chunks (#144)
## Summary
- Fix `invoke-with-response-stream` to emit Anthropic-native Claude
invoke stream payloads wrapped in Bedrock EventStream `chunk` frames.
- Keep `converse-stream` on Converse-style camelCase payloads by moving
those builders into the Converse implementation.
- Add coverage for Bedrock invoke streaming tool-use deltas, including
`input_json_delta.partial_json`, so real `boto3` Bedrock Runtime
consumers can parse tool calls correctly.
## Why
`invoke_model_with_response_stream` and `converse_stream` are separate
Bedrock Runtime APIs with different stream payload shapes. The invoke
stream endpoint was returning Converse-style events such as
`contentBlockDelta` / `delta.toolUse.input`, but Anthropic native invoke
streams return events such as `content_block_delta` / `delta.type =
input_json_delta` / `delta.partial_json`.
This breaks clients that use
`boto3.client("bedrock-runtime").invoke_model_with_response_stream(...)`
and parse Anthropic Claude invoke payloads.
## Test plan
- `corepack pnpm -C /Users/jinku/sendbird/tmp/aimock test
src/__tests__/bedrock-stream.test.ts src/__tests__/bedrock.test.ts
src/__tests__/reasoning-all-providers.test.ts` — 176 passed
- `corepack pnpm -C /Users/jinku/sendbird/tmp/aimock test` — 2573
passed, 36 skipped5 files changed
Lines changed: 711 additions & 325 deletions
0 commit comments