Skip to content

GenerateTextResult

Namespace: Vercel.AI

public sealed class GenerateTextResult

Result of generateText.

Inheritance: object

View source

GenerateTextResult(string, string?, IReadOnlyList<StepResult>, FinishReason, LanguageModelUsage, JsonElement?, IReadOnlyList<GeneratedSource>, JsonElement?)

Section titled “GenerateTextResult(string, string?, IReadOnlyList<StepResult>, FinishReason, LanguageModelUsage, JsonElement?, IReadOnlyList<GeneratedSource>, JsonElement?)”
public GenerateTextResult(string text, string? reasoningText, IReadOnlyList<StepResult> steps, FinishReason finishReason, LanguageModelUsage usage, JsonElement? output, IReadOnlyList<GeneratedSource> sources, JsonElement? providerMetadata = null)

Creates a result.

Parameters

Name Type Description
text string
reasoningText string
steps IReadOnlyList<StepResult>
finishReason FinishReason
usage LanguageModelUsage
output JsonElement?
sources IReadOnlyList<GeneratedSource>
providerMetadata JsonElement?

View source

public IReadOnlyList<GeneratedContent> Content { get; }

Content from the last step. See Content.

Value: IReadOnlyList<GeneratedContent>

View source

public IReadOnlyList<GeneratedFile> Files { get; }

Files from every step.

Value: IReadOnlyList<GeneratedFile>

View source

public StepResult FinalStep { get; }

The last completed step.

Value: StepResult

View source

public FinishReason FinishReason { get; }

Finish reason of the last step.

Value: FinishReason

View source

public JsonElement? Output { get; }

Parsed structured output, when String) was used.

Value: JsonElement?

View source

public JsonElement? ProviderMetadata { get; }

Provider metadata from the last step.

Value: JsonElement?

View source

public string? ReasoningText { get; }

Reasoning from the last step.

Value: string

View source

public LanguageModelRequestMetadata Request { get; }

Additional request information of the last step. Maps to request. GenerateTextOptions has no include option yet, so Body and Messages are <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a>.

Value: LanguageModelRequestMetadata

View source

public StepResponse Response { get; }

Additional response information of the last step. Maps to response.

Value: StepResponse

View source

public IReadOnlyList<ModelMessage> ResponseMessages { get; init; }

Messages this call added to the conversation: the assistant message of each step, with any tool approval request, and the tool results the client ran. Pass them back with the caller’s approval responses to continue the conversation.

Value: IReadOnlyList<ModelMessage>

View source

public IReadOnlyList<GeneratedSource> Sources { get; }

Sources from every step.

Value: IReadOnlyList<GeneratedSource>

View source

public IReadOnlyList<StepResult> Steps { get; }

Every step.

Value: IReadOnlyList<StepResult>

View source

public string Text { get; }

Text from the last step.

Value: string

View source

public IReadOnlyList<GeneratedToolCall> ToolCalls { get; }

Tool calls from every step.

Value: IReadOnlyList<GeneratedToolCall>

View source

public IReadOnlyList<ExecutedTool> ToolResults { get; }

Tool results from every step.

Value: IReadOnlyList<ExecutedTool>

View source

public LanguageModelUsage Usage { get; }

Usage summed across steps.

Value: LanguageModelUsage

View source

public IReadOnlyList<CallWarning> Warnings { get; }

Warnings from every step.

Value: IReadOnlyList<CallWarning>

View source

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