Skip to content

Commit 6c6f554

Browse files
Annhiluccopybara-github
authored andcommitted
feat: Support Google Maps in Interactions
PiperOrigin-RevId: 881646553
1 parent 0e21c4e commit 6c6f554

16 files changed

+473
-22
lines changed

google/genai/_interactions/types/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from .document_content import DocumentContent as DocumentContent
4949
from .tool_choice_type import ToolChoiceType as ToolChoiceType
5050
from .generation_config import GenerationConfig as GenerationConfig
51+
from .google_maps_result import GoogleMapsResult as GoogleMapsResult
5152
from .image_config_param import ImageConfigParam as ImageConfigParam
5253
from .text_content_param import TextContentParam as TextContentParam
5354
from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig
@@ -68,6 +69,8 @@
6869
from .generation_config_param import GenerationConfigParam as GenerationConfigParam
6970
from .interaction_start_event import InteractionStartEvent as InteractionStartEvent
7071
from .file_search_call_content import FileSearchCallContent as FileSearchCallContent
72+
from .google_maps_call_content import GoogleMapsCallContent as GoogleMapsCallContent
73+
from .google_maps_result_param import GoogleMapsResultParam as GoogleMapsResultParam
7174
from .tool_choice_config_param import ToolChoiceConfigParam as ToolChoiceConfigParam
7275
from .url_context_call_content import URLContextCallContent as URLContextCallContent
7376
from .url_context_result_param import URLContextResultParam as URLContextResultParam
@@ -76,6 +79,8 @@
7679
from .deep_research_agent_config import DeepResearchAgentConfig as DeepResearchAgentConfig
7780
from .dynamic_agent_config_param import DynamicAgentConfigParam as DynamicAgentConfigParam
7881
from .file_search_result_content import FileSearchResultContent as FileSearchResultContent
82+
from .google_maps_call_arguments import GoogleMapsCallArguments as GoogleMapsCallArguments
83+
from .google_maps_result_content import GoogleMapsResultContent as GoogleMapsResultContent
7984
from .google_search_call_content import GoogleSearchCallContent as GoogleSearchCallContent
8085
from .google_search_result_param import GoogleSearchResultParam as GoogleSearchResultParam
8186
from .interaction_complete_event import InteractionCompleteEvent as InteractionCompleteEvent
@@ -90,10 +95,13 @@
9095
from .code_execution_result_content import CodeExecutionResultContent as CodeExecutionResultContent
9196
from .function_result_content_param import FunctionResultContentParam as FunctionResultContentParam
9297
from .file_search_call_content_param import FileSearchCallContentParam as FileSearchCallContentParam
98+
from .google_maps_call_content_param import GoogleMapsCallContentParam as GoogleMapsCallContentParam
9399
from .mcp_server_tool_result_content import MCPServerToolResultContent as MCPServerToolResultContent
94100
from .url_context_call_content_param import URLContextCallContentParam as URLContextCallContentParam
95101
from .deep_research_agent_config_param import DeepResearchAgentConfigParam as DeepResearchAgentConfigParam
96102
from .file_search_result_content_param import FileSearchResultContentParam as FileSearchResultContentParam
103+
from .google_maps_call_arguments_param import GoogleMapsCallArgumentsParam as GoogleMapsCallArgumentsParam
104+
from .google_maps_result_content_param import GoogleMapsResultContentParam as GoogleMapsResultContentParam
97105
from .google_search_call_content_param import GoogleSearchCallContentParam as GoogleSearchCallContentParam
98106
from .url_context_call_arguments_param import URLContextCallArgumentsParam as URLContextCallArgumentsParam
99107
from .url_context_result_content_param import URLContextResultContentParam as URLContextResultContentParam

google/genai/_interactions/types/content.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828
from .function_call_content import FunctionCallContent
2929
from .function_result_content import FunctionResultContent
3030
from .file_search_call_content import FileSearchCallContent
31+
from .google_maps_call_content import GoogleMapsCallContent
3132
from .url_context_call_content import URLContextCallContent
3233
from .file_search_result_content import FileSearchResultContent
34+
from .google_maps_result_content import GoogleMapsResultContent
3335
from .google_search_call_content import GoogleSearchCallContent
3436
from .url_context_result_content import URLContextResultContent
3537
from .code_execution_call_content import CodeExecutionCallContent
@@ -60,6 +62,8 @@
6062
MCPServerToolResultContent,
6163
FileSearchCallContent,
6264
FileSearchResultContent,
65+
GoogleMapsCallContent,
66+
GoogleMapsResultContent,
6367
],
6468
PropertyInfo(discriminator="type"),
6569
]

google/genai/_interactions/types/content_delta.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
from .annotation import Annotation
2424
from .text_content import TextContent
2525
from .image_content import ImageContent
26+
from .google_maps_result import GoogleMapsResult
2627
from .url_context_result import URLContextResult
2728
from .google_search_result import GoogleSearchResult
29+
from .google_maps_call_arguments import GoogleMapsCallArguments
2830
from .url_context_call_arguments import URLContextCallArguments
2931
from .google_search_call_arguments import GoogleSearchCallArguments
3032
from .code_execution_call_arguments import CodeExecutionCallArguments
@@ -59,6 +61,8 @@
5961
"DeltaFileSearchCall",
6062
"DeltaFileSearchResult",
6163
"DeltaFileSearchResultResult",
64+
"DeltaGoogleMapsCall",
65+
"DeltaGoogleMapsResult",
6266
]
6367

6468

@@ -328,6 +332,29 @@ class DeltaFileSearchResult(BaseModel):
328332
"""A signature hash for backend validation."""
329333

330334

335+
class DeltaGoogleMapsCall(BaseModel):
336+
id: str
337+
"""A unique ID for this specific tool call."""
338+
339+
type: Literal["google_maps_call"]
340+
341+
arguments: Optional[GoogleMapsCallArguments] = None
342+
"""The arguments to pass to the Google Maps tool."""
343+
344+
345+
class DeltaGoogleMapsResult(BaseModel):
346+
call_id: str
347+
"""ID to match the ID from the function call block."""
348+
349+
result: List[GoogleMapsResult]
350+
"""The results of the Google Maps."""
351+
352+
type: Literal["google_maps_result"]
353+
354+
signature: Optional[str] = None
355+
"""A signature hash for backend validation."""
356+
357+
331358
Delta: TypeAlias = Annotated[
332359
Union[
333360
DeltaText,
@@ -349,6 +376,8 @@ class DeltaFileSearchResult(BaseModel):
349376
DeltaMCPServerToolResult,
350377
DeltaFileSearchCall,
351378
DeltaFileSearchResult,
379+
DeltaGoogleMapsCall,
380+
DeltaGoogleMapsResult,
352381
],
353382
PropertyInfo(discriminator="type"),
354383
]

google/genai/_interactions/types/content_param.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
from .function_call_content_param import FunctionCallContentParam
3030
from .function_result_content_param import FunctionResultContentParam
3131
from .file_search_call_content_param import FileSearchCallContentParam
32+
from .google_maps_call_content_param import GoogleMapsCallContentParam
3233
from .url_context_call_content_param import URLContextCallContentParam
3334
from .file_search_result_content_param import FileSearchResultContentParam
35+
from .google_maps_result_content_param import GoogleMapsResultContentParam
3436
from .google_search_call_content_param import GoogleSearchCallContentParam
3537
from .url_context_result_content_param import URLContextResultContentParam
3638
from .code_execution_call_content_param import CodeExecutionCallContentParam
@@ -60,4 +62,6 @@
6062
MCPServerToolResultContentParam,
6163
FileSearchCallContentParam,
6264
FileSearchResultContentParam,
65+
GoogleMapsCallContentParam,
66+
GoogleMapsResultContentParam,
6367
]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2025 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+
16+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17+
18+
from typing import List, Optional
19+
20+
from .._models import BaseModel
21+
22+
__all__ = ["GoogleMapsCallArguments"]
23+
24+
25+
class GoogleMapsCallArguments(BaseModel):
26+
"""The arguments to pass to the Google Maps tool."""
27+
28+
queries: Optional[List[str]] = None
29+
"""The queries to be executed."""
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2025 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+
16+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17+
18+
from __future__ import annotations
19+
20+
from typing_extensions import TypedDict
21+
22+
from .._types import SequenceNotStr
23+
24+
__all__ = ["GoogleMapsCallArgumentsParam"]
25+
26+
27+
class GoogleMapsCallArgumentsParam(TypedDict, total=False):
28+
"""The arguments to pass to the Google Maps tool."""
29+
30+
queries: SequenceNotStr[str]
31+
"""The queries to be executed."""
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2025 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+
16+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17+
18+
from typing import Optional
19+
from typing_extensions import Literal
20+
21+
from .._models import BaseModel
22+
from .google_maps_call_arguments import GoogleMapsCallArguments
23+
24+
__all__ = ["GoogleMapsCallContent"]
25+
26+
27+
class GoogleMapsCallContent(BaseModel):
28+
"""Google Maps content."""
29+
30+
id: str
31+
"""A unique ID for this specific tool call."""
32+
33+
type: Literal["google_maps_call"]
34+
35+
arguments: Optional[GoogleMapsCallArguments] = None
36+
"""The arguments to pass to the Google Maps tool."""
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2025 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+
16+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17+
18+
from __future__ import annotations
19+
20+
from typing_extensions import Literal, Required, TypedDict
21+
22+
from .google_maps_call_arguments_param import GoogleMapsCallArgumentsParam
23+
24+
__all__ = ["GoogleMapsCallContentParam"]
25+
26+
27+
class GoogleMapsCallContentParam(TypedDict, total=False):
28+
"""Google Maps content."""
29+
30+
id: Required[str]
31+
"""A unique ID for this specific tool call."""
32+
33+
type: Required[Literal["google_maps_call"]]
34+
35+
arguments: GoogleMapsCallArgumentsParam
36+
"""The arguments to pass to the Google Maps tool."""
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright 2025 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+
16+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17+
18+
from typing import List, Optional
19+
20+
from .._models import BaseModel
21+
22+
__all__ = ["GoogleMapsResult", "Place", "PlaceReviewSnippet"]
23+
24+
25+
class PlaceReviewSnippet(BaseModel):
26+
"""
27+
Encapsulates a snippet of a user review that answers a question about
28+
the features of a specific place in Google Maps.
29+
"""
30+
31+
review_id: Optional[str] = None
32+
"""The ID of the review snippet."""
33+
34+
title: Optional[str] = None
35+
"""Title of the review."""
36+
37+
url: Optional[str] = None
38+
"""A link that corresponds to the user review on Google Maps."""
39+
40+
41+
class Place(BaseModel):
42+
name: Optional[str] = None
43+
"""Title of the place."""
44+
45+
place_id: Optional[str] = None
46+
"""The ID of the place, in `places/{place_id}` format."""
47+
48+
review_snippets: Optional[List[PlaceReviewSnippet]] = None
49+
"""
50+
Snippets of reviews that are used to generate answers about the
51+
features of a given place in Google Maps.
52+
"""
53+
54+
url: Optional[str] = None
55+
"""URI reference of the place."""
56+
57+
58+
class GoogleMapsResult(BaseModel):
59+
"""The result of the Google Maps."""
60+
61+
places: Optional[List[Place]] = None
62+
"""The places that were found."""
63+
64+
widget_context_token: Optional[str] = None
65+
"""Resource name of the Google Maps widget context token."""
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2025 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+
16+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17+
18+
from typing import List, Optional
19+
from typing_extensions import Literal
20+
21+
from .._models import BaseModel
22+
from .google_maps_result import GoogleMapsResult
23+
24+
__all__ = ["GoogleMapsResultContent"]
25+
26+
27+
class GoogleMapsResultContent(BaseModel):
28+
"""Google Maps result content."""
29+
30+
call_id: str
31+
"""ID to match the ID from the google maps call block."""
32+
33+
result: List[GoogleMapsResult]
34+
"""The results of the Google Maps."""
35+
36+
type: Literal["google_maps_result"]
37+
38+
signature: Optional[str] = None
39+
"""A signature hash for backend validation."""

0 commit comments

Comments
 (0)