Skip to content

StreamTextResult

Namespace: Vercel.AI

public sealed class StreamTextResult

Result of streamText. Enumerating Stream(CancellationToken) or awaiting Text consumes the same buffered events.

Inheritance: object

View source

public Task<FinishReason> FinishReason { get; }

Finish reason. Completes when the stream finishes.

Value: Task<FinishReason>

View source

public Task<LanguageModelRequestMetadata> Request { get; }

Additional request information of the last step. Body and Messages are set only when Include asks for them. Completes when the stream finishes. Maps to request.

Value: Task<LanguageModelRequestMetadata>

View source

public Task<StepResponse> Response { get; }

Additional response information of the last step, with the messages that step added. Completes when the stream finishes. Maps to response.

Value: Task<StepResponse>

View source

public Task<IReadOnlyList<StepResult>> Steps { get; }

Completed steps. Completes when the stream finishes.

Value: Task<IReadOnlyList<StepResult>>

View source

public Task<string> Text { get; }

Full text from the last step. Completes when the stream finishes.

Value: Task<string>

View source

public Task<LanguageModelUsage> Usage { get; }

Total usage. Completes when the stream finishes.

Value: Task<LanguageModelUsage>

View source

public IAsyncEnumerable<TextStreamPart> Stream(CancellationToken cancellationToken = default)

Every stream part, including tool calls, tool results, and finish.

Parameters

Name Type Description
cancellationToken CancellationToken

Returns: IAsyncEnumerable<TextStreamPart>

View source

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

Text deltas only.

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