From 23e3b7f4ec93e8f36caadbf374717626a7112aca Mon Sep 17 00:00:00 2001 From: Annie Luc Date: Wed, 12 Aug 2026 19:43:29 -0700 Subject: [PATCH] chore: remove deprecated Turn types PiperOrigin-RevId: 963798982 --- .../_gaos/types/interactions/__init__.py | 9 --- .../types/interactions/interactionsinput.py | 5 +- google/genai/_gaos/types/interactions/turn.py | 69 ------------------- .../tests/gaos/test_triggers_lifecycle.py | 4 -- 4 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 google/genai/_gaos/types/interactions/turn.py diff --git a/google/genai/_gaos/types/interactions/__init__.py b/google/genai/_gaos/types/interactions/__init__.py index 2dbba7047..28882c2ea 100644 --- a/google/genai/_gaos/types/interactions/__init__.py +++ b/google/genai/_gaos/types/interactions/__init__.py @@ -366,7 +366,6 @@ from .toolchoiceconfig import ToolChoiceConfig, ToolChoiceConfigParam from .toolchoicetype import ToolChoiceType from .transcriptionconfig import TranscriptionConfig, TranscriptionConfigParam - from .turn import Turn, TurnContent, TurnContentParam, TurnParam from .urlcitation import URLCitation, URLCitationParam from .urlcontext import URLContext, URLContextParam from .urlcontextcallarguments import ( @@ -733,10 +732,6 @@ "TranscriptionConfigParam", "Transform", "TransformParam", - "Turn", - "TurnContent", - "TurnContentParam", - "TurnParam", "URLCitation", "URLCitationParam", "URLContext", @@ -1120,10 +1115,6 @@ "ToolChoiceType": ".toolchoicetype", "TranscriptionConfig": ".transcriptionconfig", "TranscriptionConfigParam": ".transcriptionconfig", - "Turn": ".turn", - "TurnContent": ".turn", - "TurnContentParam": ".turn", - "TurnParam": ".turn", "URLCitation": ".urlcitation", "URLCitationParam": ".urlcitation", "URLContext": ".urlcontext", diff --git a/google/genai/_gaos/types/interactions/interactionsinput.py b/google/genai/_gaos/types/interactions/interactionsinput.py index c22f6506b..6b294d9dd 100644 --- a/google/genai/_gaos/types/interactions/interactionsinput.py +++ b/google/genai/_gaos/types/interactions/interactionsinput.py @@ -19,19 +19,18 @@ from __future__ import annotations from .content import Content, ContentParam from .step import Step, StepParam -from .turn import Turn, TurnParam from typing import List, Union from typing_extensions import TypeAliasType InteractionsInputParam = TypeAliasType( "InteractionsInputParam", - Union[str, List[StepParam], List[ContentParam], List[TurnParam], ContentParam], + Union[str, List[StepParam], List[ContentParam], ContentParam], ) r"""The input for the interaction.""" InteractionsInput = TypeAliasType( - "InteractionsInput", Union[str, List[Step], List[Content], List[Turn], Content] + "InteractionsInput", Union[str, List[Step], List[Content], Content] ) r"""The input for the interaction.""" diff --git a/google/genai/_gaos/types/interactions/turn.py b/google/genai/_gaos/types/interactions/turn.py deleted file mode 100644 index 2f24c65f0..000000000 --- a/google/genai/_gaos/types/interactions/turn.py +++ /dev/null @@ -1,69 +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 .content import Content, ContentParam -from pydantic import model_serializer -from typing import List, Optional, Union -from typing_extensions import NotRequired, TypeAliasType, TypedDict, deprecated - - -TurnContentParam = TypeAliasType("TurnContentParam", Union[List[ContentParam], str]) - - -TurnContent = TypeAliasType("TurnContent", Union[List[Content], str]) - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class TurnParam(TypedDict): - content: NotRequired[TurnContentParam] - role: NotRequired[str] - r"""The originator of this turn. Must be user for input or model for - model output. - """ - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class Turn(BaseModel): - content: Optional[TurnContent] = None - - role: Optional[str] = None - r"""The originator of this turn. Must be user for input or model for - model output. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["content", "role"]) - 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 diff --git a/google/genai/tests/gaos/test_triggers_lifecycle.py b/google/genai/tests/gaos/test_triggers_lifecycle.py index a010026ea..3389d202c 100644 --- a/google/genai/tests/gaos/test_triggers_lifecycle.py +++ b/google/genai/tests/gaos/test_triggers_lifecycle.py @@ -98,10 +98,6 @@ def log_message(self, *args) -> None: } ], ), - ( - [{"role": "user", "content": "test-input-turn"}], - [{"role": "user", "content": "test-input-turn"}], - ), ( {"type": "text", "text": "test-input-single-content"}, {"type": "text", "text": "test-input-single-content"},