From 5133fb63eaca9f55dab1c962a423d02283ba8232 Mon Sep 17 00:00:00 2001 From: Jaycee Li Date: Thu, 12 Mar 2026 01:16:19 -0700 Subject: [PATCH] chore: Maintain backward-compatible field ordering in generated data types PiperOrigin-RevId: 882441106 --- google/genai/_live_converters.py | 28 ++++++++++++++-------------- google/genai/_tokens_converters.py | 10 +++++----- google/genai/types.py | 28 ++++++++++++++-------------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/google/genai/_live_converters.py b/google/genai/_live_converters.py index a3e2e7ebf..0f5efe982 100644 --- a/google/genai/_live_converters.py +++ b/google/genai/_live_converters.py @@ -584,14 +584,14 @@ def _LiveClientSetup_to_mldev( if getv(from_object, ['proactivity']) is not None: setv(to_object, ['proactivity'], getv(from_object, ['proactivity'])) - if getv(from_object, ['history_config']) is not None: - setv(to_object, ['historyConfig'], getv(from_object, ['history_config'])) - if getv(from_object, ['explicit_vad_signal']) is not None: raise ValueError( 'explicit_vad_signal parameter is not supported in Gemini API.' ) + if getv(from_object, ['history_config']) is not None: + setv(to_object, ['historyConfig'], getv(from_object, ['history_config'])) + return to_object @@ -661,9 +661,6 @@ def _LiveClientSetup_to_vertex( if getv(from_object, ['proactivity']) is not None: setv(to_object, ['proactivity'], getv(from_object, ['proactivity'])) - if getv(from_object, ['history_config']) is not None: - raise ValueError('history_config parameter is not supported in Vertex AI.') - if getv(from_object, ['explicit_vad_signal']) is not None: setv( to_object, @@ -671,6 +668,9 @@ def _LiveClientSetup_to_vertex( getv(from_object, ['explicit_vad_signal']), ) + if getv(from_object, ['history_config']) is not None: + raise ValueError('history_config parameter is not supported in Vertex AI.') + return to_object @@ -825,6 +825,11 @@ def _LiveConnectConfig_to_mldev( getv(from_object, ['proactivity']), ) + if getv(from_object, ['explicit_vad_signal']) is not None: + raise ValueError( + 'explicit_vad_signal parameter is not supported in Gemini API.' + ) + if getv(from_object, ['history_config']) is not None: setv( parent_object, @@ -832,11 +837,6 @@ def _LiveConnectConfig_to_mldev( getv(from_object, ['history_config']), ) - if getv(from_object, ['explicit_vad_signal']) is not None: - raise ValueError( - 'explicit_vad_signal parameter is not supported in Gemini API.' - ) - return to_object @@ -985,9 +985,6 @@ def _LiveConnectConfig_to_vertex( getv(from_object, ['proactivity']), ) - if getv(from_object, ['history_config']) is not None: - raise ValueError('history_config parameter is not supported in Vertex AI.') - if getv(from_object, ['explicit_vad_signal']) is not None: setv( parent_object, @@ -995,6 +992,9 @@ def _LiveConnectConfig_to_vertex( getv(from_object, ['explicit_vad_signal']), ) + if getv(from_object, ['history_config']) is not None: + raise ValueError('history_config parameter is not supported in Vertex AI.') + return to_object diff --git a/google/genai/_tokens_converters.py b/google/genai/_tokens_converters.py index 957458827..9fd9e95f2 100644 --- a/google/genai/_tokens_converters.py +++ b/google/genai/_tokens_converters.py @@ -411,6 +411,11 @@ def _LiveConnectConfig_to_mldev( getv(from_object, ['proactivity']), ) + if getv(from_object, ['explicit_vad_signal']) is not None: + raise ValueError( + 'explicit_vad_signal parameter is not supported in Gemini API.' + ) + if getv(from_object, ['history_config']) is not None: setv( parent_object, @@ -418,11 +423,6 @@ def _LiveConnectConfig_to_mldev( getv(from_object, ['history_config']), ) - if getv(from_object, ['explicit_vad_signal']) is not None: - raise ValueError( - 'explicit_vad_signal parameter is not supported in Gemini API.' - ) - return to_object diff --git a/google/genai/types.py b/google/genai/types.py index d0cd822ac..ef6e87937 100644 --- a/google/genai/types.py +++ b/google/genai/types.py @@ -18211,16 +18211,16 @@ class LiveClientSetup(_common.BaseModel): description="""Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input.""", ) - history_config: Optional[HistoryConfig] = Field( - default=None, - description="""Configures the exchange of history between the client and the server.""", - ) explicit_vad_signal: Optional[bool] = Field( default=None, description="""Configures the explicit VAD signal. If enabled, the client will send vad_signal to indicate the start and end of speech. This allows the server to process the audio more efficiently.""", ) + history_config: Optional[HistoryConfig] = Field( + default=None, + description="""Configures the exchange of history between the client and the server.""", + ) class LiveClientSetupDict(TypedDict, total=False): @@ -18272,14 +18272,14 @@ class LiveClientSetupDict(TypedDict, total=False): """Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input.""" - history_config: Optional[HistoryConfigDict] - """Configures the exchange of history between the client and the server.""" - explicit_vad_signal: Optional[bool] """Configures the explicit VAD signal. If enabled, the client will send vad_signal to indicate the start and end of speech. This allows the server to process the audio more efficiently.""" + history_config: Optional[HistoryConfigDict] + """Configures the exchange of history between the client and the server.""" + LiveClientSetupOrDict = Union[LiveClientSetup, LiveClientSetupDict] @@ -18764,16 +18764,16 @@ class LiveConnectConfig(_common.BaseModel): description="""Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input.""", ) - history_config: Optional[HistoryConfig] = Field( - default=None, - description="""Configures the exchange of history between the client and the server.""", - ) explicit_vad_signal: Optional[bool] = Field( default=None, description="""Configures the explicit VAD signal. If enabled, the client will send vad_signal to indicate the start and end of speech. This allows the server to process the audio more efficiently.""", ) + history_config: Optional[HistoryConfig] = Field( + default=None, + description="""Configures the exchange of history between the client and the server.""", + ) class LiveConnectConfigDict(TypedDict, total=False): @@ -18876,14 +18876,14 @@ class LiveConnectConfigDict(TypedDict, total=False): """Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input.""" - history_config: Optional[HistoryConfigDict] - """Configures the exchange of history between the client and the server.""" - explicit_vad_signal: Optional[bool] """Configures the explicit VAD signal. If enabled, the client will send vad_signal to indicate the start and end of speech. This allows the server to process the audio more efficiently.""" + history_config: Optional[HistoryConfigDict] + """Configures the exchange of history between the client and the server.""" + LiveConnectConfigOrDict = Union[LiveConnectConfig, LiveConnectConfigDict]