Skip to content

Commit d2b19f6

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: add retrieval result step and new fields to maps and search results
PiperOrigin-RevId: 944078664
1 parent 8928da3 commit d2b19f6

12 files changed

Lines changed: 335 additions & 67 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@
7676
from ...types.interactions.model import Model
7777
from ...types.interactions.modeloutputstep import ModelOutputStep
7878
from ...types.interactions.placecitation import PlaceCitation
79+
from ...types.interactions.retrievalcallarguments import RetrievalCallArguments
80+
from ...types.interactions.retrievalcalldelta import RetrievalCallDelta
81+
from ...types.interactions.retrievalresultdelta import RetrievalResultDelta
7982
from ...types.interactions.speechconfig import SpeechConfig
8083
from ...types.interactions.step import Step
8184
from ...types.interactions.stepdelta import StepDelta
@@ -112,6 +115,7 @@
112115
from . import interactionstatusupdate
113116
from . import modeloutputstep
114117
from . import placecitation
118+
from . import retrievalcalldelta
115119
from . import stepdelta
116120
from . import stepstart
117121
from . import stepstop
@@ -173,6 +177,9 @@
173177
"Model",
174178
"ModelOutputStep",
175179
"PlaceCitation",
180+
"RetrievalCallArguments",
181+
"RetrievalCallDelta",
182+
"RetrievalResultDelta",
176183
"SpeechConfig",
177184
"Step",
178185
"StepDelta",
@@ -209,6 +216,7 @@
209216
"interactionstatusupdate",
210217
"modeloutputstep",
211218
"placecitation",
219+
"retrievalcalldelta",
212220
"stepdelta",
213221
"stepstart",
214222
"stepstop",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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 ....types.interactions.retrievalcallarguments import (
20+
RetrievalCallArguments as Arguments,
21+
)
22+
23+
__all__ = ["Arguments"]

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
1818

19-
from ....types.interactions.urlcontextcallstep import Arguments
19+
from ....types.interactions.urlcontextcallarguments import (
20+
URLContextCallArguments as Arguments,
21+
)
2022

2123
__all__ = ["Arguments"]

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

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,20 @@
291291
from .ranking import Ranking, RankingParam
292292
from .responseformat import ResponseFormat, ResponseFormatParam
293293
from .responsemodality import ResponseModality
294-
from .retrieval import Retrieval, RetrievalParam, RetrievalType
294+
from .retrieval import Retrieval, RetrievalParam, RetrievalRetrievalType
295+
from .retrievalcallarguments import (
296+
RetrievalCallArguments,
297+
RetrievalCallArgumentsTypedDict,
298+
)
299+
from .retrievalcalldelta import (
300+
RetrievalCallDelta,
301+
RetrievalCallDeltaRetrievalType,
302+
RetrievalCallDeltaTypedDict,
303+
)
304+
from .retrievalresultdelta import (
305+
RetrievalResultDelta,
306+
RetrievalResultDeltaTypedDict,
307+
)
295308
from .reviewsnippet import ReviewSnippet, ReviewSnippetParam
296309
from .servicetier import ServiceTier
297310
from .source import Source, SourceParam, SourceType
@@ -337,15 +350,10 @@
337350
from .urlcontext import URLContext, URLContextParam
338351
from .urlcontextcallarguments import (
339352
URLContextCallArguments,
340-
URLContextCallArgumentsTypedDict,
353+
URLContextCallArgumentsParam,
341354
)
342355
from .urlcontextcalldelta import URLContextCallDelta, URLContextCallDeltaTypedDict
343-
from .urlcontextcallstep import (
344-
Arguments,
345-
ArgumentsParam,
346-
URLContextCallStep,
347-
URLContextCallStepParam,
348-
)
356+
from .urlcontextcallstep import URLContextCallStep, URLContextCallStepParam
349357
from .urlcontextresult import (
350358
URLContextResult,
351359
URLContextResultParam,
@@ -380,10 +388,8 @@
380388
"AllowlistParam",
381389
"Annotation",
382390
"AnnotationParam",
383-
"Arguments",
384391
"ArgumentsDelta",
385392
"ArgumentsDeltaTypedDict",
386-
"ArgumentsParam",
387393
"AudioContent",
388394
"AudioContentMimeType",
389395
"AudioContentParam",
@@ -607,8 +613,15 @@
607613
"ResponseFormatParam",
608614
"ResponseModality",
609615
"Retrieval",
616+
"RetrievalCallArguments",
617+
"RetrievalCallArgumentsTypedDict",
618+
"RetrievalCallDelta",
619+
"RetrievalCallDeltaRetrievalType",
620+
"RetrievalCallDeltaTypedDict",
610621
"RetrievalParam",
611-
"RetrievalType",
622+
"RetrievalResultDelta",
623+
"RetrievalResultDeltaTypedDict",
624+
"RetrievalRetrievalType",
612625
"ReviewSnippet",
613626
"ReviewSnippetParam",
614627
"ServiceTier",
@@ -668,7 +681,7 @@
668681
"URLCitationParam",
669682
"URLContext",
670683
"URLContextCallArguments",
671-
"URLContextCallArgumentsTypedDict",
684+
"URLContextCallArgumentsParam",
672685
"URLContextCallDelta",
673686
"URLContextCallDeltaTypedDict",
674687
"URLContextCallStep",
@@ -957,7 +970,14 @@
957970
"ResponseModality": ".responsemodality",
958971
"Retrieval": ".retrieval",
959972
"RetrievalParam": ".retrieval",
960-
"RetrievalType": ".retrieval",
973+
"RetrievalRetrievalType": ".retrieval",
974+
"RetrievalCallArguments": ".retrievalcallarguments",
975+
"RetrievalCallArgumentsTypedDict": ".retrievalcallarguments",
976+
"RetrievalCallDelta": ".retrievalcalldelta",
977+
"RetrievalCallDeltaRetrievalType": ".retrievalcalldelta",
978+
"RetrievalCallDeltaTypedDict": ".retrievalcalldelta",
979+
"RetrievalResultDelta": ".retrievalresultdelta",
980+
"RetrievalResultDeltaTypedDict": ".retrievalresultdelta",
961981
"ReviewSnippet": ".reviewsnippet",
962982
"ReviewSnippetParam": ".reviewsnippet",
963983
"ServiceTier": ".servicetier",
@@ -1019,11 +1039,9 @@
10191039
"URLContext": ".urlcontext",
10201040
"URLContextParam": ".urlcontext",
10211041
"URLContextCallArguments": ".urlcontextcallarguments",
1022-
"URLContextCallArgumentsTypedDict": ".urlcontextcallarguments",
1042+
"URLContextCallArgumentsParam": ".urlcontextcallarguments",
10231043
"URLContextCallDelta": ".urlcontextcalldelta",
10241044
"URLContextCallDeltaTypedDict": ".urlcontextcalldelta",
1025-
"Arguments": ".urlcontextcallstep",
1026-
"ArgumentsParam": ".urlcontextcallstep",
10271045
"URLContextCallStep": ".urlcontextcallstep",
10281046
"URLContextCallStepParam": ".urlcontextcallstep",
10291047
"URLContextResult": ".urlcontextresult",

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from typing_extensions import Annotated, NotRequired, TypedDict
3131

3232

33-
RetrievalType = Union[
33+
RetrievalRetrievalType = Union[
3434
Literal[
3535
"vertex_ai_search",
3636
"rag_store",
@@ -45,7 +45,7 @@ class RetrievalParam(TypedDict):
4545
r"""A tool that can be used by the model to retrieve files."""
4646

4747
type: Literal["retrieval"]
48-
retrieval_types: NotRequired[List[RetrievalType]]
48+
retrieval_types: NotRequired[List[RetrievalRetrievalType]]
4949
r"""The types of file retrieval to enable."""
5050
vertex_ai_search_config: NotRequired[VertexAISearchConfigParam]
5151
r"""Used to specify configuration for VertexAISearch."""
@@ -65,7 +65,7 @@ class Retrieval(BaseModel):
6565
pydantic.Field(alias="type"),
6666
] = "retrieval"
6767

68-
retrieval_types: Optional[List[RetrievalType]] = None
68+
retrieval_types: Optional[List[RetrievalRetrievalType]] = None
6969
r"""The types of file retrieval to enable."""
7070

7171
vertex_ai_search_config: Optional[VertexAISearchConfig] = None
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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 pydantic import model_serializer
22+
from typing import List, Optional
23+
from typing_extensions import NotRequired, TypedDict
24+
25+
26+
class RetrievalCallArgumentsTypedDict(TypedDict):
27+
r"""The arguments to pass to Retrieval tools."""
28+
29+
queries: NotRequired[List[str]]
30+
r"""Queries for Retrieval information."""
31+
32+
33+
class RetrievalCallArguments(BaseModel):
34+
r"""The arguments to pass to Retrieval tools."""
35+
36+
queries: Optional[List[str]] = None
37+
r"""Queries for Retrieval information."""
38+
39+
@model_serializer(mode="wrap")
40+
def serialize_model(self, handler):
41+
optional_fields = set(["queries"])
42+
serialized = handler(self)
43+
m = {}
44+
45+
for n, f in type(self).model_fields.items():
46+
k = f.alias or n
47+
val = serialized.get(k, serialized.get(n))
48+
49+
if val != UNSET_SENTINEL:
50+
if val is not None or k not in optional_fields:
51+
m[k] = val
52+
53+
return m
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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, UnrecognizedStr
21+
from ...utils import validate_const
22+
from .retrievalcallarguments import (
23+
RetrievalCallArguments,
24+
RetrievalCallArgumentsTypedDict,
25+
)
26+
import pydantic
27+
from pydantic import model_serializer
28+
from pydantic.functional_validators import AfterValidator
29+
from typing import Literal, Optional, Union
30+
from typing_extensions import Annotated, NotRequired, TypedDict
31+
32+
33+
RetrievalCallDeltaRetrievalType = Union[
34+
Literal[
35+
"vertex_ai_search",
36+
"rag_store",
37+
"exa_ai_search",
38+
"parallel_ai_search",
39+
],
40+
UnrecognizedStr,
41+
]
42+
r"""The type of retrieval tools."""
43+
44+
45+
class RetrievalCallDeltaTypedDict(TypedDict):
46+
r"""Used by Vertex Retrieval tools such as Parallel AI, Exa AI, Vertex AI Search,
47+
etc. RetrievalType decides which tool is used.
48+
"""
49+
50+
arguments: RetrievalCallArgumentsTypedDict
51+
r"""The arguments to pass to Retrieval tools."""
52+
type: Literal["retrieval_call"]
53+
retrieval_type: NotRequired[RetrievalCallDeltaRetrievalType]
54+
r"""The type of retrieval tools."""
55+
signature: NotRequired[str]
56+
r"""A signature hash for backend validation."""
57+
58+
59+
class RetrievalCallDelta(BaseModel):
60+
r"""Used by Vertex Retrieval tools such as Parallel AI, Exa AI, Vertex AI Search,
61+
etc. RetrievalType decides which tool is used.
62+
"""
63+
64+
arguments: RetrievalCallArguments
65+
r"""The arguments to pass to Retrieval tools."""
66+
67+
type: Annotated[
68+
Annotated[
69+
Literal["retrieval_call"], AfterValidator(validate_const("retrieval_call"))
70+
],
71+
pydantic.Field(alias="type"),
72+
] = "retrieval_call"
73+
74+
retrieval_type: Optional[RetrievalCallDeltaRetrievalType] = None
75+
r"""The type of retrieval tools."""
76+
77+
signature: Optional[str] = None
78+
r"""A signature hash for backend validation."""
79+
80+
@model_serializer(mode="wrap")
81+
def serialize_model(self, handler):
82+
optional_fields = set(["retrieval_type", "signature"])
83+
serialized = handler(self)
84+
m = {}
85+
86+
for n, f in type(self).model_fields.items():
87+
k = f.alias or n
88+
val = serialized.get(k, serialized.get(n))
89+
90+
if val != UNSET_SENTINEL:
91+
if val is not None or k not in optional_fields:
92+
m[k] = val
93+
94+
return m
95+
96+
97+
try:
98+
RetrievalCallDelta.model_rebuild()
99+
except NameError:
100+
pass

0 commit comments

Comments
 (0)