From 2e1020ac59dd5172ae131b36a92aae3e426cccd5 Mon Sep 17 00:00:00 2001 From: Kaituo Huang Date: Thu, 5 Mar 2026 12:49:12 -0800 Subject: [PATCH] chore: update comment PiperOrigin-RevId: 879203048 --- google/genai/_interactions/_compat.py | 11 +- .../types/code_execution_call_content.py | 2 +- .../code_execution_call_content_param.py | 2 +- .../types/code_execution_result_content.py | 2 +- .../code_execution_result_content_param.py | 2 +- google/genai/_interactions/types/content.py | 12 +- .../_interactions/types/content_delta.py | 196 ++++++++---------- .../_interactions/types/content_param.py | 12 +- .../_interactions/types/content_start.py | 3 +- .../genai/_interactions/types/content_stop.py | 3 +- .../genai/_interactions/types/error_event.py | 3 +- .../_interactions/types/file_citation.py | 5 +- .../types/file_citation_param.py | 5 +- .../types/file_search_result_content.py | 6 +- .../types/file_search_result_content_param.py | 6 +- .../types/function_call_content.py | 4 +- .../types/function_call_content_param.py | 4 +- .../_interactions/types/generation_config.py | 2 +- .../types/generation_config_param.py | 2 +- .../types/google_maps_result_content.py | 2 +- .../types/google_maps_result_content_param.py | 2 +- .../types/google_search_call_content.py | 2 +- .../types/google_search_call_content_param.py | 2 +- .../types/google_search_result_content.py | 2 +- .../google_search_result_content_param.py | 2 +- .../genai/_interactions/types/interaction.py | 24 +-- .../types/interaction_complete_event.py | 6 +- .../types/interaction_create_params.py | 12 +- .../types/interaction_start_event.py | 3 +- .../types/interaction_status_update.py | 3 +- .../types/mcp_server_tool_call_content.py | 6 +- .../mcp_server_tool_call_content_param.py | 6 +- .../_interactions/types/place_citation.py | 5 +- .../types/place_citation_param.py | 5 +- .../genai/_interactions/types/text_content.py | 2 +- .../_interactions/types/text_content_param.py | 2 +- google/genai/_interactions/types/tool.py | 26 +-- .../genai/_interactions/types/tool_param.py | 26 +-- google/genai/_interactions/types/turn.py | 3 +- .../genai/_interactions/types/turn_param.py | 3 +- .../genai/_interactions/types/url_citation.py | 5 +- .../_interactions/types/url_citation_param.py | 5 +- .../types/url_context_call_content.py | 2 +- .../types/url_context_call_content_param.py | 2 +- .../types/url_context_result_content.py | 2 +- .../types/url_context_result_content_param.py | 2 +- 46 files changed, 230 insertions(+), 214 deletions(-) diff --git a/google/genai/_interactions/_compat.py b/google/genai/_interactions/_compat.py index 25b3af666..d00a0df9c 100644 --- a/google/genai/_interactions/_compat.py +++ b/google/genai/_interactions/_compat.py @@ -17,7 +17,7 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self, Literal +from typing_extensions import Self, Literal, TypedDict import pydantic from pydantic.fields import FieldInfo @@ -146,6 +146,10 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: return model.model_dump_json(indent=indent) +class _ModelDumpKwargs(TypedDict, total=False): + by_alias: bool + + def model_dump( model: pydantic.BaseModel, *, @@ -157,6 +161,9 @@ def model_dump( by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): + kwargs: _ModelDumpKwargs = {} + if by_alias is not None: + kwargs["by_alias"] = by_alias return model.model_dump( mode=mode, exclude=exclude, @@ -164,7 +171,7 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, - by_alias=by_alias, + **kwargs, ) return cast( "dict[str, Any]", diff --git a/google/genai/_interactions/types/code_execution_call_content.py b/google/genai/_interactions/types/code_execution_call_content.py index af84a4837..980cbee7b 100644 --- a/google/genai/_interactions/types/code_execution_call_content.py +++ b/google/genai/_interactions/types/code_execution_call_content.py @@ -31,7 +31,7 @@ class CodeExecutionCallContent(BaseModel): """A unique ID for this specific tool call.""" arguments: CodeExecutionCallArguments - """The arguments to pass to the code execution.""" + """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_content_param.py index 68b621045..f5a9137b6 100644 --- a/google/genai/_interactions/types/code_execution_call_content_param.py +++ b/google/genai/_interactions/types/code_execution_call_content_param.py @@ -35,7 +35,7 @@ class CodeExecutionCallContentParam(TypedDict, total=False): """A unique ID for this specific tool call.""" arguments: Required[CodeExecutionCallArgumentsParam] - """The arguments to pass to the code execution.""" + """Required. The arguments to pass to the code execution.""" type: Required[Literal["code_execution_call"]] diff --git a/google/genai/_interactions/types/code_execution_result_content.py b/google/genai/_interactions/types/code_execution_result_content.py index 21fda9505..526390542 100644 --- a/google/genai/_interactions/types/code_execution_result_content.py +++ b/google/genai/_interactions/types/code_execution_result_content.py @@ -30,7 +30,7 @@ class CodeExecutionResultContent(BaseModel): """ID to match the ID from the code execution call block.""" result: str - """The output of the code execution.""" + """Required. The output of the code execution.""" type: Literal["code_execution_result"] diff --git a/google/genai/_interactions/types/code_execution_result_content_param.py b/google/genai/_interactions/types/code_execution_result_content_param.py index cef894b4e..c7d83dba8 100644 --- a/google/genai/_interactions/types/code_execution_result_content_param.py +++ b/google/genai/_interactions/types/code_execution_result_content_param.py @@ -34,7 +34,7 @@ class CodeExecutionResultContentParam(TypedDict, total=False): """ID to match the ID from the code execution call block.""" result: Required[str] - """The output of the code execution.""" + """Required. The output of the code execution.""" type: Required[Literal["code_execution_result"]] diff --git a/google/genai/_interactions/types/content.py b/google/genai/_interactions/types/content.py index b25c11e29..414524101 100644 --- a/google/genai/_interactions/types/content.py +++ b/google/genai/_interactions/types/content.py @@ -51,18 +51,18 @@ VideoContent, ThoughtContent, FunctionCallContent, - FunctionResultContent, CodeExecutionCallContent, - CodeExecutionResultContent, URLContextCallContent, - URLContextResultContent, + MCPServerToolCallContent, GoogleSearchCallContent, + FileSearchCallContent, + GoogleMapsCallContent, + FunctionResultContent, + CodeExecutionResultContent, + URLContextResultContent, GoogleSearchResultContent, - MCPServerToolCallContent, MCPServerToolResultContent, - FileSearchCallContent, FileSearchResultContent, - GoogleMapsCallContent, GoogleMapsResultContent, ], PropertyInfo(discriminator="type"), diff --git a/google/genai/_interactions/types/content_delta.py b/google/genai/_interactions/types/content_delta.py index 30850b47f..12e244f26 100644 --- a/google/genai/_interactions/types/content_delta.py +++ b/google/genai/_interactions/types/content_delta.py @@ -43,24 +43,20 @@ "DeltaThoughtSummaryContent", "DeltaThoughtSignature", "DeltaFunctionCall", - "DeltaFunctionResult", - "DeltaFunctionResultResult", - "DeltaFunctionResultResultItems", - "DeltaFunctionResultResultItemsItem", "DeltaCodeExecutionCall", - "DeltaCodeExecutionResult", "DeltaURLContextCall", - "DeltaURLContextResult", "DeltaGoogleSearchCall", - "DeltaGoogleSearchResult", "DeltaMCPServerToolCall", - "DeltaMCPServerToolResult", - "DeltaMCPServerToolResultResult", - "DeltaMCPServerToolResultResultItems", - "DeltaMCPServerToolResultResultItemsItem", "DeltaFileSearchCall", - "DeltaFileSearchResult", "DeltaGoogleMapsCall", + "DeltaFunctionResult", + "DeltaFunctionResultResultFunctionResultSubcontentList", + "DeltaCodeExecutionResult", + "DeltaURLContextResult", + "DeltaGoogleSearchResult", + "DeltaMCPServerToolResult", + "DeltaMCPServerToolResultResultFunctionResultSubcontentList", + "DeltaFileSearchResult", "DeltaGoogleMapsResult", ] @@ -163,107 +159,126 @@ class DeltaFunctionCall(BaseModel): """A signature hash for backend validation.""" -DeltaFunctionResultResultItemsItem: TypeAlias = Union[TextContent, ImageContent] +class DeltaCodeExecutionCall(BaseModel): + id: str + """A unique ID for this specific tool call.""" + arguments: CodeExecutionCallArguments + """The arguments to pass to the code execution.""" -class DeltaFunctionResultResultItems(BaseModel): - items: Optional[List[DeltaFunctionResultResultItemsItem]] = None + type: Literal["code_execution_call"] + signature: Optional[str] = None + """A signature hash for backend validation.""" -DeltaFunctionResultResult: TypeAlias = Union[DeltaFunctionResultResultItems, str, object] +class DeltaURLContextCall(BaseModel): + id: str + """A unique ID for this specific tool call.""" -class DeltaFunctionResult(BaseModel): - call_id: str - """ID to match the ID from the function call block.""" + arguments: URLContextCallArguments + """The arguments to pass to the URL context.""" - result: DeltaFunctionResultResult - """Tool call result delta.""" + type: Literal["url_context_call"] - type: Literal["function_result"] + signature: Optional[str] = None + """A signature hash for backend validation.""" - is_error: Optional[bool] = None - name: Optional[str] = None +class DeltaGoogleSearchCall(BaseModel): + id: str + """A unique ID for this specific tool call.""" + + arguments: GoogleSearchCallArguments + """The arguments to pass to Google Search.""" + + type: Literal["google_search_call"] signature: Optional[str] = None """A signature hash for backend validation.""" -class DeltaCodeExecutionCall(BaseModel): +class DeltaMCPServerToolCall(BaseModel): id: str """A unique ID for this specific tool call.""" - arguments: CodeExecutionCallArguments - """The arguments to pass to the code execution.""" + arguments: Dict[str, object] - type: Literal["code_execution_call"] + name: str - signature: Optional[str] = None - """A signature hash for backend validation.""" + server_name: str + type: Literal["mcp_server_tool_call"] -class DeltaCodeExecutionResult(BaseModel): - call_id: str - """ID to match the ID from the function call block.""" + signature: Optional[str] = None + """A signature hash for backend validation.""" - result: str - type: Literal["code_execution_result"] +class DeltaFileSearchCall(BaseModel): + id: str + """A unique ID for this specific tool call.""" - is_error: Optional[bool] = None + type: Literal["file_search_call"] signature: Optional[str] = None """A signature hash for backend validation.""" -class DeltaURLContextCall(BaseModel): +class DeltaGoogleMapsCall(BaseModel): id: str """A unique ID for this specific tool call.""" - arguments: URLContextCallArguments - """The arguments to pass to the URL context.""" + type: Literal["google_maps_call"] - type: Literal["url_context_call"] + arguments: Optional[GoogleMapsCallArguments] = None + """The arguments to pass to the Google Maps tool.""" signature: Optional[str] = None """A signature hash for backend validation.""" -class DeltaURLContextResult(BaseModel): +DeltaFunctionResultResultFunctionResultSubcontentList: TypeAlias = Annotated[ + Union[TextContent, ImageContent], PropertyInfo(discriminator="type") +] + + +class DeltaFunctionResult(BaseModel): call_id: str """ID to match the ID from the function call block.""" - result: List[URLContextResult] + result: Union[List[DeltaFunctionResultResultFunctionResultSubcontentList], str, object] - type: Literal["url_context_result"] + type: Literal["function_result"] is_error: Optional[bool] = None + name: Optional[str] = None + signature: Optional[str] = None """A signature hash for backend validation.""" -class DeltaGoogleSearchCall(BaseModel): - id: str - """A unique ID for this specific tool call.""" +class DeltaCodeExecutionResult(BaseModel): + call_id: str + """ID to match the ID from the function call block.""" - arguments: GoogleSearchCallArguments - """The arguments to pass to Google Search.""" + result: str - type: Literal["google_search_call"] + type: Literal["code_execution_result"] + + is_error: Optional[bool] = None signature: Optional[str] = None """A signature hash for backend validation.""" -class DeltaGoogleSearchResult(BaseModel): +class DeltaURLContextResult(BaseModel): call_id: str """ID to match the ID from the function call block.""" - result: List[GoogleSearchResult] + result: List[URLContextResult] - type: Literal["google_search_result"] + type: Literal["url_context_result"] is_error: Optional[bool] = None @@ -271,38 +286,30 @@ class DeltaGoogleSearchResult(BaseModel): """A signature hash for backend validation.""" -class DeltaMCPServerToolCall(BaseModel): - id: str - """A unique ID for this specific tool call.""" - - arguments: Dict[str, object] +class DeltaGoogleSearchResult(BaseModel): + call_id: str + """ID to match the ID from the function call block.""" - name: str + result: List[GoogleSearchResult] - server_name: str + type: Literal["google_search_result"] - type: Literal["mcp_server_tool_call"] + is_error: Optional[bool] = None signature: Optional[str] = None """A signature hash for backend validation.""" -DeltaMCPServerToolResultResultItemsItem: TypeAlias = Union[TextContent, ImageContent] - - -class DeltaMCPServerToolResultResultItems(BaseModel): - items: Optional[List[DeltaMCPServerToolResultResultItemsItem]] = None - - -DeltaMCPServerToolResultResult: TypeAlias = Union[DeltaMCPServerToolResultResultItems, str, object] +DeltaMCPServerToolResultResultFunctionResultSubcontentList: TypeAlias = Annotated[ + Union[TextContent, ImageContent], PropertyInfo(discriminator="type") +] class DeltaMCPServerToolResult(BaseModel): call_id: str """ID to match the ID from the function call block.""" - result: DeltaMCPServerToolResultResult - """Tool call result delta.""" + result: Union[List[DeltaMCPServerToolResultResultFunctionResultSubcontentList], str, object] type: Literal["mcp_server_tool_result"] @@ -314,36 +321,13 @@ class DeltaMCPServerToolResult(BaseModel): """A signature hash for backend validation.""" -class DeltaFileSearchCall(BaseModel): - id: str - """A unique ID for this specific tool call.""" - - type: Literal["file_search_call"] - - signature: Optional[str] = None - """A signature hash for backend validation.""" - - class DeltaFileSearchResult(BaseModel): call_id: str """ID to match the ID from the function call block.""" - type: Literal["file_search_result"] - - result: Optional[List[object]] = None - - signature: Optional[str] = None - """A signature hash for backend validation.""" - - -class DeltaGoogleMapsCall(BaseModel): - id: str - """A unique ID for this specific tool call.""" - - type: Literal["google_maps_call"] + result: List[object] - arguments: Optional[GoogleMapsCallArguments] = None - """The arguments to pass to the Google Maps tool.""" + type: Literal["file_search_result"] signature: Optional[str] = None """A signature hash for backend validation.""" @@ -353,11 +337,11 @@ class DeltaGoogleMapsResult(BaseModel): call_id: str """ID to match the ID from the function call block.""" - result: List[GoogleMapsResult] - """The results of the Google Maps.""" - type: Literal["google_maps_result"] + result: Optional[List[GoogleMapsResult]] = None + """The results of the Google Maps.""" + signature: Optional[str] = None """A signature hash for backend validation.""" @@ -372,18 +356,18 @@ class DeltaGoogleMapsResult(BaseModel): DeltaThoughtSummary, DeltaThoughtSignature, DeltaFunctionCall, - DeltaFunctionResult, DeltaCodeExecutionCall, - DeltaCodeExecutionResult, DeltaURLContextCall, - DeltaURLContextResult, DeltaGoogleSearchCall, - DeltaGoogleSearchResult, DeltaMCPServerToolCall, - DeltaMCPServerToolResult, DeltaFileSearchCall, - DeltaFileSearchResult, DeltaGoogleMapsCall, + DeltaFunctionResult, + DeltaCodeExecutionResult, + DeltaURLContextResult, + DeltaGoogleSearchResult, + DeltaMCPServerToolResult, + DeltaFileSearchResult, DeltaGoogleMapsResult, ], PropertyInfo(discriminator="type"), @@ -392,6 +376,7 @@ class DeltaGoogleMapsResult(BaseModel): class ContentDelta(BaseModel): delta: Delta + """The delta content data for a content block.""" event_type: Literal["content.delta"] @@ -399,5 +384,6 @@ class ContentDelta(BaseModel): event_id: Optional[str] = None """ - The event_id token to be used to resume the interaction stream, from this event. + The event_id token to be used to resume the interaction stream, from + this event. """ diff --git a/google/genai/_interactions/types/content_param.py b/google/genai/_interactions/types/content_param.py index 113933f83..34b864a33 100644 --- a/google/genai/_interactions/types/content_param.py +++ b/google/genai/_interactions/types/content_param.py @@ -51,17 +51,17 @@ VideoContentParam, ThoughtContentParam, FunctionCallContentParam, - FunctionResultContentParam, CodeExecutionCallContentParam, - CodeExecutionResultContentParam, URLContextCallContentParam, - URLContextResultContentParam, + MCPServerToolCallContentParam, GoogleSearchCallContentParam, + FileSearchCallContentParam, + GoogleMapsCallContentParam, + FunctionResultContentParam, + CodeExecutionResultContentParam, + URLContextResultContentParam, GoogleSearchResultContentParam, - MCPServerToolCallContentParam, MCPServerToolResultContentParam, - FileSearchCallContentParam, FileSearchResultContentParam, - GoogleMapsCallContentParam, GoogleMapsResultContentParam, ] diff --git a/google/genai/_interactions/types/content_start.py b/google/genai/_interactions/types/content_start.py index 1431cb1eb..31688b7bd 100644 --- a/google/genai/_interactions/types/content_start.py +++ b/google/genai/_interactions/types/content_start.py @@ -34,5 +34,6 @@ class ContentStart(BaseModel): event_id: Optional[str] = None """ - The event_id token to be used to resume the interaction stream, from this event. + The event_id token to be used to resume the interaction stream, from + this event. """ diff --git a/google/genai/_interactions/types/content_stop.py b/google/genai/_interactions/types/content_stop.py index 578c1f2c9..d564cb7ec 100644 --- a/google/genai/_interactions/types/content_stop.py +++ b/google/genai/_interactions/types/content_stop.py @@ -30,5 +30,6 @@ class ContentStop(BaseModel): event_id: Optional[str] = None """ - The event_id token to be used to resume the interaction stream, from this event. + The event_id token to be used to resume the interaction stream, from + this event. """ diff --git a/google/genai/_interactions/types/error_event.py b/google/genai/_interactions/types/error_event.py index 8abf8ca3e..e109de7f6 100644 --- a/google/genai/_interactions/types/error_event.py +++ b/google/genai/_interactions/types/error_event.py @@ -41,5 +41,6 @@ class ErrorEvent(BaseModel): event_id: Optional[str] = None """ - The event_id token to be used to resume the interaction stream, from this event. + The event_id token to be used to resume the interaction stream, from + this event. """ diff --git a/google/genai/_interactions/types/file_citation.py b/google/genai/_interactions/types/file_citation.py index 6fa247093..d6f760505 100644 --- a/google/genai/_interactions/types/file_citation.py +++ b/google/genai/_interactions/types/file_citation.py @@ -41,4 +41,7 @@ class FileCitation(BaseModel): """Source attributed for a portion of the text.""" start_index: Optional[int] = None - """Start of segment of the response that is attributed to this source.""" + """Start of segment of the response that is attributed to this source. + + Index indicates the start of the segment, measured in bytes. + """ diff --git a/google/genai/_interactions/types/file_citation_param.py b/google/genai/_interactions/types/file_citation_param.py index 5f4843d75..e7ccff934 100644 --- a/google/genai/_interactions/types/file_citation_param.py +++ b/google/genai/_interactions/types/file_citation_param.py @@ -40,4 +40,7 @@ class FileCitationParam(TypedDict, total=False): """Source attributed for a portion of the text.""" start_index: int - """Start of segment of the response that is attributed to this source.""" + """Start of segment of the response that is attributed to this source. + + Index indicates the start of the segment, measured in bytes. + """ diff --git a/google/genai/_interactions/types/file_search_result_content.py b/google/genai/_interactions/types/file_search_result_content.py index 31fa4d763..3b8e0660c 100644 --- a/google/genai/_interactions/types/file_search_result_content.py +++ b/google/genai/_interactions/types/file_search_result_content.py @@ -29,10 +29,10 @@ class FileSearchResultContent(BaseModel): call_id: str """ID to match the ID from the file search call block.""" - type: Literal["file_search_result"] + result: List[object] + """Required. The results of the File Search.""" - result: Optional[List[object]] = None - """The results of the File Search.""" + type: Literal["file_search_result"] 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_content_param.py index fe04db52d..61c0736d0 100644 --- a/google/genai/_interactions/types/file_search_result_content_param.py +++ b/google/genai/_interactions/types/file_search_result_content_param.py @@ -33,10 +33,10 @@ class FileSearchResultContentParam(TypedDict, total=False): call_id: Required[str] """ID to match the ID from the file search call block.""" - type: Required[Literal["file_search_result"]] + result: Required[Iterable[object]] + """Required. The results of the File Search.""" - result: Iterable[object] - """The results of the File Search.""" + type: Required[Literal["file_search_result"]] signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] """A signature hash for backend validation.""" diff --git a/google/genai/_interactions/types/function_call_content.py b/google/genai/_interactions/types/function_call_content.py index b0e77d7e0..b19c887b3 100644 --- a/google/genai/_interactions/types/function_call_content.py +++ b/google/genai/_interactions/types/function_call_content.py @@ -30,10 +30,10 @@ class FunctionCallContent(BaseModel): """A unique ID for this specific tool call.""" arguments: Dict[str, object] - """The arguments to pass to the function.""" + """Required. The arguments to pass to the function.""" name: str - """The name of the tool to call.""" + """Required. The name of the tool to call.""" type: Literal["function_call"] diff --git a/google/genai/_interactions/types/function_call_content_param.py b/google/genai/_interactions/types/function_call_content_param.py index 032ea14e1..47a655143 100644 --- a/google/genai/_interactions/types/function_call_content_param.py +++ b/google/genai/_interactions/types/function_call_content_param.py @@ -34,10 +34,10 @@ class FunctionCallContentParam(TypedDict, total=False): """A unique ID for this specific tool call.""" arguments: Required[Dict[str, object]] - """The arguments to pass to the function.""" + """Required. The arguments to pass to the function.""" name: Required[str] - """The name of the tool to call.""" + """Required. The name of the tool to call.""" type: Required[Literal["function_call"]] diff --git a/google/genai/_interactions/types/generation_config.py b/google/genai/_interactions/types/generation_config.py index 4972faba0..cf2b99c9a 100644 --- a/google/genai/_interactions/types/generation_config.py +++ b/google/genai/_interactions/types/generation_config.py @@ -58,7 +58,7 @@ class GenerationConfig(BaseModel): """Whether to include thought summaries in the response.""" tool_choice: Optional[ToolChoice] = None - """The tool choice for the interaction.""" + """The tool choice configuration.""" top_p: Optional[float] = None """The maximum cumulative probability of tokens to consider when sampling.""" diff --git a/google/genai/_interactions/types/generation_config_param.py b/google/genai/_interactions/types/generation_config_param.py index a18ac8798..286df7766 100644 --- a/google/genai/_interactions/types/generation_config_param.py +++ b/google/genai/_interactions/types/generation_config_param.py @@ -60,7 +60,7 @@ class GenerationConfigParam(TypedDict, total=False): """Whether to include thought summaries in the response.""" tool_choice: ToolChoice - """The tool choice for the interaction.""" + """The tool choice configuration.""" top_p: float """The maximum cumulative probability of tokens to consider when sampling.""" diff --git a/google/genai/_interactions/types/google_maps_result_content.py b/google/genai/_interactions/types/google_maps_result_content.py index cafd72179..9c87fd7fb 100644 --- a/google/genai/_interactions/types/google_maps_result_content.py +++ b/google/genai/_interactions/types/google_maps_result_content.py @@ -31,7 +31,7 @@ class GoogleMapsResultContent(BaseModel): """ID to match the ID from the google maps call block.""" result: List[GoogleMapsResult] - """The results of the Google Maps.""" + """Required. The results of the Google Maps.""" type: Literal["google_maps_result"] diff --git a/google/genai/_interactions/types/google_maps_result_content_param.py b/google/genai/_interactions/types/google_maps_result_content_param.py index ffae22672..f600d7a68 100644 --- a/google/genai/_interactions/types/google_maps_result_content_param.py +++ b/google/genai/_interactions/types/google_maps_result_content_param.py @@ -35,7 +35,7 @@ class GoogleMapsResultContentParam(TypedDict, total=False): """ID to match the ID from the google maps call block.""" result: Required[Iterable[GoogleMapsResultParam]] - """The results of the Google Maps.""" + """Required. The results of the Google Maps.""" type: Required[Literal["google_maps_result"]] diff --git a/google/genai/_interactions/types/google_search_call_content.py b/google/genai/_interactions/types/google_search_call_content.py index bbda4edd0..e7f3a0be2 100644 --- a/google/genai/_interactions/types/google_search_call_content.py +++ b/google/genai/_interactions/types/google_search_call_content.py @@ -31,7 +31,7 @@ class GoogleSearchCallContent(BaseModel): """A unique ID for this specific tool call.""" arguments: GoogleSearchCallArguments - """The arguments to pass to Google Search.""" + """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_content_param.py index 3508a6eed..b8ca6bd23 100644 --- a/google/genai/_interactions/types/google_search_call_content_param.py +++ b/google/genai/_interactions/types/google_search_call_content_param.py @@ -35,7 +35,7 @@ class GoogleSearchCallContentParam(TypedDict, total=False): """A unique ID for this specific tool call.""" arguments: Required[GoogleSearchCallArgumentsParam] - """The arguments to pass to Google Search.""" + """Required. The arguments to pass to Google Search.""" type: Required[Literal["google_search_call"]] diff --git a/google/genai/_interactions/types/google_search_result_content.py b/google/genai/_interactions/types/google_search_result_content.py index 98777018c..e4769551e 100644 --- a/google/genai/_interactions/types/google_search_result_content.py +++ b/google/genai/_interactions/types/google_search_result_content.py @@ -31,7 +31,7 @@ class GoogleSearchResultContent(BaseModel): """ID to match the ID from the google search call block.""" result: List[GoogleSearchResult] - """The results of the Google Search.""" + """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_content_param.py index ac4cb4352..0557091d8 100644 --- a/google/genai/_interactions/types/google_search_result_content_param.py +++ b/google/genai/_interactions/types/google_search_result_content_param.py @@ -35,7 +35,7 @@ class GoogleSearchResultContentParam(TypedDict, total=False): """ID to match the ID from the google search call block.""" result: Required[Iterable[GoogleSearchResultParam]] - """The results of the Google Search.""" + """Required. The results of the Google Search.""" type: Required[Literal["google_search_result"]] diff --git a/google/genai/_interactions/types/interaction.py b/google/genai/_interactions/types/interaction.py index 0885908ac..7db360680 100644 --- a/google/genai/_interactions/types/interaction.py +++ b/google/genai/_interactions/types/interaction.py @@ -66,18 +66,18 @@ VideoContent, ThoughtContent, FunctionCallContent, - FunctionResultContent, CodeExecutionCallContent, - CodeExecutionResultContent, URLContextCallContent, - URLContextResultContent, + MCPServerToolCallContent, GoogleSearchCallContent, + FileSearchCallContent, + GoogleMapsCallContent, + FunctionResultContent, + CodeExecutionResultContent, + URLContextResultContent, GoogleSearchResultContent, - MCPServerToolCallContent, MCPServerToolResultContent, - FileSearchCallContent, FileSearchResultContent, - GoogleMapsCallContent, GoogleMapsResultContent, ] @@ -86,22 +86,22 @@ class Interaction(BaseModel): """The Interaction resource.""" id: str - """Output only. A unique identifier for the interaction completion.""" + """Required. Output only. A unique identifier for the interaction completion.""" created: datetime - """Output only. + """Required. - The time at which the response was created in ISO 8601 format + Output only. The time at which the response was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). """ status: Literal["in_progress", "requires_action", "completed", "failed", "cancelled", "incomplete"] - """Output only. The status of the interaction.""" + """Required. Output only. The status of the interaction.""" updated: datetime - """Output only. + """Required. - The time at which the response was last updated in ISO 8601 format + Output only. The time at which the response was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). """ diff --git a/google/genai/_interactions/types/interaction_complete_event.py b/google/genai/_interactions/types/interaction_complete_event.py index b45a642f5..2b384a753 100644 --- a/google/genai/_interactions/types/interaction_complete_event.py +++ b/google/genai/_interactions/types/interaction_complete_event.py @@ -28,12 +28,14 @@ class InteractionCompleteEvent(BaseModel): event_type: Literal["interaction.complete"] interaction: Interaction - """ + """Required. + The completed interaction with empty outputs to reduce the payload size. Use the preceding ContentDelta events for the actual output. """ event_id: Optional[str] = None """ - The event_id token to be used to resume the interaction stream, from this event. + The event_id token to be used to resume the interaction stream, from + this event. """ diff --git a/google/genai/_interactions/types/interaction_create_params.py b/google/genai/_interactions/types/interaction_create_params.py index aebf09847..4a6610323 100644 --- a/google/genai/_interactions/types/interaction_create_params.py +++ b/google/genai/_interactions/types/interaction_create_params.py @@ -111,18 +111,18 @@ class BaseCreateModelInteractionParams(TypedDict, total=False): VideoContentParam, ThoughtContentParam, FunctionCallContentParam, - FunctionResultContentParam, CodeExecutionCallContentParam, - CodeExecutionResultContentParam, URLContextCallContentParam, - URLContextResultContentParam, + MCPServerToolCallContentParam, GoogleSearchCallContentParam, + FileSearchCallContentParam, + GoogleMapsCallContentParam, + FunctionResultContentParam, + CodeExecutionResultContentParam, + URLContextResultContentParam, GoogleSearchResultContentParam, - MCPServerToolCallContentParam, MCPServerToolResultContentParam, - FileSearchCallContentParam, FileSearchResultContentParam, - GoogleMapsCallContentParam, GoogleMapsResultContentParam, ] diff --git a/google/genai/_interactions/types/interaction_start_event.py b/google/genai/_interactions/types/interaction_start_event.py index 1202ec849..6bca76557 100644 --- a/google/genai/_interactions/types/interaction_start_event.py +++ b/google/genai/_interactions/types/interaction_start_event.py @@ -32,5 +32,6 @@ class InteractionStartEvent(BaseModel): event_id: Optional[str] = None """ - The event_id token to be used to resume the interaction stream, from this event. + The event_id token to be used to resume the interaction stream, from + this event. """ diff --git a/google/genai/_interactions/types/interaction_status_update.py b/google/genai/_interactions/types/interaction_status_update.py index b4c571ab3..aca983c58 100644 --- a/google/genai/_interactions/types/interaction_status_update.py +++ b/google/genai/_interactions/types/interaction_status_update.py @@ -32,5 +32,6 @@ class InteractionStatusUpdate(BaseModel): event_id: Optional[str] = None """ - The event_id token to be used to resume the interaction stream, from this event. + The event_id token to be used to resume the interaction stream, from + this event. """ diff --git a/google/genai/_interactions/types/mcp_server_tool_call_content.py b/google/genai/_interactions/types/mcp_server_tool_call_content.py index c9c71858b..c647e2174 100644 --- a/google/genai/_interactions/types/mcp_server_tool_call_content.py +++ b/google/genai/_interactions/types/mcp_server_tool_call_content.py @@ -30,13 +30,13 @@ class MCPServerToolCallContent(BaseModel): """A unique ID for this specific tool call.""" arguments: Dict[str, object] - """The JSON object of arguments for the function.""" + """Required. The JSON object of arguments for the function.""" name: str - """The name of the tool which was called.""" + """Required. The name of the tool which was called.""" server_name: str - """The name of the used MCP server.""" + """Required. The name of the used MCP server.""" type: Literal["mcp_server_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_content_param.py index 296c51396..821758f44 100644 --- a/google/genai/_interactions/types/mcp_server_tool_call_content_param.py +++ b/google/genai/_interactions/types/mcp_server_tool_call_content_param.py @@ -34,13 +34,13 @@ class MCPServerToolCallContentParam(TypedDict, total=False): """A unique ID for this specific tool call.""" arguments: Required[Dict[str, object]] - """The JSON object of arguments for the function.""" + """Required. The JSON object of arguments for the function.""" name: Required[str] - """The name of the tool which was called.""" + """Required. The name of the tool which was called.""" server_name: Required[str] - """The name of the used MCP server.""" + """Required. The name of the used MCP server.""" type: Required[Literal["mcp_server_tool_call"]] diff --git a/google/genai/_interactions/types/place_citation.py b/google/genai/_interactions/types/place_citation.py index 21e52636b..fbe6072a5 100644 --- a/google/genai/_interactions/types/place_citation.py +++ b/google/genai/_interactions/types/place_citation.py @@ -60,7 +60,10 @@ class PlaceCitation(BaseModel): """ start_index: Optional[int] = None - """Start of segment of the response that is attributed to this source.""" + """Start of segment of the response that is attributed to this source. + + Index indicates the start of the segment, measured in bytes. + """ url: Optional[str] = None """URI reference of the place.""" diff --git a/google/genai/_interactions/types/place_citation_param.py b/google/genai/_interactions/types/place_citation_param.py index 498b4d9a8..162a78271 100644 --- a/google/genai/_interactions/types/place_citation_param.py +++ b/google/genai/_interactions/types/place_citation_param.py @@ -60,7 +60,10 @@ class PlaceCitationParam(TypedDict, total=False): """ start_index: int - """Start of segment of the response that is attributed to this source.""" + """Start of segment of the response that is attributed to this source. + + Index indicates the start of the segment, measured in bytes. + """ url: str """URI reference of the place.""" diff --git a/google/genai/_interactions/types/text_content.py b/google/genai/_interactions/types/text_content.py index d0b631f24..b753059e6 100644 --- a/google/genai/_interactions/types/text_content.py +++ b/google/genai/_interactions/types/text_content.py @@ -28,7 +28,7 @@ class TextContent(BaseModel): """A text content block.""" text: str - """The text content.""" + """Required. The text content.""" type: Literal["text"] diff --git a/google/genai/_interactions/types/text_content_param.py b/google/genai/_interactions/types/text_content_param.py index a9d5cfd7b..97eb9ebd7 100644 --- a/google/genai/_interactions/types/text_content_param.py +++ b/google/genai/_interactions/types/text_content_param.py @@ -29,7 +29,7 @@ class TextContentParam(TypedDict, total=False): """A text content block.""" text: Required[str] - """The text content.""" + """Required. The text content.""" type: Required[Literal["text"]] diff --git a/google/genai/_interactions/types/tool.py b/google/genai/_interactions/types/tool.py index 3ef06a37d..e7f2a1b92 100644 --- a/google/genai/_interactions/types/tool.py +++ b/google/genai/_interactions/types/tool.py @@ -27,25 +27,16 @@ __all__ = [ "Tool", - "GoogleSearch", "CodeExecution", "URLContext", "ComputerUse", "MCPServer", + "GoogleSearch", "FileSearch", "GoogleMaps", ] -class GoogleSearch(BaseModel): - """A tool that can be used by the model to search Google.""" - - type: Literal["google_search"] - - search_types: Optional[List[Literal["web_search", "image_search"]]] = None - """The types of search grounding to enable.""" - - class CodeExecution(BaseModel): """A tool that can be used by the model to execute code.""" @@ -91,6 +82,15 @@ class MCPServer(BaseModel): """ +class GoogleSearch(BaseModel): + """A tool that can be used by the model to search Google.""" + + type: Literal["google_search"] + + search_types: Optional[List[Literal["web_search", "image_search"]]] = None + """The types of search grounding to enable.""" + + class FileSearch(BaseModel): """A tool that can be used by the model to search files.""" @@ -109,6 +109,8 @@ class FileSearch(BaseModel): class GoogleMaps(BaseModel): """A tool that can be used by the model to call Google Maps.""" + type: Literal["google_maps"] + enable_widget: Optional[bool] = None """ Whether to return a widget context token in the tool call result of the @@ -121,10 +123,8 @@ class GoogleMaps(BaseModel): longitude: Optional[float] = None """The longitude of the user's location.""" - type: Optional[Literal["google_maps"]] = None - Tool: TypeAlias = Annotated[ - Union[Function, GoogleSearch, CodeExecution, URLContext, ComputerUse, MCPServer, FileSearch, GoogleMaps], + Union[Function, CodeExecution, URLContext, ComputerUse, MCPServer, GoogleSearch, FileSearch, GoogleMaps], PropertyInfo(discriminator="type"), ] diff --git a/google/genai/_interactions/types/tool_param.py b/google/genai/_interactions/types/tool_param.py index ec01bc2b3..c7d71c1bb 100644 --- a/google/genai/_interactions/types/tool_param.py +++ b/google/genai/_interactions/types/tool_param.py @@ -27,25 +27,16 @@ __all__ = [ "ToolParam", - "GoogleSearch", "CodeExecution", "URLContext", "ComputerUse", "MCPServer", + "GoogleSearch", "FileSearch", "GoogleMaps", ] -class GoogleSearch(TypedDict, total=False): - """A tool that can be used by the model to search Google.""" - - type: Required[Literal["google_search"]] - - search_types: List[Literal["web_search", "image_search"]] - """The types of search grounding to enable.""" - - class CodeExecution(TypedDict, total=False): """A tool that can be used by the model to execute code.""" @@ -91,6 +82,15 @@ class MCPServer(TypedDict, total=False): """ +class GoogleSearch(TypedDict, total=False): + """A tool that can be used by the model to search Google.""" + + type: Required[Literal["google_search"]] + + search_types: List[Literal["web_search", "image_search"]] + """The types of search grounding to enable.""" + + class FileSearch(TypedDict, total=False): """A tool that can be used by the model to search files.""" @@ -109,6 +109,8 @@ class FileSearch(TypedDict, total=False): class GoogleMaps(TypedDict, total=False): """A tool that can be used by the model to call Google Maps.""" + type: Required[Literal["google_maps"]] + enable_widget: bool """ Whether to return a widget context token in the tool call result of the @@ -121,9 +123,7 @@ class GoogleMaps(TypedDict, total=False): longitude: float """The longitude of the user's location.""" - type: Literal["google_maps"] - ToolParam: TypeAlias = Union[ - FunctionParam, GoogleSearch, CodeExecution, URLContext, ComputerUse, MCPServer, FileSearch, GoogleMaps + FunctionParam, CodeExecution, URLContext, ComputerUse, MCPServer, GoogleSearch, FileSearch, GoogleMaps ] diff --git a/google/genai/_interactions/types/turn.py b/google/genai/_interactions/types/turn.py index b769c7686..b7be1b25f 100644 --- a/google/genai/_interactions/types/turn.py +++ b/google/genai/_interactions/types/turn.py @@ -24,8 +24,7 @@ class Turn(BaseModel): - content: Union[str, List[Content], None] = None - """The content of the turn.""" + content: Union[List[Content], str, None] = None role: Optional[str] = None """The originator of this turn. diff --git a/google/genai/_interactions/types/turn_param.py b/google/genai/_interactions/types/turn_param.py index e55030db1..975b7f1ec 100644 --- a/google/genai/_interactions/types/turn_param.py +++ b/google/genai/_interactions/types/turn_param.py @@ -26,8 +26,7 @@ class TurnParam(TypedDict, total=False): - content: Union[str, Iterable[ContentParam]] - """The content of the turn.""" + content: Union[Iterable[ContentParam], str] role: str """The originator of this turn. diff --git a/google/genai/_interactions/types/url_citation.py b/google/genai/_interactions/types/url_citation.py index e1c27bffb..818ce5bf5 100644 --- a/google/genai/_interactions/types/url_citation.py +++ b/google/genai/_interactions/types/url_citation.py @@ -32,7 +32,10 @@ class URLCitation(BaseModel): """End of the attributed segment, exclusive.""" start_index: Optional[int] = None - """Start of segment of the response that is attributed to this source.""" + """Start of segment of the response that is attributed to this source. + + Index indicates the start of the segment, measured in bytes. + """ title: Optional[str] = None """The title of the URL.""" diff --git a/google/genai/_interactions/types/url_citation_param.py b/google/genai/_interactions/types/url_citation_param.py index 6df7dbcae..1f57b5736 100644 --- a/google/genai/_interactions/types/url_citation_param.py +++ b/google/genai/_interactions/types/url_citation_param.py @@ -31,7 +31,10 @@ class URLCitationParam(TypedDict, total=False): """End of the attributed segment, exclusive.""" start_index: int - """Start of segment of the response that is attributed to this source.""" + """Start of segment of the response that is attributed to this source. + + Index indicates the start of the segment, measured in bytes. + """ title: str """The title of the URL.""" diff --git a/google/genai/_interactions/types/url_context_call_content.py b/google/genai/_interactions/types/url_context_call_content.py index 243f87ad2..36f1cfc58 100644 --- a/google/genai/_interactions/types/url_context_call_content.py +++ b/google/genai/_interactions/types/url_context_call_content.py @@ -31,7 +31,7 @@ class URLContextCallContent(BaseModel): """A unique ID for this specific tool call.""" arguments: URLContextCallArguments - """The arguments to pass to the URL context.""" + """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_content_param.py index e7ae71d4e..3650041ad 100644 --- a/google/genai/_interactions/types/url_context_call_content_param.py +++ b/google/genai/_interactions/types/url_context_call_content_param.py @@ -35,7 +35,7 @@ class URLContextCallContentParam(TypedDict, total=False): """A unique ID for this specific tool call.""" arguments: Required[URLContextCallArgumentsParam] - """The arguments to pass to the URL context.""" + """Required. The arguments to pass to the URL context.""" type: Required[Literal["url_context_call"]] diff --git a/google/genai/_interactions/types/url_context_result_content.py b/google/genai/_interactions/types/url_context_result_content.py index b4c9cbf5a..da9d86880 100644 --- a/google/genai/_interactions/types/url_context_result_content.py +++ b/google/genai/_interactions/types/url_context_result_content.py @@ -31,7 +31,7 @@ class URLContextResultContent(BaseModel): """ID to match the ID from the url context call block.""" result: List[URLContextResult] - """The results of the URL context.""" + """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_content_param.py index a0c3ad36c..6c8efbfd9 100644 --- a/google/genai/_interactions/types/url_context_result_content_param.py +++ b/google/genai/_interactions/types/url_context_result_content_param.py @@ -35,7 +35,7 @@ class URLContextResultContentParam(TypedDict, total=False): """ID to match the ID from the url context call block.""" result: Required[Iterable[URLContextResultParam]] - """The results of the URL context.""" + """Required. The results of the URL context.""" type: Required[Literal["url_context_result"]]