FinishReason

public final classFinishReason


This class is deprecated.
The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk

Represents the reason why the model stopped generating content.

Summary

Nested types

public static classFinishReason.Companion

Public fields

final @NonNullFinishReason

Token generation stopped because the content contains forbidden terms.

final @NonNullFinishReason

The function call generated by the model is invalid.

final @NonNullFinishReason

Model hit the token limit.

final @NonNullFinishReason

Model stopped for another reason.

final @NonNullFinishReason

Token generation stopped for potentially containing prohibited content.

final @NonNullFinishReason

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

final @NonNullFinishReason

SafetySetting prevented the model from outputting content.

final @NonNullFinishReason

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

final @NonNullFinishReason

Model finished successfully and stopped.

final @NonNullFinishReason

A new and not yet supported value.

final @NonNullString

The name of the finish reason.

final int

The ordinal value of the finish reason.

Public fields

BLOCKLIST

public final @NonNullFinishReason BLOCKLIST

Token generation stopped because the content contains forbidden terms.

MALFORMED_FUNCTION_CALL

public final @NonNullFinishReason MALFORMED_FUNCTION_CALL

The function call generated by the model is invalid.

MAX_TOKENS

public final @NonNullFinishReason MAX_TOKENS

Model hit the token limit.

OTHER

public final @NonNullFinishReason OTHER

Model stopped for another reason.

PROHIBITED_CONTENT

public final @NonNullFinishReason PROHIBITED_CONTENT

Token generation stopped for potentially containing prohibited content.

RECITATION

public final @NonNullFinishReason RECITATION

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

SAFETY

public final @NonNullFinishReason SAFETY

SafetySetting prevented the model from outputting content.

SPII

public final @NonNullFinishReason SPII

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

STOP

public final @NonNullFinishReason STOP

Model finished successfully and stopped.

UNKNOWN

public final @NonNullFinishReason UNKNOWN

A new and not yet supported value.

name

public final @NonNullString name

The name of the finish reason.

ordinal

public final int ordinal

The ordinal value of the finish reason.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.