Skip to content

Commit 20066d9

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: Deprecate legacy response_format and publish new polymorphic field.
PiperOrigin-RevId: 911077297
1 parent 7fdc9a1 commit 20066d9

12 files changed

Lines changed: 16 additions & 382 deletions

google/genai/_interactions/resources/interactions.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def create(
7575
background: bool | Omit = omit,
7676
generation_config: GenerationConfigParam | Omit = omit,
7777
previous_interaction_id: str | Omit = omit,
78-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
78+
response_format: object | Omit = omit,
7979
response_mime_type: str | Omit = omit,
8080
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
8181
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -146,7 +146,7 @@ def create(
146146
background: bool | Omit = omit,
147147
generation_config: GenerationConfigParam | Omit = omit,
148148
previous_interaction_id: str | Omit = omit,
149-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
149+
response_format: object | Omit = omit,
150150
response_mime_type: str | Omit = omit,
151151
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
152152
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -222,7 +222,7 @@ def create(
222222
agent_config: interaction_create_params.AgentConfig | Omit = omit,
223223
background: bool | Omit = omit,
224224
previous_interaction_id: str | Omit = omit,
225-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
225+
response_format: object | Omit = omit,
226226
response_mime_type: str | Omit = omit,
227227
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
228228
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -300,7 +300,7 @@ def create(
300300
agent_config: interaction_create_params.AgentConfig | Omit = omit,
301301
background: bool | Omit = omit,
302302
previous_interaction_id: str | Omit = omit,
303-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
303+
response_format: object | Omit = omit,
304304
response_mime_type: str | Omit = omit,
305305
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
306306
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -370,7 +370,7 @@ def create(
370370
background: bool | Omit = omit,
371371
generation_config: GenerationConfigParam | Omit = omit,
372372
previous_interaction_id: str | Omit = omit,
373-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
373+
response_format: object | Omit = omit,
374374
response_mime_type: str | Omit = omit,
375375
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
376376
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -439,7 +439,7 @@ def create(
439439
background: bool | Omit = omit,
440440
generation_config: GenerationConfigParam | Omit = omit,
441441
previous_interaction_id: str | Omit = omit,
442-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
442+
response_format: object | Omit = omit,
443443
response_mime_type: str | Omit = omit,
444444
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
445445
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -771,7 +771,7 @@ async def create(
771771
background: bool | Omit = omit,
772772
generation_config: GenerationConfigParam | Omit = omit,
773773
previous_interaction_id: str | Omit = omit,
774-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
774+
response_format: object | Omit = omit,
775775
response_mime_type: str | Omit = omit,
776776
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
777777
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -842,7 +842,7 @@ async def create(
842842
background: bool | Omit = omit,
843843
generation_config: GenerationConfigParam | Omit = omit,
844844
previous_interaction_id: str | Omit = omit,
845-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
845+
response_format: object | Omit = omit,
846846
response_mime_type: str | Omit = omit,
847847
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
848848
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -918,7 +918,7 @@ async def create(
918918
agent_config: interaction_create_params.AgentConfig | Omit = omit,
919919
background: bool | Omit = omit,
920920
previous_interaction_id: str | Omit = omit,
921-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
921+
response_format: object | Omit = omit,
922922
response_mime_type: str | Omit = omit,
923923
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
924924
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -996,7 +996,7 @@ async def create(
996996
agent_config: interaction_create_params.AgentConfig | Omit = omit,
997997
background: bool | Omit = omit,
998998
previous_interaction_id: str | Omit = omit,
999-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
999+
response_format: object | Omit = omit,
10001000
response_mime_type: str | Omit = omit,
10011001
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
10021002
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -1066,7 +1066,7 @@ async def create(
10661066
background: bool | Omit = omit,
10671067
generation_config: GenerationConfigParam | Omit = omit,
10681068
previous_interaction_id: str | Omit = omit,
1069-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
1069+
response_format: object | Omit = omit,
10701070
response_mime_type: str | Omit = omit,
10711071
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
10721072
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,
@@ -1135,7 +1135,7 @@ async def create(
11351135
background: bool | Omit = omit,
11361136
generation_config: GenerationConfigParam | Omit = omit,
11371137
previous_interaction_id: str | Omit = omit,
1138-
response_format: interaction_create_params.ResponseFormat | Omit = omit,
1138+
response_format: object | Omit = omit,
11391139
response_mime_type: str | Omit = omit,
11401140
response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit,
11411141
service_tier: Literal["flex", "standard", "priority"] | Omit = omit,

google/genai/_interactions/types/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,12 @@
7979
from .function_result_step import FunctionResultStep as FunctionResultStep
8080
from .google_search_result import GoogleSearchResult as GoogleSearchResult
8181
from .place_citation_param import PlaceCitationParam as PlaceCitationParam
82-
from .text_response_format import TextResponseFormat as TextResponseFormat
8382
from .webhook_config_param import WebhookConfigParam as WebhookConfigParam
84-
from .audio_response_format import AudioResponseFormat as AudioResponseFormat
8583
from .file_search_call_step import FileSearchCallStep as FileSearchCallStep
8684
from .google_maps_call_step import GoogleMapsCallStep as GoogleMapsCallStep
87-
from .image_response_format import ImageResponseFormat as ImageResponseFormat
8885
from .interaction_sse_event import InteractionSSEEvent as InteractionSSEEvent
8986
from .url_context_call_step import URLContextCallStep as URLContextCallStep
9087
from .user_input_step_param import UserInputStepParam as UserInputStepParam
91-
from .video_response_format import VideoResponseFormat as VideoResponseFormat
9288
from .webhook_create_params import WebhookCreateParams as WebhookCreateParams
9389
from .webhook_list_response import WebhookListResponse as WebhookListResponse
9490
from .webhook_ping_response import WebhookPingResponse as WebhookPingResponse
@@ -116,15 +112,11 @@
116112
from .function_result_step_param import FunctionResultStepParam as FunctionResultStepParam
117113
from .google_maps_call_arguments import GoogleMapsCallArguments as GoogleMapsCallArguments
118114
from .interaction_complete_event import InteractionCompleteEvent as InteractionCompleteEvent
119-
from .text_response_format_param import TextResponseFormatParam as TextResponseFormatParam
120115
from .url_context_call_arguments import URLContextCallArguments as URLContextCallArguments
121-
from .audio_response_format_param import AudioResponseFormatParam as AudioResponseFormatParam
122116
from .file_search_call_step_param import FileSearchCallStepParam as FileSearchCallStepParam
123117
from .google_maps_call_step_param import GoogleMapsCallStepParam as GoogleMapsCallStepParam
124-
from .image_response_format_param import ImageResponseFormatParam as ImageResponseFormatParam
125118
from .mcp_server_tool_result_step import MCPServerToolResultStep as MCPServerToolResultStep
126119
from .url_context_call_step_param import URLContextCallStepParam as URLContextCallStepParam
127-
from .video_response_format_param import VideoResponseFormatParam as VideoResponseFormatParam
128120
from .google_search_call_arguments import GoogleSearchCallArguments as GoogleSearchCallArguments
129121
from .code_execution_call_arguments import CodeExecutionCallArguments as CodeExecutionCallArguments
130122
from .file_search_result_step_param import FileSearchResultStepParam as FileSearchResultStepParam

google/genai/_interactions/types/audio_response_format.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

google/genai/_interactions/types/audio_response_format_param.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

google/genai/_interactions/types/image_response_format.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

google/genai/_interactions/types/image_response_format_param.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

google/genai/_interactions/types/interaction.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,9 @@
3333
from .webhook_config import WebhookConfig
3434
from .document_content import DocumentContent
3535
from .dynamic_agent_config import DynamicAgentConfig
36-
from .text_response_format import TextResponseFormat
37-
from .audio_response_format import AudioResponseFormat
38-
from .image_response_format import ImageResponseFormat
39-
from .video_response_format import VideoResponseFormat
4036
from .deep_research_agent_config import DeepResearchAgentConfig
4137

42-
__all__ = ["Interaction", "AgentConfig", "Input", "ResponseFormat", "ResponseFormatResponseFormatList"]
38+
__all__ = ["Interaction", "AgentConfig", "Input"]
4339

4440
AgentConfig: TypeAlias = Annotated[
4541
Union[DynamicAgentConfig, DeepResearchAgentConfig], PropertyInfo(discriminator="type")
@@ -49,19 +45,6 @@
4945
str, List[Step], List[Content], TextContent, ImageContent, AudioContent, DocumentContent, VideoContent
5046
]
5147

52-
ResponseFormatResponseFormatList: TypeAlias = Union[
53-
AudioResponseFormat, TextResponseFormat, ImageResponseFormat, VideoResponseFormat, object
54-
]
55-
56-
ResponseFormat: TypeAlias = Union[
57-
List[ResponseFormatResponseFormatList],
58-
AudioResponseFormat,
59-
TextResponseFormat,
60-
ImageResponseFormat,
61-
VideoResponseFormat,
62-
object,
63-
]
64-
6548

6649
class Interaction(BaseModel):
6750
"""The Interaction resource."""
@@ -107,7 +90,7 @@ class Interaction(BaseModel):
10790
previous_interaction_id: Optional[str] = None
10891
"""The ID of the previous interaction, if any."""
10992

110-
response_format: Optional[ResponseFormat] = None
93+
response_format: Optional[object] = None
11194
"""
11295
Enforces that the generated response is a JSON object that complies with the
11396
JSON schema specified in this field.

0 commit comments

Comments
 (0)