consumeStream
Drain a stream to completion, discarding output.
Runs a stream to the end without collecting it. Use it when the work matters
but the output does not, such as making sure onFinish fires and the run is
persisted even if the client disconnected.
try await consumeStream(stream: result.fullStream)Signature
func consumeStream(
_ chunks: AsyncThrowingStream<UIMessageChunk, Error>,
onError: (@Sendable (Error) async -> Void)? = nil
) asyncDefined in Sources/AI/Transport/TextStreamChatTransport.swift.
Parameters
| Parameter | Type | Default |
|---|---|---|
_ | AsyncThrowingStream<UIMessageChunk, Error> | required |
onError | (@Sendable (Error) async -> Void)? | nil |
Overloads
1 other form of this function exists:
func consumeStream(
_ parts: AsyncThrowingStream<TextStreamPart, Error>,
onError: (@Sendable (Error) async -> Void)? = nil
) asyncReturns
Nothing.