Skip to content

Commit cd51e54

Browse files
jaycee-licopybara-github
authored andcommitted
chore: Maintain backward-compatible field ordering in generated data types
PiperOrigin-RevId: 882441109
1 parent ff7469a commit cd51e54

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

google/genai/_live_converters.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -584,14 +584,14 @@ def _LiveClientSetup_to_mldev(
584584
if getv(from_object, ['proactivity']) is not None:
585585
setv(to_object, ['proactivity'], getv(from_object, ['proactivity']))
586586

587-
if getv(from_object, ['history_config']) is not None:
588-
setv(to_object, ['historyConfig'], getv(from_object, ['history_config']))
589-
590587
if getv(from_object, ['explicit_vad_signal']) is not None:
591588
raise ValueError(
592589
'explicit_vad_signal parameter is not supported in Gemini API.'
593590
)
594591

592+
if getv(from_object, ['history_config']) is not None:
593+
setv(to_object, ['historyConfig'], getv(from_object, ['history_config']))
594+
595595
return to_object
596596

597597

@@ -661,16 +661,16 @@ def _LiveClientSetup_to_vertex(
661661
if getv(from_object, ['proactivity']) is not None:
662662
setv(to_object, ['proactivity'], getv(from_object, ['proactivity']))
663663

664-
if getv(from_object, ['history_config']) is not None:
665-
raise ValueError('history_config parameter is not supported in Vertex AI.')
666-
667664
if getv(from_object, ['explicit_vad_signal']) is not None:
668665
setv(
669666
to_object,
670667
['explicitVadSignal'],
671668
getv(from_object, ['explicit_vad_signal']),
672669
)
673670

671+
if getv(from_object, ['history_config']) is not None:
672+
raise ValueError('history_config parameter is not supported in Vertex AI.')
673+
674674
return to_object
675675

676676

@@ -825,18 +825,18 @@ def _LiveConnectConfig_to_mldev(
825825
getv(from_object, ['proactivity']),
826826
)
827827

828+
if getv(from_object, ['explicit_vad_signal']) is not None:
829+
raise ValueError(
830+
'explicit_vad_signal parameter is not supported in Gemini API.'
831+
)
832+
828833
if getv(from_object, ['history_config']) is not None:
829834
setv(
830835
parent_object,
831836
['setup', 'historyConfig'],
832837
getv(from_object, ['history_config']),
833838
)
834839

835-
if getv(from_object, ['explicit_vad_signal']) is not None:
836-
raise ValueError(
837-
'explicit_vad_signal parameter is not supported in Gemini API.'
838-
)
839-
840840
return to_object
841841

842842

@@ -985,16 +985,16 @@ def _LiveConnectConfig_to_vertex(
985985
getv(from_object, ['proactivity']),
986986
)
987987

988-
if getv(from_object, ['history_config']) is not None:
989-
raise ValueError('history_config parameter is not supported in Vertex AI.')
990-
991988
if getv(from_object, ['explicit_vad_signal']) is not None:
992989
setv(
993990
parent_object,
994991
['setup', 'explicitVadSignal'],
995992
getv(from_object, ['explicit_vad_signal']),
996993
)
997994

995+
if getv(from_object, ['history_config']) is not None:
996+
raise ValueError('history_config parameter is not supported in Vertex AI.')
997+
998998
return to_object
999999

10001000

google/genai/_tokens_converters.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,18 +411,18 @@ def _LiveConnectConfig_to_mldev(
411411
getv(from_object, ['proactivity']),
412412
)
413413

414+
if getv(from_object, ['explicit_vad_signal']) is not None:
415+
raise ValueError(
416+
'explicit_vad_signal parameter is not supported in Gemini API.'
417+
)
418+
414419
if getv(from_object, ['history_config']) is not None:
415420
setv(
416421
parent_object,
417422
['setup', 'historyConfig'],
418423
getv(from_object, ['history_config']),
419424
)
420425

421-
if getv(from_object, ['explicit_vad_signal']) is not None:
422-
raise ValueError(
423-
'explicit_vad_signal parameter is not supported in Gemini API.'
424-
)
425-
426426
return to_object
427427

428428

google/genai/types.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18211,16 +18211,16 @@ class LiveClientSetup(_common.BaseModel):
1821118211
description="""Configures the proactivity of the model. This allows the model to respond proactively to
1821218212
the input and to ignore irrelevant input.""",
1821318213
)
18214-
history_config: Optional[HistoryConfig] = Field(
18215-
default=None,
18216-
description="""Configures the exchange of history between the client and the server.""",
18217-
)
1821818214
explicit_vad_signal: Optional[bool] = Field(
1821918215
default=None,
1822018216
description="""Configures the explicit VAD signal. If enabled, the client will send
1822118217
vad_signal to indicate the start and end of speech. This allows the server
1822218218
to process the audio more efficiently.""",
1822318219
)
18220+
history_config: Optional[HistoryConfig] = Field(
18221+
default=None,
18222+
description="""Configures the exchange of history between the client and the server.""",
18223+
)
1822418224

1822518225

1822618226
class LiveClientSetupDict(TypedDict, total=False):
@@ -18272,14 +18272,14 @@ class LiveClientSetupDict(TypedDict, total=False):
1827218272
"""Configures the proactivity of the model. This allows the model to respond proactively to
1827318273
the input and to ignore irrelevant input."""
1827418274

18275-
history_config: Optional[HistoryConfigDict]
18276-
"""Configures the exchange of history between the client and the server."""
18277-
1827818275
explicit_vad_signal: Optional[bool]
1827918276
"""Configures the explicit VAD signal. If enabled, the client will send
1828018277
vad_signal to indicate the start and end of speech. This allows the server
1828118278
to process the audio more efficiently."""
1828218279

18280+
history_config: Optional[HistoryConfigDict]
18281+
"""Configures the exchange of history between the client and the server."""
18282+
1828318283

1828418284
LiveClientSetupOrDict = Union[LiveClientSetup, LiveClientSetupDict]
1828518285

@@ -18764,16 +18764,16 @@ class LiveConnectConfig(_common.BaseModel):
1876418764
description="""Configures the proactivity of the model. This allows the model to respond proactively to
1876518765
the input and to ignore irrelevant input.""",
1876618766
)
18767-
history_config: Optional[HistoryConfig] = Field(
18768-
default=None,
18769-
description="""Configures the exchange of history between the client and the server.""",
18770-
)
1877118767
explicit_vad_signal: Optional[bool] = Field(
1877218768
default=None,
1877318769
description="""Configures the explicit VAD signal. If enabled, the client will send
1877418770
vad_signal to indicate the start and end of speech. This allows the server
1877518771
to process the audio more efficiently.""",
1877618772
)
18773+
history_config: Optional[HistoryConfig] = Field(
18774+
default=None,
18775+
description="""Configures the exchange of history between the client and the server.""",
18776+
)
1877718777

1877818778

1877918779
class LiveConnectConfigDict(TypedDict, total=False):
@@ -18876,14 +18876,14 @@ class LiveConnectConfigDict(TypedDict, total=False):
1887618876
"""Configures the proactivity of the model. This allows the model to respond proactively to
1887718877
the input and to ignore irrelevant input."""
1887818878

18879-
history_config: Optional[HistoryConfigDict]
18880-
"""Configures the exchange of history between the client and the server."""
18881-
1888218879
explicit_vad_signal: Optional[bool]
1888318880
"""Configures the explicit VAD signal. If enabled, the client will send
1888418881
vad_signal to indicate the start and end of speech. This allows the server
1888518882
to process the audio more efficiently."""
1888618883

18884+
history_config: Optional[HistoryConfigDict]
18885+
"""Configures the exchange of history between the client and the server."""
18886+
1888718887

1888818888
LiveConnectConfigOrDict = Union[LiveConnectConfig, LiveConnectConfigDict]
1888918889

0 commit comments

Comments
 (0)