diff --git a/google/genai/_gaos/types/interactions/smarttranscriptionmode.py b/google/genai/_gaos/types/interactions/smarttranscriptionmode.py index 6dac77ae8..c99303a9f 100644 --- a/google/genai/_gaos/types/interactions/smarttranscriptionmode.py +++ b/google/genai/_gaos/types/interactions/smarttranscriptionmode.py @@ -18,28 +18,64 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel +from .. import BaseModel, UNSET_SENTINEL, current_exclude_none, serialize_with_info from ...utils import validate_const +from ..basemodel import current_filtered_dump import pydantic +from pydantic import model_serializer from pydantic.functional_validators import AfterValidator -from typing import Literal -from typing_extensions import Annotated, TypedDict +from typing import Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class SmartTranscriptionModeParam(TypedDict): r"""Configuration for smart transcription mode.""" + source_text: NotRequired[str] + r"""The source text to be edited or rewritten via voice instructions. + When provided, the model performs voice-driven editing and outputs the + finalized replacement text. + """ type: Literal["smart"] class SmartTranscriptionMode(BaseModel): r"""Configuration for smart transcription mode.""" + source_text: Optional[str] = None + r"""The source text to be edited or rewritten via voice instructions. + When provided, the model performs voice-driven editing and outputs the + finalized replacement text. + """ + type: Annotated[ Annotated[Literal["smart"], AfterValidator(validate_const("smart"))], pydantic.Field(alias="type"), ] = "smart" + @model_serializer(mode="wrap") + def _serialize_model_with_info(self, handler, info): + return serialize_with_info(self.serialize_model, handler, info) + + def serialize_model(self, handler): + optional_fields = set(["source_text"]) + exclude_none = current_exclude_none() + skip_filtered = exclude_none is False or current_filtered_dump() + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias if f.alias is not None else n + if k not in serialized and n not in serialized and skip_filtered: + continue + 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: SmartTranscriptionMode.model_rebuild() diff --git a/google/genai/types.py b/google/genai/types.py index fcdf0cb34..c834595f9 100644 --- a/google/genai/types.py +++ b/google/genai/types.py @@ -6522,6 +6522,10 @@ class AudioTranscriptionConfig(_common.BaseModel): default=None, description="""Optional. Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If unspecified, defaults to `VERBATIM` transcription. In `SMART` mode, 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). Timestamps and diarization are incompatible with mode `SMART`.""", ) + source_text: Optional[str] = Field( + default=None, + description="""Optional. The source text to be edited or rewritten via voice instructions. When provided in `SMART` mode, the model evaluates the audio input against this text and emits the complete replacement text in the candidate response rather than appending to it.""", + ) class AudioTranscriptionConfigDict(TypedDict, total=False): @@ -6553,6 +6557,9 @@ class AudioTranscriptionConfigDict(TypedDict, total=False): mode: Optional[AudioTranscriptionConfigMode] """Optional. Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If unspecified, defaults to `VERBATIM` transcription. In `SMART` mode, 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). Timestamps and diarization are incompatible with mode `SMART`.""" + source_text: Optional[str] + """Optional. The source text to be edited or rewritten via voice instructions. When provided in `SMART` mode, the model evaluates the audio input against this text and emits the complete replacement text in the candidate response rather than appending to it.""" + AudioTranscriptionConfigOrDict = Union[ AudioTranscriptionConfig, AudioTranscriptionConfigDict