google.ai.generativelanguage.Candidate.FinishReason

Defines the reason why the model stopped generating tokens.

FINISH_REASON_UNSPECIFIED 0

Default value. This value is unused.

STOP 1

Natural stop point of the model or provided stop sequence.

MAX_TOKENS 2

The maximum number of tokens as specified in the request was reached.

SAFETY 3

The candidate content was flagged for safety reasons.

RECITATION 4

The candidate content was flagged for recitation reasons.

OTHER 5

Unknown reason.

FINISH_REASON_UNSPECIFIED <FinishReason.FINISH_REASON_UNSPECIFIED: 0>
MAX_TOKENS <FinishReason.MAX_TOKENS: 2>
OTHER <FinishReason.OTHER: 5>
RECITATION <FinishReason.RECITATION: 4>
SAFETY <FinishReason.SAFETY: 3>
STOP <FinishReason.STOP: 1>