FinishReason Enumeration

Defines the reason why the model stopped generating tokens.

Definition

Namespace: GenerativeAI.Types
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public enum FinishReason

Members

FINISH_REASON_UNSPECIFIED0 Default value. This value is unused.
STOP1 Natural stop point of the model or provided stop sequence.
MAX_TOKENS2 The maximum number of tokens as specified in the request was reached.
SAFETY3 The response candidate content was flagged for safety reasons.
RECITATION4 The response candidate content was flagged for recitation reasons.
LANGUAGE5 The response candidate content was flagged for using an unsupported language.
OTHER6 Unknown reason.
BLOCKLIST7 Token generation stopped because the content contains forbidden terms.
PROHIBITED_CONTENT8 Token generation stopped for potentially containing prohibited content.
SPII9 Token generation stopped because the content potentially contains Sensitive Personally Identifiable Information (SPII).
MALFORMED_FUNCTION_CALL10 The function call generated by the model is invalid.
IMAGE_SAFETY11 Token generation stopped because generated images contain safety violations.

See Also