From 68f247c04af99915b946f04806f3b0a0543180fa Mon Sep 17 00:00:00 2001 From: Annie Luc Date: Fri, 13 Mar 2026 21:27:16 -0700 Subject: [PATCH] feat: Support Google Maps in Interactions PiperOrigin-RevId: 883482533 --- google/genai/_interactions/types/__init__.py | 8 +++ google/genai/_interactions/types/content.py | 4 ++ .../_interactions/types/content_delta.py | 29 ++++++++ .../_interactions/types/content_param.py | 4 ++ .../types/google_maps_call_arguments.py | 29 ++++++++ .../types/google_maps_call_arguments_param.py | 31 +++++++++ .../types/google_maps_call_content.py | 36 ++++++++++ .../types/google_maps_call_content_param.py | 36 ++++++++++ .../_interactions/types/google_maps_result.py | 65 ++++++++++++++++++ .../types/google_maps_result_content.py | 39 +++++++++++ .../types/google_maps_result_content_param.py | 40 +++++++++++ .../types/google_maps_result_param.py | 66 +++++++++++++++++++ .../genai/_interactions/types/interaction.py | 4 ++ .../types/interaction_create_params.py | 4 ++ google/genai/_interactions/types/tool.py | 49 ++++++++++---- .../genai/_interactions/types/tool_param.py | 51 ++++++++++---- 16 files changed, 473 insertions(+), 22 deletions(-) create mode 100644 google/genai/_interactions/types/google_maps_call_arguments.py create mode 100644 google/genai/_interactions/types/google_maps_call_arguments_param.py create mode 100644 google/genai/_interactions/types/google_maps_call_content.py create mode 100644 google/genai/_interactions/types/google_maps_call_content_param.py create mode 100644 google/genai/_interactions/types/google_maps_result.py create mode 100644 google/genai/_interactions/types/google_maps_result_content.py create mode 100644 google/genai/_interactions/types/google_maps_result_content_param.py create mode 100644 google/genai/_interactions/types/google_maps_result_param.py diff --git a/google/genai/_interactions/types/__init__.py b/google/genai/_interactions/types/__init__.py index e7481070b..726a498e5 100644 --- a/google/genai/_interactions/types/__init__.py +++ b/google/genai/_interactions/types/__init__.py @@ -48,6 +48,7 @@ from .document_content import DocumentContent as DocumentContent from .tool_choice_type import ToolChoiceType as ToolChoiceType from .generation_config import GenerationConfig as GenerationConfig +from .google_maps_result import GoogleMapsResult as GoogleMapsResult from .image_config_param import ImageConfigParam as ImageConfigParam from .text_content_param import TextContentParam as TextContentParam from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig @@ -68,6 +69,8 @@ from .generation_config_param import GenerationConfigParam as GenerationConfigParam from .interaction_start_event import InteractionStartEvent as InteractionStartEvent from .file_search_call_content import FileSearchCallContent as FileSearchCallContent +from .google_maps_call_content import GoogleMapsCallContent as GoogleMapsCallContent +from .google_maps_result_param import GoogleMapsResultParam as GoogleMapsResultParam from .tool_choice_config_param import ToolChoiceConfigParam as ToolChoiceConfigParam from .url_context_call_content import URLContextCallContent as URLContextCallContent from .url_context_result_param import URLContextResultParam as URLContextResultParam @@ -76,6 +79,8 @@ from .deep_research_agent_config import DeepResearchAgentConfig as DeepResearchAgentConfig from .dynamic_agent_config_param import DynamicAgentConfigParam as DynamicAgentConfigParam from .file_search_result_content import FileSearchResultContent as FileSearchResultContent +from .google_maps_call_arguments import GoogleMapsCallArguments as GoogleMapsCallArguments +from .google_maps_result_content import GoogleMapsResultContent as GoogleMapsResultContent from .google_search_call_content import GoogleSearchCallContent as GoogleSearchCallContent from .google_search_result_param import GoogleSearchResultParam as GoogleSearchResultParam from .interaction_complete_event import InteractionCompleteEvent as InteractionCompleteEvent @@ -90,10 +95,13 @@ from .code_execution_result_content import CodeExecutionResultContent as CodeExecutionResultContent from .function_result_content_param import FunctionResultContentParam as FunctionResultContentParam from .file_search_call_content_param import FileSearchCallContentParam as FileSearchCallContentParam +from .google_maps_call_content_param import GoogleMapsCallContentParam as GoogleMapsCallContentParam from .mcp_server_tool_result_content import MCPServerToolResultContent as MCPServerToolResultContent from .url_context_call_content_param import URLContextCallContentParam as URLContextCallContentParam from .deep_research_agent_config_param import DeepResearchAgentConfigParam as DeepResearchAgentConfigParam from .file_search_result_content_param import FileSearchResultContentParam as FileSearchResultContentParam +from .google_maps_call_arguments_param import GoogleMapsCallArgumentsParam as GoogleMapsCallArgumentsParam +from .google_maps_result_content_param import GoogleMapsResultContentParam as GoogleMapsResultContentParam from .google_search_call_content_param import GoogleSearchCallContentParam as GoogleSearchCallContentParam from .url_context_call_arguments_param import URLContextCallArgumentsParam as URLContextCallArgumentsParam from .url_context_result_content_param import URLContextResultContentParam as URLContextResultContentParam diff --git a/google/genai/_interactions/types/content.py b/google/genai/_interactions/types/content.py index 8a2dcc32a..b25c11e29 100644 --- a/google/genai/_interactions/types/content.py +++ b/google/genai/_interactions/types/content.py @@ -28,8 +28,10 @@ from .function_call_content import FunctionCallContent from .function_result_content import FunctionResultContent from .file_search_call_content import FileSearchCallContent +from .google_maps_call_content import GoogleMapsCallContent from .url_context_call_content import URLContextCallContent from .file_search_result_content import FileSearchResultContent +from .google_maps_result_content import GoogleMapsResultContent from .google_search_call_content import GoogleSearchCallContent from .url_context_result_content import URLContextResultContent from .code_execution_call_content import CodeExecutionCallContent @@ -60,6 +62,8 @@ MCPServerToolResultContent, FileSearchCallContent, FileSearchResultContent, + GoogleMapsCallContent, + GoogleMapsResultContent, ], PropertyInfo(discriminator="type"), ] diff --git a/google/genai/_interactions/types/content_delta.py b/google/genai/_interactions/types/content_delta.py index 94e298803..c2365dd22 100644 --- a/google/genai/_interactions/types/content_delta.py +++ b/google/genai/_interactions/types/content_delta.py @@ -23,8 +23,10 @@ from .annotation import Annotation from .text_content import TextContent from .image_content import ImageContent +from .google_maps_result import GoogleMapsResult from .url_context_result import URLContextResult from .google_search_result import GoogleSearchResult +from .google_maps_call_arguments import GoogleMapsCallArguments from .url_context_call_arguments import URLContextCallArguments from .google_search_call_arguments import GoogleSearchCallArguments from .code_execution_call_arguments import CodeExecutionCallArguments @@ -59,6 +61,8 @@ "DeltaFileSearchCall", "DeltaFileSearchResult", "DeltaFileSearchResultResult", + "DeltaGoogleMapsCall", + "DeltaGoogleMapsResult", ] @@ -328,6 +332,29 @@ class DeltaFileSearchResult(BaseModel): """A signature hash for backend validation.""" +class DeltaGoogleMapsCall(BaseModel): + id: str + """A unique ID for this specific tool call.""" + + type: Literal["google_maps_call"] + + arguments: Optional[GoogleMapsCallArguments] = None + """The arguments to pass to the Google Maps tool.""" + + +class DeltaGoogleMapsResult(BaseModel): + call_id: str + """ID to match the ID from the function call block.""" + + result: List[GoogleMapsResult] + """The results of the Google Maps.""" + + type: Literal["google_maps_result"] + + signature: Optional[str] = None + """A signature hash for backend validation.""" + + Delta: TypeAlias = Annotated[ Union[ DeltaText, @@ -349,6 +376,8 @@ class DeltaFileSearchResult(BaseModel): DeltaMCPServerToolResult, DeltaFileSearchCall, DeltaFileSearchResult, + DeltaGoogleMapsCall, + DeltaGoogleMapsResult, ], PropertyInfo(discriminator="type"), ] diff --git a/google/genai/_interactions/types/content_param.py b/google/genai/_interactions/types/content_param.py index c1970fe16..113933f83 100644 --- a/google/genai/_interactions/types/content_param.py +++ b/google/genai/_interactions/types/content_param.py @@ -29,8 +29,10 @@ from .function_call_content_param import FunctionCallContentParam from .function_result_content_param import FunctionResultContentParam from .file_search_call_content_param import FileSearchCallContentParam +from .google_maps_call_content_param import GoogleMapsCallContentParam from .url_context_call_content_param import URLContextCallContentParam from .file_search_result_content_param import FileSearchResultContentParam +from .google_maps_result_content_param import GoogleMapsResultContentParam from .google_search_call_content_param import GoogleSearchCallContentParam from .url_context_result_content_param import URLContextResultContentParam from .code_execution_call_content_param import CodeExecutionCallContentParam @@ -60,4 +62,6 @@ MCPServerToolResultContentParam, FileSearchCallContentParam, FileSearchResultContentParam, + GoogleMapsCallContentParam, + GoogleMapsResultContentParam, ] diff --git a/google/genai/_interactions/types/google_maps_call_arguments.py b/google/genai/_interactions/types/google_maps_call_arguments.py new file mode 100644 index 000000000..3976e8779 --- /dev/null +++ b/google/genai/_interactions/types/google_maps_call_arguments.py @@ -0,0 +1,29 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .._models import BaseModel + +__all__ = ["GoogleMapsCallArguments"] + + +class GoogleMapsCallArguments(BaseModel): + """The arguments to pass to the Google Maps tool.""" + + queries: Optional[List[str]] = None + """The queries to be executed.""" diff --git a/google/genai/_interactions/types/google_maps_call_arguments_param.py b/google/genai/_interactions/types/google_maps_call_arguments_param.py new file mode 100644 index 000000000..26cb3bf97 --- /dev/null +++ b/google/genai/_interactions/types/google_maps_call_arguments_param.py @@ -0,0 +1,31 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .._types import SequenceNotStr + +__all__ = ["GoogleMapsCallArgumentsParam"] + + +class GoogleMapsCallArgumentsParam(TypedDict, total=False): + """The arguments to pass to the Google Maps tool.""" + + queries: SequenceNotStr[str] + """The queries to be executed.""" diff --git a/google/genai/_interactions/types/google_maps_call_content.py b/google/genai/_interactions/types/google_maps_call_content.py new file mode 100644 index 000000000..621ea66db --- /dev/null +++ b/google/genai/_interactions/types/google_maps_call_content.py @@ -0,0 +1,36 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .google_maps_call_arguments import GoogleMapsCallArguments + +__all__ = ["GoogleMapsCallContent"] + + +class GoogleMapsCallContent(BaseModel): + """Google Maps content.""" + + id: str + """A unique ID for this specific tool call.""" + + type: Literal["google_maps_call"] + + arguments: Optional[GoogleMapsCallArguments] = None + """The arguments to pass to the Google Maps tool.""" diff --git a/google/genai/_interactions/types/google_maps_call_content_param.py b/google/genai/_interactions/types/google_maps_call_content_param.py new file mode 100644 index 000000000..2c717d42d --- /dev/null +++ b/google/genai/_interactions/types/google_maps_call_content_param.py @@ -0,0 +1,36 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +from .google_maps_call_arguments_param import GoogleMapsCallArgumentsParam + +__all__ = ["GoogleMapsCallContentParam"] + + +class GoogleMapsCallContentParam(TypedDict, total=False): + """Google Maps content.""" + + id: Required[str] + """A unique ID for this specific tool call.""" + + type: Required[Literal["google_maps_call"]] + + arguments: GoogleMapsCallArgumentsParam + """The arguments to pass to the Google Maps tool.""" diff --git a/google/genai/_interactions/types/google_maps_result.py b/google/genai/_interactions/types/google_maps_result.py new file mode 100644 index 000000000..4cc766078 --- /dev/null +++ b/google/genai/_interactions/types/google_maps_result.py @@ -0,0 +1,65 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .._models import BaseModel + +__all__ = ["GoogleMapsResult", "Place", "PlaceReviewSnippet"] + + +class PlaceReviewSnippet(BaseModel): + """ + Encapsulates a snippet of a user review that answers a question about + the features of a specific place in Google Maps. + """ + + review_id: Optional[str] = None + """The ID of the review snippet.""" + + title: Optional[str] = None + """Title of the review.""" + + url: Optional[str] = None + """A link that corresponds to the user review on Google Maps.""" + + +class Place(BaseModel): + name: Optional[str] = None + """Title of the place.""" + + place_id: Optional[str] = None + """The ID of the place, in `places/{place_id}` format.""" + + review_snippets: Optional[List[PlaceReviewSnippet]] = None + """ + Snippets of reviews that are used to generate answers about the + features of a given place in Google Maps. + """ + + url: Optional[str] = None + """URI reference of the place.""" + + +class GoogleMapsResult(BaseModel): + """The result of the Google Maps.""" + + places: Optional[List[Place]] = None + """The places that were found.""" + + widget_context_token: Optional[str] = None + """Resource name of the Google Maps widget context token.""" diff --git a/google/genai/_interactions/types/google_maps_result_content.py b/google/genai/_interactions/types/google_maps_result_content.py new file mode 100644 index 000000000..cafd72179 --- /dev/null +++ b/google/genai/_interactions/types/google_maps_result_content.py @@ -0,0 +1,39 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .google_maps_result import GoogleMapsResult + +__all__ = ["GoogleMapsResultContent"] + + +class GoogleMapsResultContent(BaseModel): + """Google Maps result content.""" + + call_id: str + """ID to match the ID from the google maps call block.""" + + result: List[GoogleMapsResult] + """The results of the Google Maps.""" + + type: Literal["google_maps_result"] + + signature: Optional[str] = None + """A signature hash for backend validation.""" diff --git a/google/genai/_interactions/types/google_maps_result_content_param.py b/google/genai/_interactions/types/google_maps_result_content_param.py new file mode 100644 index 000000000..90558e356 --- /dev/null +++ b/google/genai/_interactions/types/google_maps_result_content_param.py @@ -0,0 +1,40 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict + +from .google_maps_result_param import GoogleMapsResultParam + +__all__ = ["GoogleMapsResultContentParam"] + + +class GoogleMapsResultContentParam(TypedDict, total=False): + """Google Maps result content.""" + + call_id: Required[str] + """ID to match the ID from the google maps call block.""" + + result: Required[Iterable[GoogleMapsResultParam]] + """The results of the Google Maps.""" + + type: Required[Literal["google_maps_result"]] + + signature: str + """A signature hash for backend validation.""" diff --git a/google/genai/_interactions/types/google_maps_result_param.py b/google/genai/_interactions/types/google_maps_result_param.py new file mode 100644 index 000000000..3810d8dd8 --- /dev/null +++ b/google/genai/_interactions/types/google_maps_result_param.py @@ -0,0 +1,66 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["GoogleMapsResultParam", "Place", "PlaceReviewSnippet"] + + +class PlaceReviewSnippet(TypedDict, total=False): + """ + Encapsulates a snippet of a user review that answers a question about + the features of a specific place in Google Maps. + """ + + review_id: str + """The ID of the review snippet.""" + + title: str + """Title of the review.""" + + url: str + """A link that corresponds to the user review on Google Maps.""" + + +class Place(TypedDict, total=False): + name: str + """Title of the place.""" + + place_id: str + """The ID of the place, in `places/{place_id}` format.""" + + review_snippets: Iterable[PlaceReviewSnippet] + """ + Snippets of reviews that are used to generate answers about the + features of a given place in Google Maps. + """ + + url: str + """URI reference of the place.""" + + +class GoogleMapsResultParam(TypedDict, total=False): + """The result of the Google Maps.""" + + places: Iterable[Place] + """The places that were found.""" + + widget_context_token: str + """Resource name of the Google Maps widget context token.""" diff --git a/google/genai/_interactions/types/interaction.py b/google/genai/_interactions/types/interaction.py index 4a35a07dd..0885908ac 100644 --- a/google/genai/_interactions/types/interaction.py +++ b/google/genai/_interactions/types/interaction.py @@ -36,9 +36,11 @@ from .function_call_content import FunctionCallContent from .function_result_content import FunctionResultContent from .file_search_call_content import FileSearchCallContent +from .google_maps_call_content import GoogleMapsCallContent from .url_context_call_content import URLContextCallContent from .deep_research_agent_config import DeepResearchAgentConfig from .file_search_result_content import FileSearchResultContent +from .google_maps_result_content import GoogleMapsResultContent from .google_search_call_content import GoogleSearchCallContent from .url_context_result_content import URLContextResultContent from .code_execution_call_content import CodeExecutionCallContent @@ -75,6 +77,8 @@ MCPServerToolResultContent, FileSearchCallContent, FileSearchResultContent, + GoogleMapsCallContent, + GoogleMapsResultContent, ] diff --git a/google/genai/_interactions/types/interaction_create_params.py b/google/genai/_interactions/types/interaction_create_params.py index beeede433..aebf09847 100644 --- a/google/genai/_interactions/types/interaction_create_params.py +++ b/google/genai/_interactions/types/interaction_create_params.py @@ -35,9 +35,11 @@ from .function_call_content_param import FunctionCallContentParam from .function_result_content_param import FunctionResultContentParam from .file_search_call_content_param import FileSearchCallContentParam +from .google_maps_call_content_param import GoogleMapsCallContentParam from .url_context_call_content_param import URLContextCallContentParam from .deep_research_agent_config_param import DeepResearchAgentConfigParam from .file_search_result_content_param import FileSearchResultContentParam +from .google_maps_result_content_param import GoogleMapsResultContentParam from .google_search_call_content_param import GoogleSearchCallContentParam from .url_context_result_content_param import URLContextResultContentParam from .code_execution_call_content_param import CodeExecutionCallContentParam @@ -120,6 +122,8 @@ class BaseCreateModelInteractionParams(TypedDict, total=False): MCPServerToolResultContentParam, FileSearchCallContentParam, FileSearchResultContentParam, + GoogleMapsCallContentParam, + GoogleMapsResultContentParam, ] diff --git a/google/genai/_interactions/types/tool.py b/google/genai/_interactions/types/tool.py index 6c70302f7..3ef06a37d 100644 --- a/google/genai/_interactions/types/tool.py +++ b/google/genai/_interactions/types/tool.py @@ -25,7 +25,25 @@ from .function import Function from .allowed_tools import AllowedTools -__all__ = ["Tool", "CodeExecution", "URLContext", "ComputerUse", "MCPServer", "GoogleSearch", "FileSearch"] +__all__ = [ + "Tool", + "GoogleSearch", + "CodeExecution", + "URLContext", + "ComputerUse", + "MCPServer", + "FileSearch", + "GoogleMaps", +] + + +class GoogleSearch(BaseModel): + """A tool that can be used by the model to search Google.""" + + type: Literal["google_search"] + + search_types: Optional[List[Literal["web_search", "image_search"]]] = None + """The types of search grounding to enable.""" class CodeExecution(BaseModel): @@ -73,15 +91,6 @@ class MCPServer(BaseModel): """ -class GoogleSearch(BaseModel): - """A tool that can be used by the model to search Google.""" - - type: Literal["google_search"] - - search_types: Optional[List[Literal["web_search", "image_search"]]] = None - """The types of search grounding to enable.""" - - class FileSearch(BaseModel): """A tool that can be used by the model to search files.""" @@ -97,7 +106,25 @@ class FileSearch(BaseModel): """The number of semantic retrieval chunks to retrieve.""" +class GoogleMaps(BaseModel): + """A tool that can be used by the model to call Google Maps.""" + + enable_widget: Optional[bool] = None + """ + Whether to return a widget context token in the tool call result of the + response. + """ + + latitude: Optional[float] = None + """The latitude of the user's location.""" + + longitude: Optional[float] = None + """The longitude of the user's location.""" + + type: Optional[Literal["google_maps"]] = None + + Tool: TypeAlias = Annotated[ - Union[Function, CodeExecution, URLContext, ComputerUse, MCPServer, GoogleSearch, FileSearch], + Union[Function, GoogleSearch, CodeExecution, URLContext, ComputerUse, MCPServer, FileSearch, GoogleMaps], PropertyInfo(discriminator="type"), ] diff --git a/google/genai/_interactions/types/tool_param.py b/google/genai/_interactions/types/tool_param.py index e408e7acf..ec01bc2b3 100644 --- a/google/genai/_interactions/types/tool_param.py +++ b/google/genai/_interactions/types/tool_param.py @@ -25,7 +25,25 @@ from .function_param import FunctionParam from .allowed_tools_param import AllowedToolsParam -__all__ = ["ToolParam", "CodeExecution", "URLContext", "ComputerUse", "MCPServer", "GoogleSearch", "FileSearch"] +__all__ = [ + "ToolParam", + "GoogleSearch", + "CodeExecution", + "URLContext", + "ComputerUse", + "MCPServer", + "FileSearch", + "GoogleMaps", +] + + +class GoogleSearch(TypedDict, total=False): + """A tool that can be used by the model to search Google.""" + + type: Required[Literal["google_search"]] + + search_types: List[Literal["web_search", "image_search"]] + """The types of search grounding to enable.""" class CodeExecution(TypedDict, total=False): @@ -73,15 +91,6 @@ class MCPServer(TypedDict, total=False): """ -class GoogleSearch(TypedDict, total=False): - """A tool that can be used by the model to search Google.""" - - type: Required[Literal["google_search"]] - - search_types: List[Literal["web_search", "image_search"]] - """The types of search grounding to enable.""" - - class FileSearch(TypedDict, total=False): """A tool that can be used by the model to search files.""" @@ -97,4 +106,24 @@ class FileSearch(TypedDict, total=False): """The number of semantic retrieval chunks to retrieve.""" -ToolParam: TypeAlias = Union[FunctionParam, CodeExecution, URLContext, ComputerUse, MCPServer, GoogleSearch, FileSearch] +class GoogleMaps(TypedDict, total=False): + """A tool that can be used by the model to call Google Maps.""" + + enable_widget: bool + """ + Whether to return a widget context token in the tool call result of the + response. + """ + + latitude: float + """The latitude of the user's location.""" + + longitude: float + """The longitude of the user's location.""" + + type: Literal["google_maps"] + + +ToolParam: TypeAlias = Union[ + FunctionParam, GoogleSearch, CodeExecution, URLContext, ComputerUse, MCPServer, FileSearch, GoogleMaps +]