Skip to content

Commit 2cc99a9

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: add Video Understanding support to the Interactions API
Adds public support for server-initiated media processing steps: - ProcessingCallStep and ProcessingResultStep - ProcessingCallDelta and ProcessingResultDelta (streaming) - VideoContent.name field - Blob.display_name and FileData.display_name fields PiperOrigin-RevId: 972042329
1 parent 9570065 commit 2cc99a9

6 files changed

Lines changed: 190 additions & 8 deletions

File tree

google/genai/_gaos/resources/interactions/stepdelta/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
from ....types.interactions.mcpservertoolresultdelta import (
5454
MCPServerToolResultDelta as MCPServerToolResult,
5555
)
56+
from ....types.interactions.processingcalldelta import (
57+
ProcessingCallDelta as ProcessingCall,
58+
)
59+
from ....types.interactions.processingresultdelta import (
60+
ProcessingResultDelta as ProcessingResult,
61+
)
5662
from ....types.interactions.stepdeltametadata import StepDeltaMetadata as Metadata
5763
from ....types.interactions.textannotationdelta import TextAnnotationDelta
5864
from ....types.interactions.textdelta import TextDelta as Text
@@ -87,6 +93,8 @@
8793
"MCPServerToolCall",
8894
"MCPServerToolResult",
8995
"Metadata",
96+
"ProcessingCall",
97+
"ProcessingResult",
9098
"Text",
9199
"TextAnnotationDelta",
92100
"ThoughtSignature",

google/genai/_gaos/types/interactions/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@
302302
ParallelAISearchConfigParam,
303303
)
304304
from .placecitation import PlaceCitation, PlaceCitationParam
305+
from .processingcalldelta import ProcessingCallDelta, ProcessingCallDeltaTypedDict
306+
from .processingresultdelta import (
307+
ProcessingResultDelta,
308+
ProcessingResultDeltaTypedDict,
309+
)
305310
from .ragresource import RagResource, RagResourceParam
306311
from .ragretrievalconfig import RagRetrievalConfig, RagRetrievalConfigParam
307312
from .ragstoreconfig import RagStoreConfig, RagStoreConfigParam
@@ -665,8 +670,12 @@
665670
"PlaceCitation",
666671
"PlaceCitationParam",
667672
"Processing",
673+
"ProcessingCallDelta",
674+
"ProcessingCallDeltaTypedDict",
668675
"ProcessingEnum",
669676
"ProcessingParam",
677+
"ProcessingResultDelta",
678+
"ProcessingResultDeltaTypedDict",
670679
"RagResource",
671680
"RagResourceParam",
672681
"RagRetrievalConfig",
@@ -1063,6 +1072,10 @@
10631072
"ParallelAISearchConfigParam": ".parallelaisearchconfig",
10641073
"PlaceCitation": ".placecitation",
10651074
"PlaceCitationParam": ".placecitation",
1075+
"ProcessingCallDelta": ".processingcalldelta",
1076+
"ProcessingCallDeltaTypedDict": ".processingcalldelta",
1077+
"ProcessingResultDelta": ".processingresultdelta",
1078+
"ProcessingResultDeltaTypedDict": ".processingresultdelta",
10661079
"RagResource": ".ragresource",
10671080
"RagResourceParam": ".ragresource",
10681081
"RagRetrievalConfig": ".ragretrievalconfig",
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# pyformat: disable
16+
17+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
18+
19+
from __future__ import annotations
20+
from .. import BaseModel, UNSET_SENTINEL
21+
from ...utils import validate_const
22+
import pydantic
23+
from pydantic import model_serializer
24+
from pydantic.functional_validators import AfterValidator
25+
from typing import Literal, Optional
26+
from typing_extensions import Annotated, NotRequired, TypedDict
27+
28+
29+
class ProcessingCallDeltaTypedDict(TypedDict):
30+
r"""Streaming delta for a server-initiated media processing step."""
31+
32+
signature: NotRequired[str]
33+
r"""A signature hash for backend validation."""
34+
type: Literal["processing_call"]
35+
36+
37+
class ProcessingCallDelta(BaseModel):
38+
r"""Streaming delta for a server-initiated media processing step."""
39+
40+
signature: Optional[str] = None
41+
r"""A signature hash for backend validation."""
42+
43+
type: Annotated[
44+
Annotated[
45+
Literal["processing_call"],
46+
AfterValidator(validate_const("processing_call")),
47+
],
48+
pydantic.Field(alias="type"),
49+
] = "processing_call"
50+
51+
@model_serializer(mode="wrap")
52+
def serialize_model(self, handler):
53+
optional_fields = set(["signature"])
54+
serialized = handler(self)
55+
m = {}
56+
57+
for n, f in type(self).model_fields.items():
58+
k = f.alias or n
59+
val = serialized.get(k, serialized.get(n))
60+
61+
if val != UNSET_SENTINEL:
62+
if val is not None or k not in optional_fields:
63+
m[k] = val
64+
65+
return m
66+
67+
68+
try:
69+
ProcessingCallDelta.model_rebuild()
70+
except NameError:
71+
pass
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# pyformat: disable
16+
17+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
18+
19+
from __future__ import annotations
20+
from .. import BaseModel, UNSET_SENTINEL
21+
from ...utils import validate_const
22+
import pydantic
23+
from pydantic import model_serializer
24+
from pydantic.functional_validators import AfterValidator
25+
from typing import Literal, Optional
26+
from typing_extensions import Annotated, NotRequired, TypedDict
27+
28+
29+
class ProcessingResultDeltaTypedDict(TypedDict):
30+
r"""Streaming delta for the result of a server-initiated media processing step."""
31+
32+
signature: NotRequired[str]
33+
r"""A signature hash for backend validation."""
34+
type: Literal["processing_result"]
35+
36+
37+
class ProcessingResultDelta(BaseModel):
38+
r"""Streaming delta for the result of a server-initiated media processing step."""
39+
40+
signature: Optional[str] = None
41+
r"""A signature hash for backend validation."""
42+
43+
type: Annotated[
44+
Annotated[
45+
Literal["processing_result"],
46+
AfterValidator(validate_const("processing_result")),
47+
],
48+
pydantic.Field(alias="type"),
49+
] = "processing_result"
50+
51+
@model_serializer(mode="wrap")
52+
def serialize_model(self, handler):
53+
optional_fields = set(["signature"])
54+
serialized = handler(self)
55+
m = {}
56+
57+
for n, f in type(self).model_fields.items():
58+
k = f.alias or n
59+
val = serialized.get(k, serialized.get(n))
60+
61+
if val != UNSET_SENTINEL:
62+
if val is not None or k not in optional_fields:
63+
m[k] = val
64+
65+
return m
66+
67+
68+
try:
69+
ProcessingResultDelta.model_rebuild()
70+
except NameError:
71+
pass

google/genai/_gaos/types/interactions/stepdeltadata.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
MCPServerToolResultDelta,
4848
MCPServerToolResultDeltaTypedDict,
4949
)
50+
from .processingcalldelta import ProcessingCallDelta, ProcessingCallDeltaTypedDict
51+
from .processingresultdelta import ProcessingResultDelta, ProcessingResultDeltaTypedDict
5052
from .retrievalcalldelta import RetrievalCallDelta, RetrievalCallDeltaTypedDict
5153
from .retrievalresultdelta import RetrievalResultDelta, RetrievalResultDeltaTypedDict
5254
from .textannotationdelta import TextAnnotationDelta, TextAnnotationDeltaTypedDict
@@ -68,28 +70,30 @@
6870
StepDeltaDataTypedDict = TypeAliasType(
6971
"StepDeltaDataTypedDict",
7072
Union[
71-
ArgumentsDeltaTypedDict,
73+
ProcessingCallDeltaTypedDict,
7274
ThoughtSummaryDeltaTypedDict,
7375
ThoughtSignatureDeltaTypedDict,
7476
TextDeltaTypedDict,
7577
TextAnnotationDeltaTypedDict,
7678
FileSearchCallDeltaTypedDict,
77-
FileSearchResultDeltaTypedDict,
79+
ArgumentsDeltaTypedDict,
80+
ProcessingResultDeltaTypedDict,
7881
RetrievalResultDeltaTypedDict,
7982
GoogleMapsCallDeltaTypedDict,
80-
GoogleMapsResultDeltaTypedDict,
8183
GoogleSearchCallDeltaTypedDict,
8284
URLContextCallDeltaTypedDict,
8385
CodeExecutionCallDeltaTypedDict,
84-
GoogleSearchResultDeltaTypedDict,
85-
MCPServerToolResultDeltaTypedDict,
86-
RetrievalCallDeltaTypedDict,
86+
GoogleMapsResultDeltaTypedDict,
87+
FileSearchResultDeltaTypedDict,
8788
MCPServerToolCallDeltaTypedDict,
89+
RetrievalCallDeltaTypedDict,
90+
MCPServerToolResultDeltaTypedDict,
8891
DocumentDeltaTypedDict,
8992
CodeExecutionResultDeltaTypedDict,
93+
GoogleSearchResultDeltaTypedDict,
9094
URLContextResultDeltaTypedDict,
91-
ImageDeltaTypedDict,
9295
FunctionResultDeltaTypedDict,
96+
ImageDeltaTypedDict,
9397
VideoDeltaTypedDict,
9498
AudioDeltaTypedDict,
9599
],
@@ -122,6 +126,8 @@ class UnknownStepDeltaData(BaseModel):
122126
"image": ImageDelta,
123127
"mcp_server_tool_call": MCPServerToolCallDelta,
124128
"mcp_server_tool_result": MCPServerToolResultDelta,
129+
"processing_call": ProcessingCallDelta,
130+
"processing_result": ProcessingResultDelta,
125131
"retrieval_call": RetrievalCallDelta,
126132
"retrieval_result": RetrievalResultDelta,
127133
"text_annotation_delta": TextAnnotationDelta,
@@ -151,6 +157,8 @@ class UnknownStepDeltaData(BaseModel):
151157
ImageDelta,
152158
MCPServerToolCallDelta,
153159
MCPServerToolResultDelta,
160+
ProcessingCallDelta,
161+
ProcessingResultDelta,
154162
RetrievalCallDelta,
155163
RetrievalResultDelta,
156164
TextAnnotationDelta,

google/genai/_gaos/types/interactions/videocontent.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ class VideoContentParam(TypedDict):
7777
r"""The video content."""
7878
mime_type: NotRequired[VideoContentMimeType]
7979
r"""The mime type of the video."""
80+
name: NotRequired[str]
81+
r"""A user-defined name for this content block. Can be referenced by the model
82+
in the final response.
83+
"""
8084
processing: NotRequired[ProcessingParam]
8185
r"""How the model processes this video for understanding."""
8286
resolution: NotRequired[MediaResolution]
@@ -94,6 +98,11 @@ class VideoContent(BaseModel):
9498
mime_type: Optional[VideoContentMimeType] = None
9599
r"""The mime type of the video."""
96100

101+
name: Optional[str] = None
102+
r"""A user-defined name for this content block. Can be referenced by the model
103+
in the final response.
104+
"""
105+
97106
processing: Optional[Processing] = None
98107
r"""How the model processes this video for understanding."""
99108

@@ -109,7 +118,9 @@ class VideoContent(BaseModel):
109118

110119
@model_serializer(mode="wrap")
111120
def serialize_model(self, handler):
112-
optional_fields = set(["data", "mime_type", "processing", "resolution", "uri"])
121+
optional_fields = set(
122+
["data", "mime_type", "name", "processing", "resolution", "uri"]
123+
)
113124
serialized = handler(self)
114125
m = {}
115126

0 commit comments

Comments
 (0)