From 66807187f2123c6676175ac991f4e34eb09200d1 Mon Sep 17 00:00:00 2001 From: Peter Morgan Date: Fri, 21 Aug 2026 12:13:02 -0700 Subject: [PATCH] No public description PiperOrigin-RevId: 968625353 --- .../_gaos/resources/interactions/__init__.py | 4 + .../transcriptionmode/__init__.py | 26 +++++++ .../_gaos/types/interactions/__init__.py | 45 ++++++++++- .../_gaos/types/interactions/findrequest.py | 6 +- .../interactions/smarttranscriptionmode.py | 46 +++++++++++ .../types/interactions/transcriptionconfig.py | 46 +++++++++-- .../types/interactions/transcriptionmode.py | 70 +++++++++++++++++ .../interactions/verbatimtranscriptionmode.py | 77 +++++++++++++++++++ 8 files changed, 309 insertions(+), 11 deletions(-) create mode 100644 google/genai/_gaos/resources/interactions/transcriptionmode/__init__.py create mode 100644 google/genai/_gaos/types/interactions/smarttranscriptionmode.py create mode 100644 google/genai/_gaos/types/interactions/transcriptionmode.py create mode 100644 google/genai/_gaos/types/interactions/verbatimtranscriptionmode.py diff --git a/google/genai/_gaos/resources/interactions/__init__.py b/google/genai/_gaos/resources/interactions/__init__.py index 5bdf1ef5e..87216d45d 100644 --- a/google/genai/_gaos/resources/interactions/__init__.py +++ b/google/genai/_gaos/resources/interactions/__init__.py @@ -97,6 +97,7 @@ from ...types.interactions.toolchoiceconfig import ToolChoiceConfig from ...types.interactions.toolchoicetype import ToolChoiceType from ...types.interactions.transcriptionconfig import TranscriptionConfig +from ...types.interactions.transcriptionmode import TranscriptionMode from ...types.interactions.urlcitation import URLCitation from ...types.interactions.urlcontextcallarguments import URLContextCallArguments from ...types.interactions.urlcontextcallstep import URLContextCallStep @@ -122,6 +123,7 @@ from . import retrievalcalldelta from . import stepdelta from . import tool +from . import transcriptionmode from . import urlcontextcallstep from . import urlcontextresultstep from . import usage @@ -201,6 +203,7 @@ "ToolChoiceConfig", "ToolChoiceType", "TranscriptionConfig", + "TranscriptionMode", "URLCitation", "URLContextCallArguments", "URLContextCallStep", @@ -226,6 +229,7 @@ "retrievalcalldelta", "stepdelta", "tool", + "transcriptionmode", "urlcontextcallstep", "urlcontextresultstep", "usage", diff --git a/google/genai/_gaos/resources/interactions/transcriptionmode/__init__.py b/google/genai/_gaos/resources/interactions/transcriptionmode/__init__.py new file mode 100644 index 000000000..44fd1616a --- /dev/null +++ b/google/genai/_gaos/resources/interactions/transcriptionmode/__init__.py @@ -0,0 +1,26 @@ +# 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 ....types.interactions.smarttranscriptionmode import ( + SmartTranscriptionMode as Smart, +) +from ....types.interactions.verbatimtranscriptionmode import ( + VerbatimTranscriptionMode as Verbatim, +) + +__all__ = ["Smart", "Verbatim"] diff --git a/google/genai/_gaos/types/interactions/__init__.py b/google/genai/_gaos/types/interactions/__init__.py index 71bfd6481..6c4068b90 100644 --- a/google/genai/_gaos/types/interactions/__init__.py +++ b/google/genai/_gaos/types/interactions/__init__.py @@ -134,7 +134,7 @@ ) from .filesearchresultstep import FileSearchResultStep, FileSearchResultStepParam from .filter_ import Filter, FilterParam - from .findrequest import FindRequest, FindRequestParam, Mode + from .findrequest import FindRequest, FindRequestMode, FindRequestParam from .fixrequest import FixRequest, FixRequestParam from .function import Function, FunctionParam from .functioncallstep import FunctionCallStep, FunctionCallStepParam @@ -326,6 +326,10 @@ from .safetysetting import Method, SafetySetting, SafetySettingParam, Threshold from .servicetier import ServiceTier from .sessionconfig import SessionConfig, SessionConfigParam + from .smarttranscriptionmode import ( + SmartTranscriptionMode, + SmartTranscriptionModeParam, + ) from .source import Source, SourceParam, SourceType from .speakerconfig import SpeakerConfig, SpeakerConfigParam from .speechconfig import SpeechConfig, SpeechConfigParam @@ -365,7 +369,18 @@ from .tool import Tool, ToolParam, UnknownTool from .toolchoiceconfig import ToolChoiceConfig, ToolChoiceConfigParam from .toolchoicetype import ToolChoiceType - from .transcriptionconfig import TranscriptionConfig, TranscriptionConfigParam + from .transcriptionconfig import ( + Mode, + ModeParam, + TranscriptionConfig, + TranscriptionConfigModeEnum, + TranscriptionConfigParam, + ) + from .transcriptionmode import ( + TranscriptionMode, + TranscriptionModeParam, + UnknownTranscriptionMode, + ) from .urlcitation import URLCitation, URLCitationParam from .urlcontext import URLContext, URLContextParam from .urlcontextcallarguments import ( @@ -386,6 +401,10 @@ from .urlcontextresultstep import URLContextResultStep, URLContextResultStepParam from .usage import Usage, UsageTypedDict from .userinputstep import UserInputStep, UserInputStepParam + from .verbatimtranscriptionmode import ( + VerbatimTranscriptionMode, + VerbatimTranscriptionModeParam, + ) from .vertexaisearchconfig import VertexAISearchConfig, VertexAISearchConfigParam from .videoconfig import Task, VideoConfig, VideoConfigParam from .videocontent import ( @@ -507,6 +526,7 @@ "Filter", "FilterParam", "FindRequest", + "FindRequestMode", "FindRequestParam", "FixRequest", "FixRequestParam", @@ -635,6 +655,7 @@ "ModalityTokens", "ModalityTokensTypedDict", "Mode", + "ModeParam", "Model", "ModelOutputStep", "ModelOutputStepParam", @@ -677,6 +698,8 @@ "ServiceTier", "SessionConfig", "SessionConfigParam", + "SmartTranscriptionMode", + "SmartTranscriptionModeParam", "Source", "SourceParam", "SourceType", @@ -731,7 +754,10 @@ "ToolChoiceType", "ToolParam", "TranscriptionConfig", + "TranscriptionConfigModeEnum", "TranscriptionConfigParam", + "TranscriptionMode", + "TranscriptionModeParam", "Transform", "TransformParam", "URLCitation", @@ -760,10 +786,13 @@ "UnknownStepDeltaData", "UnknownThoughtSummaryContent", "UnknownTool", + "UnknownTranscriptionMode", "Usage", "UsageTypedDict", "UserInputStep", "UserInputStepParam", + "VerbatimTranscriptionMode", + "VerbatimTranscriptionModeParam", "VertexAISearchConfig", "VertexAISearchConfigParam", "VideoConfig", @@ -894,8 +923,8 @@ "Filter": ".filter_", "FilterParam": ".filter_", "FindRequest": ".findrequest", + "FindRequestMode": ".findrequest", "FindRequestParam": ".findrequest", - "Mode": ".findrequest", "FixRequest": ".fixrequest", "FixRequestParam": ".fixrequest", "Function": ".function", @@ -1064,6 +1093,8 @@ "ServiceTier": ".servicetier", "SessionConfig": ".sessionconfig", "SessionConfigParam": ".sessionconfig", + "SmartTranscriptionMode": ".smarttranscriptionmode", + "SmartTranscriptionModeParam": ".smarttranscriptionmode", "Source": ".source", "SourceParam": ".source", "SourceType": ".source", @@ -1115,8 +1146,14 @@ "ToolChoiceConfig": ".toolchoiceconfig", "ToolChoiceConfigParam": ".toolchoiceconfig", "ToolChoiceType": ".toolchoicetype", + "Mode": ".transcriptionconfig", + "ModeParam": ".transcriptionconfig", "TranscriptionConfig": ".transcriptionconfig", + "TranscriptionConfigModeEnum": ".transcriptionconfig", "TranscriptionConfigParam": ".transcriptionconfig", + "TranscriptionMode": ".transcriptionmode", + "TranscriptionModeParam": ".transcriptionmode", + "UnknownTranscriptionMode": ".transcriptionmode", "URLCitation": ".urlcitation", "URLCitationParam": ".urlcitation", "URLContext": ".urlcontext", @@ -1138,6 +1175,8 @@ "UsageTypedDict": ".usage", "UserInputStep": ".userinputstep", "UserInputStepParam": ".userinputstep", + "VerbatimTranscriptionMode": ".verbatimtranscriptionmode", + "VerbatimTranscriptionModeParam": ".verbatimtranscriptionmode", "VertexAISearchConfig": ".vertexaisearchconfig", "VertexAISearchConfigParam": ".vertexaisearchconfig", "Task": ".videoconfig", diff --git a/google/genai/_gaos/types/interactions/findrequest.py b/google/genai/_gaos/types/interactions/findrequest.py index f98f067dc..9a00e3cca 100644 --- a/google/genai/_gaos/types/interactions/findrequest.py +++ b/google/genai/_gaos/types/interactions/findrequest.py @@ -24,7 +24,7 @@ from typing_extensions import NotRequired, TypedDict -Mode = Union[ +FindRequestMode = Union[ Literal[ "scan", "verify", @@ -48,7 +48,7 @@ class FindRequestParam(TypedDict): VERIFY mode to focus the agent's execution-based validation on a single vulnerability. """ - mode: NotRequired[Mode] + mode: NotRequired[FindRequestMode] r"""The mode of the find session.""" source_files: NotRequired[List[FileContentParam]] r"""A list of source files to provide as context for the scan.""" @@ -70,7 +70,7 @@ class FindRequest(BaseModel): vulnerability. """ - mode: Optional[Mode] = None + mode: Optional[FindRequestMode] = None r"""The mode of the find session.""" source_files: Optional[List[FileContent]] = None diff --git a/google/genai/_gaos/types/interactions/smarttranscriptionmode.py b/google/genai/_gaos/types/interactions/smarttranscriptionmode.py new file mode 100644 index 000000000..27f270548 --- /dev/null +++ b/google/genai/_gaos/types/interactions/smarttranscriptionmode.py @@ -0,0 +1,46 @@ +# 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 +from ...utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, TypedDict + + +class SmartTranscriptionModeParam(TypedDict): + r"""Configuration for smart transcription mode.""" + + type: Literal["smart"] + + +class SmartTranscriptionMode(BaseModel): + r"""Configuration for smart transcription mode.""" + + type: Annotated[ + Annotated[Literal["smart"], AfterValidator(validate_const("smart"))], + pydantic.Field(alias="type"), + ] = "smart" + + +try: + SmartTranscriptionMode.model_rebuild() +except NameError: + pass diff --git a/google/genai/_gaos/types/interactions/transcriptionconfig.py b/google/genai/_gaos/types/interactions/transcriptionconfig.py index f86a67495..2c846d343 100644 --- a/google/genai/_gaos/types/interactions/transcriptionconfig.py +++ b/google/genai/_gaos/types/interactions/transcriptionconfig.py @@ -17,11 +17,31 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL +from .transcriptionmode import TranscriptionMode, TranscriptionModeParam +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr import pydantic from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +TranscriptionConfigModeEnum = Union[ + Literal[ + "verbatim", + "smart", + ], + UnrecognizedStr, +] + + +ModeParam = TypeAliasType( + "ModeParam", Union[TranscriptionModeParam, TranscriptionConfigModeEnum] +) +r"""Discriminated transcription mode options or enum.""" + + +Mode = TypeAliasType("Mode", Union[TranscriptionMode, TranscriptionConfigModeEnum]) +r"""Discriminated transcription mode options or enum.""" class TranscriptionConfigParam(TypedDict): @@ -39,6 +59,8 @@ class TranscriptionConfigParam(TypedDict): r"""Optional. BCP-47 language codes providing hints about the languages present in the audio. If omitted or empty, defaults to automatic language detection. """ + mode: NotRequired[ModeParam] + r"""Discriminated transcription mode options or enum.""" timestamp_granularities: NotRequired[List[str]] r"""Optional. The granularity of timestamps to include in the transcription output. Supported values: \"word\". If empty, no timestamps are generated. @@ -61,7 +83,12 @@ class TranscriptionConfig(BaseModel): toward recognizing specific terms. """ - diarization_mode: Optional[str] = None + diarization_mode: Annotated[ + Optional[str], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = None r"""Optional. Configures speaker diarization. Supported values: \"speaker\".""" language_codes: Optional[List[str]] = None @@ -69,7 +96,15 @@ class TranscriptionConfig(BaseModel): audio. If omitted or empty, defaults to automatic language detection. """ - timestamp_granularities: Optional[List[str]] = None + mode: Optional[Mode] = None + r"""Discriminated transcription mode options or enum.""" + + timestamp_granularities: Annotated[ + Optional[List[str]], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = None r"""Optional. The granularity of timestamps to include in the transcription output. Supported values: \"word\". If empty, no timestamps are generated. """ @@ -82,6 +117,7 @@ def serialize_model(self, handler): "custom_vocabulary", "diarization_mode", "language_codes", + "mode", "timestamp_granularities", ] ) diff --git a/google/genai/_gaos/types/interactions/transcriptionmode.py b/google/genai/_gaos/types/interactions/transcriptionmode.py new file mode 100644 index 000000000..c9f71bb4e --- /dev/null +++ b/google/genai/_gaos/types/interactions/transcriptionmode.py @@ -0,0 +1,70 @@ +# 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 .smarttranscriptionmode import SmartTranscriptionMode, SmartTranscriptionModeParam +from .verbatimtranscriptionmode import ( + VerbatimTranscriptionMode, + VerbatimTranscriptionModeParam, +) +from functools import partial +from .. import BaseModel +from ...utils.unions import parse_open_union +from pydantic import ConfigDict +from pydantic.functional_validators import BeforeValidator +from typing import Any, Literal, Union +from typing_extensions import Annotated, TypeAliasType + + +TranscriptionModeParam = TypeAliasType( + "TranscriptionModeParam", + Union[SmartTranscriptionModeParam, VerbatimTranscriptionModeParam], +) +r"""Configuration for transcription mode.""" + + +class UnknownTranscriptionMode(BaseModel): + r"""A TranscriptionMode variant the SDK doesn't recognize. Preserves the raw payload.""" + + type: Literal["UNKNOWN"] = "UNKNOWN" + raw: Any + is_unknown: Literal[True] = True + + model_config = ConfigDict(frozen=True) + + +_TRANSCRIPTION_MODE_VARIANTS: dict[str, Any] = { + "smart": SmartTranscriptionMode, + "verbatim": VerbatimTranscriptionMode, +} + + +TranscriptionMode = Annotated[ + Union[SmartTranscriptionMode, VerbatimTranscriptionMode, UnknownTranscriptionMode], + BeforeValidator( + partial( + parse_open_union, + disc_key="type", + variants=_TRANSCRIPTION_MODE_VARIANTS, + unknown_cls=UnknownTranscriptionMode, + union_name="TranscriptionMode", + lenient=True, + ) + ), +] +r"""Configuration for transcription mode.""" diff --git a/google/genai/_gaos/types/interactions/verbatimtranscriptionmode.py b/google/genai/_gaos/types/interactions/verbatimtranscriptionmode.py new file mode 100644 index 000000000..92b9982c1 --- /dev/null +++ b/google/genai/_gaos/types/interactions/verbatimtranscriptionmode.py @@ -0,0 +1,77 @@ +# 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 ...utils import validate_const +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import List, Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class VerbatimTranscriptionModeParam(TypedDict): + r"""Configuration for verbatim transcription mode.""" + + diarization_mode: NotRequired[str] + r"""Optional. Configures speaker diarization. Supported values: \"speaker\".""" + timestamp_granularities: NotRequired[List[str]] + r"""Optional. The granularity of timestamps to include in the transcription output. + Supported values: \"word\". If empty, no timestamps are generated. + """ + type: Literal["verbatim"] + + +class VerbatimTranscriptionMode(BaseModel): + r"""Configuration for verbatim transcription mode.""" + + diarization_mode: Optional[str] = None + r"""Optional. Configures speaker diarization. Supported values: \"speaker\".""" + + timestamp_granularities: Optional[List[str]] = None + r"""Optional. The granularity of timestamps to include in the transcription output. + Supported values: \"word\". If empty, no timestamps are generated. + """ + + type: Annotated[ + Annotated[Literal["verbatim"], AfterValidator(validate_const("verbatim"))], + pydantic.Field(alias="type"), + ] = "verbatim" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["diarization_mode", "timestamp_granularities"]) + 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 + + +try: + VerbatimTranscriptionMode.model_rebuild() +except NameError: + pass