Skip to main content

Module stream

Module stream 

Source
Expand description

Real streaming adapter for Bedrock’s /converse-stream endpoint.

Parses AWS eventstream frames into StreamChunks so callers see text deltas and tool-call argument deltas as they arrive, rather than waiting for the full response.

Bedrock event types handled:

  • messageStart → ignored (role is always assistant)
  • contentBlockStartStreamChunk::ToolCallStart (only for tool blocks)
  • contentBlockDeltaStreamChunk::Text or StreamChunk::ToolCallDelta
  • contentBlockStopStreamChunk::ToolCallEnd (only for open tool blocks)
  • messageStop → ignored (finish reason is carried by Done)
  • metadata → captured into usage, emitted at Done
  • exception / errorStreamChunk::Error