Skip to content

Commit 3877044

Browse files
matthew29tangcopybara-github
authored andcommitted
feat: Add NO_IMAGE enum value to FinishReason
PiperOrigin-RevId: 814377707
1 parent efaa574 commit 3877044

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

google/genai/tests/models/test_generate_content_image_generation.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@
5050
),
5151
),
5252
),
53+
pytest_helper.TestTableItem(
54+
name='test_image_generation_no_image',
55+
parameters=types._GenerateContentParameters(
56+
model='gemini-2.5-flash-image',
57+
contents=t.t_contents('What is your name?'),
58+
config=types.GenerateContentConfig(
59+
response_modalities=['IMAGE'],
60+
image_config=types.ImageConfig(
61+
aspect_ratio='16:9',
62+
)
63+
),
64+
),
65+
),
5366
pytest_helper.TestTableItem(
5467
name='test_image_generation_config_validation_none',
5568
parameters=types._GenerateContentParameters(

google/genai/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ class FinishReason(_common.CaseInSensitiveEnum):
287287
"""The tool call generated by the model is invalid."""
288288
IMAGE_PROHIBITED_CONTENT = 'IMAGE_PROHIBITED_CONTENT'
289289
"""Image generation stopped because the generated images have prohibited content."""
290+
NO_IMAGE = 'NO_IMAGE'
291+
"""The model was expected to generate an image, but none was generated."""
290292

291293

292294
class HarmProbability(_common.CaseInSensitiveEnum):

0 commit comments

Comments
 (0)