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 94e298803..6d3379d2b 100644 --- a/google/genai/_interactions/types/content_delta.py +++ b/google/genai/_interactions/types/content_delta.py @@ -41,22 +41,18 @@ "DeltaThoughtSummaryContent", "DeltaThoughtSignature", "DeltaFunctionCall", - "DeltaFunctionResult", - "DeltaFunctionResultResult", - "DeltaFunctionResultResultItems", - "DeltaFunctionResultResultItemsItem", "DeltaCodeExecutionCall", - "DeltaCodeExecutionResult", "DeltaURLContextCall", - "DeltaURLContextResult", "DeltaGoogleSearchCall", - "DeltaGoogleSearchResult", "DeltaMCPServerToolCall", - "DeltaMCPServerToolResult", - "DeltaMCPServerToolResultResult", - "DeltaMCPServerToolResultResultItems", - "DeltaMCPServerToolResultResultItemsItem", "DeltaFileSearchCall", + "DeltaFunctionResult", + "DeltaFunctionResultResultFunctionResultSubcontentList", + "DeltaCodeExecutionResult", + "DeltaURLContextResult", + "DeltaGoogleSearchResult", + "DeltaMCPServerToolResult", + "DeltaMCPServerToolResultResultFunctionResultSubcontentList", "DeltaFileSearchResult", "DeltaFileSearchResultResult", ] @@ -157,22 +153,66 @@ class DeltaFunctionCall(BaseModel): type: Literal["function_call"] -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"] -DeltaFunctionResultResult: TypeAlias = Union[DeltaFunctionResultResultItems, str, object] +class DeltaURLContextCall(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 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"] + + +class DeltaMCPServerToolCall(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"] + + +class DeltaFileSearchCall(BaseModel): + id: str + """A unique ID for this specific tool call.""" + + type: Literal["file_search_call"] + + +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: DeltaFunctionResultResult - """Tool call result delta.""" + result: Union[List[DeltaFunctionResultResultFunctionResultSubcontentList], str, object] type: Literal["function_result"] @@ -184,16 +224,6 @@ class DeltaFunctionResult(BaseModel): """A signature hash for backend validation.""" -class DeltaCodeExecutionCall(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 DeltaCodeExecutionResult(BaseModel): call_id: str """ID to match the ID from the function call block.""" @@ -208,16 +238,6 @@ class DeltaCodeExecutionResult(BaseModel): """A signature hash for backend validation.""" -class DeltaURLContextCall(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 DeltaURLContextResult(BaseModel): call_id: str """ID to match the ID from the function call block.""" @@ -232,16 +252,6 @@ class DeltaURLContextResult(BaseModel): """A signature hash for backend validation.""" -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"] - - class DeltaGoogleSearchResult(BaseModel): call_id: str """ID to match the ID from the function call block.""" @@ -256,35 +266,16 @@ 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] - - name: str - - server_name: str - - type: Literal["mcp_server_tool_call"] - - -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"] @@ -296,13 +287,6 @@ 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"] - - class DeltaFileSearchResultResult(BaseModel): """The result of the File Search.""" @@ -338,16 +322,16 @@ class DeltaFileSearchResult(BaseModel): DeltaThoughtSummary, DeltaThoughtSignature, DeltaFunctionCall, - DeltaFunctionResult, DeltaCodeExecutionCall, - DeltaCodeExecutionResult, DeltaURLContextCall, - DeltaURLContextResult, DeltaGoogleSearchCall, - DeltaGoogleSearchResult, DeltaMCPServerToolCall, - DeltaMCPServerToolResult, DeltaFileSearchCall, + DeltaFunctionResult, + DeltaCodeExecutionResult, + DeltaURLContextResult, + DeltaGoogleSearchResult, + DeltaMCPServerToolResult, DeltaFileSearchResult, ], PropertyInfo(discriminator="type"), @@ -356,6 +340,7 @@ class DeltaFileSearchResult(BaseModel): class ContentDelta(BaseModel): delta: Delta + """The delta content data for a content block.""" event_type: Literal["content.delta"] @@ -363,5 +348,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. """ 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.