Enumeration FinishReason

Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating.

Enumeration Members

BLOCKLIST: "BLOCKLIST"

The model stopped generating because the content contains a term from a configured blocklist.

CONTINUATION: "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.

ESCALATION: "ESCALATION"

Request was filtered by an escalation rule. This enum value is not supported in Vertex AI.

FINISH_REASON_UNSPECIFIED: "FINISH_REASON_UNSPECIFIED"

The finish reason is unspecified.

IMAGE_OTHER: "IMAGE_OTHER"

The image generation stopped for a reason not otherwise specified.

IMAGE_PROHIBITED_CONTENT: "IMAGE_PROHIBITED_CONTENT"

The generated image may contain prohibited content.

IMAGE_RECITATION: "IMAGE_RECITATION"

The generated image may be a recitation from a source.

IMAGE_SAFETY: "IMAGE_SAFETY"

The generated image potentially violates safety policies.

LANGUAGE: "LANGUAGE"

The response candidate content was flagged for using an unsupported language. This enum value is not supported in Vertex AI.

MALFORMED_FUNCTION_CALL: "MALFORMED_FUNCTION_CALL"

The model generated a function call that is syntactically invalid and can't be parsed.

MALFORMED_RESPONSE: "MALFORMED_RESPONSE"

Finishes due to malformed response.

MAX_TOKENS: "MAX_TOKENS"

The model generated the maximum number of tokens allowed by the max_output_tokens parameter.

MISSING_THOUGHT_SIGNATURE: "MISSING_THOUGHT_SIGNATURE"

Request has at least one thought signature missing. This enum value is not supported in Vertex AI.

MODEL_ARMOR: "MODEL_ARMOR"

The model response was blocked by Model Armor. This enum value is not supported in Gemini API.

NO_IMAGE: "NO_IMAGE"

The model was expected to generate an image, but didn't.

OTHER: "OTHER"

The model stopped generating for a reason not otherwise specified.

PROHIBITED_CONTENT: "PROHIBITED_CONTENT"

The model stopped generating because the content may be prohibited.

PUP_LIMITED_DISABLED: "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.

RECITATION: "RECITATION"

The model stopped generating because the content may be a recitation from a source.

SAFETY: "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.

SPII: "SPII"

The model stopped generating because the content may contain sensitive personally identifiable information (SPII).

STOP: "STOP"

The model reached a natural stopping point or a configured stop sequence.

TOO_MANY_TOOL_CALLS: "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.

UNEXPECTED_TOOL_CALL: "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.