Enum FinishReason.Known

java.lang.Object
java.lang.Enum<FinishReason.Known>
com.google.genai.types.FinishReason.Known
All Implemented Interfaces:
Serializable, Comparable<FinishReason.Known>
Enclosing class:
FinishReason

public static enum FinishReason.Known extends Enum<FinishReason.Known>
Enum representing the known values for FinishReason.
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The model stopped generating because the content contains a term from a configured blocklist.
    Token generation was stopped because the response reached the per-request token limit, but generation is not yet complete.
    Request was filtered by an escalation rule.
    The finish reason is unspecified.
    The image generation stopped for a reason not otherwise specified.
    The generated image may contain prohibited content.
    The generated image may be a recitation from a source.
    The generated image potentially violates safety policies.
    The response candidate content was flagged for using an unsupported language.
    The model generated a function call that is syntactically invalid and can't be parsed.
    Finishes due to malformed response.
    The model generated the maximum number of tokens allowed by the `max_output_tokens` parameter.
    Request has at least one thought signature missing.
    The model response was blocked by Model Armor.
    The model was expected to generate an image, but didn't.
    The model stopped generating for a reason not otherwise specified.
    The model stopped generating because the content may be prohibited.
    Indicates that token generation stopped because the user account is limited or disabled due to Prohibited Use Policy (PUP) violations.
    The model stopped generating because the content may be a recitation from a source.
    The model stopped generating because the content potentially violates safety policies.
    The model stopped generating because the content may contain sensitive personally identifiable information (SPII).
    The model reached a natural stopping point or a configured stop sequence.
    The model made too many tool calls in a single request, so the server-side tool loop stopped before the model returned a final answer.
    The model generated a function call that is semantically invalid.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Enum

    compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • FINISH_REASON_UNSPECIFIED

      public static final FinishReason.Known FINISH_REASON_UNSPECIFIED
      The finish reason is unspecified.
    • STOP

      public static final FinishReason.Known STOP
      The model reached a natural stopping point or a configured stop sequence.
    • MAX_TOKENS

      public static final FinishReason.Known MAX_TOKENS
      The model generated the maximum number of tokens allowed by the `max_output_tokens` parameter.
    • SAFETY

      public static final FinishReason.Known SAFETY
      The model stopped generating because the content potentially violates safety policies. NOTE: When streaming, the `content` field is empty if content filters block the output.
    • RECITATION

      public static final FinishReason.Known RECITATION
      The model stopped generating because the content may be a recitation from a source.
    • LANGUAGE

      public static final FinishReason.Known LANGUAGE
      The response candidate content was flagged for using an unsupported language. This enum value is not supported in Vertex AI.
    • OTHER

      public static final FinishReason.Known OTHER
      The model stopped generating for a reason not otherwise specified.
    • BLOCKLIST

      public static final FinishReason.Known BLOCKLIST
      The model stopped generating because the content contains a term from a configured blocklist.
    • PROHIBITED_CONTENT

      public static final FinishReason.Known PROHIBITED_CONTENT
      The model stopped generating because the content may be prohibited.
    • SPII

      public static final FinishReason.Known SPII
      The model stopped generating because the content may contain sensitive personally identifiable information (SPII).
    • MALFORMED_FUNCTION_CALL

      public static final FinishReason.Known MALFORMED_FUNCTION_CALL
      The model generated a function call that is syntactically invalid and can't be parsed.
    • IMAGE_SAFETY

      public static final FinishReason.Known IMAGE_SAFETY
      The generated image potentially violates safety policies.
    • IMAGE_PROHIBITED_CONTENT

      public static final FinishReason.Known IMAGE_PROHIBITED_CONTENT
      The generated image may contain prohibited content.
    • IMAGE_OTHER

      public static final FinishReason.Known IMAGE_OTHER
      The image generation stopped for a reason not otherwise specified.
    • NO_IMAGE

      public static final FinishReason.Known NO_IMAGE
      The model was expected to generate an image, but didn't.
    • IMAGE_RECITATION

      public static final FinishReason.Known IMAGE_RECITATION
      The generated image may be a recitation from a source.
    • UNEXPECTED_TOOL_CALL

      public static final FinishReason.Known UNEXPECTED_TOOL_CALL
      The model generated a function call that is semantically invalid. This can happen, for example, if function calling is not enabled or the generated function is not in the function declaration.
    • TOO_MANY_TOOL_CALLS

      public static final FinishReason.Known TOO_MANY_TOOL_CALLS
      The model made too many tool calls in a single request, so the server-side tool loop stopped before the model returned a final answer.
    • MISSING_THOUGHT_SIGNATURE

      public static final FinishReason.Known MISSING_THOUGHT_SIGNATURE
      Request has at least one thought signature missing. This enum value is not supported in Vertex AI.
    • MALFORMED_RESPONSE

      public static final FinishReason.Known MALFORMED_RESPONSE
      Finishes due to malformed response.
    • ESCALATION

      public static final FinishReason.Known ESCALATION
      Request was filtered by an escalation rule. This enum value is not supported in Vertex AI.
    • PUP_LIMITED_DISABLED

      public static final FinishReason.Known PUP_LIMITED_DISABLED
      Indicates that token generation stopped because the user account is limited or disabled due to Prohibited Use Policy (PUP) violations. This enum value is not supported in Vertex AI.
    • CONTINUATION

      public static final FinishReason.Known CONTINUATION
      Token generation was stopped because the response reached the per-request token limit, but generation is not yet complete. The model response can be continued via a subsequent request using the returned `continuation_token`.
    • MODEL_ARMOR

      public static final FinishReason.Known MODEL_ARMOR
      The model response was blocked by Model Armor. This enum value is not supported in Gemini API.
  • Method Details

    • values

      public static FinishReason.Known[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static FinishReason.Known valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null