Skip to content

UIMessageChunkStreamResult

Namespace: Vercel.AI.AspNetCore

public sealed class UIMessageChunkStreamResult : IResult

SSE response for UI message chunks that are already built.

Inheritance: object

Implements: IResult

View source

UIMessageChunkStreamResult(IReadOnlyList<JsonObject>, int, IReadOnlyList<KeyValuePair<string, string>>?)

Section titled “UIMessageChunkStreamResult(IReadOnlyList<JsonObject>, int, IReadOnlyList<KeyValuePair<string, string>>?)”
public UIMessageChunkStreamResult(IReadOnlyList<JsonObject> chunks, int statusCode = 200, IReadOnlyList<KeyValuePair<string, string>>? headers = null)

Creates a response that frames <code class=“paramref”>chunks</code> and then writes data: [DONE].

Parameters

Name Type Description
chunks IReadOnlyList<JsonObject> Chunk objects, in order.
statusCode int HTTP status code. Defaults to 200.
headers IReadOnlyList<KeyValuePair<string, string>> Extra headers. Repeated names, including Set-Cookie, are all written.

View source

public Task ExecuteAsync(HttpContext httpContext)

Write an HTTP response reflecting the result.

Parameters

Name Type Description
httpContext HttpContext The HttpContext for the current request.

Returns: Task — A task that represents the asynchronous execute operation.

View source

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