Skip to content
Merged
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
11 changes: 11 additions & 0 deletions google/genai/_gaos/types/interactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@
from .generationconfig import (
GenerationConfig,
GenerationConfigParam,
SpeechConfigUnion,
SpeechConfigUnionParam,
ToolChoice,
ToolChoiceParam,
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -676,8 +679,12 @@
"Source",
"SourceParam",
"SourceType",
"SpeakerConfig",
"SpeakerConfigParam",
"SpeechConfig",
"SpeechConfigParam",
"SpeechConfigUnion",
"SpeechConfigUnionParam",
"StaticMediaProcessing",
"StaticMediaProcessingParam",
"Status",
Expand Down Expand Up @@ -915,6 +922,8 @@
"UnknownFunctionResultSubcontent": ".functionresultsubcontent",
"GenerationConfig": ".generationconfig",
"GenerationConfigParam": ".generationconfig",
"SpeechConfigUnion": ".generationconfig",
"SpeechConfigUnionParam": ".generationconfig",
"ToolChoice": ".generationconfig",
"ToolChoiceParam": ".generationconfig",
"GoogleMaps": ".googlemaps",
Expand Down Expand Up @@ -1061,6 +1070,8 @@
"Source": ".source",
"SourceParam": ".source",
"SourceType": ".source",
"SpeakerConfig": ".speakerconfig",
"SpeakerConfigParam": ".speakerconfig",
"SpeechConfig": ".speechconfig",
"SpeechConfigParam": ".speechconfig",
"StaticMediaProcessing": ".staticmediaprocessing",
Expand Down
25 changes: 19 additions & 6 deletions google/genai/_gaos/types/interactions/generationconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."""

Expand All @@ -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]
Expand All @@ -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):
Expand All @@ -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."""

Expand All @@ -101,20 +111,23 @@ 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(
[
"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)
Expand Down
54 changes: 54 additions & 0 deletions google/genai/_gaos/types/interactions/speakerconfig.py
Original file line number Diff line number Diff line change
@@ -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
Loading