Skip to content

Commit b07a895

Browse files
jaycee-licopybara-github
authored andcommitted
feat: Add missing enum values to FinishReason and ReinforcementTuningThinkingLevel
PiperOrigin-RevId: 1019626832
1 parent 39f6abe commit b07a895

1 file changed

Lines changed: 80 additions & 43 deletions

File tree

‎google/genai/types.py‎

Lines changed: 80 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,14 @@ def __getattr__(name: str) -> Any:
181181

182182

183183
class MediaProcessing(_common.CaseInSensitiveEnum):
184-
"""How the model processes input media for understanding."""
184+
"""How the model processes this part's media for understanding.
185+
186+
Only meaningful for video parts (`inline_data` or `file_data` with video
187+
mime). Non-video parts ignore this field.
188+
"""
185189

186190
MEDIA_PROCESSING_UNSPECIFIED = 'MEDIA_PROCESSING_UNSPECIFIED'
187-
"""Default. Uses model-specific processing"""
191+
"""Defaults to model-specific processing."""
188192
STATIC = 'STATIC'
189193
"""Fixed-rate frame extraction. All frames placed in context."""
190194
AGENTIC = 'AGENTIC'
@@ -517,51 +521,60 @@ class AudioTranscriptionConfigMode(_common.CaseInSensitiveEnum):
517521

518522

519523
class FinishReason(_common.CaseInSensitiveEnum):
520-
"""Output only. The reason why the model stopped generating tokens.
524+
"""Output only.
521525

522-
If empty, the model has not stopped generating the tokens.
526+
The reason why the model stopped generating tokens. If empty, the model has
527+
not stopped generating.
523528
"""
524529

525530
FINISH_REASON_UNSPECIFIED = 'FINISH_REASON_UNSPECIFIED'
526531
"""The finish reason is unspecified."""
527532
STOP = 'STOP'
528-
"""Token generation reached a natural stopping point or a configured stop sequence."""
533+
"""The model reached a natural stopping point or a configured stop sequence."""
529534
MAX_TOKENS = 'MAX_TOKENS'
530-
"""Token generation reached the configured maximum output tokens."""
535+
"""The model generated the maximum number of tokens allowed by the `max_output_tokens` parameter."""
531536
SAFETY = 'SAFETY'
532-
"""Token generation stopped because the content potentially contains safety violations. NOTE: When streaming, [content][] is empty if content filters blocks the output."""
537+
"""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."""
533538
RECITATION = 'RECITATION'
534-
"""The token generation stopped because of potential recitation."""
539+
"""The model stopped generating because the content may be a recitation from a source."""
535540
LANGUAGE = 'LANGUAGE'
536-
"""The token generation stopped because of using an unsupported language."""
541+
"""The response candidate content was flagged for using an unsupported language. This enum value is not supported in Vertex AI."""
537542
OTHER = 'OTHER'
538-
"""All other reasons that stopped the token generation."""
543+
"""The model stopped generating for a reason not otherwise specified."""
539544
BLOCKLIST = 'BLOCKLIST'
540-
"""Token generation stopped because the content contains forbidden terms."""
545+
"""The model stopped generating because the content contains a term from a configured blocklist."""
541546
PROHIBITED_CONTENT = 'PROHIBITED_CONTENT'
542-
"""Token generation stopped for potentially containing prohibited content."""
547+
"""The model stopped generating because the content may be prohibited."""
543548
SPII = 'SPII'
544-
"""Token generation stopped because the content potentially contains Sensitive Personally Identifiable Information (SPII)."""
549+
"""The model stopped generating because the content may contain sensitive personally identifiable information (SPII)."""
545550
MALFORMED_FUNCTION_CALL = 'MALFORMED_FUNCTION_CALL'
546-
"""The function call generated by the model is invalid."""
551+
"""The model generated a function call that is syntactically invalid and can't be parsed."""
547552
IMAGE_SAFETY = 'IMAGE_SAFETY'
548-
"""Token generation stopped because generated images have safety violations."""
549-
UNEXPECTED_TOOL_CALL = 'UNEXPECTED_TOOL_CALL'
550-
"""The tool call generated by the model is invalid."""
551-
TOO_MANY_TOOL_CALLS = 'TOO_MANY_TOOL_CALLS'
552-
"""Model called too many tools consecutively, thus the system exited execution."""
553+
"""The generated image potentially violates safety policies."""
553554
IMAGE_PROHIBITED_CONTENT = 'IMAGE_PROHIBITED_CONTENT'
554-
"""Image generation stopped because the generated images have prohibited content."""
555+
"""The generated image may contain prohibited content."""
556+
IMAGE_OTHER = 'IMAGE_OTHER'
557+
"""The image generation stopped for a reason not otherwise specified."""
555558
NO_IMAGE = 'NO_IMAGE'
556-
"""The model was expected to generate an image, but none was generated."""
559+
"""The model was expected to generate an image, but didn't."""
557560
IMAGE_RECITATION = 'IMAGE_RECITATION'
558-
"""Image generation stopped because the generated image may be a recitation from a source."""
559-
IMAGE_OTHER = 'IMAGE_OTHER'
560-
"""Image generation stopped for a reason not otherwise specified."""
561-
CONTINUATION = 'CONTINUATION'
562-
"""Token generation stopped because the response reached the per-request token limit, but generation is not yet complete. The response can be continued by passing the returned `continuation_token` in a subsequent request."""
561+
"""The generated image may be a recitation from a source."""
562+
UNEXPECTED_TOOL_CALL = 'UNEXPECTED_TOOL_CALL'
563+
"""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."""
564+
TOO_MANY_TOOL_CALLS = 'TOO_MANY_TOOL_CALLS'
565+
"""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."""
566+
MISSING_THOUGHT_SIGNATURE = 'MISSING_THOUGHT_SIGNATURE'
567+
"""Request has at least one thought signature missing. This enum value is not supported in Vertex AI."""
563568
MALFORMED_RESPONSE = 'MALFORMED_RESPONSE'
564-
"""Token generation stopped because the response was malformed."""
569+
"""Finishes due to malformed response."""
570+
ESCALATION = 'ESCALATION'
571+
"""Request was filtered by an escalation rule. This enum value is not supported in Vertex AI."""
572+
PUP_LIMITED_DISABLED = 'PUP_LIMITED_DISABLED'
573+
"""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."""
574+
CONTINUATION = 'CONTINUATION'
575+
"""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`."""
576+
MODEL_ARMOR = 'MODEL_ARMOR'
577+
"""The model response was blocked by Model Armor. This enum value is not supported in Gemini API."""
565578

566579

567580
class HarmProbability(_common.CaseInSensitiveEnum):
@@ -709,10 +722,17 @@ class ServiceTier(_common.CaseInSensitiveEnum):
709722

710723

711724
class MediaResolution(_common.CaseInSensitiveEnum):
712-
"""The media resolution to use."""
725+
"""The token resolution at which input media content is sampled.
726+
727+
This is used to control the trade-off between the quality of the response and
728+
the number of tokens used to represent the media. A higher resolution allows
729+
the model to perceive more detail, which can lead to a more nuanced response,
730+
but it will also use more tokens. This does not affect the image dimensions
731+
sent to the model.
732+
"""
713733

714734
MEDIA_RESOLUTION_UNSPECIFIED = 'MEDIA_RESOLUTION_UNSPECIFIED'
715-
"""Media resolution has not been set"""
735+
"""Media resolution has not been set."""
716736
MEDIA_RESOLUTION_LOW = 'MEDIA_RESOLUTION_LOW'
717737
"""Media resolution set to low (64 tokens)."""
718738
MEDIA_RESOLUTION_MEDIUM = 'MEDIA_RESOLUTION_MEDIUM'
@@ -725,13 +745,13 @@ class Modality(_common.CaseInSensitiveEnum):
725745
"""Server content modalities."""
726746

727747
MODALITY_UNSPECIFIED = 'MODALITY_UNSPECIFIED'
728-
"""The modality is unspecified."""
748+
"""Unspecified modality. Will be processed as text."""
729749
TEXT = 'TEXT'
730-
"""Indicates the model should return text"""
750+
"""Text modality."""
731751
IMAGE = 'IMAGE'
732-
"""Indicates the model should return images."""
752+
"""Image modality."""
733753
AUDIO = 'AUDIO'
734-
"""Indicates the model should return audio."""
754+
"""Audio modality."""
735755
VIDEO = 'VIDEO'
736756
"""Indicates the model should return video."""
737757

@@ -858,14 +878,24 @@ class MatchOperation(_common.CaseInSensitiveEnum):
858878

859879

860880
class ReinforcementTuningThinkingLevel(_common.CaseInSensitiveEnum):
861-
"""Represents how much to think for the tuning job."""
881+
"""Indicates the maximum thinking depth during tuning.
882+
883+
Starting from Gemini 3.5 models, the old thinking_budget will no longer be
884+
supported and will result in a user error if set. Instead, users should use
885+
the thinking_level parameter to control the maximum thinking depth. This enum
886+
is not supported in Gemini API.
887+
"""
862888

863889
REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED = (
864890
'REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED'
865891
)
866892
"""Unspecified thinking level."""
867893
MINIMAL = 'MINIMAL'
868894
"""Little to no thinking."""
895+
LOW = 'LOW'
896+
"""Low thinking level."""
897+
MEDIUM = 'MEDIUM'
898+
"""Medium thinking level."""
869899
HIGH = 'HIGH'
870900
"""High thinking level."""
871901

@@ -894,7 +924,7 @@ class JobState(_common.CaseInSensitiveEnum):
894924
JOB_STATE_EXPIRED = 'JOB_STATE_EXPIRED'
895925
"""The job has expired."""
896926
JOB_STATE_UPDATING = 'JOB_STATE_UPDATING'
897-
"""The job is being updated. Only jobs in the `JOB_STATE_RUNNING` state can be updated. After updating, the job goes back to the `JOB_STATE_RUNNING` state."""
927+
"""The job is being updated. Only jobs in the `RUNNING` state can be updated. After updating, the job goes back to the `RUNNING` state."""
898928
JOB_STATE_PARTIALLY_SUCCEEDED = 'JOB_STATE_PARTIALLY_SUCCEEDED'
899929
"""The job is partially succeeded, some results may be missing due to errors."""
900930

@@ -1023,10 +1053,13 @@ class DocumentState(_common.CaseInSensitiveEnum):
10231053

10241054

10251055
class RubricContentType(_common.CaseInSensitiveEnum):
1026-
"""Represents the rubric content type."""
1056+
"""The type of rubric content to be generated.
1057+
1058+
This enum is not supported in Gemini API.
1059+
"""
10271060

10281061
RUBRIC_CONTENT_TYPE_UNSPECIFIED = 'RUBRIC_CONTENT_TYPE_UNSPECIFIED'
1029-
"""Rubric content type is unspecified."""
1062+
"""The content type to generate is not specified."""
10301063
PROPERTY = 'PROPERTY'
10311064
"""Generate rubrics based on properties."""
10321065
NL_QUESTION_ANSWER = 'NL_QUESTION_ANSWER'
@@ -1036,12 +1069,15 @@ class RubricContentType(_common.CaseInSensitiveEnum):
10361069

10371070

10381071
class ComputationBasedMetricType(_common.CaseInSensitiveEnum):
1039-
"""Represents the type of the computation based metric."""
1072+
"""The type of the computation based metric.
1073+
1074+
This enum is not supported in Gemini API.
1075+
"""
10401076

10411077
COMPUTATION_BASED_METRIC_TYPE_UNSPECIFIED = (
10421078
'COMPUTATION_BASED_METRIC_TYPE_UNSPECIFIED'
10431079
)
1044-
"""Computation based metric type is unspecified."""
1080+
"""Unspecified computation based metric type."""
10451081
EXACT_MATCH = 'EXACT_MATCH'
10461082
"""Exact match metric."""
10471083
BLEU = 'BLEU'
@@ -2382,7 +2418,7 @@ class Part(_common.BaseModel):
23822418
)
23832419
media_processing: Optional[MediaProcessing] = Field(
23842420
default=None,
2385-
description="""How the model processes this part's media for understanding.""",
2421+
description="""Optional. How the model processes this part's media for understanding. Only meaningful for video parts (`inline_data` or `file_data` with video mime). Non-video parts ignore this field.""",
23862422
)
23872423
speech_metadata: Optional[SpeechMetadata] = Field(
23882424
default=None,
@@ -2624,7 +2660,7 @@ class PartDict(TypedDict, total=False):
26242660
"""Output only. The transcription of the audio part."""
26252661

26262662
media_processing: Optional[MediaProcessing]
2627-
"""How the model processes this part's media for understanding."""
2663+
"""Optional. How the model processes this part's media for understanding. Only meaningful for video parts (`inline_data` or `file_data` with video mime). Non-video parts ignore this field."""
26282664

26292665
speech_metadata: Optional[SpeechMetadataDict]
26302666
"""Extra metadata associated with the part for speech synthesis, such
@@ -23740,7 +23776,8 @@ class ComputationBasedMetricSpec(_common.BaseModel):
2374023776
"""Specification for a computation based metric."""
2374123777

2374223778
type: Optional[ComputationBasedMetricType] = Field(
23743-
default=None, description="""The type of the computation based metric."""
23779+
default=None,
23780+
description="""Required. The type of the computation based metric.""",
2374423781
)
2374523782
parameters: Optional[dict[str, Any]] = Field(
2374623783
default=None,
@@ -23752,7 +23789,7 @@ class ComputationBasedMetricSpecDict(TypedDict, total=False):
2375223789
"""Specification for a computation based metric."""
2375323790

2375423791
type: Optional[ComputationBasedMetricType]
23755-
"""The type of the computation based metric."""
23792+
"""Required. The type of the computation based metric."""
2375623793

2375723794
parameters: Optional[dict[str, Any]]
2375823795
"""A map of parameters for the metric. ROUGE example: {"rouge_type": "rougeL", "split_summaries": True, "use_stemmer": True}. BLEU example: {"use_effective_order": True}."""

0 commit comments

Comments
 (0)