From 65e9e5a3fd9fadfd4504f5363b55e167c861709b Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Tue, 7 Jul 2026 01:56:03 -0700 Subject: [PATCH] refactor: remove StreamMetadata and its usages. PiperOrigin-RevId: 943752795 --- .../_gaos/resources/interactions/__init__.py | 10 ---- .../interactions/errorevent/__init__.py | 3 +- .../interactioncompletedevent/__init__.py | 21 -------- .../interactioncreatedevent/__init__.py | 21 -------- .../interactionstatusupdate/__init__.py | 21 -------- .../interactions/stepstart/__init__.py | 21 -------- .../interactions/stepstop/__init__.py | 21 -------- .../_gaos/types/interactions/__init__.py | 5 -- .../_gaos/types/interactions/errorevent.py | 6 +-- .../interactions/interactioncompletedevent.py | 6 +-- .../interactions/interactioncreatedevent.py | 6 +-- .../interactions/interactionstatusupdate.py | 6 +-- .../_gaos/types/interactions/stepstart.py | 6 +-- .../_gaos/types/interactions/stepstop.py | 6 +-- .../types/interactions/streammetadata.py | 50 ------------------- 15 files changed, 7 insertions(+), 202 deletions(-) delete mode 100644 google/genai/_gaos/resources/interactions/interactioncompletedevent/__init__.py delete mode 100644 google/genai/_gaos/resources/interactions/interactioncreatedevent/__init__.py delete mode 100644 google/genai/_gaos/resources/interactions/interactionstatusupdate/__init__.py delete mode 100644 google/genai/_gaos/resources/interactions/stepstart/__init__.py delete mode 100644 google/genai/_gaos/resources/interactions/stepstop/__init__.py delete mode 100644 google/genai/_gaos/types/interactions/streammetadata.py diff --git a/google/genai/_gaos/resources/interactions/__init__.py b/google/genai/_gaos/resources/interactions/__init__.py index b0275cf63..0c991698c 100644 --- a/google/genai/_gaos/resources/interactions/__init__.py +++ b/google/genai/_gaos/resources/interactions/__init__.py @@ -110,15 +110,10 @@ from . import googlemapsresultstep from . import googlesearchcallstep from . import googlesearchresultstep -from . import interactioncompletedevent -from . import interactioncreatedevent -from . import interactionstatusupdate from . import modeloutputstep from . import placecitation from . import retrievalcalldelta from . import stepdelta -from . import stepstart -from . import stepstop from . import tool from . import urlcontextcallstep from . import urlcontextresultstep @@ -211,15 +206,10 @@ "googlemapsresultstep", "googlesearchcallstep", "googlesearchresultstep", - "interactioncompletedevent", - "interactioncreatedevent", - "interactionstatusupdate", "modeloutputstep", "placecitation", "retrievalcalldelta", "stepdelta", - "stepstart", - "stepstop", "tool", "urlcontextcallstep", "urlcontextresultstep", diff --git a/google/genai/_gaos/resources/interactions/errorevent/__init__.py b/google/genai/_gaos/resources/interactions/errorevent/__init__.py index e0585bd3b..f260248e1 100644 --- a/google/genai/_gaos/resources/interactions/errorevent/__init__.py +++ b/google/genai/_gaos/resources/interactions/errorevent/__init__.py @@ -17,6 +17,5 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from ....types.interactions.error import Error -from ....types.interactions.streammetadata import StreamMetadata as Metadata -__all__ = ["Error", "Metadata"] +__all__ = ["Error"] diff --git a/google/genai/_gaos/resources/interactions/interactioncompletedevent/__init__.py b/google/genai/_gaos/resources/interactions/interactioncompletedevent/__init__.py deleted file mode 100644 index cefc54863..000000000 --- a/google/genai/_gaos/resources/interactions/interactioncompletedevent/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2026 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. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from ....types.interactions.streammetadata import StreamMetadata as Metadata - -__all__ = ["Metadata"] diff --git a/google/genai/_gaos/resources/interactions/interactioncreatedevent/__init__.py b/google/genai/_gaos/resources/interactions/interactioncreatedevent/__init__.py deleted file mode 100644 index cefc54863..000000000 --- a/google/genai/_gaos/resources/interactions/interactioncreatedevent/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2026 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. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from ....types.interactions.streammetadata import StreamMetadata as Metadata - -__all__ = ["Metadata"] diff --git a/google/genai/_gaos/resources/interactions/interactionstatusupdate/__init__.py b/google/genai/_gaos/resources/interactions/interactionstatusupdate/__init__.py deleted file mode 100644 index cefc54863..000000000 --- a/google/genai/_gaos/resources/interactions/interactionstatusupdate/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2026 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. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from ....types.interactions.streammetadata import StreamMetadata as Metadata - -__all__ = ["Metadata"] diff --git a/google/genai/_gaos/resources/interactions/stepstart/__init__.py b/google/genai/_gaos/resources/interactions/stepstart/__init__.py deleted file mode 100644 index cefc54863..000000000 --- a/google/genai/_gaos/resources/interactions/stepstart/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2026 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. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from ....types.interactions.streammetadata import StreamMetadata as Metadata - -__all__ = ["Metadata"] diff --git a/google/genai/_gaos/resources/interactions/stepstop/__init__.py b/google/genai/_gaos/resources/interactions/stepstop/__init__.py deleted file mode 100644 index cefc54863..000000000 --- a/google/genai/_gaos/resources/interactions/stepstop/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2026 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. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from ....types.interactions.streammetadata import StreamMetadata as Metadata - -__all__ = ["Metadata"] diff --git a/google/genai/_gaos/types/interactions/__init__.py b/google/genai/_gaos/types/interactions/__init__.py index b0fb93dda..a31ce05dd 100644 --- a/google/genai/_gaos/types/interactions/__init__.py +++ b/google/genai/_gaos/types/interactions/__init__.py @@ -320,7 +320,6 @@ from .stepdeltametadata import StepDeltaMetadata, StepDeltaMetadataTypedDict from .stepstart import StepStart, StepStartTypedDict from .stepstop import StepStop, StepStopTypedDict - from .streammetadata import StreamMetadata, StreamMetadataTypedDict from .textannotationdelta import TextAnnotationDelta, TextAnnotationDeltaTypedDict from .textcontent import TextContent, TextContentParam from .textdelta import TextDelta, TextDeltaTypedDict @@ -644,8 +643,6 @@ "StepStartTypedDict", "StepStop", "StepStopTypedDict", - "StreamMetadata", - "StreamMetadataTypedDict", "Task", "TextAnnotationDelta", "TextAnnotationDeltaTypedDict", @@ -1002,8 +999,6 @@ "StepStartTypedDict": ".stepstart", "StepStop": ".stepstop", "StepStopTypedDict": ".stepstop", - "StreamMetadata": ".streammetadata", - "StreamMetadataTypedDict": ".streammetadata", "TextAnnotationDelta": ".textannotationdelta", "TextAnnotationDeltaTypedDict": ".textannotationdelta", "TextContent": ".textcontent", diff --git a/google/genai/_gaos/types/interactions/errorevent.py b/google/genai/_gaos/types/interactions/errorevent.py index 6d04ad03c..5307a48e7 100644 --- a/google/genai/_gaos/types/interactions/errorevent.py +++ b/google/genai/_gaos/types/interactions/errorevent.py @@ -20,7 +20,6 @@ from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const from .error import Error, ErrorTypedDict -from .streammetadata import StreamMetadata, StreamMetadataTypedDict import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -36,7 +35,6 @@ class ErrorEventTypedDict(TypedDict): r"""The event_id token to be used to resume the interaction stream, from this event. """ - metadata: NotRequired[StreamMetadataTypedDict] class ErrorEvent(BaseModel): @@ -53,11 +51,9 @@ class ErrorEvent(BaseModel): this event. """ - metadata: Optional[StreamMetadata] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["error", "event_id", "metadata"]) + optional_fields = set(["error", "event_id"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/interactioncompletedevent.py b/google/genai/_gaos/types/interactions/interactioncompletedevent.py index 2a23b50b9..a7efc3fcd 100644 --- a/google/genai/_gaos/types/interactions/interactioncompletedevent.py +++ b/google/genai/_gaos/types/interactions/interactioncompletedevent.py @@ -23,7 +23,6 @@ InteractionSseEventInteraction, InteractionSseEventInteractionTypedDict, ) -from .streammetadata import StreamMetadata, StreamMetadataTypedDict import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -43,7 +42,6 @@ class InteractionCompletedEventTypedDict(TypedDict): r"""The event_id token to be used to resume the interaction stream, from this event. """ - metadata: NotRequired[StreamMetadataTypedDict] class InteractionCompletedEvent(BaseModel): @@ -67,11 +65,9 @@ class InteractionCompletedEvent(BaseModel): this event. """ - metadata: Optional[StreamMetadata] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["event_id", "metadata"]) + optional_fields = set(["event_id"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/interactioncreatedevent.py b/google/genai/_gaos/types/interactions/interactioncreatedevent.py index 046a55682..496035cd0 100644 --- a/google/genai/_gaos/types/interactions/interactioncreatedevent.py +++ b/google/genai/_gaos/types/interactions/interactioncreatedevent.py @@ -23,7 +23,6 @@ InteractionSseEventInteraction, InteractionSseEventInteractionTypedDict, ) -from .streammetadata import StreamMetadata, StreamMetadataTypedDict import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -43,7 +42,6 @@ class InteractionCreatedEventTypedDict(TypedDict): r"""The event_id token to be used to resume the interaction stream, from this event. """ - metadata: NotRequired[StreamMetadataTypedDict] class InteractionCreatedEvent(BaseModel): @@ -67,11 +65,9 @@ class InteractionCreatedEvent(BaseModel): this event. """ - metadata: Optional[StreamMetadata] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["event_id", "metadata"]) + optional_fields = set(["event_id"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/interactionstatusupdate.py b/google/genai/_gaos/types/interactions/interactionstatusupdate.py index 2df40570e..f0b3c824a 100644 --- a/google/genai/_gaos/types/interactions/interactionstatusupdate.py +++ b/google/genai/_gaos/types/interactions/interactionstatusupdate.py @@ -19,7 +19,6 @@ from __future__ import annotations from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from ...utils import validate_const -from .streammetadata import StreamMetadata, StreamMetadataTypedDict import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -49,7 +48,6 @@ class InteractionStatusUpdateTypedDict(TypedDict): r"""The event_id token to be used to resume the interaction stream, from this event. """ - metadata: NotRequired[StreamMetadataTypedDict] class InteractionStatusUpdate(BaseModel): @@ -70,11 +68,9 @@ class InteractionStatusUpdate(BaseModel): this event. """ - metadata: Optional[StreamMetadata] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["event_id", "metadata"]) + optional_fields = set(["event_id"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/stepstart.py b/google/genai/_gaos/types/interactions/stepstart.py index ac5c41c5d..baa2a0e49 100644 --- a/google/genai/_gaos/types/interactions/stepstart.py +++ b/google/genai/_gaos/types/interactions/stepstart.py @@ -20,7 +20,6 @@ from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const from .step import Step, StepParam -from .streammetadata import StreamMetadata, StreamMetadataTypedDict import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -37,7 +36,6 @@ class StepStartTypedDict(TypedDict): r"""The event_id token to be used to resume the interaction stream, from this event. """ - metadata: NotRequired[StreamMetadataTypedDict] class StepStart(BaseModel): @@ -56,11 +54,9 @@ class StepStart(BaseModel): this event. """ - metadata: Optional[StreamMetadata] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["event_id", "metadata"]) + optional_fields = set(["event_id"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/stepstop.py b/google/genai/_gaos/types/interactions/stepstop.py index 2fd0d181c..ccc49159a 100644 --- a/google/genai/_gaos/types/interactions/stepstop.py +++ b/google/genai/_gaos/types/interactions/stepstop.py @@ -19,7 +19,6 @@ from __future__ import annotations from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .streammetadata import StreamMetadata, StreamMetadataTypedDict from .usage import Usage, UsageTypedDict import pydantic from pydantic import model_serializer @@ -39,7 +38,6 @@ class StepStopTypedDict(TypedDict): r"""The event_id token to be used to resume the interaction stream, from this event. """ - metadata: NotRequired[StreamMetadataTypedDict] class StepStop(BaseModel): @@ -61,11 +59,9 @@ class StepStop(BaseModel): this event. """ - metadata: Optional[StreamMetadata] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["usage", "step_usage", "event_id", "metadata"]) + optional_fields = set(["usage", "step_usage", "event_id"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/streammetadata.py b/google/genai/_gaos/types/interactions/streammetadata.py deleted file mode 100644 index 5b31e30a6..000000000 --- a/google/genai/_gaos/types/interactions/streammetadata.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2026 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. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from .usage import Usage, UsageTypedDict -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict - - -class StreamMetadataTypedDict(TypedDict): - total_usage: NotRequired[UsageTypedDict] - r"""Statistics on the interaction request's token usage.""" - - -class StreamMetadata(BaseModel): - total_usage: Optional[Usage] = None - r"""Statistics on the interaction request's token usage.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["total_usage"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m