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
4 changes: 4 additions & 0 deletions google/genai/_gaos/resources/interactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
from ...types.interactions.tool import Tool
from ...types.interactions.toolchoiceconfig import ToolChoiceConfig
from ...types.interactions.toolchoicetype import ToolChoiceType
from ...types.interactions.transcriptionconfig import TranscriptionConfig
from ...types.interactions.urlcitation import URLCitation
from ...types.interactions.urlcontextcallarguments import URLContextCallArguments
from ...types.interactions.urlcontextcallstep import URLContextCallStep
Expand All @@ -106,6 +107,7 @@
from ...types.interactions.videocontent import VideoContent
from ...types.interactions.videoresponseformat import VideoResponseFormat
from ...types.interactions.webhookconfig import WebhookConfig
from ...types.interactions.wordinfo import WordInfo
from . import codeexecutioncallstep
from . import codemenderagentconfig
from . import environment
Expand Down Expand Up @@ -201,6 +203,7 @@
"Tool",
"ToolChoiceConfig",
"ToolChoiceType",
"TranscriptionConfig",
"URLCitation",
"URLContextCallArguments",
"URLContextCallStep",
Expand All @@ -212,6 +215,7 @@
"VideoContent",
"VideoResponseFormat",
"WebhookConfig",
"WordInfo",
"codeexecutioncallstep",
"codemenderagentconfig",
"environment",
Expand Down
10 changes: 10 additions & 0 deletions google/genai/_gaos/types/interactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@
from .tool import Tool, ToolParam, UnknownTool
from .toolchoiceconfig import ToolChoiceConfig, ToolChoiceConfigParam
from .toolchoicetype import ToolChoiceType
from .transcriptionconfig import TranscriptionConfig, TranscriptionConfigParam
from .turn import Turn, TurnContent, TurnContentParam, TurnParam
from .urlcitation import URLCitation, URLCitationParam
from .urlcontext import URLContext, URLContextParam
Expand Down Expand Up @@ -478,6 +479,7 @@
VideoResponseFormatParam,
)
from .webhookconfig import WebhookConfig, WebhookConfigParam
from .wordinfo import WordInfo, WordInfoParam

__all__ = [
"AgentOption",
Expand Down Expand Up @@ -869,6 +871,8 @@
"ToolChoiceParam",
"ToolChoiceType",
"ToolParam",
"TranscriptionConfig",
"TranscriptionConfigParam",
"Transform",
"TransformParam",
"Turn",
Expand Down Expand Up @@ -922,6 +926,8 @@
"Visualization",
"WebhookConfig",
"WebhookConfigParam",
"WordInfo",
"WordInfoParam",
]

_dynamic_imports: dict[str, str] = {
Expand Down Expand Up @@ -1325,6 +1331,8 @@
"ToolChoiceConfig": ".toolchoiceconfig",
"ToolChoiceConfigParam": ".toolchoiceconfig",
"ToolChoiceType": ".toolchoicetype",
"TranscriptionConfig": ".transcriptionconfig",
"TranscriptionConfigParam": ".transcriptionconfig",
"Turn": ".turn",
"TurnContent": ".turn",
"TurnContentParam": ".turn",
Expand Down Expand Up @@ -1367,6 +1375,8 @@
"VideoResponseFormatParam": ".videoresponseformat",
"WebhookConfig": ".webhookconfig",
"WebhookConfigParam": ".webhookconfig",
"WordInfo": ".wordinfo",
"WordInfoParam": ".wordinfo",
}


Expand Down
7 changes: 5 additions & 2 deletions google/genai/_gaos/types/interactions/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .filecitation import FileCitation, FileCitationParam
from .placecitation import PlaceCitation, PlaceCitationParam
from .urlcitation import URLCitation, URLCitationParam
from .wordinfo import WordInfo, WordInfoParam
from functools import partial
from pydantic import ConfigDict
from pydantic.functional_validators import BeforeValidator
Expand All @@ -30,7 +31,8 @@


AnnotationParam = TypeAliasType(
"AnnotationParam", Union[URLCitationParam, PlaceCitationParam, FileCitationParam]
"AnnotationParam",
Union[URLCitationParam, PlaceCitationParam, WordInfoParam, FileCitationParam],
)
r"""Citation information for model-generated content."""

Expand All @@ -49,11 +51,12 @@ class UnknownAnnotation(BaseModel):
"url_citation": URLCitation,
"file_citation": FileCitation,
"place_citation": PlaceCitation,
"word_info": WordInfo,
}


Annotation = Annotated[
Union[URLCitation, FileCitation, PlaceCitation, UnknownAnnotation],
Union[URLCitation, FileCitation, PlaceCitation, WordInfo, UnknownAnnotation],
BeforeValidator(
partial(
parse_open_union,
Expand Down
7 changes: 7 additions & 0 deletions google/genai/_gaos/types/interactions/generationconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .thinkingsummaries import ThinkingSummaries
from .toolchoiceconfig import ToolChoiceConfig, ToolChoiceConfigParam
from .toolchoicetype import ToolChoiceType
from .transcriptionconfig import TranscriptionConfig, TranscriptionConfigParam
from .videoconfig import VideoConfig, VideoConfigParam
import pydantic
from pydantic import model_serializer
Expand Down Expand Up @@ -62,6 +63,8 @@ class GenerationConfigParam(TypedDict):
r"""The tool choice configuration."""
top_p: NotRequired[float]
r"""The maximum cumulative probability of tokens to consider when sampling."""
transcription_config: NotRequired[TranscriptionConfigParam]
r"""Configuration for speech recognition (transcription)."""
video_config: NotRequired[VideoConfigParam]
r"""Configuration options for video generation."""

Expand Down Expand Up @@ -102,6 +105,9 @@ class GenerationConfig(BaseModel):
top_p: Optional[float] = None
r"""The maximum cumulative probability of tokens to consider when sampling."""

transcription_config: Optional[TranscriptionConfig] = None
r"""Configuration for speech recognition (transcription)."""

video_config: Optional[VideoConfig] = None
r"""Configuration options for video generation."""

Expand All @@ -119,6 +125,7 @@ def serialize_model(self, handler):
"thinking_summaries",
"tool_choice",
"top_p",
"transcription_config",
"video_config",
]
)
Expand Down
100 changes: 100 additions & 0 deletions google/genai/_gaos/types/interactions/transcriptionconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 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
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class TranscriptionConfigParam(TypedDict):
r"""Configuration for speech recognition (transcription)."""

language_hints: List[str]
r"""Required. BCP-47 language codes providing hints about the languages present in the
audio. At least one must be specified, or set to [\"auto\"] to enable
automatic language detection.
"""
adaptation_phrases: NotRequired[List[str]]
r"""Optional. A list of phrases to bias the ASR model towards."""
custom_vocabulary: NotRequired[List[str]]
r"""Optional. A list of custom vocabulary phrases to bias the speech recognition model
toward recognizing specific terms.
"""
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.
"""


class TranscriptionConfig(BaseModel):
r"""Configuration for speech recognition (transcription)."""

language_hints: List[str]
r"""Required. BCP-47 language codes providing hints about the languages present in the
audio. At least one must be specified, or set to [\"auto\"] to enable
automatic language detection.
"""

adaptation_phrases: 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. A list of phrases to bias the ASR model towards."""

custom_vocabulary: Optional[List[str]] = None
r"""Optional. A list of custom vocabulary phrases to bias the speech recognition model
toward recognizing specific terms.
"""

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.
"""

@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
[
"adaptation_phrases",
"custom_vocabulary",
"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
124 changes: 124 additions & 0 deletions google/genai/_gaos/types/interactions/wordinfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# 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 Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class WordInfoParam(TypedDict):
r"""Word-level ASR annotation for transcription output.
Carries the word text, optional timing, and optional speaker attribution.
"""

end_index: NotRequired[int]
r"""End of the attributed segment, exclusive."""
end_offset: NotRequired[str]
r"""End offset in time of the word relative to the start of the audio.
Present when timestamp_granularities contains \"word\".
"""
speaker: NotRequired[str]
r"""Optional. Speaker label for this word (e.g. \"spk_1\", \"spk_2\").
Present when diarization_mode is set in TranscriptionConfig.
"""
start_index: NotRequired[int]
r"""Start of segment of the response that is attributed to this source.

Index indicates the start of the segment, measured in bytes.
"""
start_offset: NotRequired[str]
r"""Start offset in time of the word relative to the start of the audio.
Present when timestamp_granularities contains \"word\".
"""
text: NotRequired[str]
r"""The transcribed word."""
type: Literal["word_info"]


class WordInfo(BaseModel):
r"""Word-level ASR annotation for transcription output.
Carries the word text, optional timing, and optional speaker attribution.
"""

end_index: Optional[int] = None
r"""End of the attributed segment, exclusive."""

end_offset: Optional[str] = None
r"""End offset in time of the word relative to the start of the audio.
Present when timestamp_granularities contains \"word\".
"""

speaker: Optional[str] = None
r"""Optional. Speaker label for this word (e.g. \"spk_1\", \"spk_2\").
Present when diarization_mode is set in TranscriptionConfig.
"""

start_index: Optional[int] = None
r"""Start of segment of the response that is attributed to this source.

Index indicates the start of the segment, measured in bytes.
"""

start_offset: Optional[str] = None
r"""Start offset in time of the word relative to the start of the audio.
Present when timestamp_granularities contains \"word\".
"""

text: Optional[str] = None
r"""The transcribed word."""

type: Annotated[
Annotated[Literal["word_info"], AfterValidator(validate_const("word_info"))],
pydantic.Field(alias="type"),
] = "word_info"

@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
[
"end_index",
"end_offset",
"speaker",
"start_index",
"start_offset",
"text",
]
)
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:
WordInfo.model_rebuild()
except NameError:
pass
Loading