throttleStream
throttleStream(
stream,intervalMs):IRChatStream
Defined in: streaming.ts:1002
Create a throttled version of a stream that limits how often chunks are yielded. Batches content chunks that arrive faster than the interval. Unlike rateLimitStream, this merges content chunks rather than delaying them.
Parameters
Section titled “Parameters”stream
Section titled “stream”The source stream
intervalMs
Section titled “intervalMs”number
Minimum milliseconds between yields
Returns
Section titled “Returns”Example
Section titled “Example”// Update UI at most every 50msfor await (const chunk of throttleStream(stream, 50)) { updateUI(chunk);}