Skip to content

streamWithBackupModels

function streamWithBackupModels<T>(attempt, opts): AsyncGenerator<T>;

Defined in: core/src/retry.ts:268

The streaming twin of withBackupModels, with the same commitment rule as withStreamRetry.

This is the correction worth naming: walking to a backup model AFTER chunks have already reached the consumer replays the answer from the top, in a different model’s voice, on top of text the caller has already rendered. So a stream that fails past its first chunk ends the walk, exactly as it ends a retry.

Type Parameter
T
Parameter Type
attempt (model) => AsyncIterable<T>
opts BackupModelOptions

AsyncGenerator<T>