Stream chat model events using the new content-block-centric protocol.
Override this method to provide native event streaming from the provider SDK.
The default implementation bridges from _streamResponseChunks by
synthesizing lifecycle events from ChatGenerationChunk objects.
MessageStart
-> ContentBlockStart(index, contentBlock)
-> ContentBlockDelta(index, delta) ...
-> ContentBlockFinish(index, contentBlock)
-> MessageFinish(reason, usage?)
Content blocks may interleave (e.g., parallel tool calls). The only invariant: a block's start precedes its deltas, and its deltas precede its finish.
_streamChatModelEvents(
messages: BaseMessage<MessageStructure<MessageToolSet>, MessageType>[],
options: Omit<CallOptions, "configurable" | "recursionLimit" | "runName" | "tags" | "metadata" | "callbacks" | "runId">,
runManager: CallbackManagerForLLMRun
): AsyncGenerator<ChatModelStreamEvent>| Name | Type | Description |
|---|---|---|
messages* | BaseMessage<MessageStructure<MessageToolSet>, MessageType>[] | The input messages. |
options* | Omit<CallOptions, "configurable" | "recursionLimit" | "runName" | "tags" | "metadata" | "callbacks" | "runId"> | Parsed call options. |
runManager | CallbackManagerForLLMRun | Optional callback manager for the run. |