Skip to content

Commit 4742c9a

Browse files
yyyu-googlecopybara-github
authored andcommitted
feat: include labels for LiveClientSetup
PiperOrigin-RevId: 986359438
1 parent 81ffa26 commit 4742c9a

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎google/genai/_live_converters.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,9 @@ def _LiveClientSetup_to_mldev(
607607
],
608608
)
609609

610+
if getv(from_object, ['labels']) is not None:
611+
setv(to_object, ['labels'], getv(from_object, ['labels']))
612+
610613
return to_object
611614

612615

@@ -698,6 +701,12 @@ def _LiveClientSetup_to_vertex(
698701
[item for item in getv(from_object, ['safety_settings'])],
699702
)
700703

704+
if getv(from_object, ['labels']) is not None:
705+
raise ValueError(
706+
'labels parameter is only supported in Gemini Developer API mode, not'
707+
' in Gemini Enterprise Agent Platform mode.'
708+
)
709+
701710
return to_object
702711

703712

‎google/genai/types.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21188,6 +21188,10 @@ class LiveClientSetup(_common.BaseModel):
2118821188
response.
2118921189
""",
2119021190
)
21191+
labels: Optional[dict[str, str]] = Field(
21192+
default=None,
21193+
description="""Optional. Labels with user-defined metadata for the request. Optional. Labels must follow standard unified Cloud label requirements: - Label keys must start with a letter. - Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. - International characters are allowed. Usage: - Safety identifiers from aggregators: Use the key `safety_identifier` (e.g. `{"safety_identifier": "user_session_123"}`)""",
21194+
)
2119121195

2119221196

2119321197
class LiveClientSetupDict(TypedDict, total=False):
@@ -21255,6 +21259,9 @@ class LiveClientSetupDict(TypedDict, total=False):
2125521259
response.
2125621260
"""
2125721261

21262+
labels: Optional[dict[str, str]]
21263+
"""Optional. Labels with user-defined metadata for the request. Optional. Labels must follow standard unified Cloud label requirements: - Label keys must start with a letter. - Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. - International characters are allowed. Usage: - Safety identifiers from aggregators: Use the key `safety_identifier` (e.g. `{"safety_identifier": "user_session_123"}`)"""
21264+
2125821265

2125921266
LiveClientSetupOrDict = Union[LiveClientSetup, LiveClientSetupDict]
2126021267

0 commit comments

Comments
 (0)