finishReason property

String? finishReason
getter/setter pair

The reason why the model stopped generating tokens.

If empty, the model has not stopped generating.

Output only. Possible string values are:

  • "FINISH_REASON_UNSPECIFIED" : The finish reason is unspecified.
  • "STOP" : The model reached a natural stopping point or a configured stop sequence.
  • "MAX_TOKENS" : The model generated the maximum number of tokens allowed by the max_output_tokens parameter.
  • "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" : The model stopped generating because the content may be a recitation from a source.
  • "OTHER" : The model stopped generating for a reason not otherwise specified.
  • "BLOCKLIST" : The model stopped generating because the content contains a term from a configured blocklist.
  • "PROHIBITED_CONTENT" : The model stopped generating because the content may be prohibited.
  • "SPII" : The model stopped generating because the content may contain sensitive personally identifiable information (SPII).
  • "MALFORMED_FUNCTION_CALL" : The model generated a function call that is syntactically invalid and can't be parsed.
  • "MODEL_ARMOR" : The model response was blocked by Model Armor.
  • "IMAGE_SAFETY" : The generated image potentially violates safety policies.
  • "IMAGE_PROHIBITED_CONTENT" : The generated image may contain prohibited content.
  • "IMAGE_RECITATION" : The generated image may be a recitation from a source.
  • "IMAGE_OTHER" : The image generation stopped for a reason not otherwise specified.
  • "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.
  • "NO_IMAGE" : The model was expected to generate an image, but didn't.

Implementation

core.String? finishReason;