diff --git a/google/genai/_gaos/types/interactions/__init__.py b/google/genai/_gaos/types/interactions/__init__.py index 3ba034039..2dbba7047 100644 --- a/google/genai/_gaos/types/interactions/__init__.py +++ b/google/genai/_gaos/types/interactions/__init__.py @@ -162,6 +162,8 @@ from .generationconfig import ( GenerationConfig, GenerationConfigParam, + SpeechConfigUnion, + SpeechConfigUnionParam, ToolChoice, ToolChoiceParam, ) @@ -325,6 +327,7 @@ from .servicetier import ServiceTier from .sessionconfig import SessionConfig, SessionConfigParam from .source import Source, SourceParam, SourceType + from .speakerconfig import SpeakerConfig, SpeakerConfigParam from .speechconfig import SpeechConfig, SpeechConfigParam from .staticmediaprocessing import StaticMediaProcessing, StaticMediaProcessingParam from .status import Status, StatusParam @@ -676,8 +679,12 @@ "Source", "SourceParam", "SourceType", + "SpeakerConfig", + "SpeakerConfigParam", "SpeechConfig", "SpeechConfigParam", + "SpeechConfigUnion", + "SpeechConfigUnionParam", "StaticMediaProcessing", "StaticMediaProcessingParam", "Status", @@ -915,6 +922,8 @@ "UnknownFunctionResultSubcontent": ".functionresultsubcontent", "GenerationConfig": ".generationconfig", "GenerationConfigParam": ".generationconfig", + "SpeechConfigUnion": ".generationconfig", + "SpeechConfigUnionParam": ".generationconfig", "ToolChoice": ".generationconfig", "ToolChoiceParam": ".generationconfig", "GoogleMaps": ".googlemaps", @@ -1061,6 +1070,8 @@ "Source": ".source", "SourceParam": ".source", "SourceType": ".source", + "SpeakerConfig": ".speakerconfig", + "SpeakerConfigParam": ".speakerconfig", "SpeechConfig": ".speechconfig", "SpeechConfigParam": ".speechconfig", "StaticMediaProcessing": ".staticmediaprocessing", diff --git a/google/genai/_gaos/types/interactions/generationconfig.py b/google/genai/_gaos/types/interactions/generationconfig.py index ca3ebaa9f..55dc1885c 100644 --- a/google/genai/_gaos/types/interactions/generationconfig.py +++ b/google/genai/_gaos/types/interactions/generationconfig.py @@ -19,6 +19,7 @@ from __future__ import annotations from .. import BaseModel, UNSET_SENTINEL from .imageconfig import ImageConfig, ImageConfigParam +from .speakerconfig import SpeakerConfig, SpeakerConfigParam from .speechconfig import SpeechConfig, SpeechConfigParam from .thinkinglevel import ThinkingLevel from .thinkingsummaries import ThinkingSummaries @@ -42,6 +43,18 @@ r"""The tool choice configuration.""" +SpeechConfigUnionParam = TypeAliasType( + "SpeechConfigUnionParam", Union[SpeakerConfigParam, List[SpeechConfigParam]] +) +r"""Optional. Speech and multi-speaker configuration.""" + + +SpeechConfigUnion = TypeAliasType( + "SpeechConfigUnion", Union[SpeakerConfig, List[SpeechConfig]] +) +r"""Optional. Speech and multi-speaker configuration.""" + + class GenerationConfigParam(TypedDict): r"""Configuration parameters for model interactions.""" @@ -51,8 +64,6 @@ class GenerationConfigParam(TypedDict): r"""The maximum number of tokens to include in the response.""" seed: NotRequired[int] r"""Seed used in decoding for reproducibility.""" - speech_config: NotRequired[List[SpeechConfigParam]] - r"""Configuration for speech interaction.""" stop_sequences: NotRequired[List[str]] r"""A list of character sequences that will stop output interaction.""" thinking_level: NotRequired[ThinkingLevel] @@ -63,6 +74,8 @@ class GenerationConfigParam(TypedDict): r"""Configuration for speech recognition (transcription).""" video_config: NotRequired[VideoConfigParam] r"""Configuration options for video generation.""" + speech_config: NotRequired[SpeechConfigUnionParam] + r"""Optional. Speech and multi-speaker configuration.""" class GenerationConfig(BaseModel): @@ -82,9 +95,6 @@ class GenerationConfig(BaseModel): seed: Optional[int] = None r"""Seed used in decoding for reproducibility.""" - speech_config: Optional[List[SpeechConfig]] = None - r"""Configuration for speech interaction.""" - stop_sequences: Optional[List[str]] = None r"""A list of character sequences that will stop output interaction.""" @@ -101,6 +111,9 @@ class GenerationConfig(BaseModel): video_config: Optional[VideoConfig] = None r"""Configuration options for video generation.""" + speech_config: Optional[SpeechConfigUnion] = None + r"""Optional. Speech and multi-speaker configuration.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -108,13 +121,13 @@ def serialize_model(self, handler): "image_config", "max_output_tokens", "seed", - "speech_config", "stop_sequences", "thinking_level", "thinking_summaries", "tool_choice", "transcription_config", "video_config", + "speech_config", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/speakerconfig.py b/google/genai/_gaos/types/interactions/speakerconfig.py new file mode 100644 index 000000000..afae1ae5d --- /dev/null +++ b/google/genai/_gaos/types/interactions/speakerconfig.py @@ -0,0 +1,54 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .. import BaseModel, UNSET_SENTINEL +from .speechconfig import SpeechConfig, SpeechConfigParam +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class SpeakerConfigParam(TypedDict): + r"""Configuration for multi-speaker and speech generation.""" + + speakers: NotRequired[List[SpeechConfigParam]] + r"""Individual speaker configurations.""" + + +class SpeakerConfig(BaseModel): + r"""Configuration for multi-speaker and speech generation.""" + + speakers: Optional[List[SpeechConfig]] = None + r"""Individual speaker configurations.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["speakers"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m