The initial chat context of this stream.
The connection options for this stream.
The function context of this stream.
Collect the entire stream into a single response.
const response = await myLlm.chat({ chatCtx, toolCtx }).collect();
for (const tc of response.toolCalls) {
// execute the tool call...
}
Streaming response handler for Anthropic Messages API.
Remarks
Parses SSE events including:
content_block_start/content_block_delta/content_block_stopfor text and tool usemessage_start/message_deltafor token usage tracking<thinking>block filtering when tools are active