Contents

init(stream:)

Creates a loader backed by the given async sequence.

Declaration

init(stream: some Sendable & AsyncSequence<Sample, any Error>)

Discussion

let loader = StreamLoader(stream: AsyncThrowingStream { continuation in
    continuation.yield(ModelSample(prompt: "What is 2+2?", expected: "4"))
    continuation.finish()
})