Skip to content

OpenAICompatibleSseResponse

Namespace: Vercel.AI.OpenAICompatible

public sealed class OpenAICompatibleSseResponse : IDisposable

An open SSE response. The caller disposes it.

Inheritance: object

Implements: IDisposable

View source

OpenAICompatibleSseResponse(HttpResponseMessage)

Section titled “OpenAICompatibleSseResponse(HttpResponseMessage)”
public OpenAICompatibleSseResponse(HttpResponseMessage response)

Creates a response wrapper.

Parameters

Name Type Description
response HttpResponseMessage

View source

public IReadOnlyDictionary<string, string> Headers { get; }

Response headers.

Value: IReadOnlyDictionary<string, string>

View source

public void Dispose()

Disposes the HTTP response.

View source

public IAsyncEnumerable<string> ReadAsync(CancellationToken cancellationToken = default)

Reads SSE data payloads until [DONE].

Parameters

Name Type Description
cancellationToken CancellationToken

Returns: IAsyncEnumerable<string>

View source

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