chunks_to_events(
chunks: Iterator[ChatGenerationChunk],
*,
message_id: str | None = None| Name | Type | Description |
|---|---|---|
chunks* | Iterator[ChatGenerationChunk] | |
message_id | str | None | Default: None |
Convert a stream of ChatGenerationChunk to protocol events.
Blocks stream one at a time: when a chunk carries a different block
identifier than the currently-open one, the open block is finished
before the new block starts, matching the protocol's no-interleave
rule. Source-side identifiers (from the block's index field, which
may be int or string) are translated to sequential uint wire
indices.
Iterator of ChatGenerationChunk from _stream().
Optional stable message ID.