Skip to content

Commit 8d7e8cd

Browse files
speedstorm1copybara-github
authored andcommitted
chore: Remove SdkClassPatch config that only repeats the discovery docs
Some class and field descriptions now match the API reference. FUTURE_COPYBARA_INTEGRATE_REVIEW=#3249 from googleapis:release-please--branches--main 4b4b0f3 PiperOrigin-RevId: 1015939709
1 parent afb10e8 commit 8d7e8cd

1 file changed

Lines changed: 143 additions & 106 deletions

File tree

‎google/genai/types.py‎

Lines changed: 143 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -515,51 +515,60 @@ class AudioTranscriptionConfigMode(_common.CaseInSensitiveEnum):
515515

516516

517517
class FinishReason(_common.CaseInSensitiveEnum):
518-
"""Output only. The reason why the model stopped generating tokens.
518+
"""Output only.
519519

520-
If empty, the model has not stopped generating the tokens.
520+
The reason why the model stopped generating tokens. If empty, the model has
521+
not stopped generating.
521522
"""
522523

523524
FINISH_REASON_UNSPECIFIED = 'FINISH_REASON_UNSPECIFIED'
524525
"""The finish reason is unspecified."""
525526
STOP = 'STOP'
526-
"""Token generation reached a natural stopping point or a configured stop sequence."""
527+
"""The model reached a natural stopping point or a configured stop sequence."""
527528
MAX_TOKENS = 'MAX_TOKENS'
528-
"""Token generation reached the configured maximum output tokens."""
529+
"""The model generated the maximum number of tokens allowed by the `max_output_tokens` parameter."""
529530
SAFETY = 'SAFETY'
530-
"""Token generation stopped because the content potentially contains safety violations. NOTE: When streaming, [content][] is empty if content filters blocks the output."""
531+
"""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."""
531532
RECITATION = 'RECITATION'
532-
"""The token generation stopped because of potential recitation."""
533+
"""The model stopped generating because the content may be a recitation from a source."""
533534
LANGUAGE = 'LANGUAGE'
534-
"""The token generation stopped because of using an unsupported language."""
535+
"""The response candidate content was flagged for using an unsupported language. This enum value is not supported in Vertex AI."""
535536
OTHER = 'OTHER'
536-
"""All other reasons that stopped the token generation."""
537+
"""The model stopped generating for a reason not otherwise specified."""
537538
BLOCKLIST = 'BLOCKLIST'
538-
"""Token generation stopped because the content contains forbidden terms."""
539+
"""The model stopped generating because the content contains a term from a configured blocklist."""
539540
PROHIBITED_CONTENT = 'PROHIBITED_CONTENT'
540-
"""Token generation stopped for potentially containing prohibited content."""
541+
"""The model stopped generating because the content may be prohibited."""
541542
SPII = 'SPII'
542-
"""Token generation stopped because the content potentially contains Sensitive Personally Identifiable Information (SPII)."""
543+
"""The model stopped generating because the content may contain sensitive personally identifiable information (SPII)."""
543544
MALFORMED_FUNCTION_CALL = 'MALFORMED_FUNCTION_CALL'
544-
"""The function call generated by the model is invalid."""
545+
"""The model generated a function call that is syntactically invalid and can't be parsed."""
545546
IMAGE_SAFETY = 'IMAGE_SAFETY'
546-
"""Token generation stopped because generated images have safety violations."""
547-
UNEXPECTED_TOOL_CALL = 'UNEXPECTED_TOOL_CALL'
548-
"""The tool call generated by the model is invalid."""
549-
TOO_MANY_TOOL_CALLS = 'TOO_MANY_TOOL_CALLS'
550-
"""Model called too many tools consecutively, thus the system exited execution."""
547+
"""The generated image potentially violates safety policies."""
551548
IMAGE_PROHIBITED_CONTENT = 'IMAGE_PROHIBITED_CONTENT'
552-
"""Image generation stopped because the generated images have prohibited content."""
549+
"""The generated image may contain prohibited content."""
550+
IMAGE_OTHER = 'IMAGE_OTHER'
551+
"""The image generation stopped for a reason not otherwise specified."""
553552
NO_IMAGE = 'NO_IMAGE'
554-
"""The model was expected to generate an image, but none was generated."""
553+
"""The model was expected to generate an image, but didn't."""
555554
IMAGE_RECITATION = 'IMAGE_RECITATION'
556-
"""Image generation stopped because the generated image may be a recitation from a source."""
557-
IMAGE_OTHER = 'IMAGE_OTHER'
558-
"""Image generation stopped for a reason not otherwise specified."""
559-
CONTINUATION = 'CONTINUATION'
560-
"""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."""
555+
"""The generated image may be a recitation from a source."""
556+
UNEXPECTED_TOOL_CALL = 'UNEXPECTED_TOOL_CALL'
557+
"""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."""
558+
TOO_MANY_TOOL_CALLS = 'TOO_MANY_TOOL_CALLS'
559+
"""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."""
560+
MISSING_THOUGHT_SIGNATURE = 'MISSING_THOUGHT_SIGNATURE'
561+
"""Request has at least one thought signature missing. This enum value is not supported in Vertex AI."""
561562
MALFORMED_RESPONSE = 'MALFORMED_RESPONSE'
562-
"""Token generation stopped because the response was malformed."""
563+
"""Finishes due to malformed response."""
564+
ESCALATION = 'ESCALATION'
565+
"""Request was filtered by an escalation rule. This enum value is not supported in Vertex AI."""
566+
PUP_LIMITED_DISABLED = 'PUP_LIMITED_DISABLED'
567+
"""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."""
568+
CONTINUATION = 'CONTINUATION'
569+
"""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`."""
570+
MODEL_ARMOR = 'MODEL_ARMOR'
571+
"""The model response was blocked by Model Armor. This enum value is not supported in Gemini API."""
563572

564573

565574
class HarmProbability(_common.CaseInSensitiveEnum):
@@ -843,14 +852,24 @@ class MatchOperation(_common.CaseInSensitiveEnum):
843852

844853

845854
class ReinforcementTuningThinkingLevel(_common.CaseInSensitiveEnum):
846-
"""Represents how much to think for the tuning job."""
855+
"""Indicates the maximum thinking depth during tuning.
856+
857+
Starting from Gemini 3.5 models, the old thinking_budget will no longer be
858+
supported and will result in a user error if set. Instead, users should use
859+
the thinking_level parameter to control the maximum thinking depth. This enum
860+
is not supported in Gemini API.
861+
"""
847862

848863
REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED = (
849864
'REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED'
850865
)
851866
"""Unspecified thinking level."""
852867
MINIMAL = 'MINIMAL'
853868
"""Little to no thinking."""
869+
LOW = 'LOW'
870+
"""Low thinking level."""
871+
MEDIUM = 'MEDIUM'
872+
"""Medium thinking level."""
854873
HIGH = 'HIGH'
855874
"""High thinking level."""
856875

@@ -8037,57 +8056,61 @@ class GroundingSupportDict(TypedDict, total=False):
80378056

80388057

80398058
class RetrievalMetadata(_common.BaseModel):
8040-
"""Metadata returned to client when grounding is enabled."""
8059+
"""Metadata related to the retrieval grounding source.
8060+
8061+
This is part of the `GroundingMetadata` returned when grounding is enabled.
8062+
"""
80418063

80428064
google_search_dynamic_retrieval_score: Optional[float] = Field(
80438065
default=None,
8044-
description="""Optional. Score indicating how likely information from google
8045-
search could help answer the prompt. The score is in the range [0, 1],
8046-
where 0 is the least likely and 1 is the most likely. This score is only
8047-
populated when google search grounding and dynamic retrieval is enabled.
8048-
It will be compared to the threshold to determine whether to trigger
8049-
Google search.""",
8066+
description="""Optional. A score indicating how likely it is that a Google Search query could help answer the prompt. The score is in the range of `[0, 1]`. A score of 1 means the model is confident that a search will be helpful, and 0 means it is not. This score is populated only when Google Search grounding and dynamic retrieval are enabled. The score is used to determine whether to trigger a search.""",
80508067
)
80518068

80528069

80538070
class RetrievalMetadataDict(TypedDict, total=False):
8054-
"""Metadata returned to client when grounding is enabled."""
8071+
"""Metadata related to the retrieval grounding source.
8072+
8073+
This is part of the `GroundingMetadata` returned when grounding is enabled.
8074+
"""
80558075

80568076
google_search_dynamic_retrieval_score: Optional[float]
8057-
"""Optional. Score indicating how likely information from google
8058-
search could help answer the prompt. The score is in the range [0, 1],
8059-
where 0 is the least likely and 1 is the most likely. This score is only
8060-
populated when google search grounding and dynamic retrieval is enabled.
8061-
It will be compared to the threshold to determine whether to trigger
8062-
Google search."""
8077+
"""Optional. A score indicating how likely it is that a Google Search query could help answer the prompt. The score is in the range of `[0, 1]`. A score of 1 means the model is confident that a search will be helpful, and 0 means it is not. This score is populated only when Google Search grounding and dynamic retrieval are enabled. The score is used to determine whether to trigger a search."""
80638078

80648079

80658080
RetrievalMetadataOrDict = Union[RetrievalMetadata, RetrievalMetadataDict]
80668081

80678082

80688083
class SearchEntryPoint(_common.BaseModel):
8069-
"""The entry point used to search for grounding sources."""
8084+
"""An entry point for displaying Google Search results.
8085+
8086+
A `SearchEntryPoint` is populated when the grounding source for a model's
8087+
response is Google Search. It provides information that you can use to display
8088+
the search results in your application.
8089+
"""
80708090

80718091
rendered_content: Optional[str] = Field(
80728092
default=None,
8073-
description="""Optional. Web content snippet that can be embedded in a web page
8074-
or an app webview.""",
8093+
description="""Optional. An HTML snippet that can be embedded in a web page or an application's webview. This snippet displays a search result, including the title, URL, and a brief description of the search result.""",
80758094
)
80768095
sdk_blob: Optional[bytes] = Field(
80778096
default=None,
8078-
description="""Optional. JSON representing array of tuples.""",
8097+
description="""Optional. A base64-encoded JSON object that contains a list of search queries and their corresponding search URLs. This information can be used to build a custom search UI.""",
80798098
)
80808099

80818100

80828101
class SearchEntryPointDict(TypedDict, total=False):
8083-
"""The entry point used to search for grounding sources."""
8102+
"""An entry point for displaying Google Search results.
8103+
8104+
A `SearchEntryPoint` is populated when the grounding source for a model's
8105+
response is Google Search. It provides information that you can use to display
8106+
the search results in your application.
8107+
"""
80848108

80858109
rendered_content: Optional[str]
8086-
"""Optional. Web content snippet that can be embedded in a web page
8087-
or an app webview."""
8110+
"""Optional. An HTML snippet that can be embedded in a web page or an application's webview. This snippet displays a search result, including the title, URL, and a brief description of the search result."""
80888111

80898112
sdk_blob: Optional[bytes]
8090-
"""Optional. JSON representing array of tuples."""
8113+
"""Optional. A base64-encoded JSON object that contains a list of search queries and their corresponding search URLs. This information can be used to build a custom search UI."""
80918114

80928115

80938116
SearchEntryPointOrDict = Union[SearchEntryPoint, SearchEntryPointDict]
@@ -13771,64 +13794,6 @@ class SingleReinforcementTuningRewardConfigDict(TypedDict, total=False):
1377113794
]
1377213795

1377313796

13774-
class CompositeReinforcementTuningRewardConfigWeightedRewardConfig(
13775-
_common.BaseModel
13776-
):
13777-
"""Composite reinforcement tuning reward config weighted reward config."""
13778-
13779-
reward_config: Optional[SingleReinforcementTuningRewardConfig] = Field(
13780-
default=None, description="""Single reward configuration."""
13781-
)
13782-
weight: Optional[float] = Field(
13783-
default=None,
13784-
description="""How much this single reward contributes to the total overall reward. Total reward is a linear combination of single rewards with their corresponding weights, i.e., ``` total_reward = ( weight_a * reward_a + weight_b * reward_b + ... ) / (weight_a + weight_b + ...) ```""",
13785-
)
13786-
13787-
13788-
class CompositeReinforcementTuningRewardConfigWeightedRewardConfigDict(
13789-
TypedDict, total=False
13790-
):
13791-
"""Composite reinforcement tuning reward config weighted reward config."""
13792-
13793-
reward_config: Optional[SingleReinforcementTuningRewardConfigDict]
13794-
"""Single reward configuration."""
13795-
13796-
weight: Optional[float]
13797-
"""How much this single reward contributes to the total overall reward. Total reward is a linear combination of single rewards with their corresponding weights, i.e., ``` total_reward = ( weight_a * reward_a + weight_b * reward_b + ... ) / (weight_a + weight_b + ...) ```"""
13798-
13799-
13800-
CompositeReinforcementTuningRewardConfigWeightedRewardConfigOrDict = Union[
13801-
CompositeReinforcementTuningRewardConfigWeightedRewardConfig,
13802-
CompositeReinforcementTuningRewardConfigWeightedRewardConfigDict,
13803-
]
13804-
13805-
13806-
class CompositeReinforcementTuningRewardConfig(_common.BaseModel):
13807-
"""Composite reinforcement tuning reward config."""
13808-
13809-
weighted_reward_configs: Optional[
13810-
list[CompositeReinforcementTuningRewardConfigWeightedRewardConfig]
13811-
] = Field(
13812-
default=None,
13813-
description="""List of reward function configurations with weights.""",
13814-
)
13815-
13816-
13817-
class CompositeReinforcementTuningRewardConfigDict(TypedDict, total=False):
13818-
"""Composite reinforcement tuning reward config."""
13819-
13820-
weighted_reward_configs: Optional[
13821-
list[CompositeReinforcementTuningRewardConfigWeightedRewardConfigDict]
13822-
]
13823-
"""List of reward function configurations with weights."""
13824-
13825-
13826-
CompositeReinforcementTuningRewardConfigOrDict = Union[
13827-
CompositeReinforcementTuningRewardConfig,
13828-
CompositeReinforcementTuningRewardConfigDict,
13829-
]
13830-
13831-
1383213797
class ReinforcementTuningHyperParameters(_common.BaseModel):
1383313798
"""Hyperparameters for Reinforcement Tuning."""
1383413799

@@ -13920,6 +13885,78 @@ class ReinforcementTuningHyperParametersDict(TypedDict, total=False):
1392013885
]
1392113886

1392213887

13888+
class CompositeReinforcementTuningRewardConfigWeightedRewardConfig(
13889+
_common.BaseModel
13890+
):
13891+
"""Reward function configuration with a weight.
13892+
13893+
The weight is used to combine the reward with other rewards. This data type is
13894+
not supported in Gemini API.
13895+
"""
13896+
13897+
reward_config: Optional[SingleReinforcementTuningRewardConfig] = Field(
13898+
default=None, description="""Single reward configuration."""
13899+
)
13900+
weight: Optional[float] = Field(
13901+
default=None,
13902+
description="""How much this single reward contributes to the total overall reward. Total reward is a linear combination of single rewards with their corresponding weights, i.e., ``` total_reward = ( weight_a * reward_a + weight_b * reward_b + ... ) / (weight_a + weight_b + ...) ```""",
13903+
)
13904+
13905+
13906+
class CompositeReinforcementTuningRewardConfigWeightedRewardConfigDict(
13907+
TypedDict, total=False
13908+
):
13909+
"""Reward function configuration with a weight.
13910+
13911+
The weight is used to combine the reward with other rewards. This data type is
13912+
not supported in Gemini API.
13913+
"""
13914+
13915+
reward_config: Optional[SingleReinforcementTuningRewardConfigDict]
13916+
"""Single reward configuration."""
13917+
13918+
weight: Optional[float]
13919+
"""How much this single reward contributes to the total overall reward. Total reward is a linear combination of single rewards with their corresponding weights, i.e., ``` total_reward = ( weight_a * reward_a + weight_b * reward_b + ... ) / (weight_a + weight_b + ...) ```"""
13920+
13921+
13922+
CompositeReinforcementTuningRewardConfigWeightedRewardConfigOrDict = Union[
13923+
CompositeReinforcementTuningRewardConfigWeightedRewardConfig,
13924+
CompositeReinforcementTuningRewardConfigWeightedRewardConfigDict,
13925+
]
13926+
13927+
13928+
class CompositeReinforcementTuningRewardConfig(_common.BaseModel):
13929+
"""Composite reward function configuration for reinforcement tuning.
13930+
13931+
This data type is not supported in Gemini API.
13932+
"""
13933+
13934+
weighted_reward_configs: Optional[
13935+
list[CompositeReinforcementTuningRewardConfigWeightedRewardConfig]
13936+
] = Field(
13937+
default=None,
13938+
description="""List of reward function configurations with weights.""",
13939+
)
13940+
13941+
13942+
class CompositeReinforcementTuningRewardConfigDict(TypedDict, total=False):
13943+
"""Composite reward function configuration for reinforcement tuning.
13944+
13945+
This data type is not supported in Gemini API.
13946+
"""
13947+
13948+
weighted_reward_configs: Optional[
13949+
list[CompositeReinforcementTuningRewardConfigWeightedRewardConfigDict]
13950+
]
13951+
"""List of reward function configurations with weights."""
13952+
13953+
13954+
CompositeReinforcementTuningRewardConfigOrDict = Union[
13955+
CompositeReinforcementTuningRewardConfig,
13956+
CompositeReinforcementTuningRewardConfigDict,
13957+
]
13958+
13959+
1392313960
class ReinforcementTuningSpec(_common.BaseModel):
1392413961
"""Reinforcement tuning spec for tuning."""
1392513962

0 commit comments

Comments
 (0)