FinishReason

public final class FinishReason


Represents the reason why the model stopped generating content.

Summary

Nested types

public static class FinishReason.Companion

Public fields

final @NonNull FinishReason

Token generation stopped because the content contains forbidden terms.

final @NonNull FinishReason

Image generation stopped because of other miscellaneous issue.

final @NonNull FinishReason

Image generation stopped because generated images have other prohibited content.

final @NonNull FinishReason

Image generation stopped due to recitation.

final @NonNull FinishReason

Token generation stopped because generated images contain safety violations.

final @NonNull FinishReason

The response candidate content was flagged for using an unsupported language.

final @NonNull FinishReason

The function call generated by the model is invalid.

final @NonNull FinishReason

Finished due to malformed response.

final @NonNull FinishReason

Model hit the token limit.

final @NonNull FinishReason

Request has at least one thought signature missing.

final @NonNull FinishReason

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

final @NonNull FinishReason

Model stopped for another reason.

final @NonNull FinishReason

Token generation stopped for potentially containing prohibited content.

final @NonNull FinishReason

The token generation was stopped because the response was flagged for unauthorized citations.

final @NonNull FinishReason

SafetySetting prevented the model from outputting content.

final @NonNull FinishReason

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

final @NonNull FinishReason

Model finished successfully and stopped.

final @NonNull FinishReason

Model called too many tools consecutively, thus the system exited execution.

final @NonNull FinishReason

Model generated a tool call but no tools were enabled in the request.

final @NonNull FinishReason

A new and not yet supported value.

final @NonNull String

The name of the finish reason.

final int

The ordinal value of the finish reason.

Public fields

BLOCKLIST

public final @NonNull FinishReason BLOCKLIST

Token generation stopped because the content contains forbidden terms.

IMAGE_OTHER

public final @NonNull FinishReason IMAGE_OTHER

Image generation stopped because of other miscellaneous issue.

IMAGE_PROHIBITED_CONTENT

public final @NonNull FinishReason IMAGE_PROHIBITED_CONTENT

Image generation stopped because generated images have other prohibited content.

IMAGE_RECITATION

public final @NonNull FinishReason IMAGE_RECITATION

Image generation stopped due to recitation.

IMAGE_SAFETY

public final @NonNull FinishReason IMAGE_SAFETY

Token generation stopped because generated images contain safety violations.

LANGUAGE

public final @NonNull FinishReason LANGUAGE

The response candidate content was flagged for using an unsupported language.

MALFORMED_FUNCTION_CALL

public final @NonNull FinishReason MALFORMED_FUNCTION_CALL

The function call generated by the model is invalid.

MALFORMED_RESPONSE

public final @NonNull FinishReason MALFORMED_RESPONSE

Finished due to malformed response.

MAX_TOKENS

public final @NonNull FinishReason MAX_TOKENS

Model hit the token limit.

MISSING_THOUGHT_SIGNATURE

public final @NonNull FinishReason MISSING_THOUGHT_SIGNATURE

Request has at least one thought signature missing.

NO_IMAGE

public final @NonNull FinishReason NO_IMAGE

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

OTHER

public final @NonNull FinishReason OTHER

Model stopped for another reason.

PROHIBITED_CONTENT

public final @NonNull FinishReason PROHIBITED_CONTENT

Token generation stopped for potentially containing prohibited content.

RECITATION

public final @NonNull FinishReason RECITATION

The token generation was stopped because the response was flagged for unauthorized citations.

SAFETY

public final @NonNull FinishReason SAFETY

SafetySetting prevented the model from outputting content.

SPII

public final @NonNull FinishReason SPII

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

STOP

public final @NonNull FinishReason STOP

Model finished successfully and stopped.

TOO_MANY_TOOL_CALLS

public final @NonNull FinishReason TOO_MANY_TOOL_CALLS

Model called too many tools consecutively, thus the system exited execution.

UNEXPECTED_TOOL_CALL

public final @NonNull FinishReason UNEXPECTED_TOOL_CALL

Model generated a tool call but no tools were enabled in the request.

UNKNOWN

public final @NonNull FinishReason UNKNOWN

A new and not yet supported value.

name

public final @NonNull String name

The name of the finish reason.

ordinal

public final int ordinal

The ordinal value of the finish reason.