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
2 changes: 2 additions & 0 deletions google/genai/_gaos/resources/interactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -201,6 +202,7 @@
"ToolChoiceConfig",
"ToolChoiceType",
"TranscriptionConfig",
"TranscriptionMode",
"URLCitation",
"URLContextCallArguments",
"URLContextCallStep",
Expand Down
3 changes: 3 additions & 0 deletions google/genai/_gaos/types/interactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
from .toolchoiceconfig import ToolChoiceConfig, ToolChoiceConfigParam
from .toolchoicetype import ToolChoiceType
from .transcriptionconfig import TranscriptionConfig, TranscriptionConfigParam
from .transcriptionmode import TranscriptionMode
from .urlcitation import URLCitation, URLCitationParam
from .urlcontext import URLContext, URLContextParam
from .urlcontextcallarguments import (
Expand Down Expand Up @@ -732,6 +733,7 @@
"ToolParam",
"TranscriptionConfig",
"TranscriptionConfigParam",
"TranscriptionMode",
"Transform",
"TransformParam",
"URLCitation",
Expand Down Expand Up @@ -1117,6 +1119,7 @@
"ToolChoiceType": ".toolchoicetype",
"TranscriptionConfig": ".transcriptionconfig",
"TranscriptionConfigParam": ".transcriptionconfig",
"TranscriptionMode": ".transcriptionmode",
"URLCitation": ".urlcitation",
"URLCitationParam": ".urlcitation",
"URLContext": ".urlcontext",
Expand Down
10 changes: 6 additions & 4 deletions google/genai/_gaos/types/interactions/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from .webhookconfig import WebhookConfig, WebhookConfigParam
from functools import partial
import pydantic
from pydantic import ConfigDict, model_serializer, model_validator
from pydantic import ConfigDict, model_serializer
from pydantic.functional_validators import BeforeValidator
from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
Expand Down Expand Up @@ -387,7 +387,7 @@ def _maybe_coerce_outputs(cls, data: Any) -> Any:
coerced["steps"] = [{"type": "model_output", "content": outputs}]
return coerced

@model_validator(mode="before")
@pydantic.model_validator(mode="before")
@classmethod
def _coerce_outputs_to_steps(cls, data: Any) -> Any:
return cls._maybe_coerce_outputs(data)
Expand All @@ -396,9 +396,11 @@ def _coerce_outputs_to_steps(cls, data: Any) -> Any:
def model_construct(cls, _fields_set=None, **values):
# Coerce legacy lyria ``outputs`` -> ``steps`` here as well: validators
# do not run on model_construct (used by deferred SSE parsing).
return super().model_construct(_fields_set, **cls._maybe_coerce_outputs(values))
return pydantic.BaseModel.model_construct(
_fields_set, **cls._maybe_coerce_outputs(values)
)

@model_validator(mode="after")
@pydantic.model_validator(mode="after")
def _populate_output_helpers(self):
steps = self.steps if isinstance(self.steps, list) else []

Expand Down
13 changes: 13 additions & 0 deletions google/genai/_gaos/types/interactions/transcriptionconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from __future__ import annotations
from .. import BaseModel, UNSET_SENTINEL
from .transcriptionmode import TranscriptionMode
import pydantic
from pydantic import model_serializer
from typing import List, Optional
Expand All @@ -39,6 +40,11 @@ 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[TranscriptionMode]
r"""Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If
unspecified, defaults to `VERBATIM` transcription. Mutually exclusive with
`timestamp_granularities` and `diarization_mode`.
"""
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.
Expand Down Expand Up @@ -69,6 +75,12 @@ class TranscriptionConfig(BaseModel):
audio. If omitted or empty, defaults to automatic language detection.
"""

mode: Optional[TranscriptionMode] = None
r"""Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If
unspecified, defaults to `VERBATIM` transcription. Mutually exclusive with
`timestamp_granularities` and `diarization_mode`.
"""

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.
Expand All @@ -82,6 +94,7 @@ def serialize_model(self, handler):
"custom_vocabulary",
"diarization_mode",
"language_codes",
"mode",
"timestamp_granularities",
]
)
Expand Down
34 changes: 34 additions & 0 deletions google/genai/_gaos/types/interactions/transcriptionmode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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 UnrecognizedStr
from typing import Literal, Union


TranscriptionMode = Union[
Literal[
"verbatim",
"smart",
],
UnrecognizedStr,
]
r"""Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If
unspecified, defaults to `VERBATIM` transcription. Mutually exclusive with
`timestamp_granularities` and `diarization_mode`.
"""
32 changes: 32 additions & 0 deletions google/genai/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,17 @@ class VoiceActivityType(_common.CaseInSensitiveEnum):
"""End of sentence signal."""


class AudioTranscriptionConfigMode(_common.CaseInSensitiveEnum):
"""Transcription mode."""

MODE_UNSPECIFIED = 'MODE_UNSPECIFIED'
"""Unspecified transcription mode."""
VERBATIM = 'VERBATIM'
"""Verbatim transcription mode."""
SMART = 'SMART'
"""Smart transcription mode."""


class StartSensitivity(_common.CaseInSensitiveEnum):
"""Start of speech sensitivity."""

Expand Down Expand Up @@ -6369,6 +6380,17 @@ class AudioTranscriptionConfig(_common.BaseModel):
description="""Configures speaker diarization.
""",
)
mode: Optional[AudioTranscriptionConfigMode] = Field(
default=None,
description="""Optional. Transcription mode.

When set to `SMART`, the model performs disfluency removal (eliminating
filler words, repetitions, and false starts), light grammatical cleanup,
automatic formatting (paragraphs, bullet points, numbered lists), and
minor user edits (inline self-corrections). Incompatible with
`word_timestamp` and `diarization`.
""",
)


class AudioTranscriptionConfigDict(TypedDict, total=False):
Expand Down Expand Up @@ -6397,6 +6419,16 @@ class AudioTranscriptionConfigDict(TypedDict, total=False):
"""Configures speaker diarization.
"""

mode: Optional[AudioTranscriptionConfigMode]
"""Optional. Transcription mode.

When set to `SMART`, the model performs disfluency removal (eliminating
filler words, repetitions, and false starts), light grammatical cleanup,
automatic formatting (paragraphs, bullet points, numbered lists), and
minor user edits (inline self-corrections). Incompatible with
`word_timestamp` and `diarization`.
"""


AudioTranscriptionConfigOrDict = Union[
AudioTranscriptionConfig, AudioTranscriptionConfigDict
Expand Down
Loading