google-genai 1.12.1__py3-none-any.whl → 1.13.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.
@@ -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 os
17
+ from typing import Optional
18
+
19
+ from .types import HttpOptions
20
+
21
+ _default_base_gemini_url = None
22
+ _default_base_vertex_url = None
23
+
24
+
25
+ def set_default_base_urls(
26
+ gemini_url: Optional[str], vertex_url: Optional[str]
27
+ ) -> None:
28
+ """Overrides the base URLs for the Gemini API and Vertex AI API."""
29
+ global _default_base_gemini_url, _default_base_vertex_url
30
+ _default_base_gemini_url = gemini_url
31
+ _default_base_vertex_url = vertex_url
32
+
33
+
34
+ def get_base_url(
35
+ vertexai: bool,
36
+ http_options: Optional[HttpOptions] = None,
37
+ ) -> Optional[str]:
38
+ """Returns the default base URL based on the following priority.
39
+
40
+ 1. Base URLs set via HttpOptions.
41
+ 2. Base URLs set via the latest call to setDefaultBaseUrls.
42
+ 3. Base URLs set via environment variables.
43
+ """
44
+ if http_options and http_options.base_url:
45
+ return http_options.base_url
46
+
47
+ if vertexai:
48
+ return _default_base_vertex_url or os.getenv('GOOGLE_VERTEX_BASE_URL')
49
+ else:
50
+ return _default_base_gemini_url or os.getenv('GOOGLE_GEMINI_BASE_URL')
@@ -154,212 +154,6 @@ def _Content_to_vertex(
154
154
  return to_object
155
155
 
156
156
 
157
- def _Schema_to_mldev(
158
- api_client: BaseApiClient,
159
- from_object: Union[dict[str, Any], object],
160
- parent_object: Optional[dict[str, Any]] = None,
161
- ) -> dict[str, Any]:
162
- to_object: dict[str, Any] = {}
163
- if getv(from_object, ['example']) is not None:
164
- raise ValueError('example parameter is not supported in Gemini API.')
165
-
166
- if getv(from_object, ['pattern']) is not None:
167
- raise ValueError('pattern parameter is not supported in Gemini API.')
168
-
169
- if getv(from_object, ['default']) is not None:
170
- raise ValueError('default parameter is not supported in Gemini API.')
171
-
172
- if getv(from_object, ['max_length']) is not None:
173
- raise ValueError('max_length parameter is not supported in Gemini API.')
174
-
175
- if getv(from_object, ['min_length']) is not None:
176
- raise ValueError('min_length parameter is not supported in Gemini API.')
177
-
178
- if getv(from_object, ['min_properties']) is not None:
179
- raise ValueError('min_properties parameter is not supported in Gemini API.')
180
-
181
- if getv(from_object, ['max_properties']) is not None:
182
- raise ValueError('max_properties parameter is not supported in Gemini API.')
183
-
184
- if getv(from_object, ['any_of']) is not None:
185
- setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
186
-
187
- if getv(from_object, ['description']) is not None:
188
- setv(to_object, ['description'], getv(from_object, ['description']))
189
-
190
- if getv(from_object, ['enum']) is not None:
191
- setv(to_object, ['enum'], getv(from_object, ['enum']))
192
-
193
- if getv(from_object, ['format']) is not None:
194
- setv(to_object, ['format'], getv(from_object, ['format']))
195
-
196
- if getv(from_object, ['items']) is not None:
197
- setv(to_object, ['items'], getv(from_object, ['items']))
198
-
199
- if getv(from_object, ['max_items']) is not None:
200
- setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
201
-
202
- if getv(from_object, ['maximum']) is not None:
203
- setv(to_object, ['maximum'], getv(from_object, ['maximum']))
204
-
205
- if getv(from_object, ['min_items']) is not None:
206
- setv(to_object, ['minItems'], getv(from_object, ['min_items']))
207
-
208
- if getv(from_object, ['minimum']) is not None:
209
- setv(to_object, ['minimum'], getv(from_object, ['minimum']))
210
-
211
- if getv(from_object, ['nullable']) is not None:
212
- setv(to_object, ['nullable'], getv(from_object, ['nullable']))
213
-
214
- if getv(from_object, ['properties']) is not None:
215
- setv(to_object, ['properties'], getv(from_object, ['properties']))
216
-
217
- if getv(from_object, ['property_ordering']) is not None:
218
- setv(
219
- to_object,
220
- ['propertyOrdering'],
221
- getv(from_object, ['property_ordering']),
222
- )
223
-
224
- if getv(from_object, ['required']) is not None:
225
- setv(to_object, ['required'], getv(from_object, ['required']))
226
-
227
- if getv(from_object, ['title']) is not None:
228
- setv(to_object, ['title'], getv(from_object, ['title']))
229
-
230
- if getv(from_object, ['type']) is not None:
231
- setv(to_object, ['type'], getv(from_object, ['type']))
232
-
233
- return to_object
234
-
235
-
236
- def _Schema_to_vertex(
237
- api_client: BaseApiClient,
238
- from_object: Union[dict[str, Any], object],
239
- parent_object: Optional[dict[str, Any]] = None,
240
- ) -> dict[str, Any]:
241
- to_object: dict[str, Any] = {}
242
- if getv(from_object, ['example']) is not None:
243
- setv(to_object, ['example'], getv(from_object, ['example']))
244
-
245
- if getv(from_object, ['pattern']) is not None:
246
- setv(to_object, ['pattern'], getv(from_object, ['pattern']))
247
-
248
- if getv(from_object, ['default']) is not None:
249
- setv(to_object, ['default'], getv(from_object, ['default']))
250
-
251
- if getv(from_object, ['max_length']) is not None:
252
- setv(to_object, ['maxLength'], getv(from_object, ['max_length']))
253
-
254
- if getv(from_object, ['min_length']) is not None:
255
- setv(to_object, ['minLength'], getv(from_object, ['min_length']))
256
-
257
- if getv(from_object, ['min_properties']) is not None:
258
- setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
259
-
260
- if getv(from_object, ['max_properties']) is not None:
261
- setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
262
-
263
- if getv(from_object, ['any_of']) is not None:
264
- setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
265
-
266
- if getv(from_object, ['description']) is not None:
267
- setv(to_object, ['description'], getv(from_object, ['description']))
268
-
269
- if getv(from_object, ['enum']) is not None:
270
- setv(to_object, ['enum'], getv(from_object, ['enum']))
271
-
272
- if getv(from_object, ['format']) is not None:
273
- setv(to_object, ['format'], getv(from_object, ['format']))
274
-
275
- if getv(from_object, ['items']) is not None:
276
- setv(to_object, ['items'], getv(from_object, ['items']))
277
-
278
- if getv(from_object, ['max_items']) is not None:
279
- setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
280
-
281
- if getv(from_object, ['maximum']) is not None:
282
- setv(to_object, ['maximum'], getv(from_object, ['maximum']))
283
-
284
- if getv(from_object, ['min_items']) is not None:
285
- setv(to_object, ['minItems'], getv(from_object, ['min_items']))
286
-
287
- if getv(from_object, ['minimum']) is not None:
288
- setv(to_object, ['minimum'], getv(from_object, ['minimum']))
289
-
290
- if getv(from_object, ['nullable']) is not None:
291
- setv(to_object, ['nullable'], getv(from_object, ['nullable']))
292
-
293
- if getv(from_object, ['properties']) is not None:
294
- setv(to_object, ['properties'], getv(from_object, ['properties']))
295
-
296
- if getv(from_object, ['property_ordering']) is not None:
297
- setv(
298
- to_object,
299
- ['propertyOrdering'],
300
- getv(from_object, ['property_ordering']),
301
- )
302
-
303
- if getv(from_object, ['required']) is not None:
304
- setv(to_object, ['required'], getv(from_object, ['required']))
305
-
306
- if getv(from_object, ['title']) is not None:
307
- setv(to_object, ['title'], getv(from_object, ['title']))
308
-
309
- if getv(from_object, ['type']) is not None:
310
- setv(to_object, ['type'], getv(from_object, ['type']))
311
-
312
- return to_object
313
-
314
-
315
- def _FunctionDeclaration_to_mldev(
316
- api_client: BaseApiClient,
317
- from_object: Union[dict[str, Any], object],
318
- parent_object: Optional[dict[str, Any]] = None,
319
- ) -> dict[str, Any]:
320
- to_object: dict[str, Any] = {}
321
- if getv(from_object, ['response']) is not None:
322
- raise ValueError('response parameter is not supported in Gemini API.')
323
-
324
- if getv(from_object, ['description']) is not None:
325
- setv(to_object, ['description'], getv(from_object, ['description']))
326
-
327
- if getv(from_object, ['name']) is not None:
328
- setv(to_object, ['name'], getv(from_object, ['name']))
329
-
330
- if getv(from_object, ['parameters']) is not None:
331
- setv(to_object, ['parameters'], getv(from_object, ['parameters']))
332
-
333
- return to_object
334
-
335
-
336
- def _FunctionDeclaration_to_vertex(
337
- api_client: BaseApiClient,
338
- from_object: Union[dict[str, Any], object],
339
- parent_object: Optional[dict[str, Any]] = None,
340
- ) -> dict[str, Any]:
341
- to_object: dict[str, Any] = {}
342
- if getv(from_object, ['response']) is not None:
343
- setv(
344
- to_object,
345
- ['response'],
346
- _Schema_to_vertex(
347
- api_client, getv(from_object, ['response']), to_object
348
- ),
349
- )
350
-
351
- if getv(from_object, ['description']) is not None:
352
- setv(to_object, ['description'], getv(from_object, ['description']))
353
-
354
- if getv(from_object, ['name']) is not None:
355
- setv(to_object, ['name'], getv(from_object, ['name']))
356
-
357
- if getv(from_object, ['parameters']) is not None:
358
- setv(to_object, ['parameters'], getv(from_object, ['parameters']))
359
-
360
- return to_object
361
-
362
-
363
157
  def _GoogleSearch_to_mldev(
364
158
  api_client: BaseApiClient,
365
159
  from_object: Union[dict[str, Any], object],
@@ -464,16 +258,6 @@ def _Tool_to_mldev(
464
258
  parent_object: Optional[dict[str, Any]] = None,
465
259
  ) -> dict[str, Any]:
466
260
  to_object: dict[str, Any] = {}
467
- if getv(from_object, ['function_declarations']) is not None:
468
- setv(
469
- to_object,
470
- ['functionDeclarations'],
471
- [
472
- _FunctionDeclaration_to_mldev(api_client, item, to_object)
473
- for item in getv(from_object, ['function_declarations'])
474
- ],
475
- )
476
-
477
261
  if getv(from_object, ['retrieval']) is not None:
478
262
  raise ValueError('retrieval parameter is not supported in Gemini API.')
479
263
 
@@ -500,6 +284,13 @@ def _Tool_to_mldev(
500
284
  if getv(from_object, ['code_execution']) is not None:
501
285
  setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
502
286
 
287
+ if getv(from_object, ['function_declarations']) is not None:
288
+ setv(
289
+ to_object,
290
+ ['functionDeclarations'],
291
+ getv(from_object, ['function_declarations']),
292
+ )
293
+
503
294
  return to_object
504
295
 
505
296
 
@@ -509,16 +300,6 @@ def _Tool_to_vertex(
509
300
  parent_object: Optional[dict[str, Any]] = None,
510
301
  ) -> dict[str, Any]:
511
302
  to_object: dict[str, Any] = {}
512
- if getv(from_object, ['function_declarations']) is not None:
513
- setv(
514
- to_object,
515
- ['functionDeclarations'],
516
- [
517
- _FunctionDeclaration_to_vertex(api_client, item, to_object)
518
- for item in getv(from_object, ['function_declarations'])
519
- ],
520
- )
521
-
522
303
  if getv(from_object, ['retrieval']) is not None:
523
304
  setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
524
305
 
@@ -545,6 +326,13 @@ def _Tool_to_vertex(
545
326
  if getv(from_object, ['code_execution']) is not None:
546
327
  setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
547
328
 
329
+ if getv(from_object, ['function_declarations']) is not None:
330
+ setv(
331
+ to_object,
332
+ ['functionDeclarations'],
333
+ getv(from_object, ['function_declarations']),
334
+ )
335
+
548
336
  return to_object
549
337
 
550
338
 
@@ -1887,6 +1675,13 @@ def _LiveServerContent_from_mldev(
1887
1675
  if getv(from_object, ['interrupted']) is not None:
1888
1676
  setv(to_object, ['interrupted'], getv(from_object, ['interrupted']))
1889
1677
 
1678
+ if getv(from_object, ['groundingMetadata']) is not None:
1679
+ setv(
1680
+ to_object,
1681
+ ['grounding_metadata'],
1682
+ getv(from_object, ['groundingMetadata']),
1683
+ )
1684
+
1890
1685
  if getv(from_object, ['generationComplete']) is not None:
1891
1686
  setv(
1892
1687
  to_object,
@@ -1936,6 +1731,13 @@ def _LiveServerContent_from_vertex(
1936
1731
  if getv(from_object, ['interrupted']) is not None:
1937
1732
  setv(to_object, ['interrupted'], getv(from_object, ['interrupted']))
1938
1733
 
1734
+ if getv(from_object, ['groundingMetadata']) is not None:
1735
+ setv(
1736
+ to_object,
1737
+ ['grounding_metadata'],
1738
+ getv(from_object, ['groundingMetadata']),
1739
+ )
1740
+
1939
1741
  if getv(from_object, ['generationComplete']) is not None:
1940
1742
  setv(
1941
1743
  to_object,
@@ -790,7 +790,7 @@ def t_schema(
790
790
  if not origin:
791
791
  return None
792
792
  if isinstance(origin, dict) and _is_type_dict_str_any(origin):
793
- process_schema(origin, client, order_properties=False)
793
+ process_schema(origin, client)
794
794
  return types.Schema.model_validate(origin)
795
795
  if isinstance(origin, EnumMeta):
796
796
  return _process_enum(origin, client)
@@ -799,7 +799,7 @@ def t_schema(
799
799
  # response_schema value was coerced to an empty Schema instance because it did not adhere to the Schema field annotation
800
800
  raise ValueError(f'Unsupported schema type.')
801
801
  schema = origin.model_dump(exclude_unset=True)
802
- process_schema(schema, client, order_properties=False)
802
+ process_schema(schema, client)
803
803
  return types.Schema.model_validate(schema)
804
804
 
805
805
  if (
google/genai/batches.py CHANGED
@@ -743,7 +743,7 @@ class Batches(_api_module.BaseModule):
743
743
  .. code-block:: python
744
744
 
745
745
  batch_job = client.batches.create(
746
- model="gemini-1.5-flash",
746
+ model="gemini-2.0-flash-001",
747
747
  src="gs://path/to/input/data",
748
748
  )
749
749
  print(batch_job.state)
@@ -1113,7 +1113,7 @@ class AsyncBatches(_api_module.BaseModule):
1113
1113
  .. code-block:: python
1114
1114
 
1115
1115
  batch_job = await client.aio.batches.create(
1116
- model="gemini-1.5-flash",
1116
+ model="gemini-2.0-flash-001",
1117
1117
  src="gs://path/to/input/data",
1118
1118
  )
1119
1119
  """
google/genai/caches.py CHANGED
@@ -96,106 +96,6 @@ def _Content_to_mldev(
96
96
  return to_object
97
97
 
98
98
 
99
- def _Schema_to_mldev(
100
- api_client: BaseApiClient,
101
- from_object: Union[dict[str, Any], object],
102
- parent_object: Optional[dict[str, Any]] = None,
103
- ) -> dict[str, Any]:
104
- to_object: dict[str, Any] = {}
105
- if getv(from_object, ['example']) is not None:
106
- raise ValueError('example parameter is not supported in Gemini API.')
107
-
108
- if getv(from_object, ['pattern']) is not None:
109
- raise ValueError('pattern parameter is not supported in Gemini API.')
110
-
111
- if getv(from_object, ['default']) is not None:
112
- raise ValueError('default parameter is not supported in Gemini API.')
113
-
114
- if getv(from_object, ['max_length']) is not None:
115
- raise ValueError('max_length parameter is not supported in Gemini API.')
116
-
117
- if getv(from_object, ['min_length']) is not None:
118
- raise ValueError('min_length parameter is not supported in Gemini API.')
119
-
120
- if getv(from_object, ['min_properties']) is not None:
121
- raise ValueError('min_properties parameter is not supported in Gemini API.')
122
-
123
- if getv(from_object, ['max_properties']) is not None:
124
- raise ValueError('max_properties parameter is not supported in Gemini API.')
125
-
126
- if getv(from_object, ['any_of']) is not None:
127
- setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
128
-
129
- if getv(from_object, ['description']) is not None:
130
- setv(to_object, ['description'], getv(from_object, ['description']))
131
-
132
- if getv(from_object, ['enum']) is not None:
133
- setv(to_object, ['enum'], getv(from_object, ['enum']))
134
-
135
- if getv(from_object, ['format']) is not None:
136
- setv(to_object, ['format'], getv(from_object, ['format']))
137
-
138
- if getv(from_object, ['items']) is not None:
139
- setv(to_object, ['items'], getv(from_object, ['items']))
140
-
141
- if getv(from_object, ['max_items']) is not None:
142
- setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
143
-
144
- if getv(from_object, ['maximum']) is not None:
145
- setv(to_object, ['maximum'], getv(from_object, ['maximum']))
146
-
147
- if getv(from_object, ['min_items']) is not None:
148
- setv(to_object, ['minItems'], getv(from_object, ['min_items']))
149
-
150
- if getv(from_object, ['minimum']) is not None:
151
- setv(to_object, ['minimum'], getv(from_object, ['minimum']))
152
-
153
- if getv(from_object, ['nullable']) is not None:
154
- setv(to_object, ['nullable'], getv(from_object, ['nullable']))
155
-
156
- if getv(from_object, ['properties']) is not None:
157
- setv(to_object, ['properties'], getv(from_object, ['properties']))
158
-
159
- if getv(from_object, ['property_ordering']) is not None:
160
- setv(
161
- to_object,
162
- ['propertyOrdering'],
163
- getv(from_object, ['property_ordering']),
164
- )
165
-
166
- if getv(from_object, ['required']) is not None:
167
- setv(to_object, ['required'], getv(from_object, ['required']))
168
-
169
- if getv(from_object, ['title']) is not None:
170
- setv(to_object, ['title'], getv(from_object, ['title']))
171
-
172
- if getv(from_object, ['type']) is not None:
173
- setv(to_object, ['type'], getv(from_object, ['type']))
174
-
175
- return to_object
176
-
177
-
178
- def _FunctionDeclaration_to_mldev(
179
- api_client: BaseApiClient,
180
- from_object: Union[dict[str, Any], object],
181
- parent_object: Optional[dict[str, Any]] = None,
182
- ) -> dict[str, Any]:
183
- to_object: dict[str, Any] = {}
184
- if getv(from_object, ['response']) is not None:
185
- raise ValueError('response parameter is not supported in Gemini API.')
186
-
187
- if getv(from_object, ['description']) is not None:
188
- setv(to_object, ['description'], getv(from_object, ['description']))
189
-
190
- if getv(from_object, ['name']) is not None:
191
- setv(to_object, ['name'], getv(from_object, ['name']))
192
-
193
- if getv(from_object, ['parameters']) is not None:
194
- setv(to_object, ['parameters'], getv(from_object, ['parameters']))
195
-
196
- return to_object
197
-
198
-
199
99
  def _GoogleSearch_to_mldev(
200
100
  api_client: BaseApiClient,
201
101
  from_object: Union[dict[str, Any], object],
@@ -251,16 +151,6 @@ def _Tool_to_mldev(
251
151
  parent_object: Optional[dict[str, Any]] = None,
252
152
  ) -> dict[str, Any]:
253
153
  to_object: dict[str, Any] = {}
254
- if getv(from_object, ['function_declarations']) is not None:
255
- setv(
256
- to_object,
257
- ['functionDeclarations'],
258
- [
259
- _FunctionDeclaration_to_mldev(api_client, item, to_object)
260
- for item in getv(from_object, ['function_declarations'])
261
- ],
262
- )
263
-
264
154
  if getv(from_object, ['retrieval']) is not None:
265
155
  raise ValueError('retrieval parameter is not supported in Gemini API.')
266
156
 
@@ -287,6 +177,13 @@ def _Tool_to_mldev(
287
177
  if getv(from_object, ['code_execution']) is not None:
288
178
  setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
289
179
 
180
+ if getv(from_object, ['function_declarations']) is not None:
181
+ setv(
182
+ to_object,
183
+ ['functionDeclarations'],
184
+ getv(from_object, ['function_declarations']),
185
+ )
186
+
290
187
  return to_object
291
188
 
292
189
 
@@ -600,112 +497,6 @@ def _Content_to_vertex(
600
497
  return to_object
601
498
 
602
499
 
603
- def _Schema_to_vertex(
604
- api_client: BaseApiClient,
605
- from_object: Union[dict[str, Any], object],
606
- parent_object: Optional[dict[str, Any]] = None,
607
- ) -> dict[str, Any]:
608
- to_object: dict[str, Any] = {}
609
- if getv(from_object, ['example']) is not None:
610
- setv(to_object, ['example'], getv(from_object, ['example']))
611
-
612
- if getv(from_object, ['pattern']) is not None:
613
- setv(to_object, ['pattern'], getv(from_object, ['pattern']))
614
-
615
- if getv(from_object, ['default']) is not None:
616
- setv(to_object, ['default'], getv(from_object, ['default']))
617
-
618
- if getv(from_object, ['max_length']) is not None:
619
- setv(to_object, ['maxLength'], getv(from_object, ['max_length']))
620
-
621
- if getv(from_object, ['min_length']) is not None:
622
- setv(to_object, ['minLength'], getv(from_object, ['min_length']))
623
-
624
- if getv(from_object, ['min_properties']) is not None:
625
- setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
626
-
627
- if getv(from_object, ['max_properties']) is not None:
628
- setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
629
-
630
- if getv(from_object, ['any_of']) is not None:
631
- setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
632
-
633
- if getv(from_object, ['description']) is not None:
634
- setv(to_object, ['description'], getv(from_object, ['description']))
635
-
636
- if getv(from_object, ['enum']) is not None:
637
- setv(to_object, ['enum'], getv(from_object, ['enum']))
638
-
639
- if getv(from_object, ['format']) is not None:
640
- setv(to_object, ['format'], getv(from_object, ['format']))
641
-
642
- if getv(from_object, ['items']) is not None:
643
- setv(to_object, ['items'], getv(from_object, ['items']))
644
-
645
- if getv(from_object, ['max_items']) is not None:
646
- setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
647
-
648
- if getv(from_object, ['maximum']) is not None:
649
- setv(to_object, ['maximum'], getv(from_object, ['maximum']))
650
-
651
- if getv(from_object, ['min_items']) is not None:
652
- setv(to_object, ['minItems'], getv(from_object, ['min_items']))
653
-
654
- if getv(from_object, ['minimum']) is not None:
655
- setv(to_object, ['minimum'], getv(from_object, ['minimum']))
656
-
657
- if getv(from_object, ['nullable']) is not None:
658
- setv(to_object, ['nullable'], getv(from_object, ['nullable']))
659
-
660
- if getv(from_object, ['properties']) is not None:
661
- setv(to_object, ['properties'], getv(from_object, ['properties']))
662
-
663
- if getv(from_object, ['property_ordering']) is not None:
664
- setv(
665
- to_object,
666
- ['propertyOrdering'],
667
- getv(from_object, ['property_ordering']),
668
- )
669
-
670
- if getv(from_object, ['required']) is not None:
671
- setv(to_object, ['required'], getv(from_object, ['required']))
672
-
673
- if getv(from_object, ['title']) is not None:
674
- setv(to_object, ['title'], getv(from_object, ['title']))
675
-
676
- if getv(from_object, ['type']) is not None:
677
- setv(to_object, ['type'], getv(from_object, ['type']))
678
-
679
- return to_object
680
-
681
-
682
- def _FunctionDeclaration_to_vertex(
683
- api_client: BaseApiClient,
684
- from_object: Union[dict[str, Any], object],
685
- parent_object: Optional[dict[str, Any]] = None,
686
- ) -> dict[str, Any]:
687
- to_object: dict[str, Any] = {}
688
- if getv(from_object, ['response']) is not None:
689
- setv(
690
- to_object,
691
- ['response'],
692
- _Schema_to_vertex(
693
- api_client, getv(from_object, ['response']), to_object
694
- ),
695
- )
696
-
697
- if getv(from_object, ['description']) is not None:
698
- setv(to_object, ['description'], getv(from_object, ['description']))
699
-
700
- if getv(from_object, ['name']) is not None:
701
- setv(to_object, ['name'], getv(from_object, ['name']))
702
-
703
- if getv(from_object, ['parameters']) is not None:
704
- setv(to_object, ['parameters'], getv(from_object, ['parameters']))
705
-
706
- return to_object
707
-
708
-
709
500
  def _GoogleSearch_to_vertex(
710
501
  api_client: BaseApiClient,
711
502
  from_object: Union[dict[str, Any], object],
@@ -761,16 +552,6 @@ def _Tool_to_vertex(
761
552
  parent_object: Optional[dict[str, Any]] = None,
762
553
  ) -> dict[str, Any]:
763
554
  to_object: dict[str, Any] = {}
764
- if getv(from_object, ['function_declarations']) is not None:
765
- setv(
766
- to_object,
767
- ['functionDeclarations'],
768
- [
769
- _FunctionDeclaration_to_vertex(api_client, item, to_object)
770
- for item in getv(from_object, ['function_declarations'])
771
- ],
772
- )
773
-
774
555
  if getv(from_object, ['retrieval']) is not None:
775
556
  setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
776
557
 
@@ -797,6 +578,13 @@ def _Tool_to_vertex(
797
578
  if getv(from_object, ['code_execution']) is not None:
798
579
  setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
799
580
 
581
+ if getv(from_object, ['function_declarations']) is not None:
582
+ setv(
583
+ to_object,
584
+ ['functionDeclarations'],
585
+ getv(from_object, ['function_declarations']),
586
+ )
587
+
800
588
  return to_object
801
589
 
802
590