Table of Contents

Struct FinishReason

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.

[JsonConverter(typeof(FinishReasonConverter))]
public readonly record struct FinishReason : IEquatable<FinishReason>
Implements
Inherited Members

Properties

AllValues

public static IReadOnlyList<FinishReason> AllValues { get; }

Property Value

IReadOnlyList<FinishReason>

Blocklist

Token generation stopped because the content contains forbidden terms.

public static FinishReason Blocklist { get; }

Property Value

FinishReason

FinishReasonUnspecified

The finish reason is unspecified.

public static FinishReason FinishReasonUnspecified { get; }

Property Value

FinishReason

ImageOther

Image generation stopped for a reason not otherwise specified.

public static FinishReason ImageOther { get; }

Property Value

FinishReason

ImageProhibitedContent

Image generation stopped because the generated images have prohibited content.

public static FinishReason ImageProhibitedContent { get; }

Property Value

FinishReason

ImageRecitation

Image generation stopped because the generated image may be a recitation from a source.

public static FinishReason ImageRecitation { get; }

Property Value

FinishReason

ImageSafety

Token generation stopped because generated images have safety violations.

public static FinishReason ImageSafety { get; }

Property Value

FinishReason

Language

The token generation stopped because of using an unsupported language.

public static FinishReason Language { get; }

Property Value

FinishReason

MalformedFunctionCall

The function call generated by the model is invalid.

public static FinishReason MalformedFunctionCall { get; }

Property Value

FinishReason

MaxTokens

Token generation reached the configured maximum output tokens.

public static FinishReason MaxTokens { get; }

Property Value

FinishReason

NoImage

The model was expected to generate an image, but none was generated.

public static FinishReason NoImage { get; }

Property Value

FinishReason

Other

All other reasons that stopped the token generation.

public static FinishReason Other { get; }

Property Value

FinishReason

ProhibitedContent

Token generation stopped for potentially containing prohibited content.

public static FinishReason ProhibitedContent { get; }

Property Value

FinishReason

Recitation

The token generation stopped because of potential recitation.

public static FinishReason Recitation { get; }

Property Value

FinishReason

Safety

Token generation stopped because the content potentially contains safety violations. NOTE: When streaming, [content][] is empty if content filters blocks the output.

public static FinishReason Safety { get; }

Property Value

FinishReason

Spii

Token generation stopped because the content potentially contains Sensitive Personally Identifiable Information (SPII).

public static FinishReason Spii { get; }

Property Value

FinishReason

Stop

Token generation reached a natural stopping point or a configured stop sequence.

public static FinishReason Stop { get; }

Property Value

FinishReason

UnexpectedToolCall

The tool call generated by the model is invalid.

public static FinishReason UnexpectedToolCall { get; }

Property Value

FinishReason

Value

public string Value { get; }

Property Value

string

Methods

Equals(FinishReason)

public bool Equals(FinishReason other)

Parameters

other FinishReason

Returns

bool

FromString(string)

public static FinishReason FromString(string value)

Parameters

value string

Returns

FinishReason

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

implicit operator FinishReason(string)

public static implicit operator FinishReason(string value)

Parameters

value string

Returns

FinishReason