google-genai 1.12.1__py3-none-any.whl → 1.14.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.
- google/genai/_api_client.py +59 -17
- google/genai/_base_url.py +50 -0
- google/genai/_live_converters.py +231 -203
- google/genai/_transformers.py +2 -2
- google/genai/batches.py +2 -2
- google/genai/caches.py +236 -198
- google/genai/chats.py +4 -4
- google/genai/client.py +21 -9
- google/genai/live.py +9 -6
- google/genai/models.py +260 -230
- google/genai/types.py +1380 -1045
- google/genai/version.py +1 -1
- {google_genai-1.12.1.dist-info → google_genai-1.14.0.dist-info}/METADATA +8 -6
- google_genai-1.14.0.dist-info/RECORD +30 -0
- {google_genai-1.12.1.dist-info → google_genai-1.14.0.dist-info}/WHEEL +1 -1
- google_genai-1.12.1.dist-info/RECORD +0 -29
- {google_genai-1.12.1.dist-info → google_genai-1.14.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.12.1.dist-info → google_genai-1.14.0.dist-info}/top_level.txt +0 -0
google/genai/client.py
CHANGED
@@ -20,6 +20,7 @@ import google.auth
|
|
20
20
|
import pydantic
|
21
21
|
|
22
22
|
from ._api_client import BaseApiClient
|
23
|
+
from ._base_url import get_base_url
|
23
24
|
from ._replay_api_client import ReplayApiClient
|
24
25
|
from .batches import AsyncBatches, Batches
|
25
26
|
from .caches import AsyncCaches, Caches
|
@@ -78,6 +79,7 @@ class AsyncClient:
|
|
78
79
|
def operations(self) -> AsyncOperations:
|
79
80
|
return self._operations
|
80
81
|
|
82
|
+
|
81
83
|
class DebugConfig(pydantic.BaseModel):
|
82
84
|
"""Configuration options that change client network behavior when testing."""
|
83
85
|
|
@@ -114,26 +116,29 @@ class Client:
|
|
114
116
|
Attributes:
|
115
117
|
api_key: The `API key <https://ai.google.dev/gemini-api/docs/api-key>`_ to
|
116
118
|
use for authentication. Applies to the Gemini Developer API only.
|
117
|
-
vertexai: Indicates whether the client should use the Vertex AI
|
118
|
-
|
119
|
+
vertexai: Indicates whether the client should use the Vertex AI API
|
120
|
+
endpoints. Defaults to False (uses Gemini Developer API endpoints).
|
119
121
|
Applies to the Vertex AI API only.
|
120
122
|
credentials: The credentials to use for authentication when calling the
|
121
123
|
Vertex AI APIs. Credentials can be obtained from environment variables and
|
122
|
-
default credentials. For more information, see
|
123
|
-
|
124
|
+
default credentials. For more information, see `Set up Application Default
|
125
|
+
Credentials
|
124
126
|
<https://cloud.google.com/docs/authentication/provide-credentials-adc>`_.
|
125
127
|
Applies to the Vertex AI API only.
|
126
|
-
project: The `Google Cloud project ID
|
127
|
-
|
128
|
+
project: The `Google Cloud project ID
|
129
|
+
<https://cloud.google.com/vertex-ai/docs/start/cloud-environment>`_ to use
|
130
|
+
for quota. Can be obtained from environment variables (for example,
|
128
131
|
``GOOGLE_CLOUD_PROJECT``). Applies to the Vertex AI API only.
|
129
|
-
|
132
|
+
Find your `Google Cloud project ID <https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects>`_.
|
133
|
+
location: The `location
|
134
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations>`_
|
130
135
|
to send API requests to (for example, ``us-central1``). Can be obtained
|
131
136
|
from environment variables. Applies to the Vertex AI API only.
|
132
137
|
debug_config: Config settings that control network behavior of the client.
|
133
138
|
This is typically used when running test code.
|
134
139
|
http_options: Http options to use for the client. These options will be
|
135
|
-
applied to all requests made by the client. Example usage:
|
136
|
-
|
140
|
+
applied to all requests made by the client. Example usage: `client =
|
141
|
+
genai.Client(http_options=types.HttpOptions(api_version='v1'))`.
|
137
142
|
|
138
143
|
Usage for the Gemini Developer API:
|
139
144
|
|
@@ -198,6 +203,13 @@ class Client:
|
|
198
203
|
if isinstance(http_options, dict):
|
199
204
|
http_options = HttpOptions(**http_options)
|
200
205
|
|
206
|
+
base_url = get_base_url(vertexai or False, http_options)
|
207
|
+
if base_url:
|
208
|
+
if http_options:
|
209
|
+
http_options.base_url = base_url
|
210
|
+
else:
|
211
|
+
http_options = HttpOptions(base_url=base_url)
|
212
|
+
|
201
213
|
self._api_client = self._get_api_client(
|
202
214
|
vertexai=vertexai,
|
203
215
|
api_key=api_key,
|
google/genai/live.py
CHANGED
@@ -892,15 +892,18 @@ class AsyncLive(_api_module.BaseModule):
|
|
892
892
|
|
893
893
|
request = json.dumps(request_dict)
|
894
894
|
else:
|
895
|
-
|
896
|
-
|
895
|
+
if not self._api_client._credentials:
|
896
|
+
# Get bearer token through Application Default Credentials.
|
897
|
+
creds, _ = google.auth.default( # type: ignore[no-untyped-call]
|
897
898
|
scopes=['https://www.googleapis.com/auth/cloud-platform']
|
898
|
-
|
899
|
-
|
899
|
+
)
|
900
|
+
else:
|
901
|
+
creds = self._api_client._credentials
|
900
902
|
# creds.valid is False, and creds.token is None
|
901
903
|
# Need to refresh credentials to populate those
|
902
|
-
|
903
|
-
|
904
|
+
if not (creds.token and creds.valid):
|
905
|
+
auth_req = google.auth.transport.requests.Request() # type: ignore[no-untyped-call]
|
906
|
+
creds.refresh(auth_req)
|
904
907
|
bearer_token = creds.token
|
905
908
|
headers = self._api_client._http_options.headers
|
906
909
|
if headers is not None:
|
google/genai/models.py
CHANGED
@@ -97,85 +97,6 @@ def _Content_to_mldev(
|
|
97
97
|
return to_object
|
98
98
|
|
99
99
|
|
100
|
-
def _Schema_to_mldev(
|
101
|
-
api_client: BaseApiClient,
|
102
|
-
from_object: Union[dict[str, Any], object],
|
103
|
-
parent_object: Optional[dict[str, Any]] = None,
|
104
|
-
) -> dict[str, Any]:
|
105
|
-
to_object: dict[str, Any] = {}
|
106
|
-
if getv(from_object, ['example']) is not None:
|
107
|
-
raise ValueError('example parameter is not supported in Gemini API.')
|
108
|
-
|
109
|
-
if getv(from_object, ['pattern']) is not None:
|
110
|
-
raise ValueError('pattern parameter is not supported in Gemini API.')
|
111
|
-
|
112
|
-
if getv(from_object, ['default']) is not None:
|
113
|
-
raise ValueError('default parameter is not supported in Gemini API.')
|
114
|
-
|
115
|
-
if getv(from_object, ['max_length']) is not None:
|
116
|
-
raise ValueError('max_length parameter is not supported in Gemini API.')
|
117
|
-
|
118
|
-
if getv(from_object, ['min_length']) is not None:
|
119
|
-
raise ValueError('min_length parameter is not supported in Gemini API.')
|
120
|
-
|
121
|
-
if getv(from_object, ['min_properties']) is not None:
|
122
|
-
raise ValueError('min_properties parameter is not supported in Gemini API.')
|
123
|
-
|
124
|
-
if getv(from_object, ['max_properties']) is not None:
|
125
|
-
raise ValueError('max_properties parameter is not supported in Gemini API.')
|
126
|
-
|
127
|
-
if getv(from_object, ['any_of']) is not None:
|
128
|
-
setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
|
129
|
-
|
130
|
-
if getv(from_object, ['description']) is not None:
|
131
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
132
|
-
|
133
|
-
if getv(from_object, ['enum']) is not None:
|
134
|
-
setv(to_object, ['enum'], getv(from_object, ['enum']))
|
135
|
-
|
136
|
-
if getv(from_object, ['format']) is not None:
|
137
|
-
setv(to_object, ['format'], getv(from_object, ['format']))
|
138
|
-
|
139
|
-
if getv(from_object, ['items']) is not None:
|
140
|
-
setv(to_object, ['items'], getv(from_object, ['items']))
|
141
|
-
|
142
|
-
if getv(from_object, ['max_items']) is not None:
|
143
|
-
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
144
|
-
|
145
|
-
if getv(from_object, ['maximum']) is not None:
|
146
|
-
setv(to_object, ['maximum'], getv(from_object, ['maximum']))
|
147
|
-
|
148
|
-
if getv(from_object, ['min_items']) is not None:
|
149
|
-
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
150
|
-
|
151
|
-
if getv(from_object, ['minimum']) is not None:
|
152
|
-
setv(to_object, ['minimum'], getv(from_object, ['minimum']))
|
153
|
-
|
154
|
-
if getv(from_object, ['nullable']) is not None:
|
155
|
-
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
156
|
-
|
157
|
-
if getv(from_object, ['properties']) is not None:
|
158
|
-
setv(to_object, ['properties'], getv(from_object, ['properties']))
|
159
|
-
|
160
|
-
if getv(from_object, ['property_ordering']) is not None:
|
161
|
-
setv(
|
162
|
-
to_object,
|
163
|
-
['propertyOrdering'],
|
164
|
-
getv(from_object, ['property_ordering']),
|
165
|
-
)
|
166
|
-
|
167
|
-
if getv(from_object, ['required']) is not None:
|
168
|
-
setv(to_object, ['required'], getv(from_object, ['required']))
|
169
|
-
|
170
|
-
if getv(from_object, ['title']) is not None:
|
171
|
-
setv(to_object, ['title'], getv(from_object, ['title']))
|
172
|
-
|
173
|
-
if getv(from_object, ['type']) is not None:
|
174
|
-
setv(to_object, ['type'], getv(from_object, ['type']))
|
175
|
-
|
176
|
-
return to_object
|
177
|
-
|
178
|
-
|
179
100
|
def _ModelSelectionConfig_to_mldev(
|
180
101
|
api_client: BaseApiClient,
|
181
102
|
from_object: Union[dict[str, Any], object],
|
@@ -208,27 +129,6 @@ def _SafetySetting_to_mldev(
|
|
208
129
|
return to_object
|
209
130
|
|
210
131
|
|
211
|
-
def _FunctionDeclaration_to_mldev(
|
212
|
-
api_client: BaseApiClient,
|
213
|
-
from_object: Union[dict[str, Any], object],
|
214
|
-
parent_object: Optional[dict[str, Any]] = None,
|
215
|
-
) -> dict[str, Any]:
|
216
|
-
to_object: dict[str, Any] = {}
|
217
|
-
if getv(from_object, ['response']) is not None:
|
218
|
-
raise ValueError('response parameter is not supported in Gemini API.')
|
219
|
-
|
220
|
-
if getv(from_object, ['description']) is not None:
|
221
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
222
|
-
|
223
|
-
if getv(from_object, ['name']) is not None:
|
224
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
225
|
-
|
226
|
-
if getv(from_object, ['parameters']) is not None:
|
227
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
228
|
-
|
229
|
-
return to_object
|
230
|
-
|
231
|
-
|
232
132
|
def _GoogleSearch_to_mldev(
|
233
133
|
api_client: BaseApiClient,
|
234
134
|
from_object: Union[dict[str, Any], object],
|
@@ -278,22 +178,81 @@ def _GoogleSearchRetrieval_to_mldev(
|
|
278
178
|
return to_object
|
279
179
|
|
280
180
|
|
281
|
-
def
|
181
|
+
def _EnterpriseWebSearch_to_mldev(
|
282
182
|
api_client: BaseApiClient,
|
283
183
|
from_object: Union[dict[str, Any], object],
|
284
184
|
parent_object: Optional[dict[str, Any]] = None,
|
285
185
|
) -> dict[str, Any]:
|
286
186
|
to_object: dict[str, Any] = {}
|
287
|
-
|
187
|
+
|
188
|
+
return to_object
|
189
|
+
|
190
|
+
|
191
|
+
def _ApiKeyConfig_to_mldev(
|
192
|
+
api_client: BaseApiClient,
|
193
|
+
from_object: Union[dict[str, Any], object],
|
194
|
+
parent_object: Optional[dict[str, Any]] = None,
|
195
|
+
) -> dict[str, Any]:
|
196
|
+
to_object: dict[str, Any] = {}
|
197
|
+
if getv(from_object, ['api_key_string']) is not None:
|
198
|
+
raise ValueError('api_key_string parameter is not supported in Gemini API.')
|
199
|
+
|
200
|
+
return to_object
|
201
|
+
|
202
|
+
|
203
|
+
def _AuthConfig_to_mldev(
|
204
|
+
api_client: BaseApiClient,
|
205
|
+
from_object: Union[dict[str, Any], object],
|
206
|
+
parent_object: Optional[dict[str, Any]] = None,
|
207
|
+
) -> dict[str, Any]:
|
208
|
+
to_object: dict[str, Any] = {}
|
209
|
+
if getv(from_object, ['api_key_config']) is not None:
|
210
|
+
raise ValueError('api_key_config parameter is not supported in Gemini API.')
|
211
|
+
|
212
|
+
if getv(from_object, ['auth_type']) is not None:
|
213
|
+
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
214
|
+
|
215
|
+
if getv(from_object, ['google_service_account_config']) is not None:
|
288
216
|
setv(
|
289
217
|
to_object,
|
290
|
-
['
|
291
|
-
[
|
292
|
-
|
293
|
-
|
294
|
-
|
218
|
+
['googleServiceAccountConfig'],
|
219
|
+
getv(from_object, ['google_service_account_config']),
|
220
|
+
)
|
221
|
+
|
222
|
+
if getv(from_object, ['http_basic_auth_config']) is not None:
|
223
|
+
setv(
|
224
|
+
to_object,
|
225
|
+
['httpBasicAuthConfig'],
|
226
|
+
getv(from_object, ['http_basic_auth_config']),
|
295
227
|
)
|
296
228
|
|
229
|
+
if getv(from_object, ['oauth_config']) is not None:
|
230
|
+
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
231
|
+
|
232
|
+
if getv(from_object, ['oidc_config']) is not None:
|
233
|
+
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
234
|
+
|
235
|
+
return to_object
|
236
|
+
|
237
|
+
|
238
|
+
def _GoogleMaps_to_mldev(
|
239
|
+
api_client: BaseApiClient,
|
240
|
+
from_object: Union[dict[str, Any], object],
|
241
|
+
parent_object: Optional[dict[str, Any]] = None,
|
242
|
+
) -> dict[str, Any]:
|
243
|
+
to_object: dict[str, Any] = {}
|
244
|
+
if getv(from_object, ['auth_config']) is not None:
|
245
|
+
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
246
|
+
|
247
|
+
return to_object
|
248
|
+
|
249
|
+
|
250
|
+
def _Tool_to_mldev(
|
251
|
+
api_client: BaseApiClient,
|
252
|
+
from_object: Union[dict[str, Any], object],
|
253
|
+
parent_object: Optional[dict[str, Any]] = None,
|
254
|
+
) -> dict[str, Any]:
|
255
|
+
to_object: dict[str, Any] = {}
|
297
256
|
if getv(from_object, ['retrieval']) is not None:
|
298
257
|
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
299
258
|
|
@@ -317,9 +276,24 @@ def _Tool_to_mldev(
|
|
317
276
|
),
|
318
277
|
)
|
319
278
|
|
279
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
280
|
+
raise ValueError(
|
281
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
282
|
+
)
|
283
|
+
|
284
|
+
if getv(from_object, ['google_maps']) is not None:
|
285
|
+
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
286
|
+
|
320
287
|
if getv(from_object, ['code_execution']) is not None:
|
321
288
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
322
289
|
|
290
|
+
if getv(from_object, ['function_declarations']) is not None:
|
291
|
+
setv(
|
292
|
+
to_object,
|
293
|
+
['functionDeclarations'],
|
294
|
+
getv(from_object, ['function_declarations']),
|
295
|
+
)
|
296
|
+
|
323
297
|
return to_object
|
324
298
|
|
325
299
|
|
@@ -342,6 +316,33 @@ def _FunctionCallingConfig_to_mldev(
|
|
342
316
|
return to_object
|
343
317
|
|
344
318
|
|
319
|
+
def _LatLng_to_mldev(
|
320
|
+
api_client: BaseApiClient,
|
321
|
+
from_object: Union[dict[str, Any], object],
|
322
|
+
parent_object: Optional[dict[str, Any]] = None,
|
323
|
+
) -> dict[str, Any]:
|
324
|
+
to_object: dict[str, Any] = {}
|
325
|
+
if getv(from_object, ['latitude']) is not None:
|
326
|
+
raise ValueError('latitude parameter is not supported in Gemini API.')
|
327
|
+
|
328
|
+
if getv(from_object, ['longitude']) is not None:
|
329
|
+
raise ValueError('longitude parameter is not supported in Gemini API.')
|
330
|
+
|
331
|
+
return to_object
|
332
|
+
|
333
|
+
|
334
|
+
def _RetrievalConfig_to_mldev(
|
335
|
+
api_client: BaseApiClient,
|
336
|
+
from_object: Union[dict[str, Any], object],
|
337
|
+
parent_object: Optional[dict[str, Any]] = None,
|
338
|
+
) -> dict[str, Any]:
|
339
|
+
to_object: dict[str, Any] = {}
|
340
|
+
if getv(from_object, ['lat_lng']) is not None:
|
341
|
+
raise ValueError('lat_lng parameter is not supported in Gemini API.')
|
342
|
+
|
343
|
+
return to_object
|
344
|
+
|
345
|
+
|
345
346
|
def _ToolConfig_to_mldev(
|
346
347
|
api_client: BaseApiClient,
|
347
348
|
from_object: Union[dict[str, Any], object],
|
@@ -359,6 +360,11 @@ def _ToolConfig_to_mldev(
|
|
359
360
|
),
|
360
361
|
)
|
361
362
|
|
363
|
+
if getv(from_object, ['retrieval_config']) is not None:
|
364
|
+
raise ValueError(
|
365
|
+
'retrieval_config parameter is not supported in Gemini API.'
|
366
|
+
)
|
367
|
+
|
362
368
|
return to_object
|
363
369
|
|
364
370
|
|
@@ -504,11 +510,7 @@ def _GenerateContentConfig_to_mldev(
|
|
504
510
|
setv(
|
505
511
|
to_object,
|
506
512
|
['responseSchema'],
|
507
|
-
|
508
|
-
api_client,
|
509
|
-
t.t_schema(api_client, getv(from_object, ['response_schema'])),
|
510
|
-
to_object,
|
511
|
-
),
|
513
|
+
t.t_schema(api_client, getv(from_object, ['response_schema'])),
|
512
514
|
)
|
513
515
|
|
514
516
|
if getv(from_object, ['routing_config']) is not None:
|
@@ -1213,85 +1215,6 @@ def _Content_to_vertex(
|
|
1213
1215
|
return to_object
|
1214
1216
|
|
1215
1217
|
|
1216
|
-
def _Schema_to_vertex(
|
1217
|
-
api_client: BaseApiClient,
|
1218
|
-
from_object: Union[dict[str, Any], object],
|
1219
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1220
|
-
) -> dict[str, Any]:
|
1221
|
-
to_object: dict[str, Any] = {}
|
1222
|
-
if getv(from_object, ['example']) is not None:
|
1223
|
-
setv(to_object, ['example'], getv(from_object, ['example']))
|
1224
|
-
|
1225
|
-
if getv(from_object, ['pattern']) is not None:
|
1226
|
-
setv(to_object, ['pattern'], getv(from_object, ['pattern']))
|
1227
|
-
|
1228
|
-
if getv(from_object, ['default']) is not None:
|
1229
|
-
setv(to_object, ['default'], getv(from_object, ['default']))
|
1230
|
-
|
1231
|
-
if getv(from_object, ['max_length']) is not None:
|
1232
|
-
setv(to_object, ['maxLength'], getv(from_object, ['max_length']))
|
1233
|
-
|
1234
|
-
if getv(from_object, ['min_length']) is not None:
|
1235
|
-
setv(to_object, ['minLength'], getv(from_object, ['min_length']))
|
1236
|
-
|
1237
|
-
if getv(from_object, ['min_properties']) is not None:
|
1238
|
-
setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
|
1239
|
-
|
1240
|
-
if getv(from_object, ['max_properties']) is not None:
|
1241
|
-
setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
|
1242
|
-
|
1243
|
-
if getv(from_object, ['any_of']) is not None:
|
1244
|
-
setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
|
1245
|
-
|
1246
|
-
if getv(from_object, ['description']) is not None:
|
1247
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
1248
|
-
|
1249
|
-
if getv(from_object, ['enum']) is not None:
|
1250
|
-
setv(to_object, ['enum'], getv(from_object, ['enum']))
|
1251
|
-
|
1252
|
-
if getv(from_object, ['format']) is not None:
|
1253
|
-
setv(to_object, ['format'], getv(from_object, ['format']))
|
1254
|
-
|
1255
|
-
if getv(from_object, ['items']) is not None:
|
1256
|
-
setv(to_object, ['items'], getv(from_object, ['items']))
|
1257
|
-
|
1258
|
-
if getv(from_object, ['max_items']) is not None:
|
1259
|
-
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
1260
|
-
|
1261
|
-
if getv(from_object, ['maximum']) is not None:
|
1262
|
-
setv(to_object, ['maximum'], getv(from_object, ['maximum']))
|
1263
|
-
|
1264
|
-
if getv(from_object, ['min_items']) is not None:
|
1265
|
-
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
1266
|
-
|
1267
|
-
if getv(from_object, ['minimum']) is not None:
|
1268
|
-
setv(to_object, ['minimum'], getv(from_object, ['minimum']))
|
1269
|
-
|
1270
|
-
if getv(from_object, ['nullable']) is not None:
|
1271
|
-
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
1272
|
-
|
1273
|
-
if getv(from_object, ['properties']) is not None:
|
1274
|
-
setv(to_object, ['properties'], getv(from_object, ['properties']))
|
1275
|
-
|
1276
|
-
if getv(from_object, ['property_ordering']) is not None:
|
1277
|
-
setv(
|
1278
|
-
to_object,
|
1279
|
-
['propertyOrdering'],
|
1280
|
-
getv(from_object, ['property_ordering']),
|
1281
|
-
)
|
1282
|
-
|
1283
|
-
if getv(from_object, ['required']) is not None:
|
1284
|
-
setv(to_object, ['required'], getv(from_object, ['required']))
|
1285
|
-
|
1286
|
-
if getv(from_object, ['title']) is not None:
|
1287
|
-
setv(to_object, ['title'], getv(from_object, ['title']))
|
1288
|
-
|
1289
|
-
if getv(from_object, ['type']) is not None:
|
1290
|
-
setv(to_object, ['type'], getv(from_object, ['type']))
|
1291
|
-
|
1292
|
-
return to_object
|
1293
|
-
|
1294
|
-
|
1295
1218
|
def _ModelSelectionConfig_to_vertex(
|
1296
1219
|
api_client: BaseApiClient,
|
1297
1220
|
from_object: Union[dict[str, Any], object],
|
@@ -1326,33 +1249,6 @@ def _SafetySetting_to_vertex(
|
|
1326
1249
|
return to_object
|
1327
1250
|
|
1328
1251
|
|
1329
|
-
def _FunctionDeclaration_to_vertex(
|
1330
|
-
api_client: BaseApiClient,
|
1331
|
-
from_object: Union[dict[str, Any], object],
|
1332
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1333
|
-
) -> dict[str, Any]:
|
1334
|
-
to_object: dict[str, Any] = {}
|
1335
|
-
if getv(from_object, ['response']) is not None:
|
1336
|
-
setv(
|
1337
|
-
to_object,
|
1338
|
-
['response'],
|
1339
|
-
_Schema_to_vertex(
|
1340
|
-
api_client, getv(from_object, ['response']), to_object
|
1341
|
-
),
|
1342
|
-
)
|
1343
|
-
|
1344
|
-
if getv(from_object, ['description']) is not None:
|
1345
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
1346
|
-
|
1347
|
-
if getv(from_object, ['name']) is not None:
|
1348
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1349
|
-
|
1350
|
-
if getv(from_object, ['parameters']) is not None:
|
1351
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
1352
|
-
|
1353
|
-
return to_object
|
1354
|
-
|
1355
|
-
|
1356
1252
|
def _GoogleSearch_to_vertex(
|
1357
1253
|
api_client: BaseApiClient,
|
1358
1254
|
from_object: Union[dict[str, Any], object],
|
@@ -1402,22 +1298,93 @@ def _GoogleSearchRetrieval_to_vertex(
|
|
1402
1298
|
return to_object
|
1403
1299
|
|
1404
1300
|
|
1405
|
-
def
|
1301
|
+
def _EnterpriseWebSearch_to_vertex(
|
1406
1302
|
api_client: BaseApiClient,
|
1407
1303
|
from_object: Union[dict[str, Any], object],
|
1408
1304
|
parent_object: Optional[dict[str, Any]] = None,
|
1409
1305
|
) -> dict[str, Any]:
|
1410
1306
|
to_object: dict[str, Any] = {}
|
1411
|
-
|
1307
|
+
|
1308
|
+
return to_object
|
1309
|
+
|
1310
|
+
|
1311
|
+
def _ApiKeyConfig_to_vertex(
|
1312
|
+
api_client: BaseApiClient,
|
1313
|
+
from_object: Union[dict[str, Any], object],
|
1314
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1315
|
+
) -> dict[str, Any]:
|
1316
|
+
to_object: dict[str, Any] = {}
|
1317
|
+
if getv(from_object, ['api_key_string']) is not None:
|
1318
|
+
setv(to_object, ['apiKeyString'], getv(from_object, ['api_key_string']))
|
1319
|
+
|
1320
|
+
return to_object
|
1321
|
+
|
1322
|
+
|
1323
|
+
def _AuthConfig_to_vertex(
|
1324
|
+
api_client: BaseApiClient,
|
1325
|
+
from_object: Union[dict[str, Any], object],
|
1326
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1327
|
+
) -> dict[str, Any]:
|
1328
|
+
to_object: dict[str, Any] = {}
|
1329
|
+
if getv(from_object, ['api_key_config']) is not None:
|
1412
1330
|
setv(
|
1413
1331
|
to_object,
|
1414
|
-
['
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1332
|
+
['apiKeyConfig'],
|
1333
|
+
_ApiKeyConfig_to_vertex(
|
1334
|
+
api_client, getv(from_object, ['api_key_config']), to_object
|
1335
|
+
),
|
1336
|
+
)
|
1337
|
+
|
1338
|
+
if getv(from_object, ['auth_type']) is not None:
|
1339
|
+
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
1340
|
+
|
1341
|
+
if getv(from_object, ['google_service_account_config']) is not None:
|
1342
|
+
setv(
|
1343
|
+
to_object,
|
1344
|
+
['googleServiceAccountConfig'],
|
1345
|
+
getv(from_object, ['google_service_account_config']),
|
1419
1346
|
)
|
1420
1347
|
|
1348
|
+
if getv(from_object, ['http_basic_auth_config']) is not None:
|
1349
|
+
setv(
|
1350
|
+
to_object,
|
1351
|
+
['httpBasicAuthConfig'],
|
1352
|
+
getv(from_object, ['http_basic_auth_config']),
|
1353
|
+
)
|
1354
|
+
|
1355
|
+
if getv(from_object, ['oauth_config']) is not None:
|
1356
|
+
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
1357
|
+
|
1358
|
+
if getv(from_object, ['oidc_config']) is not None:
|
1359
|
+
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
1360
|
+
|
1361
|
+
return to_object
|
1362
|
+
|
1363
|
+
|
1364
|
+
def _GoogleMaps_to_vertex(
|
1365
|
+
api_client: BaseApiClient,
|
1366
|
+
from_object: Union[dict[str, Any], object],
|
1367
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1368
|
+
) -> dict[str, Any]:
|
1369
|
+
to_object: dict[str, Any] = {}
|
1370
|
+
if getv(from_object, ['auth_config']) is not None:
|
1371
|
+
setv(
|
1372
|
+
to_object,
|
1373
|
+
['authConfig'],
|
1374
|
+
_AuthConfig_to_vertex(
|
1375
|
+
api_client, getv(from_object, ['auth_config']), to_object
|
1376
|
+
),
|
1377
|
+
)
|
1378
|
+
|
1379
|
+
return to_object
|
1380
|
+
|
1381
|
+
|
1382
|
+
def _Tool_to_vertex(
|
1383
|
+
api_client: BaseApiClient,
|
1384
|
+
from_object: Union[dict[str, Any], object],
|
1385
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1386
|
+
) -> dict[str, Any]:
|
1387
|
+
to_object: dict[str, Any] = {}
|
1421
1388
|
if getv(from_object, ['retrieval']) is not None:
|
1422
1389
|
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
1423
1390
|
|
@@ -1441,9 +1408,34 @@ def _Tool_to_vertex(
|
|
1441
1408
|
),
|
1442
1409
|
)
|
1443
1410
|
|
1411
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
1412
|
+
setv(
|
1413
|
+
to_object,
|
1414
|
+
['enterpriseWebSearch'],
|
1415
|
+
_EnterpriseWebSearch_to_vertex(
|
1416
|
+
api_client, getv(from_object, ['enterprise_web_search']), to_object
|
1417
|
+
),
|
1418
|
+
)
|
1419
|
+
|
1420
|
+
if getv(from_object, ['google_maps']) is not None:
|
1421
|
+
setv(
|
1422
|
+
to_object,
|
1423
|
+
['googleMaps'],
|
1424
|
+
_GoogleMaps_to_vertex(
|
1425
|
+
api_client, getv(from_object, ['google_maps']), to_object
|
1426
|
+
),
|
1427
|
+
)
|
1428
|
+
|
1444
1429
|
if getv(from_object, ['code_execution']) is not None:
|
1445
1430
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
1446
1431
|
|
1432
|
+
if getv(from_object, ['function_declarations']) is not None:
|
1433
|
+
setv(
|
1434
|
+
to_object,
|
1435
|
+
['functionDeclarations'],
|
1436
|
+
getv(from_object, ['function_declarations']),
|
1437
|
+
)
|
1438
|
+
|
1447
1439
|
return to_object
|
1448
1440
|
|
1449
1441
|
|
@@ -1466,6 +1458,39 @@ def _FunctionCallingConfig_to_vertex(
|
|
1466
1458
|
return to_object
|
1467
1459
|
|
1468
1460
|
|
1461
|
+
def _LatLng_to_vertex(
|
1462
|
+
api_client: BaseApiClient,
|
1463
|
+
from_object: Union[dict[str, Any], object],
|
1464
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1465
|
+
) -> dict[str, Any]:
|
1466
|
+
to_object: dict[str, Any] = {}
|
1467
|
+
if getv(from_object, ['latitude']) is not None:
|
1468
|
+
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
|
1469
|
+
|
1470
|
+
if getv(from_object, ['longitude']) is not None:
|
1471
|
+
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
|
1472
|
+
|
1473
|
+
return to_object
|
1474
|
+
|
1475
|
+
|
1476
|
+
def _RetrievalConfig_to_vertex(
|
1477
|
+
api_client: BaseApiClient,
|
1478
|
+
from_object: Union[dict[str, Any], object],
|
1479
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1480
|
+
) -> dict[str, Any]:
|
1481
|
+
to_object: dict[str, Any] = {}
|
1482
|
+
if getv(from_object, ['lat_lng']) is not None:
|
1483
|
+
setv(
|
1484
|
+
to_object,
|
1485
|
+
['latLng'],
|
1486
|
+
_LatLng_to_vertex(
|
1487
|
+
api_client, getv(from_object, ['lat_lng']), to_object
|
1488
|
+
),
|
1489
|
+
)
|
1490
|
+
|
1491
|
+
return to_object
|
1492
|
+
|
1493
|
+
|
1469
1494
|
def _ToolConfig_to_vertex(
|
1470
1495
|
api_client: BaseApiClient,
|
1471
1496
|
from_object: Union[dict[str, Any], object],
|
@@ -1483,6 +1508,15 @@ def _ToolConfig_to_vertex(
|
|
1483
1508
|
),
|
1484
1509
|
)
|
1485
1510
|
|
1511
|
+
if getv(from_object, ['retrieval_config']) is not None:
|
1512
|
+
setv(
|
1513
|
+
to_object,
|
1514
|
+
['retrievalConfig'],
|
1515
|
+
_RetrievalConfig_to_vertex(
|
1516
|
+
api_client, getv(from_object, ['retrieval_config']), to_object
|
1517
|
+
),
|
1518
|
+
)
|
1519
|
+
|
1486
1520
|
return to_object
|
1487
1521
|
|
1488
1522
|
|
@@ -1628,11 +1662,7 @@ def _GenerateContentConfig_to_vertex(
|
|
1628
1662
|
setv(
|
1629
1663
|
to_object,
|
1630
1664
|
['responseSchema'],
|
1631
|
-
|
1632
|
-
api_client,
|
1633
|
-
t.t_schema(api_client, getv(from_object, ['response_schema'])),
|
1634
|
-
to_object,
|
1635
|
-
),
|
1665
|
+
t.t_schema(api_client, getv(from_object, ['response_schema'])),
|
1636
1666
|
)
|
1637
1667
|
|
1638
1668
|
if getv(from_object, ['routing_config']) is not None:
|