google-genai 1.14.0__py3-none-any.whl → 1.15.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.
@@ -32,6 +32,7 @@ import math
32
32
  import os
33
33
  import ssl
34
34
  import sys
35
+ import threading
35
36
  import time
36
37
  from typing import Any, AsyncIterator, Optional, Tuple, Union
37
38
  from urllib.parse import urlparse
@@ -376,10 +377,12 @@ class BaseApiClient:
376
377
  # credentials. This is crucial for thread safety when multiple coroutines
377
378
  # might be accessing the credentials at the same time.
378
379
  try:
379
- self._auth_lock = asyncio.Lock()
380
+ self._sync_auth_lock = threading.Lock()
381
+ self._async_auth_lock = asyncio.Lock()
380
382
  except RuntimeError:
381
383
  asyncio.set_event_loop(asyncio.new_event_loop())
382
- self._auth_lock = asyncio.Lock()
384
+ self._sync_auth_lock = threading.Lock()
385
+ self._async_auth_lock = asyncio.Lock()
383
386
 
384
387
  # Handle when to use Vertex AI in express mode (api key).
385
388
  # Explicit initializer arguments are already validated above.
@@ -519,25 +522,26 @@ class BaseApiClient:
519
522
 
520
523
  def _access_token(self) -> str:
521
524
  """Retrieves the access token for the credentials."""
522
- if not self._credentials:
523
- self._credentials, project = _load_auth(project=self.project)
524
- if not self.project:
525
- self.project = project
526
-
527
- if self._credentials:
528
- if self._credentials.expired or not self._credentials.token:
529
- # Only refresh when it needs to. Default expiration is 3600 seconds.
530
- _refresh_auth(self._credentials)
531
- if not self._credentials.token:
525
+ with self._sync_auth_lock:
526
+ if not self._credentials:
527
+ self._credentials, project = _load_auth(project=self.project)
528
+ if not self.project:
529
+ self.project = project
530
+
531
+ if self._credentials:
532
+ if self._credentials.expired or not self._credentials.token:
533
+ # Only refresh when it needs to. Default expiration is 3600 seconds.
534
+ _refresh_auth(self._credentials)
535
+ if not self._credentials.token:
536
+ raise RuntimeError('Could not resolve API token from the environment')
537
+ return self._credentials.token # type: ignore[no-any-return]
538
+ else:
532
539
  raise RuntimeError('Could not resolve API token from the environment')
533
- return self._credentials.token # type: ignore[no-any-return]
534
- else:
535
- raise RuntimeError('Could not resolve API token from the environment')
536
540
 
537
541
  async def _async_access_token(self) -> Union[str, Any]:
538
542
  """Retrieves the access token for the credentials asynchronously."""
539
543
  if not self._credentials:
540
- async with self._auth_lock:
544
+ async with self._async_auth_lock:
541
545
  # This ensures that only one coroutine can execute the auth logic at a
542
546
  # time for thread safety.
543
547
  if not self._credentials:
@@ -551,7 +555,7 @@ class BaseApiClient:
551
555
  if self._credentials:
552
556
  if self._credentials.expired or not self._credentials.token:
553
557
  # Only refresh when it needs to. Default expiration is 3600 seconds.
554
- async with self._auth_lock:
558
+ async with self._async_auth_lock:
555
559
  if self._credentials.expired or not self._credentials.token:
556
560
  # Double check that the credentials expired before refreshing.
557
561
  await asyncio.to_thread(_refresh_auth, self._credentials)
@@ -269,7 +269,7 @@ def _parse_schema_from_parameter(
269
269
  raise ValueError(
270
270
  f'Failed to parse the parameter {param} of function {func_name} for'
271
271
  ' automatic function calling.Automatic function calling works best with'
272
- ' simpler function signature schema,consider manually parse your'
272
+ ' simpler function signature schema, consider manually parsing your'
273
273
  f' function declaration for function {func_name}.'
274
274
  )
275
275
 
@@ -22,6 +22,42 @@ from ._common import get_value_by_path as getv
22
22
  from ._common import set_value_by_path as setv
23
23
 
24
24
 
25
+ def _Blob_to_mldev(
26
+ api_client: BaseApiClient,
27
+ from_object: Union[dict[str, Any], object],
28
+ parent_object: Optional[dict[str, Any]] = None,
29
+ ) -> dict[str, Any]:
30
+ to_object: dict[str, Any] = {}
31
+ if getv(from_object, ['display_name']) is not None:
32
+ raise ValueError('display_name parameter is not supported in Gemini API.')
33
+
34
+ if getv(from_object, ['data']) is not None:
35
+ setv(to_object, ['data'], getv(from_object, ['data']))
36
+
37
+ if getv(from_object, ['mime_type']) is not None:
38
+ setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
39
+
40
+ return to_object
41
+
42
+
43
+ def _Blob_to_vertex(
44
+ api_client: BaseApiClient,
45
+ from_object: Union[dict[str, Any], object],
46
+ parent_object: Optional[dict[str, Any]] = None,
47
+ ) -> dict[str, Any]:
48
+ to_object: dict[str, Any] = {}
49
+ if getv(from_object, ['display_name']) is not None:
50
+ setv(to_object, ['displayName'], getv(from_object, ['display_name']))
51
+
52
+ if getv(from_object, ['data']) is not None:
53
+ setv(to_object, ['data'], getv(from_object, ['data']))
54
+
55
+ if getv(from_object, ['mime_type']) is not None:
56
+ setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
57
+
58
+ return to_object
59
+
60
+
25
61
  def _Part_to_mldev(
26
62
  api_client: BaseApiClient,
27
63
  from_object: Union[dict[str, Any], object],
@@ -34,6 +70,15 @@ def _Part_to_mldev(
34
70
  if getv(from_object, ['thought']) is not None:
35
71
  setv(to_object, ['thought'], getv(from_object, ['thought']))
36
72
 
73
+ if getv(from_object, ['inline_data']) is not None:
74
+ setv(
75
+ to_object,
76
+ ['inlineData'],
77
+ _Blob_to_mldev(
78
+ api_client, getv(from_object, ['inline_data']), to_object
79
+ ),
80
+ )
81
+
37
82
  if getv(from_object, ['code_execution_result']) is not None:
38
83
  setv(
39
84
  to_object,
@@ -57,9 +102,6 @@ def _Part_to_mldev(
57
102
  getv(from_object, ['function_response']),
58
103
  )
59
104
 
60
- if getv(from_object, ['inline_data']) is not None:
61
- setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
62
-
63
105
  if getv(from_object, ['text']) is not None:
64
106
  setv(to_object, ['text'], getv(from_object, ['text']))
65
107
 
@@ -78,6 +120,15 @@ def _Part_to_vertex(
78
120
  if getv(from_object, ['thought']) is not None:
79
121
  setv(to_object, ['thought'], getv(from_object, ['thought']))
80
122
 
123
+ if getv(from_object, ['inline_data']) is not None:
124
+ setv(
125
+ to_object,
126
+ ['inlineData'],
127
+ _Blob_to_vertex(
128
+ api_client, getv(from_object, ['inline_data']), to_object
129
+ ),
130
+ )
131
+
81
132
  if getv(from_object, ['code_execution_result']) is not None:
82
133
  setv(
83
134
  to_object,
@@ -101,9 +152,6 @@ def _Part_to_vertex(
101
152
  getv(from_object, ['function_response']),
102
153
  )
103
154
 
104
- if getv(from_object, ['inline_data']) is not None:
105
- setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
106
-
107
155
  if getv(from_object, ['text']) is not None:
108
156
  setv(to_object, ['text'], getv(from_object, ['text']))
109
157
 
@@ -1720,6 +1768,40 @@ def _LiveServerSetupComplete_from_vertex(
1720
1768
  return to_object
1721
1769
 
1722
1770
 
1771
+ def _Blob_from_mldev(
1772
+ api_client: BaseApiClient,
1773
+ from_object: Union[dict[str, Any], object],
1774
+ parent_object: Optional[dict[str, Any]] = None,
1775
+ ) -> dict[str, Any]:
1776
+ to_object: dict[str, Any] = {}
1777
+
1778
+ if getv(from_object, ['data']) is not None:
1779
+ setv(to_object, ['data'], getv(from_object, ['data']))
1780
+
1781
+ if getv(from_object, ['mimeType']) is not None:
1782
+ setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
1783
+
1784
+ return to_object
1785
+
1786
+
1787
+ def _Blob_from_vertex(
1788
+ api_client: BaseApiClient,
1789
+ from_object: Union[dict[str, Any], object],
1790
+ parent_object: Optional[dict[str, Any]] = None,
1791
+ ) -> dict[str, Any]:
1792
+ to_object: dict[str, Any] = {}
1793
+ if getv(from_object, ['displayName']) is not None:
1794
+ setv(to_object, ['display_name'], getv(from_object, ['displayName']))
1795
+
1796
+ if getv(from_object, ['data']) is not None:
1797
+ setv(to_object, ['data'], getv(from_object, ['data']))
1798
+
1799
+ if getv(from_object, ['mimeType']) is not None:
1800
+ setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
1801
+
1802
+ return to_object
1803
+
1804
+
1723
1805
  def _Part_from_mldev(
1724
1806
  api_client: BaseApiClient,
1725
1807
  from_object: Union[dict[str, Any], object],
@@ -1730,6 +1812,15 @@ def _Part_from_mldev(
1730
1812
  if getv(from_object, ['thought']) is not None:
1731
1813
  setv(to_object, ['thought'], getv(from_object, ['thought']))
1732
1814
 
1815
+ if getv(from_object, ['inlineData']) is not None:
1816
+ setv(
1817
+ to_object,
1818
+ ['inline_data'],
1819
+ _Blob_from_mldev(
1820
+ api_client, getv(from_object, ['inlineData']), to_object
1821
+ ),
1822
+ )
1823
+
1733
1824
  if getv(from_object, ['codeExecutionResult']) is not None:
1734
1825
  setv(
1735
1826
  to_object,
@@ -1753,9 +1844,6 @@ def _Part_from_mldev(
1753
1844
  getv(from_object, ['functionResponse']),
1754
1845
  )
1755
1846
 
1756
- if getv(from_object, ['inlineData']) is not None:
1757
- setv(to_object, ['inline_data'], getv(from_object, ['inlineData']))
1758
-
1759
1847
  if getv(from_object, ['text']) is not None:
1760
1848
  setv(to_object, ['text'], getv(from_object, ['text']))
1761
1849
 
@@ -1774,6 +1862,15 @@ def _Part_from_vertex(
1774
1862
  if getv(from_object, ['thought']) is not None:
1775
1863
  setv(to_object, ['thought'], getv(from_object, ['thought']))
1776
1864
 
1865
+ if getv(from_object, ['inlineData']) is not None:
1866
+ setv(
1867
+ to_object,
1868
+ ['inline_data'],
1869
+ _Blob_from_vertex(
1870
+ api_client, getv(from_object, ['inlineData']), to_object
1871
+ ),
1872
+ )
1873
+
1777
1874
  if getv(from_object, ['codeExecutionResult']) is not None:
1778
1875
  setv(
1779
1876
  to_object,
@@ -1797,9 +1894,6 @@ def _Part_from_vertex(
1797
1894
  getv(from_object, ['functionResponse']),
1798
1895
  )
1799
1896
 
1800
- if getv(from_object, ['inlineData']) is not None:
1801
- setv(to_object, ['inline_data'], getv(from_object, ['inlineData']))
1802
-
1803
1897
  if getv(from_object, ['text']) is not None:
1804
1898
  setv(to_object, ['text'], getv(from_object, ['text']))
1805
1899
 
google/genai/caches.py CHANGED
@@ -30,6 +30,24 @@ from .pagers import AsyncPager, Pager
30
30
  logger = logging.getLogger('google_genai.caches')
31
31
 
32
32
 
33
+ def _Blob_to_mldev(
34
+ api_client: BaseApiClient,
35
+ from_object: Union[dict[str, Any], object],
36
+ parent_object: Optional[dict[str, Any]] = None,
37
+ ) -> dict[str, Any]:
38
+ to_object: dict[str, Any] = {}
39
+ if getv(from_object, ['display_name']) is not None:
40
+ raise ValueError('display_name parameter is not supported in Gemini API.')
41
+
42
+ if getv(from_object, ['data']) is not None:
43
+ setv(to_object, ['data'], getv(from_object, ['data']))
44
+
45
+ if getv(from_object, ['mime_type']) is not None:
46
+ setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
47
+
48
+ return to_object
49
+
50
+
33
51
  def _Part_to_mldev(
34
52
  api_client: BaseApiClient,
35
53
  from_object: Union[dict[str, Any], object],
@@ -42,6 +60,15 @@ def _Part_to_mldev(
42
60
  if getv(from_object, ['thought']) is not None:
43
61
  setv(to_object, ['thought'], getv(from_object, ['thought']))
44
62
 
63
+ if getv(from_object, ['inline_data']) is not None:
64
+ setv(
65
+ to_object,
66
+ ['inlineData'],
67
+ _Blob_to_mldev(
68
+ api_client, getv(from_object, ['inline_data']), to_object
69
+ ),
70
+ )
71
+
45
72
  if getv(from_object, ['code_execution_result']) is not None:
46
73
  setv(
47
74
  to_object,
@@ -65,9 +92,6 @@ def _Part_to_mldev(
65
92
  getv(from_object, ['function_response']),
66
93
  )
67
94
 
68
- if getv(from_object, ['inline_data']) is not None:
69
- setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
70
-
71
95
  if getv(from_object, ['text']) is not None:
72
96
  setv(to_object, ['text'], getv(from_object, ['text']))
73
97
 
@@ -540,6 +564,24 @@ def _ListCachedContentsParameters_to_mldev(
540
564
  return to_object
541
565
 
542
566
 
567
+ def _Blob_to_vertex(
568
+ api_client: BaseApiClient,
569
+ from_object: Union[dict[str, Any], object],
570
+ parent_object: Optional[dict[str, Any]] = None,
571
+ ) -> dict[str, Any]:
572
+ to_object: dict[str, Any] = {}
573
+ if getv(from_object, ['display_name']) is not None:
574
+ setv(to_object, ['displayName'], getv(from_object, ['display_name']))
575
+
576
+ if getv(from_object, ['data']) is not None:
577
+ setv(to_object, ['data'], getv(from_object, ['data']))
578
+
579
+ if getv(from_object, ['mime_type']) is not None:
580
+ setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
581
+
582
+ return to_object
583
+
584
+
543
585
  def _Part_to_vertex(
544
586
  api_client: BaseApiClient,
545
587
  from_object: Union[dict[str, Any], object],
@@ -552,6 +594,15 @@ def _Part_to_vertex(
552
594
  if getv(from_object, ['thought']) is not None:
553
595
  setv(to_object, ['thought'], getv(from_object, ['thought']))
554
596
 
597
+ if getv(from_object, ['inline_data']) is not None:
598
+ setv(
599
+ to_object,
600
+ ['inlineData'],
601
+ _Blob_to_vertex(
602
+ api_client, getv(from_object, ['inline_data']), to_object
603
+ ),
604
+ )
605
+
555
606
  if getv(from_object, ['code_execution_result']) is not None:
556
607
  setv(
557
608
  to_object,
@@ -575,9 +626,6 @@ def _Part_to_vertex(
575
626
  getv(from_object, ['function_response']),
576
627
  )
577
628
 
578
- if getv(from_object, ['inline_data']) is not None:
579
- setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
580
-
581
629
  if getv(from_object, ['text']) is not None:
582
630
  setv(to_object, ['text'], getv(from_object, ['text']))
583
631
 
google/genai/models.py CHANGED
@@ -31,6 +31,24 @@ from .pagers import AsyncPager, Pager
31
31
  logger = logging.getLogger('google_genai.models')
32
32
 
33
33
 
34
+ def _Blob_to_mldev(
35
+ api_client: BaseApiClient,
36
+ from_object: Union[dict[str, Any], object],
37
+ parent_object: Optional[dict[str, Any]] = None,
38
+ ) -> dict[str, Any]:
39
+ to_object: dict[str, Any] = {}
40
+ if getv(from_object, ['display_name']) is not None:
41
+ raise ValueError('display_name parameter is not supported in Gemini API.')
42
+
43
+ if getv(from_object, ['data']) is not None:
44
+ setv(to_object, ['data'], getv(from_object, ['data']))
45
+
46
+ if getv(from_object, ['mime_type']) is not None:
47
+ setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
48
+
49
+ return to_object
50
+
51
+
34
52
  def _Part_to_mldev(
35
53
  api_client: BaseApiClient,
36
54
  from_object: Union[dict[str, Any], object],
@@ -43,6 +61,15 @@ def _Part_to_mldev(
43
61
  if getv(from_object, ['thought']) is not None:
44
62
  setv(to_object, ['thought'], getv(from_object, ['thought']))
45
63
 
64
+ if getv(from_object, ['inline_data']) is not None:
65
+ setv(
66
+ to_object,
67
+ ['inlineData'],
68
+ _Blob_to_mldev(
69
+ api_client, getv(from_object, ['inline_data']), to_object
70
+ ),
71
+ )
72
+
46
73
  if getv(from_object, ['code_execution_result']) is not None:
47
74
  setv(
48
75
  to_object,
@@ -66,9 +93,6 @@ def _Part_to_mldev(
66
93
  getv(from_object, ['function_response']),
67
94
  )
68
95
 
69
- if getv(from_object, ['inline_data']) is not None:
70
- setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
71
-
72
96
  if getv(from_object, ['text']) is not None:
73
97
  setv(to_object, ['text'], getv(from_object, ['text']))
74
98
 
@@ -922,6 +946,13 @@ def _UpdateModelConfig_to_mldev(
922
946
  if getv(from_object, ['description']) is not None:
923
947
  setv(parent_object, ['description'], getv(from_object, ['description']))
924
948
 
949
+ if getv(from_object, ['default_checkpoint_id']) is not None:
950
+ setv(
951
+ parent_object,
952
+ ['defaultCheckpointId'],
953
+ getv(from_object, ['default_checkpoint_id']),
954
+ )
955
+
925
956
  return to_object
926
957
 
927
958
 
@@ -1149,6 +1180,24 @@ def _GenerateVideosParameters_to_mldev(
1149
1180
  return to_object
1150
1181
 
1151
1182
 
1183
+ def _Blob_to_vertex(
1184
+ api_client: BaseApiClient,
1185
+ from_object: Union[dict[str, Any], object],
1186
+ parent_object: Optional[dict[str, Any]] = None,
1187
+ ) -> dict[str, Any]:
1188
+ to_object: dict[str, Any] = {}
1189
+ if getv(from_object, ['display_name']) is not None:
1190
+ setv(to_object, ['displayName'], getv(from_object, ['display_name']))
1191
+
1192
+ if getv(from_object, ['data']) is not None:
1193
+ setv(to_object, ['data'], getv(from_object, ['data']))
1194
+
1195
+ if getv(from_object, ['mime_type']) is not None:
1196
+ setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
1197
+
1198
+ return to_object
1199
+
1200
+
1152
1201
  def _Part_to_vertex(
1153
1202
  api_client: BaseApiClient,
1154
1203
  from_object: Union[dict[str, Any], object],
@@ -1161,6 +1210,15 @@ def _Part_to_vertex(
1161
1210
  if getv(from_object, ['thought']) is not None:
1162
1211
  setv(to_object, ['thought'], getv(from_object, ['thought']))
1163
1212
 
1213
+ if getv(from_object, ['inline_data']) is not None:
1214
+ setv(
1215
+ to_object,
1216
+ ['inlineData'],
1217
+ _Blob_to_vertex(
1218
+ api_client, getv(from_object, ['inline_data']), to_object
1219
+ ),
1220
+ )
1221
+
1164
1222
  if getv(from_object, ['code_execution_result']) is not None:
1165
1223
  setv(
1166
1224
  to_object,
@@ -1184,9 +1242,6 @@ def _Part_to_vertex(
1184
1242
  getv(from_object, ['function_response']),
1185
1243
  )
1186
1244
 
1187
- if getv(from_object, ['inline_data']) is not None:
1188
- setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
1189
-
1190
1245
  if getv(from_object, ['text']) is not None:
1191
1246
  setv(to_object, ['text'], getv(from_object, ['text']))
1192
1247
 
@@ -2472,6 +2527,13 @@ def _UpdateModelConfig_to_vertex(
2472
2527
  if getv(from_object, ['description']) is not None:
2473
2528
  setv(parent_object, ['description'], getv(from_object, ['description']))
2474
2529
 
2530
+ if getv(from_object, ['default_checkpoint_id']) is not None:
2531
+ setv(
2532
+ parent_object,
2533
+ ['defaultCheckpointId'],
2534
+ getv(from_object, ['default_checkpoint_id']),
2535
+ )
2536
+
2475
2537
  return to_object
2476
2538
 
2477
2539
 
@@ -2759,6 +2821,22 @@ def _PersonGeneration_to_mldev_enum_validate(enum_value: Any) -> None:
2759
2821
  raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
2760
2822
 
2761
2823
 
2824
+ def _Blob_from_mldev(
2825
+ api_client: BaseApiClient,
2826
+ from_object: Union[dict[str, Any], object],
2827
+ parent_object: Optional[dict[str, Any]] = None,
2828
+ ) -> dict[str, Any]:
2829
+ to_object: dict[str, Any] = {}
2830
+
2831
+ if getv(from_object, ['data']) is not None:
2832
+ setv(to_object, ['data'], getv(from_object, ['data']))
2833
+
2834
+ if getv(from_object, ['mimeType']) is not None:
2835
+ setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
2836
+
2837
+ return to_object
2838
+
2839
+
2762
2840
  def _Part_from_mldev(
2763
2841
  api_client: BaseApiClient,
2764
2842
  from_object: Union[dict[str, Any], object],
@@ -2769,6 +2847,15 @@ def _Part_from_mldev(
2769
2847
  if getv(from_object, ['thought']) is not None:
2770
2848
  setv(to_object, ['thought'], getv(from_object, ['thought']))
2771
2849
 
2850
+ if getv(from_object, ['inlineData']) is not None:
2851
+ setv(
2852
+ to_object,
2853
+ ['inline_data'],
2854
+ _Blob_from_mldev(
2855
+ api_client, getv(from_object, ['inlineData']), to_object
2856
+ ),
2857
+ )
2858
+
2772
2859
  if getv(from_object, ['codeExecutionResult']) is not None:
2773
2860
  setv(
2774
2861
  to_object,
@@ -2792,9 +2879,6 @@ def _Part_from_mldev(
2792
2879
  getv(from_object, ['functionResponse']),
2793
2880
  )
2794
2881
 
2795
- if getv(from_object, ['inlineData']) is not None:
2796
- setv(to_object, ['inline_data'], getv(from_object, ['inlineData']))
2797
-
2798
2882
  if getv(from_object, ['text']) is not None:
2799
2883
  setv(to_object, ['text'], getv(from_object, ['text']))
2800
2884
 
@@ -3109,6 +3193,16 @@ def _TunedModelInfo_from_mldev(
3109
3193
  return to_object
3110
3194
 
3111
3195
 
3196
+ def _Checkpoint_from_mldev(
3197
+ api_client: BaseApiClient,
3198
+ from_object: Union[dict[str, Any], object],
3199
+ parent_object: Optional[dict[str, Any]] = None,
3200
+ ) -> dict[str, Any]:
3201
+ to_object: dict[str, Any] = {}
3202
+
3203
+ return to_object
3204
+
3205
+
3112
3206
  def _Model_from_mldev(
3113
3207
  api_client: BaseApiClient,
3114
3208
  from_object: Union[dict[str, Any], object],
@@ -3325,6 +3419,24 @@ def _GenerateVideosOperation_from_mldev(
3325
3419
  return to_object
3326
3420
 
3327
3421
 
3422
+ def _Blob_from_vertex(
3423
+ api_client: BaseApiClient,
3424
+ from_object: Union[dict[str, Any], object],
3425
+ parent_object: Optional[dict[str, Any]] = None,
3426
+ ) -> dict[str, Any]:
3427
+ to_object: dict[str, Any] = {}
3428
+ if getv(from_object, ['displayName']) is not None:
3429
+ setv(to_object, ['display_name'], getv(from_object, ['displayName']))
3430
+
3431
+ if getv(from_object, ['data']) is not None:
3432
+ setv(to_object, ['data'], getv(from_object, ['data']))
3433
+
3434
+ if getv(from_object, ['mimeType']) is not None:
3435
+ setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
3436
+
3437
+ return to_object
3438
+
3439
+
3328
3440
  def _Part_from_vertex(
3329
3441
  api_client: BaseApiClient,
3330
3442
  from_object: Union[dict[str, Any], object],
@@ -3337,6 +3449,15 @@ def _Part_from_vertex(
3337
3449
  if getv(from_object, ['thought']) is not None:
3338
3450
  setv(to_object, ['thought'], getv(from_object, ['thought']))
3339
3451
 
3452
+ if getv(from_object, ['inlineData']) is not None:
3453
+ setv(
3454
+ to_object,
3455
+ ['inline_data'],
3456
+ _Blob_from_vertex(
3457
+ api_client, getv(from_object, ['inlineData']), to_object
3458
+ ),
3459
+ )
3460
+
3340
3461
  if getv(from_object, ['codeExecutionResult']) is not None:
3341
3462
  setv(
3342
3463
  to_object,
@@ -3360,9 +3481,6 @@ def _Part_from_vertex(
3360
3481
  getv(from_object, ['functionResponse']),
3361
3482
  )
3362
3483
 
3363
- if getv(from_object, ['inlineData']) is not None:
3364
- setv(to_object, ['inline_data'], getv(from_object, ['inlineData']))
3365
-
3366
3484
  if getv(from_object, ['text']) is not None:
3367
3485
  setv(to_object, ['text'], getv(from_object, ['text']))
3368
3486
 
@@ -3760,6 +3878,24 @@ def _TunedModelInfo_from_vertex(
3760
3878
  return to_object
3761
3879
 
3762
3880
 
3881
+ def _Checkpoint_from_vertex(
3882
+ api_client: BaseApiClient,
3883
+ from_object: Union[dict[str, Any], object],
3884
+ parent_object: Optional[dict[str, Any]] = None,
3885
+ ) -> dict[str, Any]:
3886
+ to_object: dict[str, Any] = {}
3887
+ if getv(from_object, ['checkpointId']) is not None:
3888
+ setv(to_object, ['checkpoint_id'], getv(from_object, ['checkpointId']))
3889
+
3890
+ if getv(from_object, ['epoch']) is not None:
3891
+ setv(to_object, ['epoch'], getv(from_object, ['epoch']))
3892
+
3893
+ if getv(from_object, ['step']) is not None:
3894
+ setv(to_object, ['step'], getv(from_object, ['step']))
3895
+
3896
+ return to_object
3897
+
3898
+
3763
3899
  def _Model_from_vertex(
3764
3900
  api_client: BaseApiClient,
3765
3901
  from_object: Union[dict[str, Any], object],
@@ -3800,6 +3936,23 @@ def _Model_from_vertex(
3800
3936
  ),
3801
3937
  )
3802
3938
 
3939
+ if getv(from_object, ['defaultCheckpointId']) is not None:
3940
+ setv(
3941
+ to_object,
3942
+ ['default_checkpoint_id'],
3943
+ getv(from_object, ['defaultCheckpointId']),
3944
+ )
3945
+
3946
+ if getv(from_object, ['checkpoints']) is not None:
3947
+ setv(
3948
+ to_object,
3949
+ ['checkpoints'],
3950
+ [
3951
+ _Checkpoint_from_vertex(api_client, item, to_object)
3952
+ for item in getv(from_object, ['checkpoints'])
3953
+ ],
3954
+ )
3955
+
3803
3956
  return to_object
3804
3957
 
3805
3958