finishReason property

String? finishReason
getter/setter pair

The reason why the model stopped generating tokens.

If empty, the model has not stopped generating the tokens.

Output only. Possible string values are:

  • "FINISH_REASON_UNSPECIFIED" : The finish reason is unspecified.
  • "STOP" : Token generation reached a natural stopping point or a configured stop sequence.
  • "MAX_TOKENS" : Token generation reached the configured maximum output tokens.
  • "SAFETY" : Token generation stopped because the content potentially contains safety violations. NOTE: When streaming, content is empty if content filters blocks the output.
  • "RECITATION" : The token generation stopped because of potential recitation.
  • "OTHER" : All other reasons that stopped the token generation.
  • "BLOCKLIST" : Token generation stopped because the content contains forbidden terms.
  • "PROHIBITED_CONTENT" : Token generation stopped for potentially containing prohibited content.
  • "SPII" : Token generation stopped because the content potentially contains Sensitive Personally Identifiable Information (SPII).
  • "MALFORMED_FUNCTION_CALL" : The function call generated by the model is invalid.

Implementation

core.String? finishReason;