From 37f36625930b1d3cb48f6e0abc5e781c06ca4a8e Mon Sep 17 00:00:00 2001 From: Annie Luc Date: Wed, 21 Jan 2026 15:07:14 -0800 Subject: [PATCH] chore: Split InteractionEvent into InteractionStartEvent and InteractionCompleteEvent. FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/googleapis/python-genai/pull/1966 from googleapis:release-please--branches--main 8b4a9a7081b8e376416d423962c6e4a815903924 PiperOrigin-RevId: 859281011 --- google/genai/_interactions/types/__init__.py | 3 +- ...event.py => interaction_complete_event.py} | 6 ++-- .../types/interaction_sse_event.py | 13 +++++-- .../types/interaction_start_event.py | 36 +++++++++++++++++++ 4 files changed, 52 insertions(+), 6 deletions(-) rename google/genai/_interactions/types/{interaction_event.py => interaction_complete_event.py} (87%) create mode 100644 google/genai/_interactions/types/interaction_start_event.py diff --git a/google/genai/_interactions/types/__init__.py b/google/genai/_interactions/types/__init__.py index bd448df72..a98193110 100644 --- a/google/genai/_interactions/types/__init__.py +++ b/google/genai/_interactions/types/__init__.py @@ -52,7 +52,6 @@ from .document_content import DocumentContent as DocumentContent from .tool_choice_type import ToolChoiceType as ToolChoiceType from .generation_config import GenerationConfig as GenerationConfig -from .interaction_event import InteractionEvent as InteractionEvent from .tool_choice_param import ToolChoiceParam as ToolChoiceParam from .document_mime_type import DocumentMimeType as DocumentMimeType from .image_config_param import ImageConfigParam as ImageConfigParam @@ -76,6 +75,7 @@ from .interaction_get_params import InteractionGetParams as InteractionGetParams from .function_result_content import FunctionResultContent as FunctionResultContent from .generation_config_param import GenerationConfigParam as GenerationConfigParam +from .interaction_start_event import InteractionStartEvent as InteractionStartEvent from .document_mime_type_param import DocumentMimeTypeParam as DocumentMimeTypeParam from .file_search_call_content import FileSearchCallContent as FileSearchCallContent from .tool_choice_config_param import ToolChoiceConfigParam as ToolChoiceConfigParam @@ -88,6 +88,7 @@ from .file_search_result_content import FileSearchResultContent as FileSearchResultContent 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 diff --git a/google/genai/_interactions/types/interaction_event.py b/google/genai/_interactions/types/interaction_complete_event.py similarity index 87% rename from google/genai/_interactions/types/interaction_event.py rename to google/genai/_interactions/types/interaction_complete_event.py index 58f3d5418..843e1752c 100644 --- a/google/genai/_interactions/types/interaction_event.py +++ b/google/genai/_interactions/types/interaction_complete_event.py @@ -21,16 +21,16 @@ from .._models import BaseModel from .interaction import Interaction -__all__ = ["InteractionEvent"] +__all__ = ["InteractionCompleteEvent"] -class InteractionEvent(BaseModel): +class InteractionCompleteEvent(BaseModel): event_id: Optional[str] = None """ The event_id token to be used to resume the interaction stream, from this event. """ - event_type: Optional[Literal["interaction.start", "interaction.complete"]] = None + event_type: Optional[Literal["interaction.complete"]] = None interaction: Optional[Interaction] = None """The Interaction resource.""" diff --git a/google/genai/_interactions/types/interaction_sse_event.py b/google/genai/_interactions/types/interaction_sse_event.py index bc0e84f81..0eee49201 100644 --- a/google/genai/_interactions/types/interaction_sse_event.py +++ b/google/genai/_interactions/types/interaction_sse_event.py @@ -23,12 +23,21 @@ from .content_stop import ContentStop from .content_delta import ContentDelta from .content_start import ContentStart -from .interaction_event import InteractionEvent +from .interaction_start_event import InteractionStartEvent from .interaction_status_update import InteractionStatusUpdate +from .interaction_complete_event import InteractionCompleteEvent __all__ = ["InteractionSSEEvent"] InteractionSSEEvent: TypeAlias = Annotated[ - Union[InteractionEvent, InteractionStatusUpdate, ContentStart, ContentDelta, ContentStop, ErrorEvent], + Union[ + InteractionStartEvent, + InteractionCompleteEvent, + InteractionStatusUpdate, + ContentStart, + ContentDelta, + ContentStop, + ErrorEvent, + ], PropertyInfo(discriminator="event_type"), ] diff --git a/google/genai/_interactions/types/interaction_start_event.py b/google/genai/_interactions/types/interaction_start_event.py new file mode 100644 index 000000000..f637ddbb2 --- /dev/null +++ b/google/genai/_interactions/types/interaction_start_event.py @@ -0,0 +1,36 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .interaction import Interaction + +__all__ = ["InteractionStartEvent"] + + +class InteractionStartEvent(BaseModel): + event_id: Optional[str] = None + """ + The event_id token to be used to resume the interaction stream, from this event. + """ + + event_type: Optional[Literal["interaction.start"]] = None + + interaction: Optional[Interaction] = None + """The Interaction resource."""