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
3 changes: 3 additions & 0 deletions google/genai/batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,9 @@ def _GenerateContentConfig_to_mldev(
'model_armor_config parameter is not supported in Gemini API.'
)

if getv(from_object, ['service_tier']) is not None:
setv(parent_object, ['serviceTier'], getv(from_object, ['service_tier']))

return to_object


Expand Down
6 changes: 6 additions & 0 deletions google/genai/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,9 @@ def _GenerateContentConfig_to_mldev(
'model_armor_config parameter is not supported in Gemini API.'
)

if getv(from_object, ['service_tier']) is not None:
setv(parent_object, ['serviceTier'], getv(from_object, ['service_tier']))

return to_object


Expand Down Expand Up @@ -1502,6 +1505,9 @@ def _GenerateContentConfig_to_vertex(
getv(from_object, ['model_armor_config']),
)

if getv(from_object, ['service_tier']) is not None:
setv(parent_object, ['serviceTier'], getv(from_object, ['service_tier']))

return to_object


Expand Down
20 changes: 20 additions & 0 deletions google/genai/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,19 @@ class ResourceScope(_common.CaseInSensitiveEnum):
"https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview"""


class ServiceTier(_common.CaseInSensitiveEnum):
"""Pricing and performance service tier."""

SERVICE_TIER_UNSPECIFIED = 'SERVICE_TIER_UNSPECIFIED'
"""Default service tier, which is standard."""
SERVICE_TIER_STANDARD = 'SERVICE_TIER_STANDARD'
"""Standard service tier."""
SERVICE_TIER_FLEX = 'SERVICE_TIER_FLEX'
"""Flex service tier."""
SERVICE_TIER_PRIORITY = 'SERVICE_TIER_PRIORITY'
"""Priority service tier."""


class JSONSchemaType(Enum):
"""The type of the data supported by JSON Schema.

Expand Down Expand Up @@ -5933,6 +5946,10 @@ class GenerateContentConfig(_common.BaseModel):
service. If supplied, safety_settings must not be supplied.
""",
)
service_tier: Optional[ServiceTier] = Field(
default=None,
description="""The service tier to use for the request. For example, FLEX.""",
)

@pydantic.field_validator('response_schema', mode='before')
@classmethod
Expand Down Expand Up @@ -6147,6 +6164,9 @@ class GenerateContentConfigDict(TypedDict, total=False):
service. If supplied, safety_settings must not be supplied.
"""

service_tier: Optional[ServiceTier]
"""The service tier to use for the request. For example, FLEX."""


GenerateContentConfigOrDict = Union[
GenerateContentConfig, GenerateContentConfigDict
Expand Down