StreamTextResult
Namespace: Vercel.AI
public sealed class StreamTextResultResult of streamText. Enumerating Stream(CancellationToken) or awaiting Text consumes the same buffered events.
Inheritance: object
Properties
Section titled “Properties”FinishReason
Section titled “FinishReason”public Task<FinishReason> FinishReason { get; }Finish reason. Completes when the stream finishes.
Value: Task<FinishReason>
Request
Section titled “Request”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>
Response
Section titled “Response”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>
public Task<IReadOnlyList<StepResult>> Steps { get; }Completed steps. Completes when the stream finishes.
Value: Task<IReadOnlyList<StepResult>>
public Task<string> Text { get; }Full text from the last step. Completes when the stream finishes.
Value: Task<string>
public Task<LanguageModelUsage> Usage { get; }Total usage. Completes when the stream finishes.
Value: Task<LanguageModelUsage>
Methods
Section titled “Methods”Stream(CancellationToken)
Section titled “Stream(CancellationToken)”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>
TextStream(CancellationToken)
Section titled “TextStream(CancellationToken)”public IAsyncEnumerable<string> TextStream(CancellationToken cancellationToken = default)Text deltas only.
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken |
CancellationToken |
Returns: IAsyncEnumerable<string>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product