@@ -106,6 +106,27 @@ def _Content_to_mldev(
106106 return to_object
107107
108108
109+ def _Content_to_vertex (
110+ from_object : Union [dict [str , Any ], object ],
111+ parent_object : Optional [dict [str , Any ]] = None ,
112+ ) -> dict [str , Any ]:
113+ to_object : dict [str , Any ] = {}
114+ if getv (from_object , ['parts' ]) is not None :
115+ setv (
116+ to_object ,
117+ ['parts' ],
118+ [
119+ _Part_to_vertex (item , to_object )
120+ for item in getv (from_object , ['parts' ])
121+ ],
122+ )
123+
124+ if getv (from_object , ['role' ]) is not None :
125+ setv (to_object , ['role' ], getv (from_object , ['role' ]))
126+
127+ return to_object
128+
129+
109130def _FileData_to_mldev (
110131 from_object : Union [dict [str , Any ], object ],
111132 parent_object : Optional [dict [str , Any ]] = None ,
@@ -361,6 +382,27 @@ def _LiveClientContent_to_mldev(
361382 return to_object
362383
363384
385+ def _LiveClientContent_to_vertex (
386+ from_object : Union [dict [str , Any ], object ],
387+ parent_object : Optional [dict [str , Any ]] = None ,
388+ ) -> dict [str , Any ]:
389+ to_object : dict [str , Any ] = {}
390+ if getv (from_object , ['turns' ]) is not None :
391+ setv (
392+ to_object ,
393+ ['turns' ],
394+ [
395+ _Content_to_vertex (item , to_object )
396+ for item in getv (from_object , ['turns' ])
397+ ],
398+ )
399+
400+ if getv (from_object , ['turn_complete' ]) is not None :
401+ setv (to_object , ['turnComplete' ], getv (from_object , ['turn_complete' ]))
402+
403+ return to_object
404+
405+
364406def _LiveClientMessage_to_mldev (
365407 api_client : BaseApiClient ,
366408 from_object : Union [dict [str , Any ], object ],
@@ -416,7 +458,13 @@ def _LiveClientMessage_to_vertex(
416458 )
417459
418460 if getv (from_object , ['client_content' ]) is not None :
419- setv (to_object , ['clientContent' ], getv (from_object , ['client_content' ]))
461+ setv (
462+ to_object ,
463+ ['clientContent' ],
464+ _LiveClientContent_to_vertex (
465+ getv (from_object , ['client_content' ]), to_object
466+ ),
467+ )
420468
421469 if getv (from_object , ['realtime_input' ]) is not None :
422470 setv (
@@ -617,7 +665,9 @@ def _LiveClientSetup_to_vertex(
617665 setv (
618666 to_object ,
619667 ['systemInstruction' ],
620- t .t_content (getv (from_object , ['system_instruction' ])),
668+ _Content_to_vertex (
669+ t .t_content (getv (from_object , ['system_instruction' ])), to_object
670+ ),
621671 )
622672
623673 if getv (from_object , ['tools' ]) is not None :
@@ -930,7 +980,9 @@ def _LiveConnectConfig_to_vertex(
930980 setv (
931981 parent_object ,
932982 ['setup' , 'systemInstruction' ],
933- t .t_content (getv (from_object , ['system_instruction' ])),
983+ _Content_to_vertex (
984+ t .t_content (getv (from_object , ['system_instruction' ])), to_object
985+ ),
934986 )
935987
936988 if getv (from_object , ['tools' ]) is not None :
@@ -1403,6 +1455,67 @@ def _Part_to_mldev(
14031455 if getv (from_object , ['video_metadata' ]) is not None :
14041456 setv (to_object , ['videoMetadata' ], getv (from_object , ['video_metadata' ]))
14051457
1458+ if getv (from_object , ['part_metadata' ]) is not None :
1459+ setv (to_object , ['partMetadata' ], getv (from_object , ['part_metadata' ]))
1460+
1461+ return to_object
1462+
1463+
1464+ def _Part_to_vertex (
1465+ from_object : Union [dict [str , Any ], object ],
1466+ parent_object : Optional [dict [str , Any ]] = None ,
1467+ ) -> dict [str , Any ]:
1468+ to_object : dict [str , Any ] = {}
1469+ if getv (from_object , ['media_resolution' ]) is not None :
1470+ setv (
1471+ to_object , ['mediaResolution' ], getv (from_object , ['media_resolution' ])
1472+ )
1473+
1474+ if getv (from_object , ['code_execution_result' ]) is not None :
1475+ setv (
1476+ to_object ,
1477+ ['codeExecutionResult' ],
1478+ getv (from_object , ['code_execution_result' ]),
1479+ )
1480+
1481+ if getv (from_object , ['executable_code' ]) is not None :
1482+ setv (to_object , ['executableCode' ], getv (from_object , ['executable_code' ]))
1483+
1484+ if getv (from_object , ['file_data' ]) is not None :
1485+ setv (to_object , ['fileData' ], getv (from_object , ['file_data' ]))
1486+
1487+ if getv (from_object , ['function_call' ]) is not None :
1488+ setv (to_object , ['functionCall' ], getv (from_object , ['function_call' ]))
1489+
1490+ if getv (from_object , ['function_response' ]) is not None :
1491+ setv (
1492+ to_object ,
1493+ ['functionResponse' ],
1494+ getv (from_object , ['function_response' ]),
1495+ )
1496+
1497+ if getv (from_object , ['inline_data' ]) is not None :
1498+ setv (to_object , ['inlineData' ], getv (from_object , ['inline_data' ]))
1499+
1500+ if getv (from_object , ['text' ]) is not None :
1501+ setv (to_object , ['text' ], getv (from_object , ['text' ]))
1502+
1503+ if getv (from_object , ['thought' ]) is not None :
1504+ setv (to_object , ['thought' ], getv (from_object , ['thought' ]))
1505+
1506+ if getv (from_object , ['thought_signature' ]) is not None :
1507+ setv (
1508+ to_object ,
1509+ ['thoughtSignature' ],
1510+ getv (from_object , ['thought_signature' ]),
1511+ )
1512+
1513+ if getv (from_object , ['video_metadata' ]) is not None :
1514+ setv (to_object , ['videoMetadata' ], getv (from_object , ['video_metadata' ]))
1515+
1516+ if getv (from_object , ['part_metadata' ]) is not None :
1517+ raise ValueError ('part_metadata parameter is not supported in Vertex AI.' )
1518+
14061519 return to_object
14071520
14081521
0 commit comments