Skip to content

Commit 1b3d5b6

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: Add source_text to AudioTranscriptionConfig and SmartTranscriptionMode.
PiperOrigin-RevId: 1008477611
1 parent 6e80d42 commit 1b3d5b6

2 files changed

Lines changed: 38 additions & 3 deletions

File tree

‎google/genai/_gaos/types/interactions/smarttranscriptionmode.py‎

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,56 @@
1818
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
1919

2020
from __future__ import annotations
21-
from .. import BaseModel
21+
from .. import BaseModel, UNSET_SENTINEL
2222
from ...utils import validate_const
2323
import pydantic
24+
from pydantic import model_serializer
2425
from pydantic.functional_validators import AfterValidator
25-
from typing import Literal
26-
from typing_extensions import Annotated, TypedDict
26+
from typing import Literal, Optional
27+
from typing_extensions import Annotated, NotRequired, TypedDict
2728

2829

2930
class SmartTranscriptionModeParam(TypedDict):
3031
r"""Configuration for smart transcription mode."""
3132

33+
source_text: NotRequired[str]
34+
r"""The source text to be edited or rewritten via voice instructions.
35+
When provided, the model performs voice-driven editing and outputs the
36+
finalized replacement text.
37+
"""
3238
type: Literal["smart"]
3339

3440

3541
class SmartTranscriptionMode(BaseModel):
3642
r"""Configuration for smart transcription mode."""
3743

44+
source_text: Optional[str] = None
45+
r"""The source text to be edited or rewritten via voice instructions.
46+
When provided, the model performs voice-driven editing and outputs the
47+
finalized replacement text.
48+
"""
49+
3850
type: Annotated[
3951
Annotated[Literal["smart"], AfterValidator(validate_const("smart"))],
4052
pydantic.Field(alias="type"),
4153
] = "smart"
4254

55+
@model_serializer(mode="wrap")
56+
def serialize_model(self, handler):
57+
optional_fields = set(["source_text"])
58+
serialized = handler(self)
59+
m = {}
60+
61+
for n, f in type(self).model_fields.items():
62+
k = f.alias or n
63+
val = serialized.get(k, serialized.get(n))
64+
65+
if val != UNSET_SENTINEL:
66+
if val is not None or k not in optional_fields:
67+
m[k] = val
68+
69+
return m
70+
4371

4472
try:
4573
SmartTranscriptionMode.model_rebuild()

‎google/genai/types.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6522,6 +6522,10 @@ class AudioTranscriptionConfig(_common.BaseModel):
65226522
default=None,
65236523
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`.""",
65246524
)
6525+
source_text: Optional[str] = Field(
6526+
default=None,
6527+
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.""",
6528+
)
65256529

65266530

65276531
class AudioTranscriptionConfigDict(TypedDict, total=False):
@@ -6553,6 +6557,9 @@ class AudioTranscriptionConfigDict(TypedDict, total=False):
65536557
mode: Optional[AudioTranscriptionConfigMode]
65546558
"""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`."""
65556559

6560+
source_text: Optional[str]
6561+
"""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."""
6562+
65566563

65576564
AudioTranscriptionConfigOrDict = Union[
65586565
AudioTranscriptionConfig, AudioTranscriptionConfigDict

0 commit comments

Comments
 (0)