Skip to main content
RunAnywhere.llm.generateStream returns an AsyncThrowingStream of GenerationEvent. Use it for anything a person is waiting on.

Basic usage

Signatures

Handling every event

Where errors surface

The call itself throws when no model can be loaded. A failure during generation is thrown into the stream, so wrap the loop:

Driving SwiftUI

Cancelling

The stream stops when the enclosing Task is cancelled.