Skip to content

StepResult

Namespace: Vercel.AI

public sealed class StepResult

One language-model step, including any tool results from that step.

Inheritance: object

View source

StepResult(string, string?, IReadOnlyList<GeneratedToolCall>, IReadOnlyList<ExecutedTool>, FinishReason, LanguageModelUsage, IReadOnlyList<GeneratedSource>, JsonElement?, IReadOnlyList<CallWarning>?, IReadOnlyList<GeneratedFile>?, string?, string?, IReadOnlyList<GeneratedContent>?, StepPerformance?, LanguageModelRequestMetadata?, StepResponse?, string?)

Section titled “StepResult(string, string?, IReadOnlyList<GeneratedToolCall>, IReadOnlyList<ExecutedTool>, FinishReason, LanguageModelUsage, IReadOnlyList<GeneratedSource>, JsonElement?, IReadOnlyList<CallWarning>?, IReadOnlyList<GeneratedFile>?, string?, string?, IReadOnlyList<GeneratedContent>?, StepPerformance?, LanguageModelRequestMetadata?, StepResponse?, string?)”
public StepResult(string text, string? reasoningText, IReadOnlyList<GeneratedToolCall> toolCalls, IReadOnlyList<ExecutedTool> toolResults, FinishReason finishReason, LanguageModelUsage usage, IReadOnlyList<GeneratedSource> sources, JsonElement? providerMetadata = null, IReadOnlyList<CallWarning>? warnings = null, IReadOnlyList<GeneratedFile>? files = null, string? provider = null, string? modelId = null, IReadOnlyList<GeneratedContent>? content = null, StepPerformance? performance = null, LanguageModelRequestMetadata? request = null, StepResponse? response = null, string? rawFinishReason = null)

Creates a step result.

Parameters

Name Type Description
text string
reasoningText string
toolCalls IReadOnlyList<GeneratedToolCall>
toolResults IReadOnlyList<ExecutedTool>
finishReason FinishReason
usage LanguageModelUsage
sources IReadOnlyList<GeneratedSource>
providerMetadata JsonElement?
warnings IReadOnlyList<CallWarning>
files IReadOnlyList<GeneratedFile>
provider string
modelId string
content IReadOnlyList<GeneratedContent>
performance StepPerformance
request LanguageModelRequestMetadata
response StepResponse
rawFinishReason string

View source

public IReadOnlyList<GeneratedContent> Content { get; }

Content the model generated in this step, in order, followed by the results of the client tools the loop ran. A call that failed to parse stays here as an Invalid call, followed by its error result. A GeneratedText carries its Citations, separate from the retrieved Sources.

Value: IReadOnlyList<GeneratedContent>

View source

public IReadOnlyList<GeneratedFile> Files { get; }

Files generated in this step.

Value: IReadOnlyList<GeneratedFile>

View source

public FinishReason FinishReason { get; }

Finish reason.

Value: FinishReason

View source

public string? ModelId { get; }

Model id of the model that produced this step, when known.

Value: string

View source

public StepPerformance Performance { get; }

Performance metrics of this step. Streaming-only metrics are <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a> for generateText.

Value: StepPerformance

View source

public string? Provider { get; }

Provider id of the model that produced this step, when known.

Value: string

View source

public JsonElement? ProviderMetadata { get; }

Provider metadata for this step, including cost and native-tool counts when the provider sent them.

Value: JsonElement?

View source

public string? RawFinishReason { get; }

The finish reason exactly as the provider reported it, or <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a> when the provider reported none. Maps to rawFinishReason.

Value: string

View source

public string? ReasoningText { get; }

Reasoning text generated in this step.

Value: string

View source

public LanguageModelRequestMetadata Request { get; }

Additional request information for this step. Body and Messages are set only when Include asks for them. Maps to request.

Value: LanguageModelRequestMetadata

View source

public StepResponse Response { get; }

Additional response information for this step, with the messages this step added to the conversation. Maps to response.

Value: StepResponse

View source

public IReadOnlyList<GeneratedSource> Sources { get; }

Sources cited in this step.

Value: IReadOnlyList<GeneratedSource>

View source

public string Text { get; }

Text generated in this step.

Value: string

View source

public IReadOnlyList<GeneratedToolCall> ToolCalls { get; }

Tool calls from this step.

Value: IReadOnlyList<GeneratedToolCall>

View source

public IReadOnlyList<ExecutedTool> ToolResults { get; }

Tool results from this step.

Value: IReadOnlyList<ExecutedTool>

View source

public LanguageModelUsage Usage { get; }

Usage for this step.

Value: LanguageModelUsage

View source

public IReadOnlyList<CallWarning> Warnings { get; }

Warnings reported for this step.

Value: IReadOnlyList<CallWarning>

View source

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