Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions google/genai/tests/types/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
import pytest
from ... import types


def test_finish_reason_malformed_response():
assert types.FinishReason.MALFORMED_RESPONSE.value == 'MALFORMED_RESPONSE'
assert (
types.FinishReason('MALFORMED_RESPONSE')
is types.FinishReason.MALFORMED_RESPONSE
)

_is_mcp_imported = False
if typing.TYPE_CHECKING:
from mcp import types as mcp_types
Expand Down
2 changes: 2 additions & 0 deletions google/genai/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ class FinishReason(_common.CaseInSensitiveEnum):
"""Token generation stopped because the content potentially contains Sensitive Personally Identifiable Information (SPII)."""
MALFORMED_FUNCTION_CALL = 'MALFORMED_FUNCTION_CALL'
"""The function call generated by the model is invalid."""
MALFORMED_RESPONSE = 'MALFORMED_RESPONSE'
"""The model response was malformed."""
IMAGE_SAFETY = 'IMAGE_SAFETY'
"""Token generation stopped because generated images have safety violations."""
UNEXPECTED_TOOL_CALL = 'UNEXPECTED_TOOL_CALL'
Expand Down
Loading