2323from ._common import set_value_by_path as setv
2424
2525
26- def _AuthConfig_to_mldev (
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 , ['api_key' ]) is not None :
32- setv (to_object , ['apiKey' ], getv (from_object , ['api_key' ]))
33-
34- if getv (from_object , ['api_key_config' ]) is not None :
35- raise ValueError ('api_key_config parameter is not supported in Gemini API.' )
36-
37- if getv (from_object , ['auth_type' ]) is not None :
38- raise ValueError ('auth_type parameter is not supported in Gemini API.' )
39-
40- if getv (from_object , ['google_service_account_config' ]) is not None :
41- raise ValueError (
42- 'google_service_account_config parameter is not supported in Gemini'
43- ' API.'
44- )
45-
46- if getv (from_object , ['http_basic_auth_config' ]) is not None :
47- raise ValueError (
48- 'http_basic_auth_config parameter is not supported in Gemini API.'
49- )
50-
51- if getv (from_object , ['oauth_config' ]) is not None :
52- raise ValueError ('oauth_config parameter is not supported in Gemini API.' )
53-
54- if getv (from_object , ['oidc_config' ]) is not None :
55- raise ValueError ('oidc_config parameter is not supported in Gemini API.' )
56-
57- return to_object
58-
59-
6026def _Blob_to_mldev (
6127 from_object : Union [dict [str , Any ], object ],
6228 parent_object : Optional [dict [str , Any ]] = None ,
@@ -95,27 +61,6 @@ def _Content_to_mldev(
9561 return to_object
9662
9763
98- def _Content_to_vertex (
99- from_object : Union [dict [str , Any ], object ],
100- parent_object : Optional [dict [str , Any ]] = None ,
101- ) -> dict [str , Any ]:
102- to_object : dict [str , Any ] = {}
103- if getv (from_object , ['parts' ]) is not None :
104- setv (
105- to_object ,
106- ['parts' ],
107- [
108- _Part_to_vertex (item , to_object )
109- for item in getv (from_object , ['parts' ])
110- ],
111- )
112-
113- if getv (from_object , ['role' ]) is not None :
114- setv (to_object , ['role' ], getv (from_object , ['role' ]))
115-
116- return to_object
117-
118-
11964def _FileData_to_mldev (
12065 from_object : Union [dict [str , Any ], object ],
12166 parent_object : Optional [dict [str , Any ]] = None ,
@@ -312,11 +257,7 @@ def _GoogleMaps_to_mldev(
312257) -> dict [str , Any ]:
313258 to_object : dict [str , Any ] = {}
314259 if getv (from_object , ['auth_config' ]) is not None :
315- setv (
316- to_object ,
317- ['authConfig' ],
318- _AuthConfig_to_mldev (getv (from_object , ['auth_config' ]), to_object ),
319- )
260+ raise ValueError ('auth_config parameter is not supported in Gemini API.' )
320261
321262 if getv (from_object , ['enable_widget' ]) is not None :
322263 setv (to_object , ['enableWidget' ], getv (from_object , ['enable_widget' ]))
@@ -329,14 +270,14 @@ def _GoogleSearch_to_mldev(
329270 parent_object : Optional [dict [str , Any ]] = None ,
330271) -> dict [str , Any ]:
331272 to_object : dict [str , Any ] = {}
332- if getv (from_object , ['blocking_confidence ' ]) is not None :
273+ if getv (from_object , ['exclude_domains ' ]) is not None :
333274 raise ValueError (
334- 'blocking_confidence parameter is not supported in Gemini API.'
275+ 'exclude_domains parameter is not supported in Gemini API.'
335276 )
336277
337- if getv (from_object , ['exclude_domains ' ]) is not None :
278+ if getv (from_object , ['blocking_confidence ' ]) is not None :
338279 raise ValueError (
339- 'exclude_domains parameter is not supported in Gemini API.'
280+ 'blocking_confidence parameter is not supported in Gemini API.'
340281 )
341282
342283 if getv (from_object , ['time_range_filter' ]) is not None :
@@ -368,27 +309,6 @@ def _LiveClientContent_to_mldev(
368309 return to_object
369310
370311
371- def _LiveClientContent_to_vertex (
372- from_object : Union [dict [str , Any ], object ],
373- parent_object : Optional [dict [str , Any ]] = None ,
374- ) -> dict [str , Any ]:
375- to_object : dict [str , Any ] = {}
376- if getv (from_object , ['turns' ]) is not None :
377- setv (
378- to_object ,
379- ['turns' ],
380- [
381- _Content_to_vertex (item , to_object )
382- for item in getv (from_object , ['turns' ])
383- ],
384- )
385-
386- if getv (from_object , ['turn_complete' ]) is not None :
387- setv (to_object , ['turnComplete' ], getv (from_object , ['turn_complete' ]))
388-
389- return to_object
390-
391-
392312def _LiveClientMessage_to_mldev (
393313 api_client : BaseApiClient ,
394314 from_object : Union [dict [str , Any ], object ],
@@ -444,13 +364,7 @@ def _LiveClientMessage_to_vertex(
444364 )
445365
446366 if getv (from_object , ['client_content' ]) is not None :
447- setv (
448- to_object ,
449- ['clientContent' ],
450- _LiveClientContent_to_vertex (
451- getv (from_object , ['client_content' ]), to_object
452- ),
453- )
367+ setv (to_object , ['clientContent' ], getv (from_object , ['client_content' ]))
454368
455369 if getv (from_object , ['realtime_input' ]) is not None :
456370 setv (
@@ -644,9 +558,7 @@ def _LiveClientSetup_to_vertex(
644558 setv (
645559 to_object ,
646560 ['systemInstruction' ],
647- _Content_to_vertex (
648- t .t_content (getv (from_object , ['system_instruction' ])), to_object
649- ),
561+ t .t_content (getv (from_object , ['system_instruction' ])),
650562 )
651563
652564 if getv (from_object , ['tools' ]) is not None :
@@ -945,9 +857,7 @@ def _LiveConnectConfig_to_vertex(
945857 setv (
946858 parent_object ,
947859 ['setup' , 'systemInstruction' ],
948- _Content_to_vertex (
949- t .t_content (getv (from_object , ['system_instruction' ])), to_object
950- ),
860+ t .t_content (getv (from_object , ['system_instruction' ])),
951861 )
952862
953863 if getv (from_object , ['tools' ]) is not None :
@@ -1417,67 +1327,6 @@ def _Part_to_mldev(
14171327 if getv (from_object , ['video_metadata' ]) is not None :
14181328 setv (to_object , ['videoMetadata' ], getv (from_object , ['video_metadata' ]))
14191329
1420- if getv (from_object , ['part_metadata' ]) is not None :
1421- setv (to_object , ['partMetadata' ], getv (from_object , ['part_metadata' ]))
1422-
1423- return to_object
1424-
1425-
1426- def _Part_to_vertex (
1427- from_object : Union [dict [str , Any ], object ],
1428- parent_object : Optional [dict [str , Any ]] = None ,
1429- ) -> dict [str , Any ]:
1430- to_object : dict [str , Any ] = {}
1431- if getv (from_object , ['media_resolution' ]) is not None :
1432- setv (
1433- to_object , ['mediaResolution' ], getv (from_object , ['media_resolution' ])
1434- )
1435-
1436- if getv (from_object , ['code_execution_result' ]) is not None :
1437- setv (
1438- to_object ,
1439- ['codeExecutionResult' ],
1440- getv (from_object , ['code_execution_result' ]),
1441- )
1442-
1443- if getv (from_object , ['executable_code' ]) is not None :
1444- setv (to_object , ['executableCode' ], getv (from_object , ['executable_code' ]))
1445-
1446- if getv (from_object , ['file_data' ]) is not None :
1447- setv (to_object , ['fileData' ], getv (from_object , ['file_data' ]))
1448-
1449- if getv (from_object , ['function_call' ]) is not None :
1450- setv (to_object , ['functionCall' ], getv (from_object , ['function_call' ]))
1451-
1452- if getv (from_object , ['function_response' ]) is not None :
1453- setv (
1454- to_object ,
1455- ['functionResponse' ],
1456- getv (from_object , ['function_response' ]),
1457- )
1458-
1459- if getv (from_object , ['inline_data' ]) is not None :
1460- setv (to_object , ['inlineData' ], getv (from_object , ['inline_data' ]))
1461-
1462- if getv (from_object , ['text' ]) is not None :
1463- setv (to_object , ['text' ], getv (from_object , ['text' ]))
1464-
1465- if getv (from_object , ['thought' ]) is not None :
1466- setv (to_object , ['thought' ], getv (from_object , ['thought' ]))
1467-
1468- if getv (from_object , ['thought_signature' ]) is not None :
1469- setv (
1470- to_object ,
1471- ['thoughtSignature' ],
1472- getv (from_object , ['thought_signature' ]),
1473- )
1474-
1475- if getv (from_object , ['video_metadata' ]) is not None :
1476- setv (to_object , ['videoMetadata' ], getv (from_object , ['video_metadata' ]))
1477-
1478- if getv (from_object , ['part_metadata' ]) is not None :
1479- raise ValueError ('part_metadata parameter is not supported in Vertex AI.' )
1480-
14811330 return to_object
14821331
14831332
@@ -1509,13 +1358,6 @@ def _Tool_to_mldev(
15091358 if getv (from_object , ['file_search' ]) is not None :
15101359 setv (to_object , ['fileSearch' ], getv (from_object , ['file_search' ]))
15111360
1512- if getv (from_object , ['google_maps' ]) is not None :
1513- setv (
1514- to_object ,
1515- ['googleMaps' ],
1516- _GoogleMaps_to_mldev (getv (from_object , ['google_maps' ]), to_object ),
1517- )
1518-
15191361 if getv (from_object , ['code_execution' ]) is not None :
15201362 setv (to_object , ['codeExecution' ], getv (from_object , ['code_execution' ]))
15211363
@@ -1531,6 +1373,13 @@ def _Tool_to_mldev(
15311373 [item for item in getv (from_object , ['function_declarations' ])],
15321374 )
15331375
1376+ if getv (from_object , ['google_maps' ]) is not None :
1377+ setv (
1378+ to_object ,
1379+ ['googleMaps' ],
1380+ _GoogleMaps_to_mldev (getv (from_object , ['google_maps' ]), to_object ),
1381+ )
1382+
15341383 if getv (from_object , ['google_search' ]) is not None :
15351384 setv (
15361385 to_object ,
@@ -1545,21 +1394,9 @@ def _Tool_to_mldev(
15451394 getv (from_object , ['google_search_retrieval' ]),
15461395 )
15471396
1548- if getv (from_object , ['parallel_ai_search' ]) is not None :
1549- raise ValueError (
1550- 'parallel_ai_search parameter is not supported in Gemini API.'
1551- )
1552-
15531397 if getv (from_object , ['url_context' ]) is not None :
15541398 setv (to_object , ['urlContext' ], getv (from_object , ['url_context' ]))
15551399
1556- if getv (from_object , ['mcp_servers' ]) is not None :
1557- setv (
1558- to_object ,
1559- ['mcpServers' ],
1560- [item for item in getv (from_object , ['mcp_servers' ])],
1561- )
1562-
15631400 return to_object
15641401
15651402
@@ -1577,9 +1414,6 @@ def _Tool_to_vertex(
15771414 if getv (from_object , ['file_search' ]) is not None :
15781415 raise ValueError ('file_search parameter is not supported in Vertex AI.' )
15791416
1580- if getv (from_object , ['google_maps' ]) is not None :
1581- setv (to_object , ['googleMaps' ], getv (from_object , ['google_maps' ]))
1582-
15831417 if getv (from_object , ['code_execution' ]) is not None :
15841418 setv (to_object , ['codeExecution' ], getv (from_object , ['code_execution' ]))
15851419
@@ -1600,6 +1434,9 @@ def _Tool_to_vertex(
16001434 ],
16011435 )
16021436
1437+ if getv (from_object , ['google_maps' ]) is not None :
1438+ setv (to_object , ['googleMaps' ], getv (from_object , ['google_maps' ]))
1439+
16031440 if getv (from_object , ['google_search' ]) is not None :
16041441 setv (to_object , ['googleSearch' ], getv (from_object , ['google_search' ]))
16051442
@@ -1610,19 +1447,9 @@ def _Tool_to_vertex(
16101447 getv (from_object , ['google_search_retrieval' ]),
16111448 )
16121449
1613- if getv (from_object , ['parallel_ai_search' ]) is not None :
1614- setv (
1615- to_object ,
1616- ['parallelAiSearch' ],
1617- getv (from_object , ['parallel_ai_search' ]),
1618- )
1619-
16201450 if getv (from_object , ['url_context' ]) is not None :
16211451 setv (to_object , ['urlContext' ], getv (from_object , ['url_context' ]))
16221452
1623- if getv (from_object , ['mcp_servers' ]) is not None :
1624- raise ValueError ('mcp_servers parameter is not supported in Vertex AI.' )
1625-
16261453 return to_object
16271454
16281455
0 commit comments