@@ -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 :
@@ -1344,10 +1396,8 @@ def _Part_to_mldev(
13441396 parent_object : Optional [dict [str , Any ]] = None ,
13451397) -> dict [str , Any ]:
13461398 to_object : dict [str , Any ] = {}
1347- if getv (from_object , ['media_resolution' ]) is not None :
1348- setv (
1349- to_object , ['mediaResolution' ], getv (from_object , ['media_resolution' ])
1350- )
1399+ if getv (from_object , ['executable_code' ]) is not None :
1400+ setv (to_object , ['executableCode' ], getv (from_object , ['executable_code' ]))
13511401
13521402 if getv (from_object , ['code_execution_result' ]) is not None :
13531403 setv (
@@ -1356,8 +1406,16 @@ def _Part_to_mldev(
13561406 getv (from_object , ['code_execution_result' ]),
13571407 )
13581408
1359- if getv (from_object , ['executable_code' ]) is not None :
1360- setv (to_object , ['executableCode' ], getv (from_object , ['executable_code' ]))
1409+ if getv (from_object , ['media_resolution' ]) is not None :
1410+ setv (
1411+ to_object , ['mediaResolution' ], getv (from_object , ['media_resolution' ])
1412+ )
1413+
1414+ if getv (from_object , ['tool_call' ]) is not None :
1415+ setv (to_object , ['toolCall' ], getv (from_object , ['tool_call' ]))
1416+
1417+ if getv (from_object , ['tool_response' ]) is not None :
1418+ setv (to_object , ['toolResponse' ], getv (from_object , ['tool_response' ]))
13611419
13621420 if getv (from_object , ['file_data' ]) is not None :
13631421 setv (
@@ -1406,6 +1464,67 @@ def _Part_to_mldev(
14061464 return to_object
14071465
14081466
1467+ def _Part_to_vertex (
1468+ from_object : Union [dict [str , Any ], object ],
1469+ parent_object : Optional [dict [str , Any ]] = None ,
1470+ ) -> dict [str , Any ]:
1471+ to_object : dict [str , Any ] = {}
1472+ if getv (from_object , ['executable_code' ]) is not None :
1473+ setv (to_object , ['executableCode' ], getv (from_object , ['executable_code' ]))
1474+
1475+ if getv (from_object , ['code_execution_result' ]) is not None :
1476+ setv (
1477+ to_object ,
1478+ ['codeExecutionResult' ],
1479+ getv (from_object , ['code_execution_result' ]),
1480+ )
1481+
1482+ if getv (from_object , ['media_resolution' ]) is not None :
1483+ setv (
1484+ to_object , ['mediaResolution' ], getv (from_object , ['media_resolution' ])
1485+ )
1486+
1487+ if getv (from_object , ['tool_call' ]) is not None :
1488+ raise ValueError ('tool_call parameter is not supported in Vertex AI.' )
1489+
1490+ if getv (from_object , ['tool_response' ]) is not None :
1491+ raise ValueError ('tool_response parameter is not supported in Vertex AI.' )
1492+
1493+ if getv (from_object , ['file_data' ]) is not None :
1494+ setv (to_object , ['fileData' ], getv (from_object , ['file_data' ]))
1495+
1496+ if getv (from_object , ['function_call' ]) is not None :
1497+ setv (to_object , ['functionCall' ], getv (from_object , ['function_call' ]))
1498+
1499+ if getv (from_object , ['function_response' ]) is not None :
1500+ setv (
1501+ to_object ,
1502+ ['functionResponse' ],
1503+ getv (from_object , ['function_response' ]),
1504+ )
1505+
1506+ if getv (from_object , ['inline_data' ]) is not None :
1507+ setv (to_object , ['inlineData' ], getv (from_object , ['inline_data' ]))
1508+
1509+ if getv (from_object , ['text' ]) is not None :
1510+ setv (to_object , ['text' ], getv (from_object , ['text' ]))
1511+
1512+ if getv (from_object , ['thought' ]) is not None :
1513+ setv (to_object , ['thought' ], getv (from_object , ['thought' ]))
1514+
1515+ if getv (from_object , ['thought_signature' ]) is not None :
1516+ setv (
1517+ to_object ,
1518+ ['thoughtSignature' ],
1519+ getv (from_object , ['thought_signature' ]),
1520+ )
1521+
1522+ if getv (from_object , ['video_metadata' ]) is not None :
1523+ setv (to_object , ['videoMetadata' ], getv (from_object , ['video_metadata' ]))
1524+
1525+ return to_object
1526+
1527+
14091528def _SessionResumptionConfig_to_mldev (
14101529 from_object : Union [dict [str , Any ], object ],
14111530 parent_object : Optional [dict [str , Any ]] = None ,
0 commit comments