From a315b9eb71c0a1e114ab47e0e2dd91b6357595ac Mon Sep 17 00:00:00 2001 From: Kaituo Huang Date: Tue, 3 Mar 2026 14:49:01 -0800 Subject: [PATCH] chore: update comments FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/googleapis/python-genai/pull/2125 from googleapis:release-please--branches--main 0061b63851c5f406312768a8505600b9d22769d2 PiperOrigin-RevId: 878135574 --- google/genai/_interactions/types/content.py | 10 +- .../_interactions/types/content_delta.py | 152 ++++++++---------- .../_interactions/types/content_param.py | 10 +- .../_interactions/types/content_start.py | 3 +- .../genai/_interactions/types/content_stop.py | 3 +- .../genai/_interactions/types/error_event.py | 3 +- .../_interactions/types/generation_config.py | 2 +- .../types/generation_config_param.py | 2 +- .../genai/_interactions/types/interaction.py | 10 +- .../types/interaction_complete_event.py | 3 +- .../types/interaction_create_params.py | 10 +- .../types/interaction_start_event.py | 3 +- .../types/interaction_status_update.py | 3 +- 13 files changed, 103 insertions(+), 111 deletions(-) diff --git a/google/genai/_interactions/types/content.py b/google/genai/_interactions/types/content.py index 8a2dcc32a..86dba0265 100644 --- a/google/genai/_interactions/types/content.py +++ b/google/genai/_interactions/types/content.py @@ -49,16 +49,16 @@ VideoContent, ThoughtContent, FunctionCallContent, - FunctionResultContent, CodeExecutionCallContent, - CodeExecutionResultContent, URLContextCallContent, - URLContextResultContent, + MCPServerToolCallContent, GoogleSearchCallContent, + FileSearchCallContent, + FunctionResultContent, + CodeExecutionResultContent, + URLContextResultContent, GoogleSearchResultContent, - MCPServerToolCallContent, MCPServerToolResultContent, - FileSearchCallContent, FileSearchResultContent, ], PropertyInfo(discriminator="type"), diff --git a/google/genai/_interactions/types/content_delta.py b/google/genai/_interactions/types/content_delta.py index e0fb2d0f3..17a803e0e 100644 --- a/google/genai/_interactions/types/content_delta.py +++ b/google/genai/_interactions/types/content_delta.py @@ -41,22 +41,18 @@ "DeltaThoughtSummaryDeltaContent", "DeltaThoughtSignatureDelta", "DeltaFunctionCallDelta", - "DeltaFunctionResultDelta", - "DeltaFunctionResultDeltaResult", - "DeltaFunctionResultDeltaResultItems", - "DeltaFunctionResultDeltaResultItemsItem", "DeltaCodeExecutionCallDelta", - "DeltaCodeExecutionResultDelta", "DeltaURLContextCallDelta", - "DeltaURLContextResultDelta", "DeltaGoogleSearchCallDelta", - "DeltaGoogleSearchResultDelta", "DeltaMCPServerToolCallDelta", - "DeltaMCPServerToolResultDelta", - "DeltaMCPServerToolResultDeltaResult", - "DeltaMCPServerToolResultDeltaResultItems", - "DeltaMCPServerToolResultDeltaResultItemsItem", "DeltaFileSearchCallDelta", + "DeltaFunctionResultDelta", + "DeltaFunctionResultDeltaResultFunctionResultSubcontentList", + "DeltaCodeExecutionResultDelta", + "DeltaURLContextResultDelta", + "DeltaGoogleSearchResultDelta", + "DeltaMCPServerToolResultDelta", + "DeltaMCPServerToolResultDeltaResultFunctionResultSubcontentList", "DeltaFileSearchResultDelta", "DeltaFileSearchResultDeltaResult", ] @@ -159,22 +155,66 @@ class DeltaFunctionCallDelta(BaseModel): type: Literal["function_call"] -DeltaFunctionResultDeltaResultItemsItem: TypeAlias = Union[TextContent, ImageContent] +class DeltaCodeExecutionCallDelta(BaseModel): + id: str + """A unique ID for this specific tool call.""" + + arguments: CodeExecutionCallArguments + """The arguments to pass to the code execution.""" + + type: Literal["code_execution_call"] + + +class DeltaURLContextCallDelta(BaseModel): + id: str + """A unique ID for this specific tool call.""" + + arguments: URLContextCallArguments + """The arguments to pass to the URL context.""" + + type: Literal["url_context_call"] + + +class DeltaGoogleSearchCallDelta(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"] + +class DeltaMCPServerToolCallDelta(BaseModel): + id: str + """A unique ID for this specific tool call.""" + + arguments: Dict[str, object] -class DeltaFunctionResultDeltaResultItems(BaseModel): - items: Optional[List[DeltaFunctionResultDeltaResultItemsItem]] = None + name: str + server_name: str -DeltaFunctionResultDeltaResult: TypeAlias = Union[DeltaFunctionResultDeltaResultItems, str, object] + type: Literal["mcp_server_tool_call"] + + +class DeltaFileSearchCallDelta(BaseModel): + id: str + """A unique ID for this specific tool call.""" + + type: Literal["file_search_call"] + + +DeltaFunctionResultDeltaResultFunctionResultSubcontentList: TypeAlias = Annotated[ + Union[TextContent, ImageContent], PropertyInfo(discriminator="type") +] class DeltaFunctionResultDelta(BaseModel): call_id: str """ID to match the ID from the function call block.""" - result: DeltaFunctionResultDeltaResult - """Tool call result delta.""" + result: Union[List[DeltaFunctionResultDeltaResultFunctionResultSubcontentList], str, object] type: Literal["function_result"] @@ -186,16 +226,6 @@ class DeltaFunctionResultDelta(BaseModel): """A signature hash for backend validation.""" -class DeltaCodeExecutionCallDelta(BaseModel): - id: str - """A unique ID for this specific tool call.""" - - arguments: CodeExecutionCallArguments - """The arguments to pass to the code execution.""" - - type: Literal["code_execution_call"] - - class DeltaCodeExecutionResultDelta(BaseModel): call_id: str """ID to match the ID from the function call block.""" @@ -210,16 +240,6 @@ class DeltaCodeExecutionResultDelta(BaseModel): """A signature hash for backend validation.""" -class DeltaURLContextCallDelta(BaseModel): - id: str - """A unique ID for this specific tool call.""" - - arguments: URLContextCallArguments - """The arguments to pass to the URL context.""" - - type: Literal["url_context_call"] - - class DeltaURLContextResultDelta(BaseModel): call_id: str """ID to match the ID from the function call block.""" @@ -234,16 +254,6 @@ class DeltaURLContextResultDelta(BaseModel): """A signature hash for backend validation.""" -class DeltaGoogleSearchCallDelta(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"] - - class DeltaGoogleSearchResultDelta(BaseModel): call_id: str """ID to match the ID from the function call block.""" @@ -258,35 +268,16 @@ class DeltaGoogleSearchResultDelta(BaseModel): """A signature hash for backend validation.""" -class DeltaMCPServerToolCallDelta(BaseModel): - id: str - """A unique ID for this specific tool call.""" - - arguments: Dict[str, object] - - name: str - - server_name: str - - type: Literal["mcp_server_tool_call"] - - -DeltaMCPServerToolResultDeltaResultItemsItem: TypeAlias = Union[TextContent, ImageContent] - - -class DeltaMCPServerToolResultDeltaResultItems(BaseModel): - items: Optional[List[DeltaMCPServerToolResultDeltaResultItemsItem]] = None - - -DeltaMCPServerToolResultDeltaResult: TypeAlias = Union[DeltaMCPServerToolResultDeltaResultItems, str, object] +DeltaMCPServerToolResultDeltaResultFunctionResultSubcontentList: TypeAlias = Annotated[ + Union[TextContent, ImageContent], PropertyInfo(discriminator="type") +] class DeltaMCPServerToolResultDelta(BaseModel): call_id: str """ID to match the ID from the function call block.""" - result: DeltaMCPServerToolResultDeltaResult - """Tool call result delta.""" + result: Union[List[DeltaMCPServerToolResultDeltaResultFunctionResultSubcontentList], str, object] type: Literal["mcp_server_tool_result"] @@ -298,13 +289,6 @@ class DeltaMCPServerToolResultDelta(BaseModel): """A signature hash for backend validation.""" -class DeltaFileSearchCallDelta(BaseModel): - id: str - """A unique ID for this specific tool call.""" - - type: Literal["file_search_call"] - - class DeltaFileSearchResultDeltaResult(BaseModel): """The result of the File Search.""" @@ -340,16 +324,16 @@ class DeltaFileSearchResultDelta(BaseModel): DeltaThoughtSummaryDelta, DeltaThoughtSignatureDelta, DeltaFunctionCallDelta, - DeltaFunctionResultDelta, DeltaCodeExecutionCallDelta, - DeltaCodeExecutionResultDelta, DeltaURLContextCallDelta, - DeltaURLContextResultDelta, DeltaGoogleSearchCallDelta, - DeltaGoogleSearchResultDelta, DeltaMCPServerToolCallDelta, - DeltaMCPServerToolResultDelta, DeltaFileSearchCallDelta, + DeltaFunctionResultDelta, + DeltaCodeExecutionResultDelta, + DeltaURLContextResultDelta, + DeltaGoogleSearchResultDelta, + DeltaMCPServerToolResultDelta, DeltaFileSearchResultDelta, ], PropertyInfo(discriminator="type"), @@ -358,6 +342,7 @@ class DeltaFileSearchResultDelta(BaseModel): class ContentDelta(BaseModel): delta: Delta + """The delta content data for a content block.""" event_type: Literal["content.delta"] @@ -365,5 +350,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 c1970fe16..2d33beffe 100644 --- a/google/genai/_interactions/types/content_param.py +++ b/google/genai/_interactions/types/content_param.py @@ -49,15 +49,15 @@ VideoContentParam, ThoughtContentParam, FunctionCallContentParam, - FunctionResultContentParam, CodeExecutionCallContentParam, - CodeExecutionResultContentParam, URLContextCallContentParam, - URLContextResultContentParam, + MCPServerToolCallContentParam, GoogleSearchCallContentParam, + FileSearchCallContentParam, + FunctionResultContentParam, + CodeExecutionResultContentParam, + URLContextResultContentParam, GoogleSearchResultContentParam, - MCPServerToolCallContentParam, MCPServerToolResultContentParam, - FileSearchCallContentParam, FileSearchResultContentParam, ] 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/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/interaction.py b/google/genai/_interactions/types/interaction.py index 4a35a07dd..77b8f3e4b 100644 --- a/google/genai/_interactions/types/interaction.py +++ b/google/genai/_interactions/types/interaction.py @@ -64,16 +64,16 @@ VideoContent, ThoughtContent, FunctionCallContent, - FunctionResultContent, CodeExecutionCallContent, - CodeExecutionResultContent, URLContextCallContent, - URLContextResultContent, + MCPServerToolCallContent, GoogleSearchCallContent, + FileSearchCallContent, + FunctionResultContent, + CodeExecutionResultContent, + URLContextResultContent, GoogleSearchResultContent, - MCPServerToolCallContent, MCPServerToolResultContent, - FileSearchCallContent, FileSearchResultContent, ] diff --git a/google/genai/_interactions/types/interaction_complete_event.py b/google/genai/_interactions/types/interaction_complete_event.py index b45a642f5..7b537a588 100644 --- a/google/genai/_interactions/types/interaction_complete_event.py +++ b/google/genai/_interactions/types/interaction_complete_event.py @@ -35,5 +35,6 @@ class InteractionCompleteEvent(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_create_params.py b/google/genai/_interactions/types/interaction_create_params.py index beeede433..df6ee5d63 100644 --- a/google/genai/_interactions/types/interaction_create_params.py +++ b/google/genai/_interactions/types/interaction_create_params.py @@ -109,16 +109,16 @@ class BaseCreateModelInteractionParams(TypedDict, total=False): VideoContentParam, ThoughtContentParam, FunctionCallContentParam, - FunctionResultContentParam, CodeExecutionCallContentParam, - CodeExecutionResultContentParam, URLContextCallContentParam, - URLContextResultContentParam, + MCPServerToolCallContentParam, GoogleSearchCallContentParam, + FileSearchCallContentParam, + FunctionResultContentParam, + CodeExecutionResultContentParam, + URLContextResultContentParam, GoogleSearchResultContentParam, - MCPServerToolCallContentParam, MCPServerToolResultContentParam, - FileSearchCallContentParam, FileSearchResultContentParam, ] 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. """