From 4eb6e573a2cfd79d39f846b633d4877319457467 Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Tue, 5 May 2026 11:46:58 -0700 Subject: [PATCH] chore: steps PiperOrigin-RevId: 910819972 --- google/genai/_interactions/_client.py | 2 + google/genai/_interactions/types/__init__.py | 75 +++---- .../code_execution_call_arguments_param.py | 32 --- ...content.py => code_execution_call_step.py} | 19 +- ...m.py => code_execution_call_step_param.py} | 21 +- ...ntent.py => code_execution_result_step.py} | 6 +- ...py => code_execution_result_step_param.py} | 8 +- google/genai/_interactions/types/content.py | 39 +--- .../_interactions/types/content_delta.py | 8 +- .../_interactions/types/content_param.py | 36 +-- ...ll_content.py => file_search_call_step.py} | 6 +- ...aram.py => file_search_call_step_param.py} | 8 +- ..._content.py => file_search_result_step.py} | 11 +- ...am.py => file_search_result_step_param.py} | 13 +- ..._call_content.py => function_call_step.py} | 6 +- ...t_param.py => function_call_step_param.py} | 8 +- ...ult_content.py => function_result_step.py} | 6 +- ...param.py => function_result_step_param.py} | 8 +- ...ll_content.py => google_maps_call_step.py} | 18 +- ...aram.py => google_maps_call_step_param.py} | 20 +- .../types/google_maps_result_content.py | 39 ---- ...lt_param.py => google_maps_result_step.py} | 55 ++--- ...am.py => google_maps_result_step_param.py} | 46 +++- .../google_search_call_arguments_param.py | 31 --- ..._content.py => google_search_call_step.py} | 18 +- ...am.py => google_search_call_step_param.py} | 20 +- ...ontent.py => google_search_result_step.py} | 16 +- ....py => google_search_result_step_param.py} | 18 +- .../genai/_interactions/types/interaction.py | 47 +--- .../types/interaction_create_params.py | 36 +-- .../types/interaction_sse_event.py | 209 +++++++++++++++++- ...ontent.py => mcp_server_tool_call_step.py} | 6 +- ....py => mcp_server_tool_call_step_param.py} | 8 +- ...tent.py => mcp_server_tool_result_step.py} | 8 +- ...y => mcp_server_tool_result_step_param.py} | 10 +- ...h_result_param.py => model_output_step.py} | 17 +- ...ts_param.py => model_output_step_param.py} | 16 +- google/genai/_interactions/types/step.py | 63 ++++++ .../genai/_interactions/types/step_param.py | 61 +++++ .../{thought_content.py => thought_step.py} | 8 +- ...content_param.py => thought_step_param.py} | 10 +- .../types/url_context_call_arguments_param.py | 31 --- ...ll_content.py => url_context_call_step.py} | 18 +- ...aram.py => url_context_call_step_param.py} | 20 +- .../types/url_context_result_param.py | 32 --- ..._content.py => url_context_result_step.py} | 19 +- ...am.py => url_context_result_step_param.py} | 21 +- .../types/{turn.py => user_input_step.py} | 14 +- ...turn_param.py => user_input_step_param.py} | 15 +- 49 files changed, 704 insertions(+), 558 deletions(-) delete mode 100644 google/genai/_interactions/types/code_execution_call_arguments_param.py rename google/genai/_interactions/types/{code_execution_call_content.py => code_execution_call_step.py} (71%) rename google/genai/_interactions/types/{code_execution_call_content_param.py => code_execution_call_step_param.py} (71%) rename google/genai/_interactions/types/{code_execution_result_content.py => code_execution_result_step.py} (90%) rename google/genai/_interactions/types/{code_execution_result_content_param.py => code_execution_result_step_param.py} (85%) rename google/genai/_interactions/types/{file_search_call_content.py => file_search_call_step.py} (90%) rename google/genai/_interactions/types/{file_search_call_content_param.py => file_search_call_step_param.py} (84%) rename google/genai/_interactions/types/{file_search_result_content.py => file_search_result_step.py} (79%) rename google/genai/_interactions/types/{file_search_result_content_param.py => file_search_result_step_param.py} (77%) rename google/genai/_interactions/types/{function_call_content.py => function_call_step.py} (90%) rename google/genai/_interactions/types/{function_call_content_param.py => function_call_step_param.py} (86%) rename google/genai/_interactions/types/{function_result_content.py => function_result_step.py} (90%) rename google/genai/_interactions/types/{function_result_content_param.py => function_result_step_param.py} (86%) rename google/genai/_interactions/types/{google_maps_call_content.py => google_maps_call_step.py} (73%) rename google/genai/_interactions/types/{google_maps_call_content_param.py => google_maps_call_step_param.py} (71%) delete mode 100644 google/genai/_interactions/types/google_maps_result_content.py rename google/genai/_interactions/types/{google_maps_result_param.py => google_maps_result_step.py} (51%) rename google/genai/_interactions/types/{google_maps_result_content_param.py => google_maps_result_step_param.py} (54%) delete mode 100644 google/genai/_interactions/types/google_search_call_arguments_param.py rename google/genai/_interactions/types/{google_search_call_content.py => google_search_call_step.py} (75%) rename google/genai/_interactions/types/{google_search_call_content_param.py => google_search_call_step_param.py} (72%) rename google/genai/_interactions/types/{google_search_result_content.py => google_search_result_step.py} (76%) rename google/genai/_interactions/types/{google_search_result_content_param.py => google_search_result_step_param.py} (74%) rename google/genai/_interactions/types/{mcp_server_tool_call_content.py => mcp_server_tool_call_step.py} (91%) rename google/genai/_interactions/types/{mcp_server_tool_call_content_param.py => mcp_server_tool_call_step_param.py} (86%) rename google/genai/_interactions/types/{mcp_server_tool_result_content.py => mcp_server_tool_result_step.py} (87%) rename google/genai/_interactions/types/{mcp_server_tool_result_content_param.py => mcp_server_tool_result_step_param.py} (81%) rename google/genai/_interactions/types/{google_search_result_param.py => model_output_step.py} (67%) rename google/genai/_interactions/types/{google_maps_call_arguments_param.py => model_output_step_param.py} (67%) create mode 100644 google/genai/_interactions/types/step.py create mode 100644 google/genai/_interactions/types/step_param.py rename google/genai/_interactions/types/{thought_content.py => thought_step.py} (86%) rename google/genai/_interactions/types/{thought_content_param.py => thought_step_param.py} (81%) delete mode 100644 google/genai/_interactions/types/url_context_call_arguments_param.py rename google/genai/_interactions/types/{url_context_call_content.py => url_context_call_step.py} (75%) rename google/genai/_interactions/types/{url_context_call_content_param.py => url_context_call_step_param.py} (71%) delete mode 100644 google/genai/_interactions/types/url_context_result_param.py rename google/genai/_interactions/types/{url_context_result_content.py => url_context_result_step.py} (73%) rename google/genai/_interactions/types/{url_context_result_content_param.py => url_context_result_step_param.py} (72%) rename google/genai/_interactions/types/{turn.py => user_input_step.py} (74%) rename google/genai/_interactions/types/{turn_param.py => user_input_step_param.py} (71%) diff --git a/google/genai/_interactions/_client.py b/google/genai/_interactions/_client.py index badceaead..c7457edab 100644 --- a/google/genai/_interactions/_client.py +++ b/google/genai/_interactions/_client.py @@ -166,6 +166,7 @@ def auth_headers(self) -> dict[str, str]: def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, + "Api-Revision": "2026-05-20", **self._custom_headers, } @@ -393,6 +394,7 @@ def auth_headers(self) -> dict[str, str]: def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, + "Api-Revision": "2026-05-20", **self._custom_headers, } diff --git a/google/genai/_interactions/types/__init__.py b/google/genai/_interactions/types/__init__.py index 5606758fe..0777661a8 100644 --- a/google/genai/_interactions/types/__init__.py +++ b/google/genai/_interactions/types/__init__.py @@ -17,16 +17,16 @@ from __future__ import annotations +from .step import Step as Step from .tool import Tool as Tool -from .turn import Turn as Turn from .model import Model as Model from .usage import Usage as Usage from .content import Content as Content from .webhook import Webhook as Webhook from .function import Function as Function from .annotation import Annotation as Annotation +from .step_param import StepParam as StepParam from .tool_param import ToolParam as ToolParam -from .turn_param import TurnParam as TurnParam from .error_event import ErrorEvent as ErrorEvent from .interaction import Interaction as Interaction from .model_param import ModelParam as ModelParam @@ -34,6 +34,7 @@ from .content_stop import ContentStop as ContentStop from .image_config import ImageConfig as ImageConfig from .text_content import TextContent as TextContent +from .thought_step import ThoughtStep as ThoughtStep from .url_citation import URLCitation as URLCitation from .allowed_tools import AllowedTools as AllowedTools from .audio_content import AudioContent as AudioContent @@ -49,14 +50,17 @@ from .signing_secret import SigningSecret as SigningSecret from .thinking_level import ThinkingLevel as ThinkingLevel from .webhook_config import WebhookConfig as WebhookConfig -from .thought_content import ThoughtContent as ThoughtContent +from .user_input_step import UserInputStep as UserInputStep from .annotation_param import AnnotationParam as AnnotationParam from .document_content import DocumentContent as DocumentContent from .tool_choice_type import ToolChoiceType as ToolChoiceType from .generation_config import GenerationConfig as GenerationConfig +from .model_output_step import ModelOutputStep as ModelOutputStep +from .function_call_step import FunctionCallStep as FunctionCallStep 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 .thought_step_param import ThoughtStepParam as ThoughtStepParam from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig from .url_citation_param import URLCitationParam as URLCitationParam from .url_context_result import URLContextResult as URLContextResult @@ -69,66 +73,59 @@ from .webhook_list_params import WebhookListParams as WebhookListParams from .webhook_ping_params import WebhookPingParams as WebhookPingParams from .dynamic_agent_config import DynamicAgentConfig as DynamicAgentConfig +from .function_result_step import FunctionResultStep as FunctionResultStep from .google_search_result import GoogleSearchResult as GoogleSearchResult from .place_citation_param import PlaceCitationParam as PlaceCitationParam from .webhook_config_param import WebhookConfigParam as WebhookConfigParam -from .function_call_content import FunctionCallContent as FunctionCallContent +from .file_search_call_step import FileSearchCallStep as FileSearchCallStep +from .google_maps_call_step import GoogleMapsCallStep as GoogleMapsCallStep from .interaction_sse_event import InteractionSSEEvent as InteractionSSEEvent -from .thought_content_param import ThoughtContentParam as ThoughtContentParam +from .url_context_call_step import URLContextCallStep as URLContextCallStep +from .user_input_step_param import UserInputStepParam as UserInputStepParam from .webhook_create_params import WebhookCreateParams as WebhookCreateParams from .webhook_list_response import WebhookListResponse as WebhookListResponse from .webhook_ping_response import WebhookPingResponse as WebhookPingResponse from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams from .document_content_param import DocumentContentParam as DocumentContentParam from .interaction_get_params import InteractionGetParams as InteractionGetParams -from .function_result_content import FunctionResultContent as FunctionResultContent +from .file_search_result_step import FileSearchResultStep as FileSearchResultStep from .generation_config_param import GenerationConfigParam as GenerationConfigParam +from .google_maps_result_step import GoogleMapsResultStep as GoogleMapsResultStep +from .google_search_call_step import GoogleSearchCallStep as GoogleSearchCallStep from .interaction_start_event import InteractionStartEvent as InteractionStartEvent +from .model_output_step_param import ModelOutputStepParam as ModelOutputStepParam +from .url_context_result_step import URLContextResultStep as URLContextResultStep from .webhook_delete_response import WebhookDeleteResponse as WebhookDeleteResponse -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 .code_execution_call_step import CodeExecutionCallStep as CodeExecutionCallStep +from .function_call_step_param import FunctionCallStepParam as FunctionCallStepParam 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 +from .google_search_result_step import GoogleSearchResultStep as GoogleSearchResultStep from .interaction_create_params import InteractionCreateParams as InteractionCreateParams from .interaction_status_update import InteractionStatusUpdate as InteractionStatusUpdate +from .mcp_server_tool_call_step import MCPServerToolCallStep as MCPServerToolCallStep +from .code_execution_result_step import CodeExecutionResultStep as CodeExecutionResultStep 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 .function_result_step_param import FunctionResultStepParam as FunctionResultStepParam 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 from .url_context_call_arguments import URLContextCallArguments as URLContextCallArguments -from .url_context_result_content import URLContextResultContent as URLContextResultContent -from .code_execution_call_content import CodeExecutionCallContent as CodeExecutionCallContent -from .function_call_content_param import FunctionCallContentParam as FunctionCallContentParam +from .file_search_call_step_param import FileSearchCallStepParam as FileSearchCallStepParam +from .google_maps_call_step_param import GoogleMapsCallStepParam as GoogleMapsCallStepParam +from .mcp_server_tool_result_step import MCPServerToolResultStep as MCPServerToolResultStep +from .url_context_call_step_param import URLContextCallStepParam as URLContextCallStepParam from .google_search_call_arguments import GoogleSearchCallArguments as GoogleSearchCallArguments -from .google_search_result_content import GoogleSearchResultContent as GoogleSearchResultContent -from .mcp_server_tool_call_content import MCPServerToolCallContent as MCPServerToolCallContent from .code_execution_call_arguments import CodeExecutionCallArguments as CodeExecutionCallArguments -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 .file_search_result_step_param import FileSearchResultStepParam as FileSearchResultStepParam +from .google_maps_result_step_param import GoogleMapsResultStepParam as GoogleMapsResultStepParam +from .google_search_call_step_param import GoogleSearchCallStepParam as GoogleSearchCallStepParam +from .url_context_result_step_param import URLContextResultStepParam as URLContextResultStepParam +from .code_execution_call_step_param import CodeExecutionCallStepParam as CodeExecutionCallStepParam +from .google_search_result_step_param import GoogleSearchResultStepParam as GoogleSearchResultStepParam +from .mcp_server_tool_call_step_param import MCPServerToolCallStepParam as MCPServerToolCallStepParam +from .code_execution_result_step_param import CodeExecutionResultStepParam as CodeExecutionResultStepParam 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 -from .code_execution_call_content_param import CodeExecutionCallContentParam as CodeExecutionCallContentParam -from .google_search_call_arguments_param import GoogleSearchCallArgumentsParam as GoogleSearchCallArgumentsParam -from .google_search_result_content_param import GoogleSearchResultContentParam as GoogleSearchResultContentParam -from .mcp_server_tool_call_content_param import MCPServerToolCallContentParam as MCPServerToolCallContentParam -from .code_execution_call_arguments_param import CodeExecutionCallArgumentsParam as CodeExecutionCallArgumentsParam -from .code_execution_result_content_param import CodeExecutionResultContentParam as CodeExecutionResultContentParam -from .mcp_server_tool_result_content_param import MCPServerToolResultContentParam as MCPServerToolResultContentParam +from .mcp_server_tool_result_step_param import MCPServerToolResultStepParam as MCPServerToolResultStepParam from .webhook_rotate_signing_secret_params import WebhookRotateSigningSecretParams as WebhookRotateSigningSecretParams from .webhook_rotate_signing_secret_response import ( WebhookRotateSigningSecretResponse as WebhookRotateSigningSecretResponse, diff --git a/google/genai/_interactions/types/code_execution_call_arguments_param.py b/google/genai/_interactions/types/code_execution_call_arguments_param.py deleted file mode 100644 index 87fc40d7e..000000000 --- a/google/genai/_interactions/types/code_execution_call_arguments_param.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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, TypedDict - -__all__ = ["CodeExecutionCallArgumentsParam"] - - -class CodeExecutionCallArgumentsParam(TypedDict, total=False): - """The arguments to pass to the code execution.""" - - code: str - """The code to be executed.""" - - language: Literal["python"] - """Programming language of the `code`.""" diff --git a/google/genai/_interactions/types/code_execution_call_content.py b/google/genai/_interactions/types/code_execution_call_step.py similarity index 71% rename from google/genai/_interactions/types/code_execution_call_content.py rename to google/genai/_interactions/types/code_execution_call_step.py index 0488f89c6..986940dea 100644 --- a/google/genai/_interactions/types/code_execution_call_content.py +++ b/google/genai/_interactions/types/code_execution_call_step.py @@ -19,18 +19,27 @@ from typing_extensions import Literal from .._models import BaseModel -from .code_execution_call_arguments import CodeExecutionCallArguments -__all__ = ["CodeExecutionCallContent"] +__all__ = ["CodeExecutionCallStep", "Arguments"] -class CodeExecutionCallContent(BaseModel): - """Code execution content.""" +class Arguments(BaseModel): + """Required. The arguments to pass to the code execution.""" + + code: Optional[str] = None + """The code to be executed.""" + + language: Optional[Literal["python"]] = None + """Programming language of the `code`.""" + + +class CodeExecutionCallStep(BaseModel): + """Code execution call step.""" id: str """Required. A unique ID for this specific tool call.""" - arguments: CodeExecutionCallArguments + arguments: Arguments """Required. The arguments to pass to the code execution.""" type: Literal["code_execution_call"] diff --git a/google/genai/_interactions/types/code_execution_call_content_param.py b/google/genai/_interactions/types/code_execution_call_step_param.py similarity index 71% rename from google/genai/_interactions/types/code_execution_call_content_param.py rename to google/genai/_interactions/types/code_execution_call_step_param.py index 33e5e0a61..eaa9f995e 100644 --- a/google/genai/_interactions/types/code_execution_call_content_param.py +++ b/google/genai/_interactions/types/code_execution_call_step_param.py @@ -23,18 +23,27 @@ from .._types import Base64FileInput from .._utils import PropertyInfo from .._models import set_pydantic_config -from .code_execution_call_arguments_param import CodeExecutionCallArgumentsParam -__all__ = ["CodeExecutionCallContentParam"] +__all__ = ["CodeExecutionCallStepParam", "Arguments"] -class CodeExecutionCallContentParam(TypedDict, total=False): - """Code execution content.""" +class Arguments(TypedDict, total=False): + """Required. The arguments to pass to the code execution.""" + + code: str + """The code to be executed.""" + + language: Literal["python"] + """Programming language of the `code`.""" + + +class CodeExecutionCallStepParam(TypedDict, total=False): + """Code execution call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" - arguments: Required[CodeExecutionCallArgumentsParam] + arguments: Required[Arguments] """Required. The arguments to pass to the code execution.""" type: Required[Literal["code_execution_call"]] @@ -43,4 +52,4 @@ class CodeExecutionCallContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(CodeExecutionCallContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(CodeExecutionCallStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/code_execution_result_content.py b/google/genai/_interactions/types/code_execution_result_step.py similarity index 90% rename from google/genai/_interactions/types/code_execution_result_content.py rename to google/genai/_interactions/types/code_execution_result_step.py index 1d300aeda..611228db3 100644 --- a/google/genai/_interactions/types/code_execution_result_content.py +++ b/google/genai/_interactions/types/code_execution_result_step.py @@ -20,11 +20,11 @@ from .._models import BaseModel -__all__ = ["CodeExecutionResultContent"] +__all__ = ["CodeExecutionResultStep"] -class CodeExecutionResultContent(BaseModel): - """Code execution result content.""" +class CodeExecutionResultStep(BaseModel): + """Code execution result step.""" call_id: str """Required. ID to match the ID from the function call block.""" diff --git a/google/genai/_interactions/types/code_execution_result_content_param.py b/google/genai/_interactions/types/code_execution_result_step_param.py similarity index 85% rename from google/genai/_interactions/types/code_execution_result_content_param.py rename to google/genai/_interactions/types/code_execution_result_step_param.py index b4e64370f..51e40517f 100644 --- a/google/genai/_interactions/types/code_execution_result_content_param.py +++ b/google/genai/_interactions/types/code_execution_result_step_param.py @@ -24,11 +24,11 @@ from .._utils import PropertyInfo from .._models import set_pydantic_config -__all__ = ["CodeExecutionResultContentParam"] +__all__ = ["CodeExecutionResultStepParam"] -class CodeExecutionResultContentParam(TypedDict, total=False): - """Code execution result content.""" +class CodeExecutionResultStepParam(TypedDict, total=False): + """Code execution result step.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" @@ -45,4 +45,4 @@ class CodeExecutionResultContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(CodeExecutionResultContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(CodeExecutionResultStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/content.py b/google/genai/_interactions/types/content.py index 414524101..c3852c413 100644 --- a/google/genai/_interactions/types/content.py +++ b/google/genai/_interactions/types/content.py @@ -23,47 +23,10 @@ from .audio_content import AudioContent from .image_content import ImageContent from .video_content import VideoContent -from .thought_content import ThoughtContent from .document_content import DocumentContent -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 -from .google_search_result_content import GoogleSearchResultContent -from .mcp_server_tool_call_content import MCPServerToolCallContent -from .code_execution_result_content import CodeExecutionResultContent -from .mcp_server_tool_result_content import MCPServerToolResultContent __all__ = ["Content"] Content: TypeAlias = Annotated[ - Union[ - TextContent, - ImageContent, - AudioContent, - DocumentContent, - VideoContent, - ThoughtContent, - FunctionCallContent, - CodeExecutionCallContent, - URLContextCallContent, - MCPServerToolCallContent, - GoogleSearchCallContent, - FileSearchCallContent, - GoogleMapsCallContent, - FunctionResultContent, - CodeExecutionResultContent, - URLContextResultContent, - GoogleSearchResultContent, - MCPServerToolResultContent, - FileSearchResultContent, - GoogleMapsResultContent, - ], - PropertyInfo(discriminator="type"), + Union[TextContent, ImageContent, AudioContent, DocumentContent, VideoContent], PropertyInfo(discriminator="type") ] diff --git a/google/genai/_interactions/types/content_delta.py b/google/genai/_interactions/types/content_delta.py index 725da23a2..5e55f2217 100644 --- a/google/genai/_interactions/types/content_delta.py +++ b/google/genai/_interactions/types/content_delta.py @@ -58,7 +58,7 @@ "DeltaMCPServerToolResultResultFunctionResultSubcontentList", "DeltaFileSearchResult", "DeltaGoogleMapsResult", - "DeltaTextAnnotation", + "DeltaTextAnnotationDelta", ] @@ -372,8 +372,8 @@ class DeltaGoogleMapsResult(BaseModel): """A signature hash for backend validation.""" -class DeltaTextAnnotation(BaseModel): - type: Literal["text_annotation"] +class DeltaTextAnnotationDelta(BaseModel): + type: Literal["text_annotation_delta"] annotations: Optional[List[Annotation]] = None """Citation information for model-generated content.""" @@ -402,7 +402,7 @@ class DeltaTextAnnotation(BaseModel): DeltaMCPServerToolResult, DeltaFileSearchResult, DeltaGoogleMapsResult, - DeltaTextAnnotation, + DeltaTextAnnotationDelta, ], PropertyInfo(discriminator="type"), ] diff --git a/google/genai/_interactions/types/content_param.py b/google/genai/_interactions/types/content_param.py index 34b864a33..8300749d7 100644 --- a/google/genai/_interactions/types/content_param.py +++ b/google/genai/_interactions/types/content_param.py @@ -24,44 +24,10 @@ from .audio_content_param import AudioContentParam from .image_content_param import ImageContentParam from .video_content_param import VideoContentParam -from .thought_content_param import ThoughtContentParam from .document_content_param import DocumentContentParam -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 -from .google_search_result_content_param import GoogleSearchResultContentParam -from .mcp_server_tool_call_content_param import MCPServerToolCallContentParam -from .code_execution_result_content_param import CodeExecutionResultContentParam -from .mcp_server_tool_result_content_param import MCPServerToolResultContentParam __all__ = ["ContentParam"] ContentParam: TypeAlias = Union[ - TextContentParam, - ImageContentParam, - AudioContentParam, - DocumentContentParam, - VideoContentParam, - ThoughtContentParam, - FunctionCallContentParam, - CodeExecutionCallContentParam, - URLContextCallContentParam, - MCPServerToolCallContentParam, - GoogleSearchCallContentParam, - FileSearchCallContentParam, - GoogleMapsCallContentParam, - FunctionResultContentParam, - CodeExecutionResultContentParam, - URLContextResultContentParam, - GoogleSearchResultContentParam, - MCPServerToolResultContentParam, - FileSearchResultContentParam, - GoogleMapsResultContentParam, + TextContentParam, ImageContentParam, AudioContentParam, DocumentContentParam, VideoContentParam ] diff --git a/google/genai/_interactions/types/file_search_call_content.py b/google/genai/_interactions/types/file_search_call_step.py similarity index 90% rename from google/genai/_interactions/types/file_search_call_content.py rename to google/genai/_interactions/types/file_search_call_step.py index d1e4b9fc5..478cf4cec 100644 --- a/google/genai/_interactions/types/file_search_call_content.py +++ b/google/genai/_interactions/types/file_search_call_step.py @@ -20,11 +20,11 @@ from .._models import BaseModel -__all__ = ["FileSearchCallContent"] +__all__ = ["FileSearchCallStep"] -class FileSearchCallContent(BaseModel): - """File Search content.""" +class FileSearchCallStep(BaseModel): + """File Search call step.""" id: str """Required. A unique ID for this specific tool call.""" diff --git a/google/genai/_interactions/types/file_search_call_content_param.py b/google/genai/_interactions/types/file_search_call_step_param.py similarity index 84% rename from google/genai/_interactions/types/file_search_call_content_param.py rename to google/genai/_interactions/types/file_search_call_step_param.py index e9ff0c725..0eb378501 100644 --- a/google/genai/_interactions/types/file_search_call_content_param.py +++ b/google/genai/_interactions/types/file_search_call_step_param.py @@ -24,11 +24,11 @@ from .._utils import PropertyInfo from .._models import set_pydantic_config -__all__ = ["FileSearchCallContentParam"] +__all__ = ["FileSearchCallStepParam"] -class FileSearchCallContentParam(TypedDict, total=False): - """File Search content.""" +class FileSearchCallStepParam(TypedDict, total=False): + """File Search call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" @@ -39,4 +39,4 @@ class FileSearchCallContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(FileSearchCallContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(FileSearchCallStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/file_search_result_content.py b/google/genai/_interactions/types/file_search_result_step.py similarity index 79% rename from google/genai/_interactions/types/file_search_result_content.py rename to google/genai/_interactions/types/file_search_result_step.py index 63ea02310..e7331caa3 100644 --- a/google/genai/_interactions/types/file_search_result_content.py +++ b/google/genai/_interactions/types/file_search_result_step.py @@ -15,24 +15,21 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from typing_extensions import Literal from .._models import BaseModel -__all__ = ["FileSearchResultContent"] +__all__ = ["FileSearchResultStep"] -class FileSearchResultContent(BaseModel): - """File Search result content.""" +class FileSearchResultStep(BaseModel): + """File Search result step.""" call_id: str """Required. ID to match the ID from the function call block.""" type: Literal["file_search_result"] - result: Optional[List[object]] = None - """Optional. The results of the File Search.""" - signature: Optional[str] = None """A signature hash for backend validation.""" diff --git a/google/genai/_interactions/types/file_search_result_content_param.py b/google/genai/_interactions/types/file_search_result_step_param.py similarity index 77% rename from google/genai/_interactions/types/file_search_result_content_param.py rename to google/genai/_interactions/types/file_search_result_step_param.py index db129e731..e272ada54 100644 --- a/google/genai/_interactions/types/file_search_result_content_param.py +++ b/google/genai/_interactions/types/file_search_result_step_param.py @@ -17,29 +17,26 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Union from typing_extensions import Literal, Required, Annotated, TypedDict from .._types import Base64FileInput from .._utils import PropertyInfo from .._models import set_pydantic_config -__all__ = ["FileSearchResultContentParam"] +__all__ = ["FileSearchResultStepParam"] -class FileSearchResultContentParam(TypedDict, total=False): - """File Search result content.""" +class FileSearchResultStepParam(TypedDict, total=False): + """File Search result step.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" type: Required[Literal["file_search_result"]] - result: Iterable[object] - """Optional. The results of the File Search.""" - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] """A signature hash for backend validation.""" -set_pydantic_config(FileSearchResultContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(FileSearchResultStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/function_call_content.py b/google/genai/_interactions/types/function_call_step.py similarity index 90% rename from google/genai/_interactions/types/function_call_content.py rename to google/genai/_interactions/types/function_call_step.py index 49bcaa635..5486603f1 100644 --- a/google/genai/_interactions/types/function_call_content.py +++ b/google/genai/_interactions/types/function_call_step.py @@ -20,11 +20,11 @@ from .._models import BaseModel -__all__ = ["FunctionCallContent"] +__all__ = ["FunctionCallStep"] -class FunctionCallContent(BaseModel): - """A function tool call content block.""" +class FunctionCallStep(BaseModel): + """A function tool call step.""" id: str """Required. A unique ID for this specific tool call.""" diff --git a/google/genai/_interactions/types/function_call_content_param.py b/google/genai/_interactions/types/function_call_step_param.py similarity index 86% rename from google/genai/_interactions/types/function_call_content_param.py rename to google/genai/_interactions/types/function_call_step_param.py index d3c51bc57..b6c487295 100644 --- a/google/genai/_interactions/types/function_call_content_param.py +++ b/google/genai/_interactions/types/function_call_step_param.py @@ -24,11 +24,11 @@ from .._utils import PropertyInfo from .._models import set_pydantic_config -__all__ = ["FunctionCallContentParam"] +__all__ = ["FunctionCallStepParam"] -class FunctionCallContentParam(TypedDict, total=False): - """A function tool call content block.""" +class FunctionCallStepParam(TypedDict, total=False): + """A function tool call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" @@ -45,4 +45,4 @@ class FunctionCallContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(FunctionCallContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(FunctionCallStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/function_result_content.py b/google/genai/_interactions/types/function_result_step.py similarity index 90% rename from google/genai/_interactions/types/function_result_content.py rename to google/genai/_interactions/types/function_result_step.py index bb398f05d..cd56a6f83 100644 --- a/google/genai/_interactions/types/function_result_content.py +++ b/google/genai/_interactions/types/function_result_step.py @@ -23,15 +23,15 @@ from .text_content import TextContent from .image_content import ImageContent -__all__ = ["FunctionResultContent", "ResultFunctionResultSubcontentList"] +__all__ = ["FunctionResultStep", "ResultFunctionResultSubcontentList"] ResultFunctionResultSubcontentList: TypeAlias = Annotated[ Union[TextContent, ImageContent], PropertyInfo(discriminator="type") ] -class FunctionResultContent(BaseModel): - """A function tool result content block.""" +class FunctionResultStep(BaseModel): + """Result of a function tool call.""" call_id: str """Required. ID to match the ID from the function call block.""" diff --git a/google/genai/_interactions/types/function_result_content_param.py b/google/genai/_interactions/types/function_result_step_param.py similarity index 86% rename from google/genai/_interactions/types/function_result_content_param.py rename to google/genai/_interactions/types/function_result_step_param.py index df2403609..aaf7e82a8 100644 --- a/google/genai/_interactions/types/function_result_content_param.py +++ b/google/genai/_interactions/types/function_result_step_param.py @@ -26,13 +26,13 @@ from .text_content_param import TextContentParam from .image_content_param import ImageContentParam -__all__ = ["FunctionResultContentParam", "ResultFunctionResultSubcontentList"] +__all__ = ["FunctionResultStepParam", "ResultFunctionResultSubcontentList"] ResultFunctionResultSubcontentList: TypeAlias = Union[TextContentParam, ImageContentParam] -class FunctionResultContentParam(TypedDict, total=False): - """A function tool result content block.""" +class FunctionResultStepParam(TypedDict, total=False): + """Result of a function tool call.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" @@ -52,4 +52,4 @@ class FunctionResultContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(FunctionResultContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(FunctionResultStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/google_maps_call_content.py b/google/genai/_interactions/types/google_maps_call_step.py similarity index 73% rename from google/genai/_interactions/types/google_maps_call_content.py rename to google/genai/_interactions/types/google_maps_call_step.py index 688108a71..a0b095a0b 100644 --- a/google/genai/_interactions/types/google_maps_call_content.py +++ b/google/genai/_interactions/types/google_maps_call_step.py @@ -15,24 +15,30 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Optional from typing_extensions import Literal from .._models import BaseModel -from .google_maps_call_arguments import GoogleMapsCallArguments -__all__ = ["GoogleMapsCallContent"] +__all__ = ["GoogleMapsCallStep", "Arguments"] -class GoogleMapsCallContent(BaseModel): - """Google Maps content.""" +class Arguments(BaseModel): + """The arguments to pass to the Google Maps tool.""" + + queries: Optional[List[str]] = None + """The queries to be executed.""" + + +class GoogleMapsCallStep(BaseModel): + """Google Maps call step.""" id: str """Required. A unique ID for this specific tool call.""" type: Literal["google_maps_call"] - arguments: Optional[GoogleMapsCallArguments] = None + arguments: Optional[Arguments] = None """The arguments to pass to the Google Maps tool.""" signature: Optional[str] = None diff --git a/google/genai/_interactions/types/google_maps_call_content_param.py b/google/genai/_interactions/types/google_maps_call_step_param.py similarity index 71% rename from google/genai/_interactions/types/google_maps_call_content_param.py rename to google/genai/_interactions/types/google_maps_call_step_param.py index c39d1e238..09280564c 100644 --- a/google/genai/_interactions/types/google_maps_call_content_param.py +++ b/google/genai/_interactions/types/google_maps_call_step_param.py @@ -20,27 +20,33 @@ from typing import Union from typing_extensions import Literal, Required, Annotated, TypedDict -from .._types import Base64FileInput +from .._types import SequenceNotStr, Base64FileInput from .._utils import PropertyInfo from .._models import set_pydantic_config -from .google_maps_call_arguments_param import GoogleMapsCallArgumentsParam -__all__ = ["GoogleMapsCallContentParam"] +__all__ = ["GoogleMapsCallStepParam", "Arguments"] -class GoogleMapsCallContentParam(TypedDict, total=False): - """Google Maps content.""" +class Arguments(TypedDict, total=False): + """The arguments to pass to the Google Maps tool.""" + + queries: SequenceNotStr[str] + """The queries to be executed.""" + + +class GoogleMapsCallStepParam(TypedDict, total=False): + """Google Maps call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" type: Required[Literal["google_maps_call"]] - arguments: GoogleMapsCallArgumentsParam + arguments: Arguments """The arguments to pass to the Google Maps tool.""" signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] """A signature hash for backend validation.""" -set_pydantic_config(GoogleMapsCallContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(GoogleMapsCallStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/google_maps_result_content.py b/google/genai/_interactions/types/google_maps_result_content.py deleted file mode 100644 index 4e959ba56..000000000 --- a/google/genai/_interactions/types/google_maps_result_content.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 - """Required. ID to match the ID from the function call block.""" - - result: List[GoogleMapsResult] - """Required. 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_param.py b/google/genai/_interactions/types/google_maps_result_step.py similarity index 51% rename from google/genai/_interactions/types/google_maps_result_param.py rename to google/genai/_interactions/types/google_maps_result_step.py index 9774a5357..4d6427800 100644 --- a/google/genai/_interactions/types/google_maps_result_param.py +++ b/google/genai/_interactions/types/google_maps_result_step.py @@ -15,52 +15,57 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from __future__ import annotations +from typing import List, Optional +from typing_extensions import Literal -from typing import Iterable -from typing_extensions import TypedDict +from .._models import BaseModel -__all__ = ["GoogleMapsResultParam", "Place", "PlaceReviewSnippet"] +__all__ = ["GoogleMapsResultStep", "Result", "ResultPlace", "ResultPlaceReviewSnippet"] -class PlaceReviewSnippet(TypedDict, total=False): +class ResultPlaceReviewSnippet(BaseModel): """ Encapsulates a snippet of a user review that answers a question about the features of a specific place in Google Maps. """ - review_id: str + review_id: Optional[str] = None """The ID of the review snippet.""" - title: str + title: Optional[str] = None """Title of the review.""" - url: str + url: Optional[str] = None """A link that corresponds to the user review on Google Maps.""" -class Place(TypedDict, total=False): - name: str - """Title of the place.""" +class ResultPlace(BaseModel): + name: Optional[str] = None - place_id: str - """The ID of the place, in `places/{place_id}` format.""" + place_id: Optional[str] = None - review_snippets: Iterable[PlaceReviewSnippet] - """ - Snippets of reviews that are used to generate answers about the features of a - given place in Google Maps. - """ + review_snippets: Optional[List[ResultPlaceReviewSnippet]] = None - url: str - """URI reference of the place.""" + url: Optional[str] = None -class GoogleMapsResultParam(TypedDict, total=False): +class Result(BaseModel): """The result of the Google Maps.""" - places: Iterable[Place] - """The places that were found.""" + places: Optional[List[ResultPlace]] = None + + widget_context_token: Optional[str] = None + + +class GoogleMapsResultStep(BaseModel): + """Google Maps result step.""" + + call_id: str + """Required. ID to match the ID from the function call block.""" + + result: List[Result] + + type: Literal["google_maps_result"] - widget_context_token: str - """Resource name of the Google Maps widget context token.""" + 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_step_param.py similarity index 54% rename from google/genai/_interactions/types/google_maps_result_content_param.py rename to google/genai/_interactions/types/google_maps_result_step_param.py index e29b9c3f4..28016ea12 100644 --- a/google/genai/_interactions/types/google_maps_result_content_param.py +++ b/google/genai/_interactions/types/google_maps_result_step_param.py @@ -23,19 +23,51 @@ from .._types import Base64FileInput from .._utils import PropertyInfo from .._models import set_pydantic_config -from .google_maps_result_param import GoogleMapsResultParam -__all__ = ["GoogleMapsResultContentParam"] +__all__ = ["GoogleMapsResultStepParam", "Result", "ResultPlace", "ResultPlaceReviewSnippet"] -class GoogleMapsResultContentParam(TypedDict, total=False): - """Google Maps result content.""" +class ResultPlaceReviewSnippet(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 ResultPlace(TypedDict, total=False): + name: str + + place_id: str + + review_snippets: Iterable[ResultPlaceReviewSnippet] + + url: str + + +class Result(TypedDict, total=False): + """The result of the Google Maps.""" + + places: Iterable[ResultPlace] + + widget_context_token: str + + +class GoogleMapsResultStepParam(TypedDict, total=False): + """Google Maps result step.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - result: Required[Iterable[GoogleMapsResultParam]] - """Required. The results of the Google Maps.""" + result: Required[Iterable[Result]] type: Required[Literal["google_maps_result"]] @@ -43,4 +75,4 @@ class GoogleMapsResultContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(GoogleMapsResultContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(GoogleMapsResultStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/google_search_call_arguments_param.py b/google/genai/_interactions/types/google_search_call_arguments_param.py deleted file mode 100644 index 086c2382e..000000000 --- a/google/genai/_interactions/types/google_search_call_arguments_param.py +++ /dev/null @@ -1,31 +0,0 @@ -# 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__ = ["GoogleSearchCallArgumentsParam"] - - -class GoogleSearchCallArgumentsParam(TypedDict, total=False): - """The arguments to pass to Google Search.""" - - queries: SequenceNotStr[str] - """Web search queries for the following-up web search.""" diff --git a/google/genai/_interactions/types/google_search_call_content.py b/google/genai/_interactions/types/google_search_call_step.py similarity index 75% rename from google/genai/_interactions/types/google_search_call_content.py rename to google/genai/_interactions/types/google_search_call_step.py index 5703202fe..c36abfbcf 100644 --- a/google/genai/_interactions/types/google_search_call_content.py +++ b/google/genai/_interactions/types/google_search_call_step.py @@ -15,22 +15,28 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Optional from typing_extensions import Literal from .._models import BaseModel -from .google_search_call_arguments import GoogleSearchCallArguments -__all__ = ["GoogleSearchCallContent"] +__all__ = ["GoogleSearchCallStep", "Arguments"] -class GoogleSearchCallContent(BaseModel): - """Google Search content.""" +class Arguments(BaseModel): + """Required. The arguments to pass to Google Search.""" + + queries: Optional[List[str]] = None + """Web search queries for the following-up web search.""" + + +class GoogleSearchCallStep(BaseModel): + """Google Search call step.""" id: str """Required. A unique ID for this specific tool call.""" - arguments: GoogleSearchCallArguments + arguments: Arguments """Required. The arguments to pass to Google Search.""" type: Literal["google_search_call"] diff --git a/google/genai/_interactions/types/google_search_call_content_param.py b/google/genai/_interactions/types/google_search_call_step_param.py similarity index 72% rename from google/genai/_interactions/types/google_search_call_content_param.py rename to google/genai/_interactions/types/google_search_call_step_param.py index 7e98d0d07..c1f42b364 100644 --- a/google/genai/_interactions/types/google_search_call_content_param.py +++ b/google/genai/_interactions/types/google_search_call_step_param.py @@ -20,21 +20,27 @@ from typing import Union from typing_extensions import Literal, Required, Annotated, TypedDict -from .._types import Base64FileInput +from .._types import SequenceNotStr, Base64FileInput from .._utils import PropertyInfo from .._models import set_pydantic_config -from .google_search_call_arguments_param import GoogleSearchCallArgumentsParam -__all__ = ["GoogleSearchCallContentParam"] +__all__ = ["GoogleSearchCallStepParam", "Arguments"] -class GoogleSearchCallContentParam(TypedDict, total=False): - """Google Search content.""" +class Arguments(TypedDict, total=False): + """Required. The arguments to pass to Google Search.""" + + queries: SequenceNotStr[str] + """Web search queries for the following-up web search.""" + + +class GoogleSearchCallStepParam(TypedDict, total=False): + """Google Search call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" - arguments: Required[GoogleSearchCallArgumentsParam] + arguments: Required[Arguments] """Required. The arguments to pass to Google Search.""" type: Required[Literal["google_search_call"]] @@ -46,4 +52,4 @@ class GoogleSearchCallContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(GoogleSearchCallContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(GoogleSearchCallStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/google_search_result_content.py b/google/genai/_interactions/types/google_search_result_step.py similarity index 76% rename from google/genai/_interactions/types/google_search_result_content.py rename to google/genai/_interactions/types/google_search_result_step.py index be15b8c62..976b6cea1 100644 --- a/google/genai/_interactions/types/google_search_result_content.py +++ b/google/genai/_interactions/types/google_search_result_step.py @@ -19,18 +19,24 @@ from typing_extensions import Literal from .._models import BaseModel -from .google_search_result import GoogleSearchResult -__all__ = ["GoogleSearchResultContent"] +__all__ = ["GoogleSearchResultStep", "Result"] -class GoogleSearchResultContent(BaseModel): - """Google Search result content.""" +class Result(BaseModel): + """The result of the Google Search.""" + + search_suggestions: Optional[str] = None + """Web content snippet that can be embedded in a web page or an app webview.""" + + +class GoogleSearchResultStep(BaseModel): + """Google Search result step.""" call_id: str """Required. ID to match the ID from the function call block.""" - result: List[GoogleSearchResult] + result: List[Result] """Required. The results of the Google Search.""" type: Literal["google_search_result"] diff --git a/google/genai/_interactions/types/google_search_result_content_param.py b/google/genai/_interactions/types/google_search_result_step_param.py similarity index 74% rename from google/genai/_interactions/types/google_search_result_content_param.py rename to google/genai/_interactions/types/google_search_result_step_param.py index 039d00efc..160d87f96 100644 --- a/google/genai/_interactions/types/google_search_result_content_param.py +++ b/google/genai/_interactions/types/google_search_result_step_param.py @@ -23,18 +23,24 @@ from .._types import Base64FileInput from .._utils import PropertyInfo from .._models import set_pydantic_config -from .google_search_result_param import GoogleSearchResultParam -__all__ = ["GoogleSearchResultContentParam"] +__all__ = ["GoogleSearchResultStepParam", "Result"] -class GoogleSearchResultContentParam(TypedDict, total=False): - """Google Search result content.""" +class Result(TypedDict, total=False): + """The result of the Google Search.""" + + search_suggestions: str + """Web content snippet that can be embedded in a web page or an app webview.""" + + +class GoogleSearchResultStepParam(TypedDict, total=False): + """Google Search result step.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - result: Required[Iterable[GoogleSearchResultParam]] + result: Required[Iterable[Result]] """Required. The results of the Google Search.""" type: Required[Literal["google_search_result"]] @@ -46,4 +52,4 @@ class GoogleSearchResultContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(GoogleSearchResultContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(GoogleSearchResultStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/interaction.py b/google/genai/_interactions/types/interaction.py index ed42e5476..47789bdd7 100644 --- a/google/genai/_interactions/types/interaction.py +++ b/google/genai/_interactions/types/interaction.py @@ -19,8 +19,8 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypeAlias +from .step import Step from .tool import Tool -from .turn import Turn from .model import Model from .usage import Usage from .._utils import PropertyInfo @@ -31,24 +31,9 @@ from .image_content import ImageContent from .video_content import VideoContent from .webhook_config import WebhookConfig -from .thought_content import ThoughtContent from .document_content import DocumentContent from .dynamic_agent_config import DynamicAgentConfig -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 -from .google_search_result_content import GoogleSearchResultContent -from .mcp_server_tool_call_content import MCPServerToolCallContent -from .code_execution_result_content import CodeExecutionResultContent -from .mcp_server_tool_result_content import MCPServerToolResultContent __all__ = ["Interaction", "AgentConfig", "Input"] @@ -57,29 +42,7 @@ ] Input: TypeAlias = Union[ - List[Content], - str, - List[Turn], - TextContent, - ImageContent, - AudioContent, - DocumentContent, - VideoContent, - ThoughtContent, - FunctionCallContent, - CodeExecutionCallContent, - URLContextCallContent, - MCPServerToolCallContent, - GoogleSearchCallContent, - FileSearchCallContent, - GoogleMapsCallContent, - FunctionResultContent, - CodeExecutionResultContent, - URLContextResultContent, - GoogleSearchResultContent, - MCPServerToolResultContent, - FileSearchResultContent, - GoogleMapsResultContent, + str, List[Step], List[Content], TextContent, ImageContent, AudioContent, DocumentContent, VideoContent ] @@ -124,9 +87,6 @@ class Interaction(BaseModel): model: Optional[Model] = None """The name of the `Model` used for generating the interaction.""" - outputs: Optional[List[Content]] = None - """Output only. Responses from the model.""" - previous_interaction_id: Optional[str] = None """The ID of the previous interaction, if any.""" @@ -148,6 +108,9 @@ class Interaction(BaseModel): service_tier: Optional[Literal["flex", "standard", "priority"]] = None """The service tier for the interaction.""" + steps: Optional[List[Step]] = None + """Output only. The steps that make up the interaction.""" + system_instruction: Optional[str] = None """System instruction for the interaction.""" diff --git a/google/genai/_interactions/types/interaction_create_params.py b/google/genai/_interactions/types/interaction_create_params.py index 78a1bd718..6956e20f2 100644 --- a/google/genai/_interactions/types/interaction_create_params.py +++ b/google/genai/_interactions/types/interaction_create_params.py @@ -20,8 +20,8 @@ from typing import List, Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict +from .step_param import StepParam from .tool_param import ToolParam -from .turn_param import TurnParam from .model_param import ModelParam from .content_param import ContentParam from .text_content_param import TextContentParam @@ -29,25 +29,10 @@ from .image_content_param import ImageContentParam from .video_content_param import VideoContentParam from .webhook_config_param import WebhookConfigParam -from .thought_content_param import ThoughtContentParam from .document_content_param import DocumentContentParam from .generation_config_param import GenerationConfigParam from .dynamic_agent_config_param import DynamicAgentConfigParam -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 -from .google_search_result_content_param import GoogleSearchResultContentParam -from .mcp_server_tool_call_content_param import MCPServerToolCallContentParam -from .code_execution_result_content_param import CodeExecutionResultContentParam -from .mcp_server_tool_result_content_param import MCPServerToolResultContentParam __all__ = [ "BaseCreateModelInteractionParams", @@ -112,29 +97,14 @@ class BaseCreateModelInteractionParams(TypedDict, total=False): Input: TypeAlias = Union[ - Iterable[ContentParam], str, - Iterable[TurnParam], + Iterable[StepParam], + Iterable[ContentParam], TextContentParam, ImageContentParam, AudioContentParam, DocumentContentParam, VideoContentParam, - ThoughtContentParam, - FunctionCallContentParam, - CodeExecutionCallContentParam, - URLContextCallContentParam, - MCPServerToolCallContentParam, - GoogleSearchCallContentParam, - FileSearchCallContentParam, - GoogleMapsCallContentParam, - FunctionResultContentParam, - CodeExecutionResultContentParam, - URLContextResultContentParam, - GoogleSearchResultContentParam, - MCPServerToolResultContentParam, - FileSearchResultContentParam, - GoogleMapsResultContentParam, ] diff --git a/google/genai/_interactions/types/interaction_sse_event.py b/google/genai/_interactions/types/interaction_sse_event.py index 0eee49201..b8ac90ed1 100644 --- a/google/genai/_interactions/types/interaction_sse_event.py +++ b/google/genai/_interactions/types/interaction_sse_event.py @@ -15,19 +15,219 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union -from typing_extensions import Annotated, TypeAlias +from typing import List, Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias +from .step import Step from .._utils import PropertyInfo +from .._models import BaseModel +from .annotation import Annotation from .error_event import ErrorEvent from .content_stop import ContentStop +from .text_content import TextContent from .content_delta import ContentDelta from .content_start import ContentStart +from .image_content import ImageContent from .interaction_start_event import InteractionStartEvent from .interaction_status_update import InteractionStatusUpdate from .interaction_complete_event import InteractionCompleteEvent -__all__ = ["InteractionSSEEvent"] +__all__ = [ + "InteractionSSEEvent", + "StepStart", + "StepDelta", + "StepDeltaDelta", + "StepDeltaDeltaText", + "StepDeltaDeltaImage", + "StepDeltaDeltaAudio", + "StepDeltaDeltaDocument", + "StepDeltaDeltaVideo", + "StepDeltaDeltaThoughtSummary", + "StepDeltaDeltaThoughtSummaryContent", + "StepDeltaDeltaThoughtSignature", + "StepDeltaDeltaTextAnnotationDelta", + "StepDeltaDeltaArgumentsDelta", + "StepStop", +] + + +class StepStart(BaseModel): + event_type: Literal["step.start"] + + index: int + + step: Step + """A step in the interaction.""" + + event_id: Optional[str] = None + """ + The event_id token to be used to resume the interaction stream, from this event. + """ + + +class StepDeltaDeltaText(BaseModel): + text: str + + type: Literal["text"] + + +class StepDeltaDeltaImage(BaseModel): + type: Literal["image"] + + data: Optional[str] = None + + mime_type: Optional[ + Literal[ + "image/png", "image/jpeg", "image/webp", "image/heic", "image/heif", "image/gif", "image/bmp", "image/tiff" + ] + ] = None + + resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None + """The resolution of the media.""" + + uri: Optional[str] = None + + +class StepDeltaDeltaAudio(BaseModel): + type: Literal["audio"] + + channels: Optional[int] = None + """The number of audio channels.""" + + data: Optional[str] = None + + mime_type: Optional[ + Literal[ + "audio/wav", + "audio/mp3", + "audio/aiff", + "audio/aac", + "audio/ogg", + "audio/flac", + "audio/mpeg", + "audio/m4a", + "audio/l16", + "audio/opus", + "audio/alaw", + "audio/mulaw", + ] + ] = None + + rate: Optional[int] = None + """Deprecated. Use sample_rate instead. The value is ignored.""" + + sample_rate: Optional[int] = None + """The sample rate of the audio.""" + + uri: Optional[str] = None + + +class StepDeltaDeltaDocument(BaseModel): + type: Literal["document"] + + data: Optional[str] = None + + mime_type: Optional[Literal["application/pdf"]] = None + + uri: Optional[str] = None + + +class StepDeltaDeltaVideo(BaseModel): + type: Literal["video"] + + data: Optional[str] = None + + mime_type: Optional[ + Literal[ + "video/mp4", + "video/mpeg", + "video/mpg", + "video/mov", + "video/avi", + "video/x-flv", + "video/webm", + "video/wmv", + "video/3gpp", + ] + ] = None + + resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None + """The resolution of the media.""" + + uri: Optional[str] = None + + +StepDeltaDeltaThoughtSummaryContent: TypeAlias = Annotated[ + Union[TextContent, ImageContent], PropertyInfo(discriminator="type") +] + + +class StepDeltaDeltaThoughtSummary(BaseModel): + type: Literal["thought_summary"] + + content: Optional[StepDeltaDeltaThoughtSummaryContent] = None + """A new summary item to be added to the thought.""" + + +class StepDeltaDeltaThoughtSignature(BaseModel): + type: Literal["thought_signature"] + + signature: Optional[str] = None + """Signature to match the backend source to be part of the generation.""" + + +class StepDeltaDeltaTextAnnotationDelta(BaseModel): + type: Literal["text_annotation_delta"] + + annotations: Optional[List[Annotation]] = None + """Citation information for model-generated content.""" + + +class StepDeltaDeltaArgumentsDelta(BaseModel): + type: Literal["arguments_delta"] + + partial_arguments: Optional[str] = None + + +StepDeltaDelta: TypeAlias = Annotated[ + Union[ + StepDeltaDeltaText, + StepDeltaDeltaImage, + StepDeltaDeltaAudio, + StepDeltaDeltaDocument, + StepDeltaDeltaVideo, + StepDeltaDeltaThoughtSummary, + StepDeltaDeltaThoughtSignature, + StepDeltaDeltaTextAnnotationDelta, + StepDeltaDeltaArgumentsDelta, + ], + PropertyInfo(discriminator="type"), +] + + +class StepDelta(BaseModel): + delta: StepDeltaDelta + + event_type: Literal["step.delta"] + + index: int + + event_id: Optional[str] = None + """ + The event_id token to be used to resume the interaction stream, from this event. + """ + + +class StepStop(BaseModel): + event_type: Literal["step.stop"] + + index: int + + event_id: Optional[str] = None + """ + The event_id token to be used to resume the interaction stream, from this event. + """ + InteractionSSEEvent: TypeAlias = Annotated[ Union[ @@ -38,6 +238,9 @@ ContentDelta, ContentStop, ErrorEvent, + StepStart, + StepDelta, + StepStop, ], PropertyInfo(discriminator="event_type"), ] diff --git a/google/genai/_interactions/types/mcp_server_tool_call_content.py b/google/genai/_interactions/types/mcp_server_tool_call_step.py similarity index 91% rename from google/genai/_interactions/types/mcp_server_tool_call_content.py rename to google/genai/_interactions/types/mcp_server_tool_call_step.py index 117564d9d..18907faeb 100644 --- a/google/genai/_interactions/types/mcp_server_tool_call_content.py +++ b/google/genai/_interactions/types/mcp_server_tool_call_step.py @@ -20,11 +20,11 @@ from .._models import BaseModel -__all__ = ["MCPServerToolCallContent"] +__all__ = ["MCPServerToolCallStep"] -class MCPServerToolCallContent(BaseModel): - """MCPServer tool call content.""" +class MCPServerToolCallStep(BaseModel): + """MCPServer tool call step.""" id: str """Required. A unique ID for this specific tool call.""" diff --git a/google/genai/_interactions/types/mcp_server_tool_call_content_param.py b/google/genai/_interactions/types/mcp_server_tool_call_step_param.py similarity index 86% rename from google/genai/_interactions/types/mcp_server_tool_call_content_param.py rename to google/genai/_interactions/types/mcp_server_tool_call_step_param.py index 31f40c9dd..b59c5fbf9 100644 --- a/google/genai/_interactions/types/mcp_server_tool_call_content_param.py +++ b/google/genai/_interactions/types/mcp_server_tool_call_step_param.py @@ -24,11 +24,11 @@ from .._utils import PropertyInfo from .._models import set_pydantic_config -__all__ = ["MCPServerToolCallContentParam"] +__all__ = ["MCPServerToolCallStepParam"] -class MCPServerToolCallContentParam(TypedDict, total=False): - """MCPServer tool call content.""" +class MCPServerToolCallStepParam(TypedDict, total=False): + """MCPServer tool call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" @@ -48,4 +48,4 @@ class MCPServerToolCallContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(MCPServerToolCallContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(MCPServerToolCallStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/mcp_server_tool_result_content.py b/google/genai/_interactions/types/mcp_server_tool_result_step.py similarity index 87% rename from google/genai/_interactions/types/mcp_server_tool_result_content.py rename to google/genai/_interactions/types/mcp_server_tool_result_step.py index 70bfa9d86..49c75250e 100644 --- a/google/genai/_interactions/types/mcp_server_tool_result_content.py +++ b/google/genai/_interactions/types/mcp_server_tool_result_step.py @@ -23,20 +23,20 @@ from .text_content import TextContent from .image_content import ImageContent -__all__ = ["MCPServerToolResultContent", "ResultFunctionResultSubcontentList"] +__all__ = ["MCPServerToolResultStep", "ResultFunctionResultSubcontentList"] ResultFunctionResultSubcontentList: TypeAlias = Annotated[ Union[TextContent, ImageContent], PropertyInfo(discriminator="type") ] -class MCPServerToolResultContent(BaseModel): - """MCPServer tool result content.""" +class MCPServerToolResultStep(BaseModel): + """MCPServer tool result step.""" call_id: str """Required. ID to match the ID from the function call block.""" - result: Union[List[ResultFunctionResultSubcontentList], str, object] + result: Union[str, List[ResultFunctionResultSubcontentList], object] """The output from the MCP server call. Can be simple text or rich content.""" type: Literal["mcp_server_tool_result"] diff --git a/google/genai/_interactions/types/mcp_server_tool_result_content_param.py b/google/genai/_interactions/types/mcp_server_tool_result_step_param.py similarity index 81% rename from google/genai/_interactions/types/mcp_server_tool_result_content_param.py rename to google/genai/_interactions/types/mcp_server_tool_result_step_param.py index d8838a847..b8073d9d9 100644 --- a/google/genai/_interactions/types/mcp_server_tool_result_content_param.py +++ b/google/genai/_interactions/types/mcp_server_tool_result_step_param.py @@ -26,18 +26,18 @@ from .text_content_param import TextContentParam from .image_content_param import ImageContentParam -__all__ = ["MCPServerToolResultContentParam", "ResultFunctionResultSubcontentList"] +__all__ = ["MCPServerToolResultStepParam", "ResultFunctionResultSubcontentList"] ResultFunctionResultSubcontentList: TypeAlias = Union[TextContentParam, ImageContentParam] -class MCPServerToolResultContentParam(TypedDict, total=False): - """MCPServer tool result content.""" +class MCPServerToolResultStepParam(TypedDict, total=False): + """MCPServer tool result step.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - result: Required[Union[Iterable[ResultFunctionResultSubcontentList], str, object]] + result: Required[Union[str, Iterable[ResultFunctionResultSubcontentList], object]] """The output from the MCP server call. Can be simple text or rich content.""" type: Required[Literal["mcp_server_tool_result"]] @@ -52,4 +52,4 @@ class MCPServerToolResultContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(MCPServerToolResultContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(MCPServerToolResultStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/google_search_result_param.py b/google/genai/_interactions/types/model_output_step.py similarity index 67% rename from google/genai/_interactions/types/google_search_result_param.py rename to google/genai/_interactions/types/model_output_step.py index be1d11d51..1796268d3 100644 --- a/google/genai/_interactions/types/google_search_result_param.py +++ b/google/genai/_interactions/types/model_output_step.py @@ -15,15 +15,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from __future__ import annotations +from typing import List, Optional +from typing_extensions import Literal -from typing_extensions import TypedDict +from .content import Content +from .._models import BaseModel -__all__ = ["GoogleSearchResultParam"] +__all__ = ["ModelOutputStep"] -class GoogleSearchResultParam(TypedDict, total=False): - """The result of the Google Search.""" +class ModelOutputStep(BaseModel): + """Output generated by the model.""" - search_suggestions: str - """Web content snippet that can be embedded in a web page or an app webview.""" + type: Literal["model_output"] + + content: Optional[List[Content]] = None diff --git a/google/genai/_interactions/types/google_maps_call_arguments_param.py b/google/genai/_interactions/types/model_output_step_param.py similarity index 67% rename from google/genai/_interactions/types/google_maps_call_arguments_param.py rename to google/genai/_interactions/types/model_output_step_param.py index 26cb3bf97..44d4d8a43 100644 --- a/google/genai/_interactions/types/google_maps_call_arguments_param.py +++ b/google/genai/_interactions/types/model_output_step_param.py @@ -17,15 +17,17 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict -from .._types import SequenceNotStr +from .content_param import ContentParam -__all__ = ["GoogleMapsCallArgumentsParam"] +__all__ = ["ModelOutputStepParam"] -class GoogleMapsCallArgumentsParam(TypedDict, total=False): - """The arguments to pass to the Google Maps tool.""" +class ModelOutputStepParam(TypedDict, total=False): + """Output generated by the model.""" - queries: SequenceNotStr[str] - """The queries to be executed.""" + type: Required[Literal["model_output"]] + + content: Iterable[ContentParam] diff --git a/google/genai/_interactions/types/step.py b/google/genai/_interactions/types/step.py new file mode 100644 index 000000000..1d2586bb4 --- /dev/null +++ b/google/genai/_interactions/types/step.py @@ -0,0 +1,63 @@ +# 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 Union +from typing_extensions import Annotated, TypeAlias + +from .._utils import PropertyInfo +from .thought_step import ThoughtStep +from .user_input_step import UserInputStep +from .model_output_step import ModelOutputStep +from .function_call_step import FunctionCallStep +from .function_result_step import FunctionResultStep +from .file_search_call_step import FileSearchCallStep +from .google_maps_call_step import GoogleMapsCallStep +from .url_context_call_step import URLContextCallStep +from .file_search_result_step import FileSearchResultStep +from .google_maps_result_step import GoogleMapsResultStep +from .google_search_call_step import GoogleSearchCallStep +from .url_context_result_step import URLContextResultStep +from .code_execution_call_step import CodeExecutionCallStep +from .google_search_result_step import GoogleSearchResultStep +from .mcp_server_tool_call_step import MCPServerToolCallStep +from .code_execution_result_step import CodeExecutionResultStep +from .mcp_server_tool_result_step import MCPServerToolResultStep + +__all__ = ["Step"] + +Step: TypeAlias = Annotated[ + Union[ + UserInputStep, + ModelOutputStep, + ThoughtStep, + FunctionCallStep, + CodeExecutionCallStep, + URLContextCallStep, + MCPServerToolCallStep, + GoogleSearchCallStep, + FileSearchCallStep, + GoogleMapsCallStep, + FunctionResultStep, + CodeExecutionResultStep, + URLContextResultStep, + GoogleSearchResultStep, + MCPServerToolResultStep, + FileSearchResultStep, + GoogleMapsResultStep, + ], + PropertyInfo(discriminator="type"), +] diff --git a/google/genai/_interactions/types/step_param.py b/google/genai/_interactions/types/step_param.py new file mode 100644 index 000000000..f49ab3445 --- /dev/null +++ b/google/genai/_interactions/types/step_param.py @@ -0,0 +1,61 @@ +# 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 Union +from typing_extensions import TypeAlias + +from .thought_step_param import ThoughtStepParam +from .user_input_step_param import UserInputStepParam +from .model_output_step_param import ModelOutputStepParam +from .function_call_step_param import FunctionCallStepParam +from .function_result_step_param import FunctionResultStepParam +from .file_search_call_step_param import FileSearchCallStepParam +from .google_maps_call_step_param import GoogleMapsCallStepParam +from .url_context_call_step_param import URLContextCallStepParam +from .file_search_result_step_param import FileSearchResultStepParam +from .google_maps_result_step_param import GoogleMapsResultStepParam +from .google_search_call_step_param import GoogleSearchCallStepParam +from .url_context_result_step_param import URLContextResultStepParam +from .code_execution_call_step_param import CodeExecutionCallStepParam +from .google_search_result_step_param import GoogleSearchResultStepParam +from .mcp_server_tool_call_step_param import MCPServerToolCallStepParam +from .code_execution_result_step_param import CodeExecutionResultStepParam +from .mcp_server_tool_result_step_param import MCPServerToolResultStepParam + +__all__ = ["StepParam"] + +StepParam: TypeAlias = Union[ + UserInputStepParam, + ModelOutputStepParam, + ThoughtStepParam, + FunctionCallStepParam, + CodeExecutionCallStepParam, + URLContextCallStepParam, + MCPServerToolCallStepParam, + GoogleSearchCallStepParam, + FileSearchCallStepParam, + GoogleMapsCallStepParam, + FunctionResultStepParam, + CodeExecutionResultStepParam, + URLContextResultStepParam, + GoogleSearchResultStepParam, + MCPServerToolResultStepParam, + FileSearchResultStepParam, + GoogleMapsResultStepParam, +] diff --git a/google/genai/_interactions/types/thought_content.py b/google/genai/_interactions/types/thought_step.py similarity index 86% rename from google/genai/_interactions/types/thought_content.py rename to google/genai/_interactions/types/thought_step.py index d5c081f31..582a130ab 100644 --- a/google/genai/_interactions/types/thought_content.py +++ b/google/genai/_interactions/types/thought_step.py @@ -23,18 +23,18 @@ from .text_content import TextContent from .image_content import ImageContent -__all__ = ["ThoughtContent", "Summary"] +__all__ = ["ThoughtStep", "Summary"] Summary: TypeAlias = Annotated[Union[TextContent, ImageContent], PropertyInfo(discriminator="type")] -class ThoughtContent(BaseModel): - """A thought content block.""" +class ThoughtStep(BaseModel): + """A thought step.""" type: Literal["thought"] signature: Optional[str] = None - """Signature to match the backend source to be part of the generation.""" + """A signature hash for backend validation.""" summary: Optional[List[Summary]] = None """A summary of the thought.""" diff --git a/google/genai/_interactions/types/thought_content_param.py b/google/genai/_interactions/types/thought_step_param.py similarity index 81% rename from google/genai/_interactions/types/thought_content_param.py rename to google/genai/_interactions/types/thought_step_param.py index 275038d73..439853c2a 100644 --- a/google/genai/_interactions/types/thought_content_param.py +++ b/google/genai/_interactions/types/thought_step_param.py @@ -26,21 +26,21 @@ from .text_content_param import TextContentParam from .image_content_param import ImageContentParam -__all__ = ["ThoughtContentParam", "Summary"] +__all__ = ["ThoughtStepParam", "Summary"] Summary: TypeAlias = Union[TextContentParam, ImageContentParam] -class ThoughtContentParam(TypedDict, total=False): - """A thought content block.""" +class ThoughtStepParam(TypedDict, total=False): + """A thought step.""" type: Required[Literal["thought"]] signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] - """Signature to match the backend source to be part of the generation.""" + """A signature hash for backend validation.""" summary: Iterable[Summary] """A summary of the thought.""" -set_pydantic_config(ThoughtContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(ThoughtStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/url_context_call_arguments_param.py b/google/genai/_interactions/types/url_context_call_arguments_param.py deleted file mode 100644 index 66263776d..000000000 --- a/google/genai/_interactions/types/url_context_call_arguments_param.py +++ /dev/null @@ -1,31 +0,0 @@ -# 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__ = ["URLContextCallArgumentsParam"] - - -class URLContextCallArgumentsParam(TypedDict, total=False): - """The arguments to pass to the URL context.""" - - urls: SequenceNotStr[str] - """The URLs to fetch.""" diff --git a/google/genai/_interactions/types/url_context_call_content.py b/google/genai/_interactions/types/url_context_call_step.py similarity index 75% rename from google/genai/_interactions/types/url_context_call_content.py rename to google/genai/_interactions/types/url_context_call_step.py index e049b7a0d..009154cc2 100644 --- a/google/genai/_interactions/types/url_context_call_content.py +++ b/google/genai/_interactions/types/url_context_call_step.py @@ -15,22 +15,28 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Optional from typing_extensions import Literal from .._models import BaseModel -from .url_context_call_arguments import URLContextCallArguments -__all__ = ["URLContextCallContent"] +__all__ = ["URLContextCallStep", "Arguments"] -class URLContextCallContent(BaseModel): - """URL context content.""" +class Arguments(BaseModel): + """Required. The arguments to pass to the URL context.""" + + urls: Optional[List[str]] = None + """The URLs to fetch.""" + + +class URLContextCallStep(BaseModel): + """URL context call step.""" id: str """Required. A unique ID for this specific tool call.""" - arguments: URLContextCallArguments + arguments: Arguments """Required. The arguments to pass to the URL context.""" type: Literal["url_context_call"] diff --git a/google/genai/_interactions/types/url_context_call_content_param.py b/google/genai/_interactions/types/url_context_call_step_param.py similarity index 71% rename from google/genai/_interactions/types/url_context_call_content_param.py rename to google/genai/_interactions/types/url_context_call_step_param.py index 58cdc7e46..03ca81164 100644 --- a/google/genai/_interactions/types/url_context_call_content_param.py +++ b/google/genai/_interactions/types/url_context_call_step_param.py @@ -20,21 +20,27 @@ from typing import Union from typing_extensions import Literal, Required, Annotated, TypedDict -from .._types import Base64FileInput +from .._types import SequenceNotStr, Base64FileInput from .._utils import PropertyInfo from .._models import set_pydantic_config -from .url_context_call_arguments_param import URLContextCallArgumentsParam -__all__ = ["URLContextCallContentParam"] +__all__ = ["URLContextCallStepParam", "Arguments"] -class URLContextCallContentParam(TypedDict, total=False): - """URL context content.""" +class Arguments(TypedDict, total=False): + """Required. The arguments to pass to the URL context.""" + + urls: SequenceNotStr[str] + """The URLs to fetch.""" + + +class URLContextCallStepParam(TypedDict, total=False): + """URL context call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" - arguments: Required[URLContextCallArgumentsParam] + arguments: Required[Arguments] """Required. The arguments to pass to the URL context.""" type: Required[Literal["url_context_call"]] @@ -43,4 +49,4 @@ class URLContextCallContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(URLContextCallContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(URLContextCallStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/url_context_result_param.py b/google/genai/_interactions/types/url_context_result_param.py deleted file mode 100644 index 67a3df9e3..000000000 --- a/google/genai/_interactions/types/url_context_result_param.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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, TypedDict - -__all__ = ["URLContextResultParam"] - - -class URLContextResultParam(TypedDict, total=False): - """The result of the URL context.""" - - status: Literal["success", "error", "paywall", "unsafe"] - """The status of the URL retrieval.""" - - url: str - """The URL that was fetched.""" diff --git a/google/genai/_interactions/types/url_context_result_content.py b/google/genai/_interactions/types/url_context_result_step.py similarity index 73% rename from google/genai/_interactions/types/url_context_result_content.py rename to google/genai/_interactions/types/url_context_result_step.py index 1e7788133..e9dd41ed5 100644 --- a/google/genai/_interactions/types/url_context_result_content.py +++ b/google/genai/_interactions/types/url_context_result_step.py @@ -19,18 +19,27 @@ from typing_extensions import Literal from .._models import BaseModel -from .url_context_result import URLContextResult -__all__ = ["URLContextResultContent"] +__all__ = ["URLContextResultStep", "Result"] -class URLContextResultContent(BaseModel): - """URL context result content.""" +class Result(BaseModel): + """The result of the URL context.""" + + status: Optional[Literal["success", "error", "paywall", "unsafe"]] = None + """The status of the URL retrieval.""" + + url: Optional[str] = None + """The URL that was fetched.""" + + +class URLContextResultStep(BaseModel): + """URL context result step.""" call_id: str """Required. ID to match the ID from the function call block.""" - result: List[URLContextResult] + result: List[Result] """Required. The results of the URL context.""" type: Literal["url_context_result"] diff --git a/google/genai/_interactions/types/url_context_result_content_param.py b/google/genai/_interactions/types/url_context_result_step_param.py similarity index 72% rename from google/genai/_interactions/types/url_context_result_content_param.py rename to google/genai/_interactions/types/url_context_result_step_param.py index 1bd95243a..c181bf8c2 100644 --- a/google/genai/_interactions/types/url_context_result_content_param.py +++ b/google/genai/_interactions/types/url_context_result_step_param.py @@ -23,18 +23,27 @@ from .._types import Base64FileInput from .._utils import PropertyInfo from .._models import set_pydantic_config -from .url_context_result_param import URLContextResultParam -__all__ = ["URLContextResultContentParam"] +__all__ = ["URLContextResultStepParam", "Result"] -class URLContextResultContentParam(TypedDict, total=False): - """URL context result content.""" +class Result(TypedDict, total=False): + """The result of the URL context.""" + + status: Literal["success", "error", "paywall", "unsafe"] + """The status of the URL retrieval.""" + + url: str + """The URL that was fetched.""" + + +class URLContextResultStepParam(TypedDict, total=False): + """URL context result step.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - result: Required[Iterable[URLContextResultParam]] + result: Required[Iterable[Result]] """Required. The results of the URL context.""" type: Required[Literal["url_context_result"]] @@ -46,4 +55,4 @@ class URLContextResultContentParam(TypedDict, total=False): """A signature hash for backend validation.""" -set_pydantic_config(URLContextResultContentParam, {"arbitrary_types_allowed": True}) +set_pydantic_config(URLContextResultStepParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/turn.py b/google/genai/_interactions/types/user_input_step.py similarity index 74% rename from google/genai/_interactions/types/turn.py rename to google/genai/_interactions/types/user_input_step.py index 6c28f0e48..292b079dc 100644 --- a/google/genai/_interactions/types/turn.py +++ b/google/genai/_interactions/types/user_input_step.py @@ -15,16 +15,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional +from typing_extensions import Literal from .content import Content from .._models import BaseModel -__all__ = ["Turn"] +__all__ = ["UserInputStep"] -class Turn(BaseModel): - content: Union[List[Content], str, None] = None +class UserInputStep(BaseModel): + """Input provided by the user.""" - role: Optional[str] = None - """The originator of this turn. Must be user for input or model for model output.""" + type: Literal["user_input"] + + content: Optional[List[Content]] = None diff --git a/google/genai/_interactions/types/turn_param.py b/google/genai/_interactions/types/user_input_step_param.py similarity index 71% rename from google/genai/_interactions/types/turn_param.py rename to google/genai/_interactions/types/user_input_step_param.py index cbbe4c456..46a54c062 100644 --- a/google/genai/_interactions/types/turn_param.py +++ b/google/genai/_interactions/types/user_input_step_param.py @@ -17,16 +17,17 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict from .content_param import ContentParam -__all__ = ["TurnParam"] +__all__ = ["UserInputStepParam"] -class TurnParam(TypedDict, total=False): - content: Union[Iterable[ContentParam], str] +class UserInputStepParam(TypedDict, total=False): + """Input provided by the user.""" - role: str - """The originator of this turn. Must be user for input or model for model output.""" + type: Required[Literal["user_input"]] + + content: Iterable[ContentParam]