google-genai 1.60.0__py3-none-any.whl → 1.62.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. google/genai/_interactions/_base_client.py +5 -2
  2. google/genai/_interactions/_compat.py +3 -3
  3. google/genai/_interactions/_utils/_json.py +50 -0
  4. google/genai/_interactions/resources/interactions.py +50 -28
  5. google/genai/_interactions/types/__init__.py +2 -1
  6. google/genai/_interactions/types/content_delta.py +1 -1
  7. google/genai/_interactions/types/function_result_content.py +2 -1
  8. google/genai/_interactions/types/function_result_content_param.py +4 -4
  9. google/genai/_interactions/types/{interaction_event.py → interaction_complete_event.py} +3 -3
  10. google/genai/_interactions/types/interaction_create_params.py +4 -4
  11. google/genai/_interactions/types/interaction_get_params.py +3 -0
  12. google/genai/_interactions/types/interaction_sse_event.py +11 -2
  13. google/genai/_interactions/types/interaction_start_event.py +36 -0
  14. google/genai/batches.py +3 -0
  15. google/genai/errors.py +19 -6
  16. google/genai/files.py +15 -15
  17. google/genai/live.py +22 -2
  18. google/genai/live_music.py +14 -1
  19. google/genai/models.py +486 -197
  20. google/genai/tests/batches/test_create_with_inlined_requests.py +31 -15
  21. google/genai/tests/batches/test_get.py +1 -1
  22. google/genai/tests/client/test_client_close.py +0 -1
  23. google/genai/tests/errors/test_api_error.py +38 -0
  24. google/genai/tests/files/test_register_table.py +1 -1
  25. google/genai/tests/transformers/test_schema.py +10 -1
  26. google/genai/tests/tunings/test_tune.py +87 -0
  27. google/genai/tunings.py +211 -20
  28. google/genai/types.py +178 -14
  29. google/genai/version.py +1 -1
  30. {google_genai-1.60.0.dist-info → google_genai-1.62.0.dist-info}/METADATA +1 -1
  31. {google_genai-1.60.0.dist-info → google_genai-1.62.0.dist-info}/RECORD +34 -32
  32. {google_genai-1.60.0.dist-info → google_genai-1.62.0.dist-info}/WHEEL +1 -1
  33. {google_genai-1.60.0.dist-info → google_genai-1.62.0.dist-info}/licenses/LICENSE +0 -0
  34. {google_genai-1.60.0.dist-info → google_genai-1.62.0.dist-info}/top_level.txt +0 -0
@@ -101,6 +101,7 @@ from ._exceptions import (
101
101
  APIConnectionError,
102
102
  APIResponseValidationError,
103
103
  )
104
+ from ._utils._json import openapi_dumps
104
105
 
105
106
  log: logging.Logger = logging.getLogger(__name__)
106
107
 
@@ -578,8 +579,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
578
579
  kwargs["content"] = options.content
579
580
  elif isinstance(json_data, bytes):
580
581
  kwargs["content"] = json_data
581
- else:
582
- kwargs["json"] = json_data if is_given(json_data) else None
582
+ elif not files:
583
+ # Don't set content when JSON is sent as multipart/form-data,
584
+ # since httpx's content param overrides other body arguments
585
+ kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None
583
586
  kwargs["files"] = files
584
587
  else:
585
588
  headers.pop("Content-Type", None)
@@ -154,6 +154,7 @@ def model_dump(
154
154
  exclude_defaults: bool = False,
155
155
  warnings: bool = True,
156
156
  mode: Literal["json", "python"] = "python",
157
+ by_alias: bool | None = None,
157
158
  ) -> dict[str, Any]:
158
159
  if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
159
160
  return model.model_dump(
@@ -163,13 +164,12 @@ def model_dump(
163
164
  exclude_defaults=exclude_defaults,
164
165
  # warnings are not supported in Pydantic v1
165
166
  warnings=True if PYDANTIC_V1 else warnings,
167
+ by_alias=by_alias,
166
168
  )
167
169
  return cast(
168
170
  "dict[str, Any]",
169
171
  model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
170
- exclude=exclude,
171
- exclude_unset=exclude_unset,
172
- exclude_defaults=exclude_defaults,
172
+ exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias)
173
173
  ),
174
174
  )
175
175
 
@@ -0,0 +1,50 @@
1
+ # Copyright 2025 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+
16
+ import json
17
+ from typing import Any
18
+ from datetime import datetime
19
+ from typing_extensions import override
20
+
21
+ import pydantic
22
+
23
+ from .._compat import model_dump
24
+
25
+
26
+ def openapi_dumps(obj: Any) -> bytes:
27
+ """
28
+ Serialize an object to UTF-8 encoded JSON bytes.
29
+
30
+ Extends the standard json.dumps with support for additional types
31
+ commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc.
32
+ """
33
+ return json.dumps(
34
+ obj,
35
+ cls=_CustomEncoder,
36
+ # Uses the same defaults as httpx's JSON serialization
37
+ ensure_ascii=False,
38
+ separators=(",", ":"),
39
+ allow_nan=False,
40
+ ).encode()
41
+
42
+
43
+ class _CustomEncoder(json.JSONEncoder):
44
+ @override
45
+ def default(self, o: Any) -> Any:
46
+ if isinstance(o, datetime):
47
+ return o.isoformat()
48
+ if isinstance(o, pydantic.BaseModel):
49
+ return model_dump(o, exclude_unset=True, mode="json", by_alias=True)
50
+ return super().default(o)
@@ -68,9 +68,9 @@ class InteractionsResource(SyncAPIResource):
68
68
  def create(
69
69
  self,
70
70
  *,
71
+ api_version: str | None = None,
71
72
  input: interaction_create_params.Input,
72
73
  model: ModelParam,
73
- api_version: str | None = None,
74
74
  background: bool | Omit = omit,
75
75
  generation_config: GenerationConfigParam | Omit = omit,
76
76
  previous_interaction_id: str | Omit = omit,
@@ -131,10 +131,10 @@ class InteractionsResource(SyncAPIResource):
131
131
  def create(
132
132
  self,
133
133
  *,
134
+ api_version: str | None = None,
134
135
  input: interaction_create_params.Input,
135
136
  model: ModelParam,
136
137
  stream: Literal[True],
137
- api_version: str | None = None,
138
138
  background: bool | Omit = omit,
139
139
  generation_config: GenerationConfigParam | Omit = omit,
140
140
  previous_interaction_id: str | Omit = omit,
@@ -194,9 +194,9 @@ class InteractionsResource(SyncAPIResource):
194
194
  def create(
195
195
  self,
196
196
  *,
197
+ api_version: str | None = None,
197
198
  agent: Union[str, Literal["deep-research-pro-preview-12-2025"]],
198
199
  input: interaction_create_params.Input,
199
- api_version: str | None = None,
200
200
  agent_config: interaction_create_params.AgentConfig | Omit = omit,
201
201
  background: bool | Omit = omit,
202
202
  previous_interaction_id: str | Omit = omit,
@@ -257,10 +257,10 @@ class InteractionsResource(SyncAPIResource):
257
257
  def create(
258
258
  self,
259
259
  *,
260
+ api_version: str | None = None,
260
261
  agent: Union[str, Literal["deep-research-pro-preview-12-2025"]],
261
262
  input: interaction_create_params.Input,
262
263
  stream: Literal[True],
263
- api_version: str | None = None,
264
264
  agent_config: interaction_create_params.AgentConfig | Omit = omit,
265
265
  background: bool | Omit = omit,
266
266
  previous_interaction_id: str | Omit = omit,
@@ -320,10 +320,10 @@ class InteractionsResource(SyncAPIResource):
320
320
  def create(
321
321
  self,
322
322
  *,
323
+ api_version: str | None = None,
323
324
  input: interaction_create_params.Input,
324
325
  model: ModelParam,
325
326
  stream: bool,
326
- api_version: str | None = None,
327
327
  background: bool | Omit = omit,
328
328
  generation_config: GenerationConfigParam | Omit = omit,
329
329
  previous_interaction_id: str | Omit = omit,
@@ -383,9 +383,9 @@ class InteractionsResource(SyncAPIResource):
383
383
  def create(
384
384
  self,
385
385
  *,
386
+ api_version: str | None = None,
386
387
  input: interaction_create_params.Input,
387
388
  model: ModelParam | Omit = omit,
388
- api_version: str | None = None,
389
389
  background: bool | Omit = omit,
390
390
  generation_config: GenerationConfigParam | Omit = omit,
391
391
  previous_interaction_id: str | Omit = omit,
@@ -468,12 +468,12 @@ class InteractionsResource(SyncAPIResource):
468
468
 
469
469
  timeout: Override the client-level default timeout for this request, in seconds
470
470
  """
471
- if not id:
472
- raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
473
471
  if api_version is None:
474
472
  api_version = self._client._get_api_version_path_param()
475
473
  if not api_version:
476
474
  raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
475
+ if not id:
476
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
477
477
  return self._delete(
478
478
  self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}'),
479
479
  options=make_request_options(
@@ -507,12 +507,12 @@ class InteractionsResource(SyncAPIResource):
507
507
 
508
508
  timeout: Override the client-level default timeout for this request, in seconds
509
509
  """
510
- if not id:
511
- raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
512
510
  if api_version is None:
513
511
  api_version = self._client._get_api_version_path_param()
514
512
  if not api_version:
515
513
  raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
514
+ if not id:
515
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
516
516
  return self._post(
517
517
  self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}/cancel'),
518
518
  options=make_request_options(
@@ -527,6 +527,7 @@ class InteractionsResource(SyncAPIResource):
527
527
  id: str,
528
528
  *,
529
529
  api_version: str | None = None,
530
+ include_input: bool | Omit = omit,
530
531
  last_event_id: str | Omit = omit,
531
532
  stream: Literal[False] | Omit = omit,
532
533
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -540,6 +541,8 @@ class InteractionsResource(SyncAPIResource):
540
541
  Retrieves the full details of a single interaction based on its `Interaction.id`.
541
542
 
542
543
  Args:
544
+ include_input: If set to true, includes the input in the response.
545
+
543
546
  last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
544
547
 
545
548
  stream: If set to true, the generated content will be streamed incrementally.
@@ -559,8 +562,9 @@ class InteractionsResource(SyncAPIResource):
559
562
  self,
560
563
  id: str,
561
564
  *,
562
- stream: Literal[True],
563
565
  api_version: str | None = None,
566
+ stream: Literal[True],
567
+ include_input: bool | Omit = omit,
564
568
  last_event_id: str | Omit = omit,
565
569
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
566
570
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -575,6 +579,8 @@ class InteractionsResource(SyncAPIResource):
575
579
  Args:
576
580
  stream: If set to true, the generated content will be streamed incrementally.
577
581
 
582
+ include_input: If set to true, includes the input in the response.
583
+
578
584
  last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
579
585
 
580
586
  extra_headers: Send extra headers
@@ -592,8 +598,9 @@ class InteractionsResource(SyncAPIResource):
592
598
  self,
593
599
  id: str,
594
600
  *,
595
- stream: bool,
596
601
  api_version: str | None = None,
602
+ stream: bool,
603
+ include_input: bool | Omit = omit,
597
604
  last_event_id: str | Omit = omit,
598
605
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
599
606
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -608,6 +615,8 @@ class InteractionsResource(SyncAPIResource):
608
615
  Args:
609
616
  stream: If set to true, the generated content will be streamed incrementally.
610
617
 
618
+ include_input: If set to true, includes the input in the response.
619
+
611
620
  last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
612
621
 
613
622
  extra_headers: Send extra headers
@@ -625,6 +634,7 @@ class InteractionsResource(SyncAPIResource):
625
634
  id: str,
626
635
  *,
627
636
  api_version: str | None = None,
637
+ include_input: bool | Omit = omit,
628
638
  last_event_id: str | Omit = omit,
629
639
  stream: Literal[False] | Literal[True] | Omit = omit,
630
640
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -634,12 +644,12 @@ class InteractionsResource(SyncAPIResource):
634
644
  extra_body: Body | None = None,
635
645
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
636
646
  ) -> Interaction | Stream[InteractionSSEEvent]:
637
- if not id:
638
- raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
639
647
  if api_version is None:
640
648
  api_version = self._client._get_api_version_path_param()
641
649
  if not api_version:
642
650
  raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
651
+ if not id:
652
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
643
653
  return self._get(
644
654
  self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}'),
645
655
  options=make_request_options(
@@ -649,6 +659,7 @@ class InteractionsResource(SyncAPIResource):
649
659
  timeout=timeout,
650
660
  query=maybe_transform(
651
661
  {
662
+ "include_input": include_input,
652
663
  "last_event_id": last_event_id,
653
664
  "stream": stream,
654
665
  },
@@ -685,9 +696,9 @@ class AsyncInteractionsResource(AsyncAPIResource):
685
696
  async def create(
686
697
  self,
687
698
  *,
699
+ api_version: str | None = None,
688
700
  input: interaction_create_params.Input,
689
701
  model: ModelParam,
690
- api_version: str | None = None,
691
702
  background: bool | Omit = omit,
692
703
  generation_config: GenerationConfigParam | Omit = omit,
693
704
  previous_interaction_id: str | Omit = omit,
@@ -748,10 +759,10 @@ class AsyncInteractionsResource(AsyncAPIResource):
748
759
  async def create(
749
760
  self,
750
761
  *,
762
+ api_version: str | None = None,
751
763
  input: interaction_create_params.Input,
752
764
  model: ModelParam,
753
765
  stream: Literal[True],
754
- api_version: str | None = None,
755
766
  background: bool | Omit = omit,
756
767
  generation_config: GenerationConfigParam | Omit = omit,
757
768
  previous_interaction_id: str | Omit = omit,
@@ -811,9 +822,9 @@ class AsyncInteractionsResource(AsyncAPIResource):
811
822
  async def create(
812
823
  self,
813
824
  *,
825
+ api_version: str | None = None,
814
826
  agent: Union[str, Literal["deep-research-pro-preview-12-2025"]],
815
827
  input: interaction_create_params.Input,
816
- api_version: str | None = None,
817
828
  agent_config: interaction_create_params.AgentConfig | Omit = omit,
818
829
  background: bool | Omit = omit,
819
830
  previous_interaction_id: str | Omit = omit,
@@ -874,10 +885,10 @@ class AsyncInteractionsResource(AsyncAPIResource):
874
885
  async def create(
875
886
  self,
876
887
  *,
888
+ api_version: str | None = None,
877
889
  agent: Union[str, Literal["deep-research-pro-preview-12-2025"]],
878
890
  input: interaction_create_params.Input,
879
891
  stream: Literal[True],
880
- api_version: str | None = None,
881
892
  agent_config: interaction_create_params.AgentConfig | Omit = omit,
882
893
  background: bool | Omit = omit,
883
894
  previous_interaction_id: str | Omit = omit,
@@ -937,10 +948,10 @@ class AsyncInteractionsResource(AsyncAPIResource):
937
948
  async def create(
938
949
  self,
939
950
  *,
951
+ api_version: str | None = None,
940
952
  input: interaction_create_params.Input,
941
953
  model: ModelParam,
942
954
  stream: bool,
943
- api_version: str | None = None,
944
955
  background: bool | Omit = omit,
945
956
  generation_config: GenerationConfigParam | Omit = omit,
946
957
  previous_interaction_id: str | Omit = omit,
@@ -1000,9 +1011,9 @@ class AsyncInteractionsResource(AsyncAPIResource):
1000
1011
  async def create(
1001
1012
  self,
1002
1013
  *,
1014
+ api_version: str | None = None,
1003
1015
  input: interaction_create_params.Input,
1004
1016
  model: ModelParam | Omit = omit,
1005
- api_version: str | None = None,
1006
1017
  background: bool | Omit = omit,
1007
1018
  generation_config: GenerationConfigParam | Omit = omit,
1008
1019
  previous_interaction_id: str | Omit = omit,
@@ -1085,12 +1096,12 @@ class AsyncInteractionsResource(AsyncAPIResource):
1085
1096
 
1086
1097
  timeout: Override the client-level default timeout for this request, in seconds
1087
1098
  """
1088
- if not id:
1089
- raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1090
1099
  if api_version is None:
1091
1100
  api_version = self._client._get_api_version_path_param()
1092
1101
  if not api_version:
1093
1102
  raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
1103
+ if not id:
1104
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1094
1105
  return await self._delete(
1095
1106
  self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}'),
1096
1107
  options=make_request_options(
@@ -1124,12 +1135,12 @@ class AsyncInteractionsResource(AsyncAPIResource):
1124
1135
 
1125
1136
  timeout: Override the client-level default timeout for this request, in seconds
1126
1137
  """
1127
- if not id:
1128
- raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1129
1138
  if api_version is None:
1130
1139
  api_version = self._client._get_api_version_path_param()
1131
1140
  if not api_version:
1132
1141
  raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
1142
+ if not id:
1143
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1133
1144
  return await self._post(
1134
1145
  self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}/cancel'),
1135
1146
  options=make_request_options(
@@ -1144,6 +1155,7 @@ class AsyncInteractionsResource(AsyncAPIResource):
1144
1155
  id: str,
1145
1156
  *,
1146
1157
  api_version: str | None = None,
1158
+ include_input: bool | Omit = omit,
1147
1159
  last_event_id: str | Omit = omit,
1148
1160
  stream: Literal[False] | Omit = omit,
1149
1161
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1157,6 +1169,8 @@ class AsyncInteractionsResource(AsyncAPIResource):
1157
1169
  Retrieves the full details of a single interaction based on its `Interaction.id`.
1158
1170
 
1159
1171
  Args:
1172
+ include_input: If set to true, includes the input in the response.
1173
+
1160
1174
  last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
1161
1175
 
1162
1176
  stream: If set to true, the generated content will be streamed incrementally.
@@ -1176,8 +1190,9 @@ class AsyncInteractionsResource(AsyncAPIResource):
1176
1190
  self,
1177
1191
  id: str,
1178
1192
  *,
1179
- stream: Literal[True],
1180
1193
  api_version: str | None = None,
1194
+ stream: Literal[True],
1195
+ include_input: bool | Omit = omit,
1181
1196
  last_event_id: str | Omit = omit,
1182
1197
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1183
1198
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -1192,6 +1207,8 @@ class AsyncInteractionsResource(AsyncAPIResource):
1192
1207
  Args:
1193
1208
  stream: If set to true, the generated content will be streamed incrementally.
1194
1209
 
1210
+ include_input: If set to true, includes the input in the response.
1211
+
1195
1212
  last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
1196
1213
 
1197
1214
  extra_headers: Send extra headers
@@ -1209,8 +1226,9 @@ class AsyncInteractionsResource(AsyncAPIResource):
1209
1226
  self,
1210
1227
  id: str,
1211
1228
  *,
1212
- stream: bool,
1213
1229
  api_version: str | None = None,
1230
+ stream: bool,
1231
+ include_input: bool | Omit = omit,
1214
1232
  last_event_id: str | Omit = omit,
1215
1233
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1216
1234
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -1225,6 +1243,8 @@ class AsyncInteractionsResource(AsyncAPIResource):
1225
1243
  Args:
1226
1244
  stream: If set to true, the generated content will be streamed incrementally.
1227
1245
 
1246
+ include_input: If set to true, includes the input in the response.
1247
+
1228
1248
  last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
1229
1249
 
1230
1250
  extra_headers: Send extra headers
@@ -1242,6 +1262,7 @@ class AsyncInteractionsResource(AsyncAPIResource):
1242
1262
  id: str,
1243
1263
  *,
1244
1264
  api_version: str | None = None,
1265
+ include_input: bool | Omit = omit,
1245
1266
  last_event_id: str | Omit = omit,
1246
1267
  stream: Literal[False] | Literal[True] | Omit = omit,
1247
1268
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1251,12 +1272,12 @@ class AsyncInteractionsResource(AsyncAPIResource):
1251
1272
  extra_body: Body | None = None,
1252
1273
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
1253
1274
  ) -> Interaction | AsyncStream[InteractionSSEEvent]:
1254
- if not id:
1255
- raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1256
1275
  if api_version is None:
1257
1276
  api_version = self._client._get_api_version_path_param()
1258
1277
  if not api_version:
1259
1278
  raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}")
1279
+ if not id:
1280
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1260
1281
  return await self._get(
1261
1282
  self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}'),
1262
1283
  options=make_request_options(
@@ -1266,6 +1287,7 @@ class AsyncInteractionsResource(AsyncAPIResource):
1266
1287
  timeout=timeout,
1267
1288
  query=await async_maybe_transform(
1268
1289
  {
1290
+ "include_input": include_input,
1269
1291
  "last_event_id": last_event_id,
1270
1292
  "stream": stream,
1271
1293
  },
@@ -52,7 +52,6 @@ from .annotation_param import AnnotationParam as AnnotationParam
52
52
  from .document_content import DocumentContent as DocumentContent
53
53
  from .tool_choice_type import ToolChoiceType as ToolChoiceType
54
54
  from .generation_config import GenerationConfig as GenerationConfig
55
- from .interaction_event import InteractionEvent as InteractionEvent
56
55
  from .tool_choice_param import ToolChoiceParam as ToolChoiceParam
57
56
  from .document_mime_type import DocumentMimeType as DocumentMimeType
58
57
  from .image_config_param import ImageConfigParam as ImageConfigParam
@@ -76,6 +75,7 @@ from .document_content_param import DocumentContentParam as DocumentContentParam
76
75
  from .interaction_get_params import InteractionGetParams as InteractionGetParams
77
76
  from .function_result_content import FunctionResultContent as FunctionResultContent
78
77
  from .generation_config_param import GenerationConfigParam as GenerationConfigParam
78
+ from .interaction_start_event import InteractionStartEvent as InteractionStartEvent
79
79
  from .document_mime_type_param import DocumentMimeTypeParam as DocumentMimeTypeParam
80
80
  from .file_search_call_content import FileSearchCallContent as FileSearchCallContent
81
81
  from .tool_choice_config_param import ToolChoiceConfigParam as ToolChoiceConfigParam
@@ -88,6 +88,7 @@ from .dynamic_agent_config_param import DynamicAgentConfigParam as DynamicAgentC
88
88
  from .file_search_result_content import FileSearchResultContent as FileSearchResultContent
89
89
  from .google_search_call_content import GoogleSearchCallContent as GoogleSearchCallContent
90
90
  from .google_search_result_param import GoogleSearchResultParam as GoogleSearchResultParam
91
+ from .interaction_complete_event import InteractionCompleteEvent as InteractionCompleteEvent
91
92
  from .url_context_call_arguments import URLContextCallArguments as URLContextCallArguments
92
93
  from .url_context_result_content import URLContextResultContent as URLContextResultContent
93
94
  from .code_execution_call_content import CodeExecutionCallContent as CodeExecutionCallContent
@@ -155,7 +155,7 @@ class DeltaFunctionCallDelta(BaseModel):
155
155
  name: Optional[str] = None
156
156
 
157
157
 
158
- DeltaFunctionResultDeltaResultItemsItem: TypeAlias = Union[str, ImageContent, object]
158
+ DeltaFunctionResultDeltaResultItemsItem: TypeAlias = Union[TextContent, ImageContent, object]
159
159
 
160
160
 
161
161
  class DeltaFunctionResultDeltaResultItems(BaseModel):
@@ -19,11 +19,12 @@ from typing import List, Union, Optional
19
19
  from typing_extensions import Literal, TypeAlias
20
20
 
21
21
  from .._models import BaseModel
22
+ from .text_content import TextContent
22
23
  from .image_content import ImageContent
23
24
 
24
25
  __all__ = ["FunctionResultContent", "Result", "ResultItems", "ResultItemsItem"]
25
26
 
26
- ResultItemsItem: TypeAlias = Union[str, ImageContent, object]
27
+ ResultItemsItem: TypeAlias = Union[TextContent, ImageContent, object]
27
28
 
28
29
 
29
30
  class ResultItems(BaseModel):
@@ -17,19 +17,19 @@
17
17
 
18
18
  from __future__ import annotations
19
19
 
20
- from typing import Union
20
+ from typing import Union, Iterable
21
21
  from typing_extensions import Literal, Required, TypeAlias, TypedDict
22
22
 
23
- from .._types import SequenceNotStr
23
+ from .text_content_param import TextContentParam
24
24
  from .image_content_param import ImageContentParam
25
25
 
26
26
  __all__ = ["FunctionResultContentParam", "Result", "ResultItems", "ResultItemsItem"]
27
27
 
28
- ResultItemsItem: TypeAlias = Union[str, ImageContentParam, object]
28
+ ResultItemsItem: TypeAlias = Union[TextContentParam, ImageContentParam, object]
29
29
 
30
30
 
31
31
  class ResultItems(TypedDict, total=False):
32
- items: SequenceNotStr[ResultItemsItem]
32
+ items: Iterable[ResultItemsItem]
33
33
 
34
34
 
35
35
  Result: TypeAlias = Union[ResultItems, str, object]
@@ -21,16 +21,16 @@ from typing_extensions import Literal
21
21
  from .._models import BaseModel
22
22
  from .interaction import Interaction
23
23
 
24
- __all__ = ["InteractionEvent"]
24
+ __all__ = ["InteractionCompleteEvent"]
25
25
 
26
26
 
27
- class InteractionEvent(BaseModel):
27
+ class InteractionCompleteEvent(BaseModel):
28
28
  event_id: Optional[str] = None
29
29
  """
30
30
  The event_id token to be used to resume the interaction stream, from this event.
31
31
  """
32
32
 
33
- event_type: Optional[Literal["interaction.start", "interaction.complete"]] = None
33
+ event_type: Optional[Literal["interaction.complete"]] = None
34
34
 
35
35
  interaction: Optional[Interaction] = None
36
36
  """The Interaction resource."""
@@ -59,14 +59,14 @@ __all__ = [
59
59
 
60
60
 
61
61
  class BaseCreateModelInteractionParams(TypedDict, total=False):
62
+ api_version: str
63
+
62
64
  input: Required[Input]
63
65
  """The inputs for the interaction."""
64
66
 
65
67
  model: Required[ModelParam]
66
68
  """The name of the `Model` used for generating the interaction."""
67
69
 
68
- api_version: str
69
-
70
70
  background: bool
71
71
  """Input only. Whether to run the model interaction in the background."""
72
72
 
@@ -124,14 +124,14 @@ Input: TypeAlias = Union[
124
124
 
125
125
 
126
126
  class BaseCreateAgentInteractionParams(TypedDict, total=False):
127
+ api_version: str
128
+
127
129
  agent: Required[Union[str, Literal["deep-research-pro-preview-12-2025"]]]
128
130
  """The name of the `Agent` used for generating the interaction."""
129
131
 
130
132
  input: Required[Input]
131
133
  """The inputs for the interaction."""
132
134
 
133
- api_version: str
134
-
135
135
  agent_config: AgentConfig
136
136
  """Configuration for the agent."""
137
137
 
@@ -26,6 +26,9 @@ __all__ = ["InteractionGetParamsBase", "InteractionGetParamsNonStreaming", "Inte
26
26
  class InteractionGetParamsBase(TypedDict, total=False):
27
27
  api_version: str
28
28
 
29
+ include_input: bool
30
+ """If set to true, includes the input in the response."""
31
+
29
32
  last_event_id: str
30
33
  """Optional.
31
34
 
@@ -23,12 +23,21 @@ from .error_event import ErrorEvent
23
23
  from .content_stop import ContentStop
24
24
  from .content_delta import ContentDelta
25
25
  from .content_start import ContentStart
26
- from .interaction_event import InteractionEvent
26
+ from .interaction_start_event import InteractionStartEvent
27
27
  from .interaction_status_update import InteractionStatusUpdate
28
+ from .interaction_complete_event import InteractionCompleteEvent
28
29
 
29
30
  __all__ = ["InteractionSSEEvent"]
30
31
 
31
32
  InteractionSSEEvent: TypeAlias = Annotated[
32
- Union[InteractionEvent, InteractionStatusUpdate, ContentStart, ContentDelta, ContentStop, ErrorEvent],
33
+ Union[
34
+ InteractionStartEvent,
35
+ InteractionCompleteEvent,
36
+ InteractionStatusUpdate,
37
+ ContentStart,
38
+ ContentDelta,
39
+ ContentStop,
40
+ ErrorEvent,
41
+ ],
33
42
  PropertyInfo(discriminator="event_type"),
34
43
  ]
@@ -0,0 +1,36 @@
1
+ # Copyright 2025 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+
16
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17
+
18
+ from typing import Optional
19
+ from typing_extensions import Literal
20
+
21
+ from .._models import BaseModel
22
+ from .interaction import Interaction
23
+
24
+ __all__ = ["InteractionStartEvent"]
25
+
26
+
27
+ class InteractionStartEvent(BaseModel):
28
+ event_id: Optional[str] = None
29
+ """
30
+ The event_id token to be used to resume the interaction stream, from this event.
31
+ """
32
+
33
+ event_type: Optional[Literal["interaction.start"]] = None
34
+
35
+ interaction: Optional[Interaction] = None
36
+ """The Interaction resource."""
google/genai/batches.py CHANGED
@@ -1208,6 +1208,9 @@ def _InlinedResponse_from_mldev(
1208
1208
  ),
1209
1209
  )
1210
1210
 
1211
+ if getv(from_object, ['metadata']) is not None:
1212
+ setv(to_object, ['metadata'], getv(from_object, ['metadata']))
1213
+
1211
1214
  if getv(from_object, ['error']) is not None:
1212
1215
  setv(to_object, ['error'], getv(from_object, ['error']))
1213
1216