Skip to content

SseParser

Namespace: Vercel.AI.ProviderUtils

public static class SseParser

Reads Server-Sent Events data: lines.

Inheritance: object

View source

public static IAsyncEnumerable<string> ReadDataAsync(Stream stream, CancellationToken cancellationToken = default)

Yields event data. A data: [DONE] line ends the stream. Multi-line data fields are joined with newlines.

Parameters

Name Type Description
stream Stream
cancellationToken CancellationToken

Returns: IAsyncEnumerable<string>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product