google-genai 1.24.0__py3-none-any.whl → 1.26.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/batches.py CHANGED
@@ -258,19 +258,6 @@ def _Schema_to_mldev(
258
258
  return to_object
259
259
 
260
260
 
261
- def _ModelSelectionConfig_to_mldev(
262
- from_object: Union[dict[str, Any], object],
263
- parent_object: Optional[dict[str, Any]] = None,
264
- ) -> dict[str, Any]:
265
- to_object: dict[str, Any] = {}
266
- if getv(from_object, ['feature_selection_preference']) is not None:
267
- raise ValueError(
268
- 'feature_selection_preference parameter is not supported in Gemini API.'
269
- )
270
-
271
- return to_object
272
-
273
-
274
261
  def _SafetySetting_to_mldev(
275
262
  from_object: Union[dict[str, Any], object],
276
263
  parent_object: Optional[dict[str, Any]] = None,
@@ -389,71 +376,6 @@ def _GoogleSearchRetrieval_to_mldev(
389
376
  return to_object
390
377
 
391
378
 
392
- def _EnterpriseWebSearch_to_mldev(
393
- from_object: Union[dict[str, Any], object],
394
- parent_object: Optional[dict[str, Any]] = None,
395
- ) -> dict[str, Any]:
396
- to_object: dict[str, Any] = {}
397
-
398
- return to_object
399
-
400
-
401
- def _ApiKeyConfig_to_mldev(
402
- from_object: Union[dict[str, Any], object],
403
- parent_object: Optional[dict[str, Any]] = None,
404
- ) -> dict[str, Any]:
405
- to_object: dict[str, Any] = {}
406
- if getv(from_object, ['api_key_string']) is not None:
407
- raise ValueError('api_key_string parameter is not supported in Gemini API.')
408
-
409
- return to_object
410
-
411
-
412
- def _AuthConfig_to_mldev(
413
- from_object: Union[dict[str, Any], object],
414
- parent_object: Optional[dict[str, Any]] = None,
415
- ) -> dict[str, Any]:
416
- to_object: dict[str, Any] = {}
417
- if getv(from_object, ['api_key_config']) is not None:
418
- raise ValueError('api_key_config parameter is not supported in Gemini API.')
419
-
420
- if getv(from_object, ['auth_type']) is not None:
421
- setv(to_object, ['authType'], getv(from_object, ['auth_type']))
422
-
423
- if getv(from_object, ['google_service_account_config']) is not None:
424
- setv(
425
- to_object,
426
- ['googleServiceAccountConfig'],
427
- getv(from_object, ['google_service_account_config']),
428
- )
429
-
430
- if getv(from_object, ['http_basic_auth_config']) is not None:
431
- setv(
432
- to_object,
433
- ['httpBasicAuthConfig'],
434
- getv(from_object, ['http_basic_auth_config']),
435
- )
436
-
437
- if getv(from_object, ['oauth_config']) is not None:
438
- setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
439
-
440
- if getv(from_object, ['oidc_config']) is not None:
441
- setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
442
-
443
- return to_object
444
-
445
-
446
- def _GoogleMaps_to_mldev(
447
- from_object: Union[dict[str, Any], object],
448
- parent_object: Optional[dict[str, Any]] = None,
449
- ) -> dict[str, Any]:
450
- to_object: dict[str, Any] = {}
451
- if getv(from_object, ['auth_config']) is not None:
452
- raise ValueError('auth_config parameter is not supported in Gemini API.')
453
-
454
- return to_object
455
-
456
-
457
379
  def _UrlContext_to_mldev(
458
380
  from_object: Union[dict[str, Any], object],
459
381
  parent_object: Optional[dict[str, Any]] = None,
@@ -940,245 +862,241 @@ def _BatchJobSource_to_mldev(
940
862
  return to_object
941
863
 
942
864
 
943
- def _CitationMetadata_to_mldev(
865
+ def _CreateBatchJobConfig_to_mldev(
944
866
  from_object: Union[dict[str, Any], object],
945
867
  parent_object: Optional[dict[str, Any]] = None,
946
868
  ) -> dict[str, Any]:
947
869
  to_object: dict[str, Any] = {}
948
- if getv(from_object, ['citations']) is not None:
949
- setv(to_object, ['citationSources'], getv(from_object, ['citations']))
870
+
871
+ if getv(from_object, ['display_name']) is not None:
872
+ setv(
873
+ parent_object,
874
+ ['batch', 'displayName'],
875
+ getv(from_object, ['display_name']),
876
+ )
877
+
878
+ if getv(from_object, ['dest']) is not None:
879
+ raise ValueError('dest parameter is not supported in Gemini API.')
950
880
 
951
881
  return to_object
952
882
 
953
883
 
954
- def _UrlMetadata_to_mldev(
884
+ def _CreateBatchJobParameters_to_mldev(
885
+ api_client: BaseApiClient,
955
886
  from_object: Union[dict[str, Any], object],
956
887
  parent_object: Optional[dict[str, Any]] = None,
957
888
  ) -> dict[str, Any]:
958
889
  to_object: dict[str, Any] = {}
959
- if getv(from_object, ['retrieved_url']) is not None:
960
- setv(to_object, ['retrievedUrl'], getv(from_object, ['retrieved_url']))
890
+ if getv(from_object, ['model']) is not None:
891
+ setv(
892
+ to_object,
893
+ ['_url', 'model'],
894
+ t.t_model(api_client, getv(from_object, ['model'])),
895
+ )
896
+
897
+ if getv(from_object, ['src']) is not None:
898
+ setv(
899
+ to_object,
900
+ ['batch', 'inputConfig'],
901
+ _BatchJobSource_to_mldev(
902
+ api_client,
903
+ t.t_batch_job_source(api_client, getv(from_object, ['src'])),
904
+ to_object,
905
+ ),
906
+ )
961
907
 
962
- if getv(from_object, ['url_retrieval_status']) is not None:
908
+ if getv(from_object, ['config']) is not None:
963
909
  setv(
964
910
  to_object,
965
- ['urlRetrievalStatus'],
966
- getv(from_object, ['url_retrieval_status']),
911
+ ['config'],
912
+ _CreateBatchJobConfig_to_mldev(
913
+ getv(from_object, ['config']), to_object
914
+ ),
967
915
  )
968
916
 
969
917
  return to_object
970
918
 
971
919
 
972
- def _UrlContextMetadata_to_mldev(
920
+ def _GetBatchJobParameters_to_mldev(
921
+ api_client: BaseApiClient,
973
922
  from_object: Union[dict[str, Any], object],
974
923
  parent_object: Optional[dict[str, Any]] = None,
975
924
  ) -> dict[str, Any]:
976
925
  to_object: dict[str, Any] = {}
977
- if getv(from_object, ['url_metadata']) is not None:
926
+ if getv(from_object, ['name']) is not None:
978
927
  setv(
979
928
  to_object,
980
- ['urlMetadata'],
981
- [
982
- _UrlMetadata_to_mldev(item, to_object)
983
- for item in getv(from_object, ['url_metadata'])
984
- ],
929
+ ['_url', 'name'],
930
+ t.t_batch_job_name(api_client, getv(from_object, ['name'])),
985
931
  )
986
932
 
933
+ if getv(from_object, ['config']) is not None:
934
+ setv(to_object, ['config'], getv(from_object, ['config']))
935
+
987
936
  return to_object
988
937
 
989
938
 
990
- def _Candidate_to_mldev(
939
+ def _CancelBatchJobParameters_to_mldev(
940
+ api_client: BaseApiClient,
991
941
  from_object: Union[dict[str, Any], object],
992
942
  parent_object: Optional[dict[str, Any]] = None,
993
943
  ) -> dict[str, Any]:
994
944
  to_object: dict[str, Any] = {}
995
- if getv(from_object, ['content']) is not None:
945
+ if getv(from_object, ['name']) is not None:
996
946
  setv(
997
947
  to_object,
998
- ['content'],
999
- _Content_to_mldev(getv(from_object, ['content']), to_object),
948
+ ['_url', 'name'],
949
+ t.t_batch_job_name(api_client, getv(from_object, ['name'])),
1000
950
  )
1001
951
 
1002
- if getv(from_object, ['citation_metadata']) is not None:
1003
- setv(
1004
- to_object,
1005
- ['citationMetadata'],
1006
- _CitationMetadata_to_mldev(
1007
- getv(from_object, ['citation_metadata']), to_object
1008
- ),
1009
- )
952
+ if getv(from_object, ['config']) is not None:
953
+ setv(to_object, ['config'], getv(from_object, ['config']))
1010
954
 
1011
- if getv(from_object, ['finish_message']) is not None:
1012
- raise ValueError('finish_message parameter is not supported in Gemini API.')
955
+ return to_object
1013
956
 
1014
- if getv(from_object, ['token_count']) is not None:
1015
- setv(to_object, ['tokenCount'], getv(from_object, ['token_count']))
1016
957
 
1017
- if getv(from_object, ['finish_reason']) is not None:
1018
- _FinishReason_to_mldev_enum_validate(getv(from_object, ['finish_reason']))
1019
- setv(to_object, ['finishReason'], getv(from_object, ['finish_reason']))
958
+ def _ListBatchJobsConfig_to_mldev(
959
+ from_object: Union[dict[str, Any], object],
960
+ parent_object: Optional[dict[str, Any]] = None,
961
+ ) -> dict[str, Any]:
962
+ to_object: dict[str, Any] = {}
1020
963
 
1021
- if getv(from_object, ['url_context_metadata']) is not None:
964
+ if getv(from_object, ['page_size']) is not None:
1022
965
  setv(
1023
- to_object,
1024
- ['urlContextMetadata'],
1025
- _UrlContextMetadata_to_mldev(
1026
- getv(from_object, ['url_context_metadata']), to_object
1027
- ),
966
+ parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
1028
967
  )
1029
968
 
1030
- if getv(from_object, ['avg_logprobs']) is not None:
1031
- setv(to_object, ['avgLogprobs'], getv(from_object, ['avg_logprobs']))
1032
-
1033
- if getv(from_object, ['grounding_metadata']) is not None:
969
+ if getv(from_object, ['page_token']) is not None:
1034
970
  setv(
1035
- to_object,
1036
- ['groundingMetadata'],
1037
- getv(from_object, ['grounding_metadata']),
971
+ parent_object,
972
+ ['_query', 'pageToken'],
973
+ getv(from_object, ['page_token']),
1038
974
  )
1039
975
 
1040
- if getv(from_object, ['index']) is not None:
1041
- setv(to_object, ['index'], getv(from_object, ['index']))
1042
-
1043
- if getv(from_object, ['logprobs_result']) is not None:
1044
- setv(to_object, ['logprobsResult'], getv(from_object, ['logprobs_result']))
1045
-
1046
- if getv(from_object, ['safety_ratings']) is not None:
1047
- setv(to_object, ['safetyRatings'], getv(from_object, ['safety_ratings']))
976
+ if getv(from_object, ['filter']) is not None:
977
+ raise ValueError('filter parameter is not supported in Gemini API.')
1048
978
 
1049
979
  return to_object
1050
980
 
1051
981
 
1052
- def _GenerateContentResponse_to_mldev(
982
+ def _ListBatchJobsParameters_to_mldev(
1053
983
  from_object: Union[dict[str, Any], object],
1054
984
  parent_object: Optional[dict[str, Any]] = None,
1055
985
  ) -> dict[str, Any]:
1056
986
  to_object: dict[str, Any] = {}
1057
-
1058
- if getv(from_object, ['sdk_http_response']) is not None:
1059
- setv(
1060
- to_object, ['sdkHttpResponse'], getv(from_object, ['sdk_http_response'])
1061
- )
1062
-
1063
- if getv(from_object, ['candidates']) is not None:
987
+ if getv(from_object, ['config']) is not None:
1064
988
  setv(
1065
989
  to_object,
1066
- ['candidates'],
1067
- [
1068
- _Candidate_to_mldev(item, to_object)
1069
- for item in getv(from_object, ['candidates'])
1070
- ],
990
+ ['config'],
991
+ _ListBatchJobsConfig_to_mldev(getv(from_object, ['config']), to_object),
1071
992
  )
1072
993
 
1073
- if getv(from_object, ['create_time']) is not None:
1074
- raise ValueError('create_time parameter is not supported in Gemini API.')
1075
-
1076
- if getv(from_object, ['response_id']) is not None:
1077
- raise ValueError('response_id parameter is not supported in Gemini API.')
1078
-
1079
- if getv(from_object, ['model_version']) is not None:
1080
- setv(to_object, ['modelVersion'], getv(from_object, ['model_version']))
1081
-
1082
- if getv(from_object, ['prompt_feedback']) is not None:
1083
- setv(to_object, ['promptFeedback'], getv(from_object, ['prompt_feedback']))
1084
-
1085
- if getv(from_object, ['usage_metadata']) is not None:
1086
- setv(to_object, ['usageMetadata'], getv(from_object, ['usage_metadata']))
1087
-
1088
994
  return to_object
1089
995
 
1090
996
 
1091
- def _JobError_to_mldev(
997
+ def _DeleteBatchJobParameters_to_mldev(
998
+ api_client: BaseApiClient,
1092
999
  from_object: Union[dict[str, Any], object],
1093
1000
  parent_object: Optional[dict[str, Any]] = None,
1094
1001
  ) -> dict[str, Any]:
1095
1002
  to_object: dict[str, Any] = {}
1096
- if getv(from_object, ['details']) is not None:
1097
- raise ValueError('details parameter is not supported in Gemini API.')
1098
-
1099
- if getv(from_object, ['code']) is not None:
1100
- raise ValueError('code parameter is not supported in Gemini API.')
1003
+ if getv(from_object, ['name']) is not None:
1004
+ setv(
1005
+ to_object,
1006
+ ['_url', 'name'],
1007
+ t.t_batch_job_name(api_client, getv(from_object, ['name'])),
1008
+ )
1101
1009
 
1102
- if getv(from_object, ['message']) is not None:
1103
- raise ValueError('message parameter is not supported in Gemini API.')
1010
+ if getv(from_object, ['config']) is not None:
1011
+ setv(to_object, ['config'], getv(from_object, ['config']))
1104
1012
 
1105
1013
  return to_object
1106
1014
 
1107
1015
 
1108
- def _InlinedResponse_to_mldev(
1016
+ def _BatchJobSource_to_vertex(
1109
1017
  from_object: Union[dict[str, Any], object],
1110
1018
  parent_object: Optional[dict[str, Any]] = None,
1111
1019
  ) -> dict[str, Any]:
1112
1020
  to_object: dict[str, Any] = {}
1113
- if getv(from_object, ['response']) is not None:
1021
+ if getv(from_object, ['format']) is not None:
1022
+ setv(to_object, ['instancesFormat'], getv(from_object, ['format']))
1023
+
1024
+ if getv(from_object, ['gcs_uri']) is not None:
1025
+ setv(to_object, ['gcsSource', 'uris'], getv(from_object, ['gcs_uri']))
1026
+
1027
+ if getv(from_object, ['bigquery_uri']) is not None:
1114
1028
  setv(
1115
1029
  to_object,
1116
- ['response'],
1117
- _GenerateContentResponse_to_mldev(
1118
- getv(from_object, ['response']), to_object
1119
- ),
1030
+ ['bigquerySource', 'inputUri'],
1031
+ getv(from_object, ['bigquery_uri']),
1120
1032
  )
1121
1033
 
1122
- if getv(from_object, ['error']) is not None:
1123
- setv(
1124
- to_object,
1125
- ['error'],
1126
- _JobError_to_mldev(getv(from_object, ['error']), to_object),
1034
+ if getv(from_object, ['file_name']) is not None:
1035
+ raise ValueError('file_name parameter is not supported in Vertex AI.')
1036
+
1037
+ if getv(from_object, ['inlined_requests']) is not None:
1038
+ raise ValueError(
1039
+ 'inlined_requests parameter is not supported in Vertex AI.'
1127
1040
  )
1128
1041
 
1129
1042
  return to_object
1130
1043
 
1131
1044
 
1132
- def _BatchJobDestination_to_mldev(
1045
+ def _BatchJobDestination_to_vertex(
1133
1046
  from_object: Union[dict[str, Any], object],
1134
1047
  parent_object: Optional[dict[str, Any]] = None,
1135
1048
  ) -> dict[str, Any]:
1136
1049
  to_object: dict[str, Any] = {}
1137
1050
  if getv(from_object, ['format']) is not None:
1138
- raise ValueError('format parameter is not supported in Gemini API.')
1051
+ setv(to_object, ['predictionsFormat'], getv(from_object, ['format']))
1139
1052
 
1140
1053
  if getv(from_object, ['gcs_uri']) is not None:
1141
- raise ValueError('gcs_uri parameter is not supported in Gemini API.')
1054
+ setv(
1055
+ to_object,
1056
+ ['gcsDestination', 'outputUriPrefix'],
1057
+ getv(from_object, ['gcs_uri']),
1058
+ )
1142
1059
 
1143
1060
  if getv(from_object, ['bigquery_uri']) is not None:
1144
- raise ValueError('bigquery_uri parameter is not supported in Gemini API.')
1061
+ setv(
1062
+ to_object,
1063
+ ['bigqueryDestination', 'outputUri'],
1064
+ getv(from_object, ['bigquery_uri']),
1065
+ )
1145
1066
 
1146
1067
  if getv(from_object, ['file_name']) is not None:
1147
- setv(to_object, ['responsesFile'], getv(from_object, ['file_name']))
1068
+ raise ValueError('file_name parameter is not supported in Vertex AI.')
1148
1069
 
1149
1070
  if getv(from_object, ['inlined_responses']) is not None:
1150
- setv(
1151
- to_object,
1152
- ['inlinedResponses', 'inlinedResponses'],
1153
- [
1154
- _InlinedResponse_to_mldev(item, to_object)
1155
- for item in getv(from_object, ['inlined_responses'])
1156
- ],
1071
+ raise ValueError(
1072
+ 'inlined_responses parameter is not supported in Vertex AI.'
1157
1073
  )
1158
1074
 
1159
1075
  return to_object
1160
1076
 
1161
1077
 
1162
- def _CreateBatchJobConfig_to_mldev(
1078
+ def _CreateBatchJobConfig_to_vertex(
1163
1079
  from_object: Union[dict[str, Any], object],
1164
1080
  parent_object: Optional[dict[str, Any]] = None,
1165
1081
  ) -> dict[str, Any]:
1166
1082
  to_object: dict[str, Any] = {}
1167
1083
 
1168
1084
  if getv(from_object, ['display_name']) is not None:
1085
+ setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
1086
+
1087
+ if getv(from_object, ['dest']) is not None:
1169
1088
  setv(
1170
1089
  parent_object,
1171
- ['batch', 'displayName'],
1172
- getv(from_object, ['display_name']),
1090
+ ['outputConfig'],
1091
+ _BatchJobDestination_to_vertex(
1092
+ t.t_batch_job_destination(getv(from_object, ['dest'])), to_object
1093
+ ),
1173
1094
  )
1174
1095
 
1175
- if getv(from_object, ['dest']) is not None:
1176
- raise ValueError('dest parameter is not supported in Gemini API.')
1177
-
1178
1096
  return to_object
1179
1097
 
1180
1098
 
1181
- def _CreateBatchJobParameters_to_mldev(
1099
+ def _CreateBatchJobParameters_to_vertex(
1182
1100
  api_client: BaseApiClient,
1183
1101
  from_object: Union[dict[str, Any], object],
1184
1102
  parent_object: Optional[dict[str, Any]] = None,
@@ -1187,16 +1105,15 @@ def _CreateBatchJobParameters_to_mldev(
1187
1105
  if getv(from_object, ['model']) is not None:
1188
1106
  setv(
1189
1107
  to_object,
1190
- ['_url', 'model'],
1108
+ ['model'],
1191
1109
  t.t_model(api_client, getv(from_object, ['model'])),
1192
1110
  )
1193
1111
 
1194
1112
  if getv(from_object, ['src']) is not None:
1195
1113
  setv(
1196
1114
  to_object,
1197
- ['batch', 'inputConfig'],
1198
- _BatchJobSource_to_mldev(
1199
- api_client,
1115
+ ['inputConfig'],
1116
+ _BatchJobSource_to_vertex(
1200
1117
  t.t_batch_job_source(api_client, getv(from_object, ['src'])),
1201
1118
  to_object,
1202
1119
  ),
@@ -1206,7 +1123,7 @@ def _CreateBatchJobParameters_to_mldev(
1206
1123
  setv(
1207
1124
  to_object,
1208
1125
  ['config'],
1209
- _CreateBatchJobConfig_to_mldev(
1126
+ _CreateBatchJobConfig_to_vertex(
1210
1127
  getv(from_object, ['config']), to_object
1211
1128
  ),
1212
1129
  )
@@ -1214,7 +1131,7 @@ def _CreateBatchJobParameters_to_mldev(
1214
1131
  return to_object
1215
1132
 
1216
1133
 
1217
- def _GetBatchJobParameters_to_mldev(
1134
+ def _GetBatchJobParameters_to_vertex(
1218
1135
  api_client: BaseApiClient,
1219
1136
  from_object: Union[dict[str, Any], object],
1220
1137
  parent_object: Optional[dict[str, Any]] = None,
@@ -1233,7 +1150,7 @@ def _GetBatchJobParameters_to_mldev(
1233
1150
  return to_object
1234
1151
 
1235
1152
 
1236
- def _CancelBatchJobParameters_to_mldev(
1153
+ def _CancelBatchJobParameters_to_vertex(
1237
1154
  api_client: BaseApiClient,
1238
1155
  from_object: Union[dict[str, Any], object],
1239
1156
  parent_object: Optional[dict[str, Any]] = None,
@@ -1252,7 +1169,7 @@ def _CancelBatchJobParameters_to_mldev(
1252
1169
  return to_object
1253
1170
 
1254
1171
 
1255
- def _ListBatchJobsConfig_to_mldev(
1172
+ def _ListBatchJobsConfig_to_vertex(
1256
1173
  from_object: Union[dict[str, Any], object],
1257
1174
  parent_object: Optional[dict[str, Any]] = None,
1258
1175
  ) -> dict[str, Any]:
@@ -1271,12 +1188,12 @@ def _ListBatchJobsConfig_to_mldev(
1271
1188
  )
1272
1189
 
1273
1190
  if getv(from_object, ['filter']) is not None:
1274
- raise ValueError('filter parameter is not supported in Gemini API.')
1191
+ setv(parent_object, ['_query', 'filter'], getv(from_object, ['filter']))
1275
1192
 
1276
1193
  return to_object
1277
1194
 
1278
1195
 
1279
- def _ListBatchJobsParameters_to_mldev(
1196
+ def _ListBatchJobsParameters_to_vertex(
1280
1197
  from_object: Union[dict[str, Any], object],
1281
1198
  parent_object: Optional[dict[str, Any]] = None,
1282
1199
  ) -> dict[str, Any]:
@@ -1285,13 +1202,15 @@ def _ListBatchJobsParameters_to_mldev(
1285
1202
  setv(
1286
1203
  to_object,
1287
1204
  ['config'],
1288
- _ListBatchJobsConfig_to_mldev(getv(from_object, ['config']), to_object),
1205
+ _ListBatchJobsConfig_to_vertex(
1206
+ getv(from_object, ['config']), to_object
1207
+ ),
1289
1208
  )
1290
1209
 
1291
1210
  return to_object
1292
1211
 
1293
1212
 
1294
- def _DeleteBatchJobParameters_to_mldev(
1213
+ def _DeleteBatchJobParameters_to_vertex(
1295
1214
  api_client: BaseApiClient,
1296
1215
  from_object: Union[dict[str, Any], object],
1297
1216
  parent_object: Optional[dict[str, Any]] = None,
@@ -1310,7 +1229,7 @@ def _DeleteBatchJobParameters_to_mldev(
1310
1229
  return to_object
1311
1230
 
1312
1231
 
1313
- def _VideoMetadata_to_vertex(
1232
+ def _VideoMetadata_from_mldev(
1314
1233
  from_object: Union[dict[str, Any], object],
1315
1234
  parent_object: Optional[dict[str, Any]] = None,
1316
1235
  ) -> dict[str, Any]:
@@ -1318,3333 +1237,142 @@ def _VideoMetadata_to_vertex(
1318
1237
  if getv(from_object, ['fps']) is not None:
1319
1238
  setv(to_object, ['fps'], getv(from_object, ['fps']))
1320
1239
 
1321
- if getv(from_object, ['end_offset']) is not None:
1322
- setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
1323
-
1324
- if getv(from_object, ['start_offset']) is not None:
1325
- setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
1240
+ if getv(from_object, ['endOffset']) is not None:
1241
+ setv(to_object, ['end_offset'], getv(from_object, ['endOffset']))
1242
+
1243
+ if getv(from_object, ['startOffset']) is not None:
1244
+ setv(to_object, ['start_offset'], getv(from_object, ['startOffset']))
1326
1245
 
1327
1246
  return to_object
1328
1247
 
1329
1248
 
1330
- def _Blob_to_vertex(
1249
+ def _Blob_from_mldev(
1331
1250
  from_object: Union[dict[str, Any], object],
1332
1251
  parent_object: Optional[dict[str, Any]] = None,
1333
1252
  ) -> dict[str, Any]:
1334
1253
  to_object: dict[str, Any] = {}
1335
- if getv(from_object, ['display_name']) is not None:
1336
- setv(to_object, ['displayName'], getv(from_object, ['display_name']))
1337
1254
 
1338
1255
  if getv(from_object, ['data']) is not None:
1339
1256
  setv(to_object, ['data'], getv(from_object, ['data']))
1340
1257
 
1341
- if getv(from_object, ['mime_type']) is not None:
1342
- setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
1258
+ if getv(from_object, ['mimeType']) is not None:
1259
+ setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
1343
1260
 
1344
1261
  return to_object
1345
1262
 
1346
1263
 
1347
- def _FileData_to_vertex(
1264
+ def _FileData_from_mldev(
1348
1265
  from_object: Union[dict[str, Any], object],
1349
1266
  parent_object: Optional[dict[str, Any]] = None,
1350
1267
  ) -> dict[str, Any]:
1351
1268
  to_object: dict[str, Any] = {}
1352
- if getv(from_object, ['display_name']) is not None:
1353
- setv(to_object, ['displayName'], getv(from_object, ['display_name']))
1354
1269
 
1355
- if getv(from_object, ['file_uri']) is not None:
1356
- setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
1270
+ if getv(from_object, ['fileUri']) is not None:
1271
+ setv(to_object, ['file_uri'], getv(from_object, ['fileUri']))
1357
1272
 
1358
- if getv(from_object, ['mime_type']) is not None:
1359
- setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
1273
+ if getv(from_object, ['mimeType']) is not None:
1274
+ setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
1360
1275
 
1361
1276
  return to_object
1362
1277
 
1363
1278
 
1364
- def _Part_to_vertex(
1279
+ def _Part_from_mldev(
1365
1280
  from_object: Union[dict[str, Any], object],
1366
1281
  parent_object: Optional[dict[str, Any]] = None,
1367
1282
  ) -> dict[str, Any]:
1368
1283
  to_object: dict[str, Any] = {}
1369
- if getv(from_object, ['video_metadata']) is not None:
1284
+ if getv(from_object, ['videoMetadata']) is not None:
1370
1285
  setv(
1371
1286
  to_object,
1372
- ['videoMetadata'],
1373
- _VideoMetadata_to_vertex(
1374
- getv(from_object, ['video_metadata']), to_object
1287
+ ['video_metadata'],
1288
+ _VideoMetadata_from_mldev(
1289
+ getv(from_object, ['videoMetadata']), to_object
1375
1290
  ),
1376
1291
  )
1377
1292
 
1378
1293
  if getv(from_object, ['thought']) is not None:
1379
1294
  setv(to_object, ['thought'], getv(from_object, ['thought']))
1380
1295
 
1381
- if getv(from_object, ['inline_data']) is not None:
1382
- setv(
1383
- to_object,
1384
- ['inlineData'],
1385
- _Blob_to_vertex(getv(from_object, ['inline_data']), to_object),
1386
- )
1387
-
1388
- if getv(from_object, ['file_data']) is not None:
1389
- setv(
1390
- to_object,
1391
- ['fileData'],
1392
- _FileData_to_vertex(getv(from_object, ['file_data']), to_object),
1393
- )
1394
-
1395
- if getv(from_object, ['thought_signature']) is not None:
1396
- setv(
1397
- to_object,
1398
- ['thoughtSignature'],
1399
- getv(from_object, ['thought_signature']),
1400
- )
1401
-
1402
- if getv(from_object, ['code_execution_result']) is not None:
1403
- setv(
1404
- to_object,
1405
- ['codeExecutionResult'],
1406
- getv(from_object, ['code_execution_result']),
1407
- )
1408
-
1409
- if getv(from_object, ['executable_code']) is not None:
1410
- setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
1411
-
1412
- if getv(from_object, ['function_call']) is not None:
1413
- setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
1414
-
1415
- if getv(from_object, ['function_response']) is not None:
1416
- setv(
1417
- to_object,
1418
- ['functionResponse'],
1419
- getv(from_object, ['function_response']),
1420
- )
1421
-
1422
- if getv(from_object, ['text']) is not None:
1423
- setv(to_object, ['text'], getv(from_object, ['text']))
1424
-
1425
- return to_object
1426
-
1427
-
1428
- def _Content_to_vertex(
1429
- from_object: Union[dict[str, Any], object],
1430
- parent_object: Optional[dict[str, Any]] = None,
1431
- ) -> dict[str, Any]:
1432
- to_object: dict[str, Any] = {}
1433
- if getv(from_object, ['parts']) is not None:
1434
- setv(
1435
- to_object,
1436
- ['parts'],
1437
- [
1438
- _Part_to_vertex(item, to_object)
1439
- for item in getv(from_object, ['parts'])
1440
- ],
1441
- )
1442
-
1443
- if getv(from_object, ['role']) is not None:
1444
- setv(to_object, ['role'], getv(from_object, ['role']))
1445
-
1446
- return to_object
1447
-
1448
-
1449
- def _Schema_to_vertex(
1450
- from_object: Union[dict[str, Any], object],
1451
- parent_object: Optional[dict[str, Any]] = None,
1452
- ) -> dict[str, Any]:
1453
- to_object: dict[str, Any] = {}
1454
- if getv(from_object, ['additional_properties']) is not None:
1455
- setv(
1456
- to_object,
1457
- ['additionalProperties'],
1458
- getv(from_object, ['additional_properties']),
1459
- )
1460
-
1461
- if getv(from_object, ['defs']) is not None:
1462
- setv(to_object, ['defs'], getv(from_object, ['defs']))
1463
-
1464
- if getv(from_object, ['ref']) is not None:
1465
- setv(to_object, ['ref'], getv(from_object, ['ref']))
1466
-
1467
- if getv(from_object, ['any_of']) is not None:
1468
- setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
1469
-
1470
- if getv(from_object, ['default']) is not None:
1471
- setv(to_object, ['default'], getv(from_object, ['default']))
1472
-
1473
- if getv(from_object, ['description']) is not None:
1474
- setv(to_object, ['description'], getv(from_object, ['description']))
1475
-
1476
- if getv(from_object, ['enum']) is not None:
1477
- setv(to_object, ['enum'], getv(from_object, ['enum']))
1478
-
1479
- if getv(from_object, ['example']) is not None:
1480
- setv(to_object, ['example'], getv(from_object, ['example']))
1481
-
1482
- if getv(from_object, ['format']) is not None:
1483
- setv(to_object, ['format'], getv(from_object, ['format']))
1484
-
1485
- if getv(from_object, ['items']) is not None:
1486
- setv(to_object, ['items'], getv(from_object, ['items']))
1487
-
1488
- if getv(from_object, ['max_items']) is not None:
1489
- setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
1490
-
1491
- if getv(from_object, ['max_length']) is not None:
1492
- setv(to_object, ['maxLength'], getv(from_object, ['max_length']))
1493
-
1494
- if getv(from_object, ['max_properties']) is not None:
1495
- setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
1496
-
1497
- if getv(from_object, ['maximum']) is not None:
1498
- setv(to_object, ['maximum'], getv(from_object, ['maximum']))
1499
-
1500
- if getv(from_object, ['min_items']) is not None:
1501
- setv(to_object, ['minItems'], getv(from_object, ['min_items']))
1502
-
1503
- if getv(from_object, ['min_length']) is not None:
1504
- setv(to_object, ['minLength'], getv(from_object, ['min_length']))
1505
-
1506
- if getv(from_object, ['min_properties']) is not None:
1507
- setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
1508
-
1509
- if getv(from_object, ['minimum']) is not None:
1510
- setv(to_object, ['minimum'], getv(from_object, ['minimum']))
1511
-
1512
- if getv(from_object, ['nullable']) is not None:
1513
- setv(to_object, ['nullable'], getv(from_object, ['nullable']))
1514
-
1515
- if getv(from_object, ['pattern']) is not None:
1516
- setv(to_object, ['pattern'], getv(from_object, ['pattern']))
1517
-
1518
- if getv(from_object, ['properties']) is not None:
1519
- setv(to_object, ['properties'], getv(from_object, ['properties']))
1520
-
1521
- if getv(from_object, ['property_ordering']) is not None:
1522
- setv(
1523
- to_object,
1524
- ['propertyOrdering'],
1525
- getv(from_object, ['property_ordering']),
1526
- )
1527
-
1528
- if getv(from_object, ['required']) is not None:
1529
- setv(to_object, ['required'], getv(from_object, ['required']))
1530
-
1531
- if getv(from_object, ['title']) is not None:
1532
- setv(to_object, ['title'], getv(from_object, ['title']))
1533
-
1534
- if getv(from_object, ['type']) is not None:
1535
- setv(to_object, ['type'], getv(from_object, ['type']))
1536
-
1537
- return to_object
1538
-
1539
-
1540
- def _ModelSelectionConfig_to_vertex(
1541
- from_object: Union[dict[str, Any], object],
1542
- parent_object: Optional[dict[str, Any]] = None,
1543
- ) -> dict[str, Any]:
1544
- to_object: dict[str, Any] = {}
1545
- if getv(from_object, ['feature_selection_preference']) is not None:
1546
- setv(
1547
- to_object,
1548
- ['featureSelectionPreference'],
1549
- getv(from_object, ['feature_selection_preference']),
1550
- )
1551
-
1552
- return to_object
1553
-
1554
-
1555
- def _SafetySetting_to_vertex(
1556
- from_object: Union[dict[str, Any], object],
1557
- parent_object: Optional[dict[str, Any]] = None,
1558
- ) -> dict[str, Any]:
1559
- to_object: dict[str, Any] = {}
1560
- if getv(from_object, ['method']) is not None:
1561
- setv(to_object, ['method'], getv(from_object, ['method']))
1562
-
1563
- if getv(from_object, ['category']) is not None:
1564
- setv(to_object, ['category'], getv(from_object, ['category']))
1565
-
1566
- if getv(from_object, ['threshold']) is not None:
1567
- setv(to_object, ['threshold'], getv(from_object, ['threshold']))
1568
-
1569
- return to_object
1570
-
1571
-
1572
- def _FunctionDeclaration_to_vertex(
1573
- from_object: Union[dict[str, Any], object],
1574
- parent_object: Optional[dict[str, Any]] = None,
1575
- ) -> dict[str, Any]:
1576
- to_object: dict[str, Any] = {}
1577
- if getv(from_object, ['behavior']) is not None:
1578
- raise ValueError('behavior parameter is not supported in Vertex AI.')
1579
-
1580
- if getv(from_object, ['description']) is not None:
1581
- setv(to_object, ['description'], getv(from_object, ['description']))
1582
-
1583
- if getv(from_object, ['name']) is not None:
1584
- setv(to_object, ['name'], getv(from_object, ['name']))
1585
-
1586
- if getv(from_object, ['parameters']) is not None:
1587
- setv(to_object, ['parameters'], getv(from_object, ['parameters']))
1588
-
1589
- if getv(from_object, ['parameters_json_schema']) is not None:
1296
+ if getv(from_object, ['inlineData']) is not None:
1590
1297
  setv(
1591
1298
  to_object,
1592
- ['parametersJsonSchema'],
1593
- getv(from_object, ['parameters_json_schema']),
1299
+ ['inline_data'],
1300
+ _Blob_from_mldev(getv(from_object, ['inlineData']), to_object),
1594
1301
  )
1595
1302
 
1596
- if getv(from_object, ['response']) is not None:
1597
- setv(to_object, ['response'], getv(from_object, ['response']))
1598
-
1599
- if getv(from_object, ['response_json_schema']) is not None:
1303
+ if getv(from_object, ['fileData']) is not None:
1600
1304
  setv(
1601
1305
  to_object,
1602
- ['responseJsonSchema'],
1603
- getv(from_object, ['response_json_schema']),
1604
- )
1605
-
1606
- return to_object
1607
-
1608
-
1609
- def _Interval_to_vertex(
1610
- from_object: Union[dict[str, Any], object],
1611
- parent_object: Optional[dict[str, Any]] = None,
1612
- ) -> dict[str, Any]:
1613
- to_object: dict[str, Any] = {}
1614
- if getv(from_object, ['start_time']) is not None:
1615
- setv(to_object, ['startTime'], getv(from_object, ['start_time']))
1616
-
1617
- if getv(from_object, ['end_time']) is not None:
1618
- setv(to_object, ['endTime'], getv(from_object, ['end_time']))
1619
-
1620
- return to_object
1621
-
1622
-
1623
- def _GoogleSearch_to_vertex(
1624
- from_object: Union[dict[str, Any], object],
1625
- parent_object: Optional[dict[str, Any]] = None,
1626
- ) -> dict[str, Any]:
1627
- to_object: dict[str, Any] = {}
1628
- if getv(from_object, ['time_range_filter']) is not None:
1629
- setv(
1630
- to_object,
1631
- ['timeRangeFilter'],
1632
- _Interval_to_vertex(
1633
- getv(from_object, ['time_range_filter']), to_object
1634
- ),
1635
- )
1636
-
1637
- return to_object
1638
-
1639
-
1640
- def _DynamicRetrievalConfig_to_vertex(
1641
- from_object: Union[dict[str, Any], object],
1642
- parent_object: Optional[dict[str, Any]] = None,
1643
- ) -> dict[str, Any]:
1644
- to_object: dict[str, Any] = {}
1645
- if getv(from_object, ['mode']) is not None:
1646
- setv(to_object, ['mode'], getv(from_object, ['mode']))
1647
-
1648
- if getv(from_object, ['dynamic_threshold']) is not None:
1649
- setv(
1650
- to_object,
1651
- ['dynamicThreshold'],
1652
- getv(from_object, ['dynamic_threshold']),
1653
- )
1654
-
1655
- return to_object
1656
-
1657
-
1658
- def _GoogleSearchRetrieval_to_vertex(
1659
- from_object: Union[dict[str, Any], object],
1660
- parent_object: Optional[dict[str, Any]] = None,
1661
- ) -> dict[str, Any]:
1662
- to_object: dict[str, Any] = {}
1663
- if getv(from_object, ['dynamic_retrieval_config']) is not None:
1664
- setv(
1665
- to_object,
1666
- ['dynamicRetrievalConfig'],
1667
- _DynamicRetrievalConfig_to_vertex(
1668
- getv(from_object, ['dynamic_retrieval_config']), to_object
1669
- ),
1670
- )
1671
-
1672
- return to_object
1673
-
1674
-
1675
- def _EnterpriseWebSearch_to_vertex(
1676
- from_object: Union[dict[str, Any], object],
1677
- parent_object: Optional[dict[str, Any]] = None,
1678
- ) -> dict[str, Any]:
1679
- to_object: dict[str, Any] = {}
1680
-
1681
- return to_object
1682
-
1683
-
1684
- def _ApiKeyConfig_to_vertex(
1685
- from_object: Union[dict[str, Any], object],
1686
- parent_object: Optional[dict[str, Any]] = None,
1687
- ) -> dict[str, Any]:
1688
- to_object: dict[str, Any] = {}
1689
- if getv(from_object, ['api_key_string']) is not None:
1690
- setv(to_object, ['apiKeyString'], getv(from_object, ['api_key_string']))
1691
-
1692
- return to_object
1693
-
1694
-
1695
- def _AuthConfig_to_vertex(
1696
- from_object: Union[dict[str, Any], object],
1697
- parent_object: Optional[dict[str, Any]] = None,
1698
- ) -> dict[str, Any]:
1699
- to_object: dict[str, Any] = {}
1700
- if getv(from_object, ['api_key_config']) is not None:
1701
- setv(
1702
- to_object,
1703
- ['apiKeyConfig'],
1704
- _ApiKeyConfig_to_vertex(
1705
- getv(from_object, ['api_key_config']), to_object
1706
- ),
1707
- )
1708
-
1709
- if getv(from_object, ['auth_type']) is not None:
1710
- setv(to_object, ['authType'], getv(from_object, ['auth_type']))
1711
-
1712
- if getv(from_object, ['google_service_account_config']) is not None:
1713
- setv(
1714
- to_object,
1715
- ['googleServiceAccountConfig'],
1716
- getv(from_object, ['google_service_account_config']),
1717
- )
1718
-
1719
- if getv(from_object, ['http_basic_auth_config']) is not None:
1720
- setv(
1721
- to_object,
1722
- ['httpBasicAuthConfig'],
1723
- getv(from_object, ['http_basic_auth_config']),
1724
- )
1725
-
1726
- if getv(from_object, ['oauth_config']) is not None:
1727
- setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
1728
-
1729
- if getv(from_object, ['oidc_config']) is not None:
1730
- setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
1731
-
1732
- return to_object
1733
-
1734
-
1735
- def _GoogleMaps_to_vertex(
1736
- from_object: Union[dict[str, Any], object],
1737
- parent_object: Optional[dict[str, Any]] = None,
1738
- ) -> dict[str, Any]:
1739
- to_object: dict[str, Any] = {}
1740
- if getv(from_object, ['auth_config']) is not None:
1741
- setv(
1742
- to_object,
1743
- ['authConfig'],
1744
- _AuthConfig_to_vertex(getv(from_object, ['auth_config']), to_object),
1745
- )
1746
-
1747
- return to_object
1748
-
1749
-
1750
- def _UrlContext_to_vertex(
1751
- from_object: Union[dict[str, Any], object],
1752
- parent_object: Optional[dict[str, Any]] = None,
1753
- ) -> dict[str, Any]:
1754
- to_object: dict[str, Any] = {}
1755
-
1756
- return to_object
1757
-
1758
-
1759
- def _Tool_to_vertex(
1760
- from_object: Union[dict[str, Any], object],
1761
- parent_object: Optional[dict[str, Any]] = None,
1762
- ) -> dict[str, Any]:
1763
- to_object: dict[str, Any] = {}
1764
- if getv(from_object, ['function_declarations']) is not None:
1765
- setv(
1766
- to_object,
1767
- ['functionDeclarations'],
1768
- [
1769
- _FunctionDeclaration_to_vertex(item, to_object)
1770
- for item in getv(from_object, ['function_declarations'])
1771
- ],
1772
- )
1773
-
1774
- if getv(from_object, ['retrieval']) is not None:
1775
- setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
1776
-
1777
- if getv(from_object, ['google_search']) is not None:
1778
- setv(
1779
- to_object,
1780
- ['googleSearch'],
1781
- _GoogleSearch_to_vertex(
1782
- getv(from_object, ['google_search']), to_object
1783
- ),
1784
- )
1785
-
1786
- if getv(from_object, ['google_search_retrieval']) is not None:
1787
- setv(
1788
- to_object,
1789
- ['googleSearchRetrieval'],
1790
- _GoogleSearchRetrieval_to_vertex(
1791
- getv(from_object, ['google_search_retrieval']), to_object
1792
- ),
1793
- )
1794
-
1795
- if getv(from_object, ['enterprise_web_search']) is not None:
1796
- setv(
1797
- to_object,
1798
- ['enterpriseWebSearch'],
1799
- _EnterpriseWebSearch_to_vertex(
1800
- getv(from_object, ['enterprise_web_search']), to_object
1801
- ),
1802
- )
1803
-
1804
- if getv(from_object, ['google_maps']) is not None:
1805
- setv(
1806
- to_object,
1807
- ['googleMaps'],
1808
- _GoogleMaps_to_vertex(getv(from_object, ['google_maps']), to_object),
1809
- )
1810
-
1811
- if getv(from_object, ['url_context']) is not None:
1812
- setv(
1813
- to_object,
1814
- ['urlContext'],
1815
- _UrlContext_to_vertex(getv(from_object, ['url_context']), to_object),
1816
- )
1817
-
1818
- if getv(from_object, ['code_execution']) is not None:
1819
- setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
1820
-
1821
- if getv(from_object, ['computer_use']) is not None:
1822
- setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
1823
-
1824
- return to_object
1825
-
1826
-
1827
- def _FunctionCallingConfig_to_vertex(
1828
- from_object: Union[dict[str, Any], object],
1829
- parent_object: Optional[dict[str, Any]] = None,
1830
- ) -> dict[str, Any]:
1831
- to_object: dict[str, Any] = {}
1832
- if getv(from_object, ['mode']) is not None:
1833
- setv(to_object, ['mode'], getv(from_object, ['mode']))
1834
-
1835
- if getv(from_object, ['allowed_function_names']) is not None:
1836
- setv(
1837
- to_object,
1838
- ['allowedFunctionNames'],
1839
- getv(from_object, ['allowed_function_names']),
1840
- )
1841
-
1842
- return to_object
1843
-
1844
-
1845
- def _LatLng_to_vertex(
1846
- from_object: Union[dict[str, Any], object],
1847
- parent_object: Optional[dict[str, Any]] = None,
1848
- ) -> dict[str, Any]:
1849
- to_object: dict[str, Any] = {}
1850
- if getv(from_object, ['latitude']) is not None:
1851
- setv(to_object, ['latitude'], getv(from_object, ['latitude']))
1852
-
1853
- if getv(from_object, ['longitude']) is not None:
1854
- setv(to_object, ['longitude'], getv(from_object, ['longitude']))
1855
-
1856
- return to_object
1857
-
1858
-
1859
- def _RetrievalConfig_to_vertex(
1860
- from_object: Union[dict[str, Any], object],
1861
- parent_object: Optional[dict[str, Any]] = None,
1862
- ) -> dict[str, Any]:
1863
- to_object: dict[str, Any] = {}
1864
- if getv(from_object, ['lat_lng']) is not None:
1865
- setv(
1866
- to_object,
1867
- ['latLng'],
1868
- _LatLng_to_vertex(getv(from_object, ['lat_lng']), to_object),
1869
- )
1870
-
1871
- if getv(from_object, ['language_code']) is not None:
1872
- setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
1873
-
1874
- return to_object
1875
-
1876
-
1877
- def _ToolConfig_to_vertex(
1878
- from_object: Union[dict[str, Any], object],
1879
- parent_object: Optional[dict[str, Any]] = None,
1880
- ) -> dict[str, Any]:
1881
- to_object: dict[str, Any] = {}
1882
- if getv(from_object, ['function_calling_config']) is not None:
1883
- setv(
1884
- to_object,
1885
- ['functionCallingConfig'],
1886
- _FunctionCallingConfig_to_vertex(
1887
- getv(from_object, ['function_calling_config']), to_object
1888
- ),
1889
- )
1890
-
1891
- if getv(from_object, ['retrieval_config']) is not None:
1892
- setv(
1893
- to_object,
1894
- ['retrievalConfig'],
1895
- _RetrievalConfig_to_vertex(
1896
- getv(from_object, ['retrieval_config']), to_object
1897
- ),
1898
- )
1899
-
1900
- return to_object
1901
-
1902
-
1903
- def _PrebuiltVoiceConfig_to_vertex(
1904
- from_object: Union[dict[str, Any], object],
1905
- parent_object: Optional[dict[str, Any]] = None,
1906
- ) -> dict[str, Any]:
1907
- to_object: dict[str, Any] = {}
1908
- if getv(from_object, ['voice_name']) is not None:
1909
- setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
1910
-
1911
- return to_object
1912
-
1913
-
1914
- def _VoiceConfig_to_vertex(
1915
- from_object: Union[dict[str, Any], object],
1916
- parent_object: Optional[dict[str, Any]] = None,
1917
- ) -> dict[str, Any]:
1918
- to_object: dict[str, Any] = {}
1919
- if getv(from_object, ['prebuilt_voice_config']) is not None:
1920
- setv(
1921
- to_object,
1922
- ['prebuiltVoiceConfig'],
1923
- _PrebuiltVoiceConfig_to_vertex(
1924
- getv(from_object, ['prebuilt_voice_config']), to_object
1925
- ),
1926
- )
1927
-
1928
- return to_object
1929
-
1930
-
1931
- def _SpeakerVoiceConfig_to_vertex(
1932
- from_object: Union[dict[str, Any], object],
1933
- parent_object: Optional[dict[str, Any]] = None,
1934
- ) -> dict[str, Any]:
1935
- to_object: dict[str, Any] = {}
1936
- if getv(from_object, ['speaker']) is not None:
1937
- raise ValueError('speaker parameter is not supported in Vertex AI.')
1938
-
1939
- if getv(from_object, ['voice_config']) is not None:
1940
- raise ValueError('voice_config parameter is not supported in Vertex AI.')
1941
-
1942
- return to_object
1943
-
1944
-
1945
- def _MultiSpeakerVoiceConfig_to_vertex(
1946
- from_object: Union[dict[str, Any], object],
1947
- parent_object: Optional[dict[str, Any]] = None,
1948
- ) -> dict[str, Any]:
1949
- to_object: dict[str, Any] = {}
1950
- if getv(from_object, ['speaker_voice_configs']) is not None:
1951
- raise ValueError(
1952
- 'speaker_voice_configs parameter is not supported in Vertex AI.'
1953
- )
1954
-
1955
- return to_object
1956
-
1957
-
1958
- def _SpeechConfig_to_vertex(
1959
- from_object: Union[dict[str, Any], object],
1960
- parent_object: Optional[dict[str, Any]] = None,
1961
- ) -> dict[str, Any]:
1962
- to_object: dict[str, Any] = {}
1963
- if getv(from_object, ['voice_config']) is not None:
1964
- setv(
1965
- to_object,
1966
- ['voiceConfig'],
1967
- _VoiceConfig_to_vertex(getv(from_object, ['voice_config']), to_object),
1968
- )
1969
-
1970
- if getv(from_object, ['multi_speaker_voice_config']) is not None:
1971
- raise ValueError(
1972
- 'multi_speaker_voice_config parameter is not supported in Vertex AI.'
1973
- )
1974
-
1975
- if getv(from_object, ['language_code']) is not None:
1976
- setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
1977
-
1978
- return to_object
1979
-
1980
-
1981
- def _ThinkingConfig_to_vertex(
1982
- from_object: Union[dict[str, Any], object],
1983
- parent_object: Optional[dict[str, Any]] = None,
1984
- ) -> dict[str, Any]:
1985
- to_object: dict[str, Any] = {}
1986
- if getv(from_object, ['include_thoughts']) is not None:
1987
- setv(
1988
- to_object, ['includeThoughts'], getv(from_object, ['include_thoughts'])
1989
- )
1990
-
1991
- if getv(from_object, ['thinking_budget']) is not None:
1992
- setv(to_object, ['thinkingBudget'], getv(from_object, ['thinking_budget']))
1993
-
1994
- return to_object
1995
-
1996
-
1997
- def _GenerateContentConfig_to_vertex(
1998
- api_client: BaseApiClient,
1999
- from_object: Union[dict[str, Any], object],
2000
- parent_object: Optional[dict[str, Any]] = None,
2001
- ) -> dict[str, Any]:
2002
- to_object: dict[str, Any] = {}
2003
-
2004
- if getv(from_object, ['system_instruction']) is not None:
2005
- setv(
2006
- parent_object,
2007
- ['systemInstruction'],
2008
- _Content_to_vertex(
2009
- t.t_content(getv(from_object, ['system_instruction'])), to_object
2010
- ),
2011
- )
2012
-
2013
- if getv(from_object, ['temperature']) is not None:
2014
- setv(to_object, ['temperature'], getv(from_object, ['temperature']))
2015
-
2016
- if getv(from_object, ['top_p']) is not None:
2017
- setv(to_object, ['topP'], getv(from_object, ['top_p']))
2018
-
2019
- if getv(from_object, ['top_k']) is not None:
2020
- setv(to_object, ['topK'], getv(from_object, ['top_k']))
2021
-
2022
- if getv(from_object, ['candidate_count']) is not None:
2023
- setv(to_object, ['candidateCount'], getv(from_object, ['candidate_count']))
2024
-
2025
- if getv(from_object, ['max_output_tokens']) is not None:
2026
- setv(
2027
- to_object, ['maxOutputTokens'], getv(from_object, ['max_output_tokens'])
2028
- )
2029
-
2030
- if getv(from_object, ['stop_sequences']) is not None:
2031
- setv(to_object, ['stopSequences'], getv(from_object, ['stop_sequences']))
2032
-
2033
- if getv(from_object, ['response_logprobs']) is not None:
2034
- setv(
2035
- to_object,
2036
- ['responseLogprobs'],
2037
- getv(from_object, ['response_logprobs']),
2038
- )
2039
-
2040
- if getv(from_object, ['logprobs']) is not None:
2041
- setv(to_object, ['logprobs'], getv(from_object, ['logprobs']))
2042
-
2043
- if getv(from_object, ['presence_penalty']) is not None:
2044
- setv(
2045
- to_object, ['presencePenalty'], getv(from_object, ['presence_penalty'])
2046
- )
2047
-
2048
- if getv(from_object, ['frequency_penalty']) is not None:
2049
- setv(
2050
- to_object,
2051
- ['frequencyPenalty'],
2052
- getv(from_object, ['frequency_penalty']),
2053
- )
2054
-
2055
- if getv(from_object, ['seed']) is not None:
2056
- setv(to_object, ['seed'], getv(from_object, ['seed']))
2057
-
2058
- if getv(from_object, ['response_mime_type']) is not None:
2059
- setv(
2060
- to_object,
2061
- ['responseMimeType'],
2062
- getv(from_object, ['response_mime_type']),
2063
- )
2064
-
2065
- if getv(from_object, ['response_schema']) is not None:
2066
- setv(
2067
- to_object,
2068
- ['responseSchema'],
2069
- _Schema_to_vertex(
2070
- t.t_schema(api_client, getv(from_object, ['response_schema'])),
2071
- to_object,
2072
- ),
2073
- )
2074
-
2075
- if getv(from_object, ['response_json_schema']) is not None:
2076
- setv(
2077
- to_object,
2078
- ['responseJsonSchema'],
2079
- getv(from_object, ['response_json_schema']),
2080
- )
2081
-
2082
- if getv(from_object, ['routing_config']) is not None:
2083
- setv(to_object, ['routingConfig'], getv(from_object, ['routing_config']))
2084
-
2085
- if getv(from_object, ['model_selection_config']) is not None:
2086
- setv(
2087
- to_object,
2088
- ['modelConfig'],
2089
- _ModelSelectionConfig_to_vertex(
2090
- getv(from_object, ['model_selection_config']), to_object
2091
- ),
2092
- )
2093
-
2094
- if getv(from_object, ['safety_settings']) is not None:
2095
- setv(
2096
- parent_object,
2097
- ['safetySettings'],
2098
- [
2099
- _SafetySetting_to_vertex(item, to_object)
2100
- for item in getv(from_object, ['safety_settings'])
2101
- ],
2102
- )
2103
-
2104
- if getv(from_object, ['tools']) is not None:
2105
- setv(
2106
- parent_object,
2107
- ['tools'],
2108
- [
2109
- _Tool_to_vertex(t.t_tool(api_client, item), to_object)
2110
- for item in t.t_tools(api_client, getv(from_object, ['tools']))
2111
- ],
2112
- )
2113
-
2114
- if getv(from_object, ['tool_config']) is not None:
2115
- setv(
2116
- parent_object,
2117
- ['toolConfig'],
2118
- _ToolConfig_to_vertex(getv(from_object, ['tool_config']), to_object),
2119
- )
2120
-
2121
- if getv(from_object, ['labels']) is not None:
2122
- setv(parent_object, ['labels'], getv(from_object, ['labels']))
2123
-
2124
- if getv(from_object, ['cached_content']) is not None:
2125
- setv(
2126
- parent_object,
2127
- ['cachedContent'],
2128
- t.t_cached_content_name(
2129
- api_client, getv(from_object, ['cached_content'])
2130
- ),
2131
- )
2132
-
2133
- if getv(from_object, ['response_modalities']) is not None:
2134
- setv(
2135
- to_object,
2136
- ['responseModalities'],
2137
- getv(from_object, ['response_modalities']),
2138
- )
2139
-
2140
- if getv(from_object, ['media_resolution']) is not None:
2141
- setv(
2142
- to_object, ['mediaResolution'], getv(from_object, ['media_resolution'])
2143
- )
2144
-
2145
- if getv(from_object, ['speech_config']) is not None:
2146
- setv(
2147
- to_object,
2148
- ['speechConfig'],
2149
- _SpeechConfig_to_vertex(
2150
- t.t_speech_config(getv(from_object, ['speech_config'])), to_object
2151
- ),
2152
- )
2153
-
2154
- if getv(from_object, ['audio_timestamp']) is not None:
2155
- setv(to_object, ['audioTimestamp'], getv(from_object, ['audio_timestamp']))
2156
-
2157
- if getv(from_object, ['thinking_config']) is not None:
2158
- setv(
2159
- to_object,
2160
- ['thinkingConfig'],
2161
- _ThinkingConfig_to_vertex(
2162
- getv(from_object, ['thinking_config']), to_object
2163
- ),
2164
- )
2165
-
2166
- return to_object
2167
-
2168
-
2169
- def _InlinedRequest_to_vertex(
2170
- from_object: Union[dict[str, Any], object],
2171
- parent_object: Optional[dict[str, Any]] = None,
2172
- ) -> dict[str, Any]:
2173
- to_object: dict[str, Any] = {}
2174
- if getv(from_object, ['model']) is not None:
2175
- raise ValueError('model parameter is not supported in Vertex AI.')
2176
-
2177
- if getv(from_object, ['contents']) is not None:
2178
- raise ValueError('contents parameter is not supported in Vertex AI.')
2179
-
2180
- if getv(from_object, ['config']) is not None:
2181
- raise ValueError('config parameter is not supported in Vertex AI.')
2182
-
2183
- return to_object
2184
-
2185
-
2186
- def _BatchJobSource_to_vertex(
2187
- from_object: Union[dict[str, Any], object],
2188
- parent_object: Optional[dict[str, Any]] = None,
2189
- ) -> dict[str, Any]:
2190
- to_object: dict[str, Any] = {}
2191
- if getv(from_object, ['format']) is not None:
2192
- setv(to_object, ['instancesFormat'], getv(from_object, ['format']))
2193
-
2194
- if getv(from_object, ['gcs_uri']) is not None:
2195
- setv(to_object, ['gcsSource', 'uris'], getv(from_object, ['gcs_uri']))
2196
-
2197
- if getv(from_object, ['bigquery_uri']) is not None:
2198
- setv(
2199
- to_object,
2200
- ['bigquerySource', 'inputUri'],
2201
- getv(from_object, ['bigquery_uri']),
2202
- )
2203
-
2204
- if getv(from_object, ['file_name']) is not None:
2205
- raise ValueError('file_name parameter is not supported in Vertex AI.')
2206
-
2207
- if getv(from_object, ['inlined_requests']) is not None:
2208
- raise ValueError(
2209
- 'inlined_requests parameter is not supported in Vertex AI.'
2210
- )
2211
-
2212
- return to_object
2213
-
2214
-
2215
- def _CitationMetadata_to_vertex(
2216
- from_object: Union[dict[str, Any], object],
2217
- parent_object: Optional[dict[str, Any]] = None,
2218
- ) -> dict[str, Any]:
2219
- to_object: dict[str, Any] = {}
2220
- if getv(from_object, ['citations']) is not None:
2221
- setv(to_object, ['citations'], getv(from_object, ['citations']))
2222
-
2223
- return to_object
2224
-
2225
-
2226
- def _UrlMetadata_to_vertex(
2227
- from_object: Union[dict[str, Any], object],
2228
- parent_object: Optional[dict[str, Any]] = None,
2229
- ) -> dict[str, Any]:
2230
- to_object: dict[str, Any] = {}
2231
- if getv(from_object, ['retrieved_url']) is not None:
2232
- setv(to_object, ['retrievedUrl'], getv(from_object, ['retrieved_url']))
2233
-
2234
- if getv(from_object, ['url_retrieval_status']) is not None:
2235
- setv(
2236
- to_object,
2237
- ['urlRetrievalStatus'],
2238
- getv(from_object, ['url_retrieval_status']),
2239
- )
2240
-
2241
- return to_object
2242
-
2243
-
2244
- def _UrlContextMetadata_to_vertex(
2245
- from_object: Union[dict[str, Any], object],
2246
- parent_object: Optional[dict[str, Any]] = None,
2247
- ) -> dict[str, Any]:
2248
- to_object: dict[str, Any] = {}
2249
- if getv(from_object, ['url_metadata']) is not None:
2250
- setv(
2251
- to_object,
2252
- ['urlMetadata'],
2253
- [
2254
- _UrlMetadata_to_vertex(item, to_object)
2255
- for item in getv(from_object, ['url_metadata'])
2256
- ],
2257
- )
2258
-
2259
- return to_object
2260
-
2261
-
2262
- def _Candidate_to_vertex(
2263
- from_object: Union[dict[str, Any], object],
2264
- parent_object: Optional[dict[str, Any]] = None,
2265
- ) -> dict[str, Any]:
2266
- to_object: dict[str, Any] = {}
2267
- if getv(from_object, ['content']) is not None:
2268
- setv(
2269
- to_object,
2270
- ['content'],
2271
- _Content_to_vertex(getv(from_object, ['content']), to_object),
2272
- )
2273
-
2274
- if getv(from_object, ['citation_metadata']) is not None:
2275
- setv(
2276
- to_object,
2277
- ['citationMetadata'],
2278
- _CitationMetadata_to_vertex(
2279
- getv(from_object, ['citation_metadata']), to_object
2280
- ),
2281
- )
2282
-
2283
- if getv(from_object, ['finish_message']) is not None:
2284
- setv(to_object, ['finishMessage'], getv(from_object, ['finish_message']))
2285
-
2286
- if getv(from_object, ['token_count']) is not None:
2287
- raise ValueError('token_count parameter is not supported in Vertex AI.')
2288
-
2289
- if getv(from_object, ['finish_reason']) is not None:
2290
- _FinishReason_to_vertex_enum_validate(getv(from_object, ['finish_reason']))
2291
- setv(to_object, ['finishReason'], getv(from_object, ['finish_reason']))
2292
-
2293
- if getv(from_object, ['url_context_metadata']) is not None:
2294
- setv(
2295
- to_object,
2296
- ['urlContextMetadata'],
2297
- _UrlContextMetadata_to_vertex(
2298
- getv(from_object, ['url_context_metadata']), to_object
2299
- ),
2300
- )
2301
-
2302
- if getv(from_object, ['avg_logprobs']) is not None:
2303
- setv(to_object, ['avgLogprobs'], getv(from_object, ['avg_logprobs']))
2304
-
2305
- if getv(from_object, ['grounding_metadata']) is not None:
2306
- setv(
2307
- to_object,
2308
- ['groundingMetadata'],
2309
- getv(from_object, ['grounding_metadata']),
2310
- )
2311
-
2312
- if getv(from_object, ['index']) is not None:
2313
- setv(to_object, ['index'], getv(from_object, ['index']))
2314
-
2315
- if getv(from_object, ['logprobs_result']) is not None:
2316
- setv(to_object, ['logprobsResult'], getv(from_object, ['logprobs_result']))
2317
-
2318
- if getv(from_object, ['safety_ratings']) is not None:
2319
- setv(to_object, ['safetyRatings'], getv(from_object, ['safety_ratings']))
2320
-
2321
- return to_object
2322
-
2323
-
2324
- def _GenerateContentResponse_to_vertex(
2325
- from_object: Union[dict[str, Any], object],
2326
- parent_object: Optional[dict[str, Any]] = None,
2327
- ) -> dict[str, Any]:
2328
- to_object: dict[str, Any] = {}
2329
-
2330
- if getv(from_object, ['sdk_http_response']) is not None:
2331
- setv(
2332
- to_object, ['sdkHttpResponse'], getv(from_object, ['sdk_http_response'])
2333
- )
2334
-
2335
- if getv(from_object, ['candidates']) is not None:
2336
- setv(
2337
- to_object,
2338
- ['candidates'],
2339
- [
2340
- _Candidate_to_vertex(item, to_object)
2341
- for item in getv(from_object, ['candidates'])
2342
- ],
2343
- )
2344
-
2345
- if getv(from_object, ['create_time']) is not None:
2346
- setv(to_object, ['createTime'], getv(from_object, ['create_time']))
2347
-
2348
- if getv(from_object, ['response_id']) is not None:
2349
- setv(to_object, ['responseId'], getv(from_object, ['response_id']))
2350
-
2351
- if getv(from_object, ['model_version']) is not None:
2352
- setv(to_object, ['modelVersion'], getv(from_object, ['model_version']))
2353
-
2354
- if getv(from_object, ['prompt_feedback']) is not None:
2355
- setv(to_object, ['promptFeedback'], getv(from_object, ['prompt_feedback']))
2356
-
2357
- if getv(from_object, ['usage_metadata']) is not None:
2358
- setv(to_object, ['usageMetadata'], getv(from_object, ['usage_metadata']))
2359
-
2360
- return to_object
2361
-
2362
-
2363
- def _JobError_to_vertex(
2364
- from_object: Union[dict[str, Any], object],
2365
- parent_object: Optional[dict[str, Any]] = None,
2366
- ) -> dict[str, Any]:
2367
- to_object: dict[str, Any] = {}
2368
- if getv(from_object, ['details']) is not None:
2369
- setv(to_object, ['details'], getv(from_object, ['details']))
2370
-
2371
- if getv(from_object, ['code']) is not None:
2372
- setv(to_object, ['code'], getv(from_object, ['code']))
2373
-
2374
- if getv(from_object, ['message']) is not None:
2375
- setv(to_object, ['message'], getv(from_object, ['message']))
2376
-
2377
- return to_object
2378
-
2379
-
2380
- def _InlinedResponse_to_vertex(
2381
- from_object: Union[dict[str, Any], object],
2382
- parent_object: Optional[dict[str, Any]] = None,
2383
- ) -> dict[str, Any]:
2384
- to_object: dict[str, Any] = {}
2385
- if getv(from_object, ['response']) is not None:
2386
- raise ValueError('response parameter is not supported in Vertex AI.')
2387
-
2388
- if getv(from_object, ['error']) is not None:
2389
- raise ValueError('error parameter is not supported in Vertex AI.')
2390
-
2391
- return to_object
2392
-
2393
-
2394
- def _BatchJobDestination_to_vertex(
2395
- from_object: Union[dict[str, Any], object],
2396
- parent_object: Optional[dict[str, Any]] = None,
2397
- ) -> dict[str, Any]:
2398
- to_object: dict[str, Any] = {}
2399
- if getv(from_object, ['format']) is not None:
2400
- setv(to_object, ['predictionsFormat'], getv(from_object, ['format']))
2401
-
2402
- if getv(from_object, ['gcs_uri']) is not None:
2403
- setv(
2404
- to_object,
2405
- ['gcsDestination', 'outputUriPrefix'],
2406
- getv(from_object, ['gcs_uri']),
2407
- )
2408
-
2409
- if getv(from_object, ['bigquery_uri']) is not None:
2410
- setv(
2411
- to_object,
2412
- ['bigqueryDestination', 'outputUri'],
2413
- getv(from_object, ['bigquery_uri']),
2414
- )
2415
-
2416
- if getv(from_object, ['file_name']) is not None:
2417
- raise ValueError('file_name parameter is not supported in Vertex AI.')
2418
-
2419
- if getv(from_object, ['inlined_responses']) is not None:
2420
- raise ValueError(
2421
- 'inlined_responses parameter is not supported in Vertex AI.'
2422
- )
2423
-
2424
- return to_object
2425
-
2426
-
2427
- def _CreateBatchJobConfig_to_vertex(
2428
- from_object: Union[dict[str, Any], object],
2429
- parent_object: Optional[dict[str, Any]] = None,
2430
- ) -> dict[str, Any]:
2431
- to_object: dict[str, Any] = {}
2432
-
2433
- if getv(from_object, ['display_name']) is not None:
2434
- setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
2435
-
2436
- if getv(from_object, ['dest']) is not None:
2437
- setv(
2438
- parent_object,
2439
- ['outputConfig'],
2440
- _BatchJobDestination_to_vertex(
2441
- t.t_batch_job_destination(getv(from_object, ['dest'])), to_object
2442
- ),
2443
- )
2444
-
2445
- return to_object
2446
-
2447
-
2448
- def _CreateBatchJobParameters_to_vertex(
2449
- api_client: BaseApiClient,
2450
- from_object: Union[dict[str, Any], object],
2451
- parent_object: Optional[dict[str, Any]] = None,
2452
- ) -> dict[str, Any]:
2453
- to_object: dict[str, Any] = {}
2454
- if getv(from_object, ['model']) is not None:
2455
- setv(
2456
- to_object,
2457
- ['model'],
2458
- t.t_model(api_client, getv(from_object, ['model'])),
2459
- )
2460
-
2461
- if getv(from_object, ['src']) is not None:
2462
- setv(
2463
- to_object,
2464
- ['inputConfig'],
2465
- _BatchJobSource_to_vertex(
2466
- t.t_batch_job_source(api_client, getv(from_object, ['src'])),
2467
- to_object,
2468
- ),
2469
- )
2470
-
2471
- if getv(from_object, ['config']) is not None:
2472
- setv(
2473
- to_object,
2474
- ['config'],
2475
- _CreateBatchJobConfig_to_vertex(
2476
- getv(from_object, ['config']), to_object
2477
- ),
2478
- )
2479
-
2480
- return to_object
2481
-
2482
-
2483
- def _GetBatchJobParameters_to_vertex(
2484
- api_client: BaseApiClient,
2485
- from_object: Union[dict[str, Any], object],
2486
- parent_object: Optional[dict[str, Any]] = None,
2487
- ) -> dict[str, Any]:
2488
- to_object: dict[str, Any] = {}
2489
- if getv(from_object, ['name']) is not None:
2490
- setv(
2491
- to_object,
2492
- ['_url', 'name'],
2493
- t.t_batch_job_name(api_client, getv(from_object, ['name'])),
2494
- )
2495
-
2496
- if getv(from_object, ['config']) is not None:
2497
- setv(to_object, ['config'], getv(from_object, ['config']))
2498
-
2499
- return to_object
2500
-
2501
-
2502
- def _CancelBatchJobParameters_to_vertex(
2503
- api_client: BaseApiClient,
2504
- from_object: Union[dict[str, Any], object],
2505
- parent_object: Optional[dict[str, Any]] = None,
2506
- ) -> dict[str, Any]:
2507
- to_object: dict[str, Any] = {}
2508
- if getv(from_object, ['name']) is not None:
2509
- setv(
2510
- to_object,
2511
- ['_url', 'name'],
2512
- t.t_batch_job_name(api_client, getv(from_object, ['name'])),
2513
- )
2514
-
2515
- if getv(from_object, ['config']) is not None:
2516
- setv(to_object, ['config'], getv(from_object, ['config']))
2517
-
2518
- return to_object
2519
-
2520
-
2521
- def _ListBatchJobsConfig_to_vertex(
2522
- from_object: Union[dict[str, Any], object],
2523
- parent_object: Optional[dict[str, Any]] = None,
2524
- ) -> dict[str, Any]:
2525
- to_object: dict[str, Any] = {}
2526
-
2527
- if getv(from_object, ['page_size']) is not None:
2528
- setv(
2529
- parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
2530
- )
2531
-
2532
- if getv(from_object, ['page_token']) is not None:
2533
- setv(
2534
- parent_object,
2535
- ['_query', 'pageToken'],
2536
- getv(from_object, ['page_token']),
2537
- )
2538
-
2539
- if getv(from_object, ['filter']) is not None:
2540
- setv(parent_object, ['_query', 'filter'], getv(from_object, ['filter']))
2541
-
2542
- return to_object
2543
-
2544
-
2545
- def _ListBatchJobsParameters_to_vertex(
2546
- from_object: Union[dict[str, Any], object],
2547
- parent_object: Optional[dict[str, Any]] = None,
2548
- ) -> dict[str, Any]:
2549
- to_object: dict[str, Any] = {}
2550
- if getv(from_object, ['config']) is not None:
2551
- setv(
2552
- to_object,
2553
- ['config'],
2554
- _ListBatchJobsConfig_to_vertex(
2555
- getv(from_object, ['config']), to_object
2556
- ),
2557
- )
2558
-
2559
- return to_object
2560
-
2561
-
2562
- def _DeleteBatchJobParameters_to_vertex(
2563
- api_client: BaseApiClient,
2564
- from_object: Union[dict[str, Any], object],
2565
- parent_object: Optional[dict[str, Any]] = None,
2566
- ) -> dict[str, Any]:
2567
- to_object: dict[str, Any] = {}
2568
- if getv(from_object, ['name']) is not None:
2569
- setv(
2570
- to_object,
2571
- ['_url', 'name'],
2572
- t.t_batch_job_name(api_client, getv(from_object, ['name'])),
2573
- )
2574
-
2575
- if getv(from_object, ['config']) is not None:
2576
- setv(to_object, ['config'], getv(from_object, ['config']))
2577
-
2578
- return to_object
2579
-
2580
-
2581
- def _FeatureSelectionPreference_to_mldev_enum_validate(enum_value: Any) -> None:
2582
- if enum_value in set(
2583
- [
2584
- 'FEATURE_SELECTION_PREFERENCE_UNSPECIFIED',
2585
- 'PRIORITIZE_QUALITY',
2586
- 'BALANCED',
2587
- 'PRIORITIZE_COST',
2588
- ]
2589
- ):
2590
- raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
2591
-
2592
-
2593
- def _FinishReason_to_mldev_enum_validate(enum_value: Any) -> None:
2594
- if enum_value in set(['UNEXPECTED_TOOL_CALL']):
2595
- raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
2596
-
2597
-
2598
- def _Behavior_to_vertex_enum_validate(enum_value: Any) -> None:
2599
- if enum_value in set(['UNSPECIFIED', 'BLOCKING', 'NON_BLOCKING']):
2600
- raise ValueError(f'{enum_value} enum value is not supported in Vertex AI.')
2601
-
2602
-
2603
- def _FinishReason_to_vertex_enum_validate(enum_value: Any) -> None:
2604
- if enum_value in set(['LANGUAGE', 'IMAGE_SAFETY']):
2605
- raise ValueError(f'{enum_value} enum value is not supported in Vertex AI.')
2606
-
2607
-
2608
- def _JobError_from_mldev(
2609
- from_object: Union[dict[str, Any], object],
2610
- parent_object: Optional[dict[str, Any]] = None,
2611
- ) -> dict[str, Any]:
2612
- to_object: dict[str, Any] = {}
2613
-
2614
- return to_object
2615
-
2616
-
2617
- def _VideoMetadata_from_mldev(
2618
- from_object: Union[dict[str, Any], object],
2619
- parent_object: Optional[dict[str, Any]] = None,
2620
- ) -> dict[str, Any]:
2621
- to_object: dict[str, Any] = {}
2622
- if getv(from_object, ['fps']) is not None:
2623
- setv(to_object, ['fps'], getv(from_object, ['fps']))
2624
-
2625
- if getv(from_object, ['endOffset']) is not None:
2626
- setv(to_object, ['end_offset'], getv(from_object, ['endOffset']))
2627
-
2628
- if getv(from_object, ['startOffset']) is not None:
2629
- setv(to_object, ['start_offset'], getv(from_object, ['startOffset']))
2630
-
2631
- return to_object
2632
-
2633
-
2634
- def _Blob_from_mldev(
2635
- from_object: Union[dict[str, Any], object],
2636
- parent_object: Optional[dict[str, Any]] = None,
2637
- ) -> dict[str, Any]:
2638
- to_object: dict[str, Any] = {}
2639
-
2640
- if getv(from_object, ['data']) is not None:
2641
- setv(to_object, ['data'], getv(from_object, ['data']))
2642
-
2643
- if getv(from_object, ['mimeType']) is not None:
2644
- setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
2645
-
2646
- return to_object
2647
-
2648
-
2649
- def _FileData_from_mldev(
2650
- from_object: Union[dict[str, Any], object],
2651
- parent_object: Optional[dict[str, Any]] = None,
2652
- ) -> dict[str, Any]:
2653
- to_object: dict[str, Any] = {}
2654
-
2655
- if getv(from_object, ['fileUri']) is not None:
2656
- setv(to_object, ['file_uri'], getv(from_object, ['fileUri']))
2657
-
2658
- if getv(from_object, ['mimeType']) is not None:
2659
- setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
2660
-
2661
- return to_object
2662
-
2663
-
2664
- def _Part_from_mldev(
2665
- from_object: Union[dict[str, Any], object],
2666
- parent_object: Optional[dict[str, Any]] = None,
2667
- ) -> dict[str, Any]:
2668
- to_object: dict[str, Any] = {}
2669
- if getv(from_object, ['videoMetadata']) is not None:
2670
- setv(
2671
- to_object,
2672
- ['video_metadata'],
2673
- _VideoMetadata_from_mldev(
2674
- getv(from_object, ['videoMetadata']), to_object
2675
- ),
2676
- )
2677
-
2678
- if getv(from_object, ['thought']) is not None:
2679
- setv(to_object, ['thought'], getv(from_object, ['thought']))
2680
-
2681
- if getv(from_object, ['inlineData']) is not None:
2682
- setv(
2683
- to_object,
2684
- ['inline_data'],
2685
- _Blob_from_mldev(getv(from_object, ['inlineData']), to_object),
2686
- )
2687
-
2688
- if getv(from_object, ['fileData']) is not None:
2689
- setv(
2690
- to_object,
2691
- ['file_data'],
2692
- _FileData_from_mldev(getv(from_object, ['fileData']), to_object),
2693
- )
2694
-
2695
- if getv(from_object, ['thoughtSignature']) is not None:
2696
- setv(
2697
- to_object,
2698
- ['thought_signature'],
2699
- getv(from_object, ['thoughtSignature']),
2700
- )
2701
-
2702
- if getv(from_object, ['codeExecutionResult']) is not None:
2703
- setv(
2704
- to_object,
2705
- ['code_execution_result'],
2706
- getv(from_object, ['codeExecutionResult']),
2707
- )
2708
-
2709
- if getv(from_object, ['executableCode']) is not None:
2710
- setv(to_object, ['executable_code'], getv(from_object, ['executableCode']))
2711
-
2712
- if getv(from_object, ['functionCall']) is not None:
2713
- setv(to_object, ['function_call'], getv(from_object, ['functionCall']))
2714
-
2715
- if getv(from_object, ['functionResponse']) is not None:
2716
- setv(
2717
- to_object,
2718
- ['function_response'],
2719
- getv(from_object, ['functionResponse']),
2720
- )
2721
-
2722
- if getv(from_object, ['text']) is not None:
2723
- setv(to_object, ['text'], getv(from_object, ['text']))
2724
-
2725
- return to_object
2726
-
2727
-
2728
- def _Content_from_mldev(
2729
- from_object: Union[dict[str, Any], object],
2730
- parent_object: Optional[dict[str, Any]] = None,
2731
- ) -> dict[str, Any]:
2732
- to_object: dict[str, Any] = {}
2733
- if getv(from_object, ['parts']) is not None:
2734
- setv(
2735
- to_object,
2736
- ['parts'],
2737
- [
2738
- _Part_from_mldev(item, to_object)
2739
- for item in getv(from_object, ['parts'])
2740
- ],
2741
- )
2742
-
2743
- if getv(from_object, ['role']) is not None:
2744
- setv(to_object, ['role'], getv(from_object, ['role']))
2745
-
2746
- return to_object
2747
-
2748
-
2749
- def _Schema_from_mldev(
2750
- from_object: Union[dict[str, Any], object],
2751
- parent_object: Optional[dict[str, Any]] = None,
2752
- ) -> dict[str, Any]:
2753
- to_object: dict[str, Any] = {}
2754
-
2755
- if getv(from_object, ['anyOf']) is not None:
2756
- setv(to_object, ['any_of'], getv(from_object, ['anyOf']))
2757
-
2758
- if getv(from_object, ['default']) is not None:
2759
- setv(to_object, ['default'], getv(from_object, ['default']))
2760
-
2761
- if getv(from_object, ['description']) is not None:
2762
- setv(to_object, ['description'], getv(from_object, ['description']))
2763
-
2764
- if getv(from_object, ['enum']) is not None:
2765
- setv(to_object, ['enum'], getv(from_object, ['enum']))
2766
-
2767
- if getv(from_object, ['example']) is not None:
2768
- setv(to_object, ['example'], getv(from_object, ['example']))
2769
-
2770
- if getv(from_object, ['format']) is not None:
2771
- setv(to_object, ['format'], getv(from_object, ['format']))
2772
-
2773
- if getv(from_object, ['items']) is not None:
2774
- setv(to_object, ['items'], getv(from_object, ['items']))
2775
-
2776
- if getv(from_object, ['maxItems']) is not None:
2777
- setv(to_object, ['max_items'], getv(from_object, ['maxItems']))
2778
-
2779
- if getv(from_object, ['maxLength']) is not None:
2780
- setv(to_object, ['max_length'], getv(from_object, ['maxLength']))
2781
-
2782
- if getv(from_object, ['maxProperties']) is not None:
2783
- setv(to_object, ['max_properties'], getv(from_object, ['maxProperties']))
2784
-
2785
- if getv(from_object, ['maximum']) is not None:
2786
- setv(to_object, ['maximum'], getv(from_object, ['maximum']))
2787
-
2788
- if getv(from_object, ['minItems']) is not None:
2789
- setv(to_object, ['min_items'], getv(from_object, ['minItems']))
2790
-
2791
- if getv(from_object, ['minLength']) is not None:
2792
- setv(to_object, ['min_length'], getv(from_object, ['minLength']))
2793
-
2794
- if getv(from_object, ['minProperties']) is not None:
2795
- setv(to_object, ['min_properties'], getv(from_object, ['minProperties']))
2796
-
2797
- if getv(from_object, ['minimum']) is not None:
2798
- setv(to_object, ['minimum'], getv(from_object, ['minimum']))
2799
-
2800
- if getv(from_object, ['nullable']) is not None:
2801
- setv(to_object, ['nullable'], getv(from_object, ['nullable']))
2802
-
2803
- if getv(from_object, ['pattern']) is not None:
2804
- setv(to_object, ['pattern'], getv(from_object, ['pattern']))
2805
-
2806
- if getv(from_object, ['properties']) is not None:
2807
- setv(to_object, ['properties'], getv(from_object, ['properties']))
2808
-
2809
- if getv(from_object, ['propertyOrdering']) is not None:
2810
- setv(
2811
- to_object,
2812
- ['property_ordering'],
2813
- getv(from_object, ['propertyOrdering']),
2814
- )
2815
-
2816
- if getv(from_object, ['required']) is not None:
2817
- setv(to_object, ['required'], getv(from_object, ['required']))
2818
-
2819
- if getv(from_object, ['title']) is not None:
2820
- setv(to_object, ['title'], getv(from_object, ['title']))
2821
-
2822
- if getv(from_object, ['type']) is not None:
2823
- setv(to_object, ['type'], getv(from_object, ['type']))
2824
-
2825
- return to_object
2826
-
2827
-
2828
- def _ModelSelectionConfig_from_mldev(
2829
- from_object: Union[dict[str, Any], object],
2830
- parent_object: Optional[dict[str, Any]] = None,
2831
- ) -> dict[str, Any]:
2832
- to_object: dict[str, Any] = {}
2833
-
2834
- return to_object
2835
-
2836
-
2837
- def _SafetySetting_from_mldev(
2838
- from_object: Union[dict[str, Any], object],
2839
- parent_object: Optional[dict[str, Any]] = None,
2840
- ) -> dict[str, Any]:
2841
- to_object: dict[str, Any] = {}
2842
-
2843
- if getv(from_object, ['category']) is not None:
2844
- setv(to_object, ['category'], getv(from_object, ['category']))
2845
-
2846
- if getv(from_object, ['threshold']) is not None:
2847
- setv(to_object, ['threshold'], getv(from_object, ['threshold']))
2848
-
2849
- return to_object
2850
-
2851
-
2852
- def _FunctionDeclaration_from_mldev(
2853
- from_object: Union[dict[str, Any], object],
2854
- parent_object: Optional[dict[str, Any]] = None,
2855
- ) -> dict[str, Any]:
2856
- to_object: dict[str, Any] = {}
2857
- if getv(from_object, ['behavior']) is not None:
2858
- setv(to_object, ['behavior'], getv(from_object, ['behavior']))
2859
-
2860
- if getv(from_object, ['description']) is not None:
2861
- setv(to_object, ['description'], getv(from_object, ['description']))
2862
-
2863
- if getv(from_object, ['name']) is not None:
2864
- setv(to_object, ['name'], getv(from_object, ['name']))
2865
-
2866
- if getv(from_object, ['parameters']) is not None:
2867
- setv(to_object, ['parameters'], getv(from_object, ['parameters']))
2868
-
2869
- if getv(from_object, ['parametersJsonSchema']) is not None:
2870
- setv(
2871
- to_object,
2872
- ['parameters_json_schema'],
2873
- getv(from_object, ['parametersJsonSchema']),
2874
- )
2875
-
2876
- if getv(from_object, ['response']) is not None:
2877
- setv(to_object, ['response'], getv(from_object, ['response']))
2878
-
2879
- if getv(from_object, ['responseJsonSchema']) is not None:
2880
- setv(
2881
- to_object,
2882
- ['response_json_schema'],
2883
- getv(from_object, ['responseJsonSchema']),
2884
- )
2885
-
2886
- return to_object
2887
-
2888
-
2889
- def _Interval_from_mldev(
2890
- from_object: Union[dict[str, Any], object],
2891
- parent_object: Optional[dict[str, Any]] = None,
2892
- ) -> dict[str, Any]:
2893
- to_object: dict[str, Any] = {}
2894
- if getv(from_object, ['startTime']) is not None:
2895
- setv(to_object, ['start_time'], getv(from_object, ['startTime']))
2896
-
2897
- if getv(from_object, ['endTime']) is not None:
2898
- setv(to_object, ['end_time'], getv(from_object, ['endTime']))
2899
-
2900
- return to_object
2901
-
2902
-
2903
- def _GoogleSearch_from_mldev(
2904
- from_object: Union[dict[str, Any], object],
2905
- parent_object: Optional[dict[str, Any]] = None,
2906
- ) -> dict[str, Any]:
2907
- to_object: dict[str, Any] = {}
2908
- if getv(from_object, ['timeRangeFilter']) is not None:
2909
- setv(
2910
- to_object,
2911
- ['time_range_filter'],
2912
- _Interval_from_mldev(getv(from_object, ['timeRangeFilter']), to_object),
2913
- )
2914
-
2915
- return to_object
2916
-
2917
-
2918
- def _DynamicRetrievalConfig_from_mldev(
2919
- from_object: Union[dict[str, Any], object],
2920
- parent_object: Optional[dict[str, Any]] = None,
2921
- ) -> dict[str, Any]:
2922
- to_object: dict[str, Any] = {}
2923
- if getv(from_object, ['mode']) is not None:
2924
- setv(to_object, ['mode'], getv(from_object, ['mode']))
2925
-
2926
- if getv(from_object, ['dynamicThreshold']) is not None:
2927
- setv(
2928
- to_object,
2929
- ['dynamic_threshold'],
2930
- getv(from_object, ['dynamicThreshold']),
2931
- )
2932
-
2933
- return to_object
2934
-
2935
-
2936
- def _GoogleSearchRetrieval_from_mldev(
2937
- from_object: Union[dict[str, Any], object],
2938
- parent_object: Optional[dict[str, Any]] = None,
2939
- ) -> dict[str, Any]:
2940
- to_object: dict[str, Any] = {}
2941
- if getv(from_object, ['dynamicRetrievalConfig']) is not None:
2942
- setv(
2943
- to_object,
2944
- ['dynamic_retrieval_config'],
2945
- _DynamicRetrievalConfig_from_mldev(
2946
- getv(from_object, ['dynamicRetrievalConfig']), to_object
2947
- ),
2948
- )
2949
-
2950
- return to_object
2951
-
2952
-
2953
- def _EnterpriseWebSearch_from_mldev(
2954
- from_object: Union[dict[str, Any], object],
2955
- parent_object: Optional[dict[str, Any]] = None,
2956
- ) -> dict[str, Any]:
2957
- to_object: dict[str, Any] = {}
2958
-
2959
- return to_object
2960
-
2961
-
2962
- def _ApiKeyConfig_from_mldev(
2963
- from_object: Union[dict[str, Any], object],
2964
- parent_object: Optional[dict[str, Any]] = None,
2965
- ) -> dict[str, Any]:
2966
- to_object: dict[str, Any] = {}
2967
-
2968
- return to_object
2969
-
2970
-
2971
- def _AuthConfig_from_mldev(
2972
- from_object: Union[dict[str, Any], object],
2973
- parent_object: Optional[dict[str, Any]] = None,
2974
- ) -> dict[str, Any]:
2975
- to_object: dict[str, Any] = {}
2976
-
2977
- if getv(from_object, ['authType']) is not None:
2978
- setv(to_object, ['auth_type'], getv(from_object, ['authType']))
2979
-
2980
- if getv(from_object, ['googleServiceAccountConfig']) is not None:
2981
- setv(
2982
- to_object,
2983
- ['google_service_account_config'],
2984
- getv(from_object, ['googleServiceAccountConfig']),
2985
- )
2986
-
2987
- if getv(from_object, ['httpBasicAuthConfig']) is not None:
2988
- setv(
2989
- to_object,
2990
- ['http_basic_auth_config'],
2991
- getv(from_object, ['httpBasicAuthConfig']),
2992
- )
2993
-
2994
- if getv(from_object, ['oauthConfig']) is not None:
2995
- setv(to_object, ['oauth_config'], getv(from_object, ['oauthConfig']))
2996
-
2997
- if getv(from_object, ['oidcConfig']) is not None:
2998
- setv(to_object, ['oidc_config'], getv(from_object, ['oidcConfig']))
2999
-
3000
- return to_object
3001
-
3002
-
3003
- def _GoogleMaps_from_mldev(
3004
- from_object: Union[dict[str, Any], object],
3005
- parent_object: Optional[dict[str, Any]] = None,
3006
- ) -> dict[str, Any]:
3007
- to_object: dict[str, Any] = {}
3008
-
3009
- return to_object
3010
-
3011
-
3012
- def _UrlContext_from_mldev(
3013
- from_object: Union[dict[str, Any], object],
3014
- parent_object: Optional[dict[str, Any]] = None,
3015
- ) -> dict[str, Any]:
3016
- to_object: dict[str, Any] = {}
3017
-
3018
- return to_object
3019
-
3020
-
3021
- def _Tool_from_mldev(
3022
- from_object: Union[dict[str, Any], object],
3023
- parent_object: Optional[dict[str, Any]] = None,
3024
- ) -> dict[str, Any]:
3025
- to_object: dict[str, Any] = {}
3026
- if getv(from_object, ['functionDeclarations']) is not None:
3027
- setv(
3028
- to_object,
3029
- ['function_declarations'],
3030
- [
3031
- _FunctionDeclaration_from_mldev(item, to_object)
3032
- for item in getv(from_object, ['functionDeclarations'])
3033
- ],
3034
- )
3035
-
3036
- if getv(from_object, ['googleSearch']) is not None:
3037
- setv(
3038
- to_object,
3039
- ['google_search'],
3040
- _GoogleSearch_from_mldev(
3041
- getv(from_object, ['googleSearch']), to_object
3042
- ),
3043
- )
3044
-
3045
- if getv(from_object, ['googleSearchRetrieval']) is not None:
3046
- setv(
3047
- to_object,
3048
- ['google_search_retrieval'],
3049
- _GoogleSearchRetrieval_from_mldev(
3050
- getv(from_object, ['googleSearchRetrieval']), to_object
3051
- ),
3052
- )
3053
-
3054
- if getv(from_object, ['urlContext']) is not None:
3055
- setv(
3056
- to_object,
3057
- ['url_context'],
3058
- _UrlContext_from_mldev(getv(from_object, ['urlContext']), to_object),
3059
- )
3060
-
3061
- if getv(from_object, ['codeExecution']) is not None:
3062
- setv(to_object, ['code_execution'], getv(from_object, ['codeExecution']))
3063
-
3064
- if getv(from_object, ['computerUse']) is not None:
3065
- setv(to_object, ['computer_use'], getv(from_object, ['computerUse']))
3066
-
3067
- return to_object
3068
-
3069
-
3070
- def _FunctionCallingConfig_from_mldev(
3071
- from_object: Union[dict[str, Any], object],
3072
- parent_object: Optional[dict[str, Any]] = None,
3073
- ) -> dict[str, Any]:
3074
- to_object: dict[str, Any] = {}
3075
- if getv(from_object, ['mode']) is not None:
3076
- setv(to_object, ['mode'], getv(from_object, ['mode']))
3077
-
3078
- if getv(from_object, ['allowedFunctionNames']) is not None:
3079
- setv(
3080
- to_object,
3081
- ['allowed_function_names'],
3082
- getv(from_object, ['allowedFunctionNames']),
3083
- )
3084
-
3085
- return to_object
3086
-
3087
-
3088
- def _LatLng_from_mldev(
3089
- from_object: Union[dict[str, Any], object],
3090
- parent_object: Optional[dict[str, Any]] = None,
3091
- ) -> dict[str, Any]:
3092
- to_object: dict[str, Any] = {}
3093
- if getv(from_object, ['latitude']) is not None:
3094
- setv(to_object, ['latitude'], getv(from_object, ['latitude']))
3095
-
3096
- if getv(from_object, ['longitude']) is not None:
3097
- setv(to_object, ['longitude'], getv(from_object, ['longitude']))
3098
-
3099
- return to_object
3100
-
3101
-
3102
- def _RetrievalConfig_from_mldev(
3103
- from_object: Union[dict[str, Any], object],
3104
- parent_object: Optional[dict[str, Any]] = None,
3105
- ) -> dict[str, Any]:
3106
- to_object: dict[str, Any] = {}
3107
- if getv(from_object, ['latLng']) is not None:
3108
- setv(
3109
- to_object,
3110
- ['lat_lng'],
3111
- _LatLng_from_mldev(getv(from_object, ['latLng']), to_object),
3112
- )
3113
-
3114
- if getv(from_object, ['languageCode']) is not None:
3115
- setv(to_object, ['language_code'], getv(from_object, ['languageCode']))
3116
-
3117
- return to_object
3118
-
3119
-
3120
- def _ToolConfig_from_mldev(
3121
- from_object: Union[dict[str, Any], object],
3122
- parent_object: Optional[dict[str, Any]] = None,
3123
- ) -> dict[str, Any]:
3124
- to_object: dict[str, Any] = {}
3125
- if getv(from_object, ['functionCallingConfig']) is not None:
3126
- setv(
3127
- to_object,
3128
- ['function_calling_config'],
3129
- _FunctionCallingConfig_from_mldev(
3130
- getv(from_object, ['functionCallingConfig']), to_object
3131
- ),
3132
- )
3133
-
3134
- if getv(from_object, ['retrievalConfig']) is not None:
3135
- setv(
3136
- to_object,
3137
- ['retrieval_config'],
3138
- _RetrievalConfig_from_mldev(
3139
- getv(from_object, ['retrievalConfig']), to_object
3140
- ),
3141
- )
3142
-
3143
- return to_object
3144
-
3145
-
3146
- def _PrebuiltVoiceConfig_from_mldev(
3147
- from_object: Union[dict[str, Any], object],
3148
- parent_object: Optional[dict[str, Any]] = None,
3149
- ) -> dict[str, Any]:
3150
- to_object: dict[str, Any] = {}
3151
- if getv(from_object, ['voiceName']) is not None:
3152
- setv(to_object, ['voice_name'], getv(from_object, ['voiceName']))
3153
-
3154
- return to_object
3155
-
3156
-
3157
- def _VoiceConfig_from_mldev(
3158
- from_object: Union[dict[str, Any], object],
3159
- parent_object: Optional[dict[str, Any]] = None,
3160
- ) -> dict[str, Any]:
3161
- to_object: dict[str, Any] = {}
3162
- if getv(from_object, ['prebuiltVoiceConfig']) is not None:
3163
- setv(
3164
- to_object,
3165
- ['prebuilt_voice_config'],
3166
- _PrebuiltVoiceConfig_from_mldev(
3167
- getv(from_object, ['prebuiltVoiceConfig']), to_object
3168
- ),
3169
- )
3170
-
3171
- return to_object
3172
-
3173
-
3174
- def _SpeakerVoiceConfig_from_mldev(
3175
- from_object: Union[dict[str, Any], object],
3176
- parent_object: Optional[dict[str, Any]] = None,
3177
- ) -> dict[str, Any]:
3178
- to_object: dict[str, Any] = {}
3179
- if getv(from_object, ['speaker']) is not None:
3180
- setv(to_object, ['speaker'], getv(from_object, ['speaker']))
3181
-
3182
- if getv(from_object, ['voiceConfig']) is not None:
3183
- setv(
3184
- to_object,
3185
- ['voice_config'],
3186
- _VoiceConfig_from_mldev(getv(from_object, ['voiceConfig']), to_object),
3187
- )
3188
-
3189
- return to_object
3190
-
3191
-
3192
- def _MultiSpeakerVoiceConfig_from_mldev(
3193
- from_object: Union[dict[str, Any], object],
3194
- parent_object: Optional[dict[str, Any]] = None,
3195
- ) -> dict[str, Any]:
3196
- to_object: dict[str, Any] = {}
3197
- if getv(from_object, ['speakerVoiceConfigs']) is not None:
3198
- setv(
3199
- to_object,
3200
- ['speaker_voice_configs'],
3201
- [
3202
- _SpeakerVoiceConfig_from_mldev(item, to_object)
3203
- for item in getv(from_object, ['speakerVoiceConfigs'])
3204
- ],
3205
- )
3206
-
3207
- return to_object
3208
-
3209
-
3210
- def _SpeechConfig_from_mldev(
3211
- from_object: Union[dict[str, Any], object],
3212
- parent_object: Optional[dict[str, Any]] = None,
3213
- ) -> dict[str, Any]:
3214
- to_object: dict[str, Any] = {}
3215
- if getv(from_object, ['voiceConfig']) is not None:
3216
- setv(
3217
- to_object,
3218
- ['voice_config'],
3219
- _VoiceConfig_from_mldev(getv(from_object, ['voiceConfig']), to_object),
3220
- )
3221
-
3222
- if getv(from_object, ['multiSpeakerVoiceConfig']) is not None:
3223
- setv(
3224
- to_object,
3225
- ['multi_speaker_voice_config'],
3226
- _MultiSpeakerVoiceConfig_from_mldev(
3227
- getv(from_object, ['multiSpeakerVoiceConfig']), to_object
3228
- ),
3229
- )
3230
-
3231
- if getv(from_object, ['languageCode']) is not None:
3232
- setv(to_object, ['language_code'], getv(from_object, ['languageCode']))
3233
-
3234
- return to_object
3235
-
3236
-
3237
- def _ThinkingConfig_from_mldev(
3238
- from_object: Union[dict[str, Any], object],
3239
- parent_object: Optional[dict[str, Any]] = None,
3240
- ) -> dict[str, Any]:
3241
- to_object: dict[str, Any] = {}
3242
- if getv(from_object, ['includeThoughts']) is not None:
3243
- setv(
3244
- to_object, ['include_thoughts'], getv(from_object, ['includeThoughts'])
3245
- )
3246
-
3247
- if getv(from_object, ['thinkingBudget']) is not None:
3248
- setv(to_object, ['thinking_budget'], getv(from_object, ['thinkingBudget']))
3249
-
3250
- return to_object
3251
-
3252
-
3253
- def _GenerateContentConfig_from_mldev(
3254
- api_client: BaseApiClient,
3255
- from_object: Union[dict[str, Any], object],
3256
- parent_object: Optional[dict[str, Any]] = None,
3257
- ) -> dict[str, Any]:
3258
- to_object: dict[str, Any] = {}
3259
-
3260
- if getv(parent_object, ['systemInstruction']) is not None:
3261
- setv(
3262
- to_object,
3263
- ['system_instruction'],
3264
- _Content_from_mldev(
3265
- t.t_content(getv(parent_object, ['systemInstruction'])), to_object
3266
- ),
3267
- )
3268
-
3269
- if getv(from_object, ['temperature']) is not None:
3270
- setv(to_object, ['temperature'], getv(from_object, ['temperature']))
3271
-
3272
- if getv(from_object, ['topP']) is not None:
3273
- setv(to_object, ['top_p'], getv(from_object, ['topP']))
3274
-
3275
- if getv(from_object, ['topK']) is not None:
3276
- setv(to_object, ['top_k'], getv(from_object, ['topK']))
3277
-
3278
- if getv(from_object, ['candidateCount']) is not None:
3279
- setv(to_object, ['candidate_count'], getv(from_object, ['candidateCount']))
3280
-
3281
- if getv(from_object, ['maxOutputTokens']) is not None:
3282
- setv(
3283
- to_object, ['max_output_tokens'], getv(from_object, ['maxOutputTokens'])
3284
- )
3285
-
3286
- if getv(from_object, ['stopSequences']) is not None:
3287
- setv(to_object, ['stop_sequences'], getv(from_object, ['stopSequences']))
3288
-
3289
- if getv(from_object, ['responseLogprobs']) is not None:
3290
- setv(
3291
- to_object,
3292
- ['response_logprobs'],
3293
- getv(from_object, ['responseLogprobs']),
3294
- )
3295
-
3296
- if getv(from_object, ['logprobs']) is not None:
3297
- setv(to_object, ['logprobs'], getv(from_object, ['logprobs']))
3298
-
3299
- if getv(from_object, ['presencePenalty']) is not None:
3300
- setv(
3301
- to_object, ['presence_penalty'], getv(from_object, ['presencePenalty'])
3302
- )
3303
-
3304
- if getv(from_object, ['frequencyPenalty']) is not None:
3305
- setv(
3306
- to_object,
3307
- ['frequency_penalty'],
3308
- getv(from_object, ['frequencyPenalty']),
3309
- )
3310
-
3311
- if getv(from_object, ['seed']) is not None:
3312
- setv(to_object, ['seed'], getv(from_object, ['seed']))
3313
-
3314
- if getv(from_object, ['responseMimeType']) is not None:
3315
- setv(
3316
- to_object,
3317
- ['response_mime_type'],
3318
- getv(from_object, ['responseMimeType']),
3319
- )
3320
-
3321
- if getv(from_object, ['responseSchema']) is not None:
3322
- setv(
3323
- to_object,
3324
- ['response_schema'],
3325
- _Schema_from_mldev(
3326
- t.t_schema(api_client, getv(from_object, ['responseSchema'])),
3327
- to_object,
3328
- ),
3329
- )
3330
-
3331
- if getv(from_object, ['responseJsonSchema']) is not None:
3332
- setv(
3333
- to_object,
3334
- ['response_json_schema'],
3335
- getv(from_object, ['responseJsonSchema']),
3336
- )
3337
-
3338
- if getv(parent_object, ['safetySettings']) is not None:
3339
- setv(
3340
- to_object,
3341
- ['safety_settings'],
3342
- [
3343
- _SafetySetting_from_mldev(item, to_object)
3344
- for item in getv(parent_object, ['safetySettings'])
3345
- ],
3346
- )
3347
-
3348
- if getv(parent_object, ['tools']) is not None:
3349
- setv(
3350
- to_object,
3351
- ['tools'],
3352
- [
3353
- _Tool_from_mldev(t.t_tool(api_client, item), to_object)
3354
- for item in t.t_tools(api_client, getv(parent_object, ['tools']))
3355
- ],
3356
- )
3357
-
3358
- if getv(parent_object, ['toolConfig']) is not None:
3359
- setv(
3360
- to_object,
3361
- ['tool_config'],
3362
- _ToolConfig_from_mldev(getv(parent_object, ['toolConfig']), to_object),
3363
- )
3364
-
3365
- if getv(parent_object, ['cachedContent']) is not None:
3366
- setv(
3367
- to_object,
3368
- ['cached_content'],
3369
- t.t_cached_content_name(
3370
- api_client, getv(parent_object, ['cachedContent'])
3371
- ),
3372
- )
3373
-
3374
- if getv(from_object, ['responseModalities']) is not None:
3375
- setv(
3376
- to_object,
3377
- ['response_modalities'],
3378
- getv(from_object, ['responseModalities']),
3379
- )
3380
-
3381
- if getv(from_object, ['mediaResolution']) is not None:
3382
- setv(
3383
- to_object, ['media_resolution'], getv(from_object, ['mediaResolution'])
3384
- )
3385
-
3386
- if getv(from_object, ['speechConfig']) is not None:
3387
- setv(
3388
- to_object,
3389
- ['speech_config'],
3390
- _SpeechConfig_from_mldev(
3391
- t.t_speech_config(getv(from_object, ['speechConfig'])), to_object
3392
- ),
3393
- )
3394
-
3395
- if getv(from_object, ['thinkingConfig']) is not None:
3396
- setv(
3397
- to_object,
3398
- ['thinking_config'],
3399
- _ThinkingConfig_from_mldev(
3400
- getv(from_object, ['thinkingConfig']), to_object
3401
- ),
3402
- )
3403
-
3404
- return to_object
3405
-
3406
-
3407
- def _InlinedRequest_from_mldev(
3408
- api_client: BaseApiClient,
3409
- from_object: Union[dict[str, Any], object],
3410
- parent_object: Optional[dict[str, Any]] = None,
3411
- ) -> dict[str, Any]:
3412
- to_object: dict[str, Any] = {}
3413
- if getv(from_object, ['request', 'model']) is not None:
3414
- setv(
3415
- to_object,
3416
- ['model'],
3417
- t.t_model(api_client, getv(from_object, ['request', 'model'])),
3418
- )
3419
-
3420
- if getv(from_object, ['request', 'contents']) is not None:
3421
- setv(
3422
- to_object,
3423
- ['contents'],
3424
- [
3425
- _Content_from_mldev(item, to_object)
3426
- for item in t.t_contents(getv(from_object, ['request', 'contents']))
3427
- ],
3428
- )
3429
-
3430
- if getv(from_object, ['request', 'generationConfig']) is not None:
3431
- setv(
3432
- to_object,
3433
- ['config'],
3434
- _GenerateContentConfig_from_mldev(
3435
- api_client,
3436
- getv(from_object, ['request', 'generationConfig']),
3437
- to_object,
3438
- ),
3439
- )
3440
-
3441
- return to_object
3442
-
3443
-
3444
- def _BatchJobSource_from_mldev(
3445
- api_client: BaseApiClient,
3446
- from_object: Union[dict[str, Any], object],
3447
- parent_object: Optional[dict[str, Any]] = None,
3448
- ) -> dict[str, Any]:
3449
- to_object: dict[str, Any] = {}
3450
-
3451
- if getv(from_object, ['fileName']) is not None:
3452
- setv(to_object, ['file_name'], getv(from_object, ['fileName']))
3453
-
3454
- if getv(from_object, ['requests', 'requests']) is not None:
3455
- setv(
3456
- to_object,
3457
- ['inlined_requests'],
3458
- [
3459
- _InlinedRequest_from_mldev(api_client, item, to_object)
3460
- for item in getv(from_object, ['requests', 'requests'])
3461
- ],
3462
- )
3463
-
3464
- return to_object
3465
-
3466
-
3467
- def _CitationMetadata_from_mldev(
3468
- from_object: Union[dict[str, Any], object],
3469
- parent_object: Optional[dict[str, Any]] = None,
3470
- ) -> dict[str, Any]:
3471
- to_object: dict[str, Any] = {}
3472
- if getv(from_object, ['citationSources']) is not None:
3473
- setv(to_object, ['citations'], getv(from_object, ['citationSources']))
3474
-
3475
- return to_object
3476
-
3477
-
3478
- def _UrlMetadata_from_mldev(
3479
- from_object: Union[dict[str, Any], object],
3480
- parent_object: Optional[dict[str, Any]] = None,
3481
- ) -> dict[str, Any]:
3482
- to_object: dict[str, Any] = {}
3483
- if getv(from_object, ['retrievedUrl']) is not None:
3484
- setv(to_object, ['retrieved_url'], getv(from_object, ['retrievedUrl']))
3485
-
3486
- if getv(from_object, ['urlRetrievalStatus']) is not None:
3487
- setv(
3488
- to_object,
3489
- ['url_retrieval_status'],
3490
- getv(from_object, ['urlRetrievalStatus']),
3491
- )
3492
-
3493
- return to_object
3494
-
3495
-
3496
- def _UrlContextMetadata_from_mldev(
3497
- from_object: Union[dict[str, Any], object],
3498
- parent_object: Optional[dict[str, Any]] = None,
3499
- ) -> dict[str, Any]:
3500
- to_object: dict[str, Any] = {}
3501
- if getv(from_object, ['urlMetadata']) is not None:
3502
- setv(
3503
- to_object,
3504
- ['url_metadata'],
3505
- [
3506
- _UrlMetadata_from_mldev(item, to_object)
3507
- for item in getv(from_object, ['urlMetadata'])
3508
- ],
3509
- )
3510
-
3511
- return to_object
3512
-
3513
-
3514
- def _Candidate_from_mldev(
3515
- from_object: Union[dict[str, Any], object],
3516
- parent_object: Optional[dict[str, Any]] = None,
3517
- ) -> dict[str, Any]:
3518
- to_object: dict[str, Any] = {}
3519
- if getv(from_object, ['content']) is not None:
3520
- setv(
3521
- to_object,
3522
- ['content'],
3523
- _Content_from_mldev(getv(from_object, ['content']), to_object),
3524
- )
3525
-
3526
- if getv(from_object, ['citationMetadata']) is not None:
3527
- setv(
3528
- to_object,
3529
- ['citation_metadata'],
3530
- _CitationMetadata_from_mldev(
3531
- getv(from_object, ['citationMetadata']), to_object
3532
- ),
3533
- )
3534
-
3535
- if getv(from_object, ['tokenCount']) is not None:
3536
- setv(to_object, ['token_count'], getv(from_object, ['tokenCount']))
3537
-
3538
- if getv(from_object, ['finishReason']) is not None:
3539
- setv(to_object, ['finish_reason'], getv(from_object, ['finishReason']))
3540
-
3541
- if getv(from_object, ['urlContextMetadata']) is not None:
3542
- setv(
3543
- to_object,
3544
- ['url_context_metadata'],
3545
- _UrlContextMetadata_from_mldev(
3546
- getv(from_object, ['urlContextMetadata']), to_object
3547
- ),
3548
- )
3549
-
3550
- if getv(from_object, ['avgLogprobs']) is not None:
3551
- setv(to_object, ['avg_logprobs'], getv(from_object, ['avgLogprobs']))
3552
-
3553
- if getv(from_object, ['groundingMetadata']) is not None:
3554
- setv(
3555
- to_object,
3556
- ['grounding_metadata'],
3557
- getv(from_object, ['groundingMetadata']),
3558
- )
3559
-
3560
- if getv(from_object, ['index']) is not None:
3561
- setv(to_object, ['index'], getv(from_object, ['index']))
3562
-
3563
- if getv(from_object, ['logprobsResult']) is not None:
3564
- setv(to_object, ['logprobs_result'], getv(from_object, ['logprobsResult']))
3565
-
3566
- if getv(from_object, ['safetyRatings']) is not None:
3567
- setv(to_object, ['safety_ratings'], getv(from_object, ['safetyRatings']))
3568
-
3569
- return to_object
3570
-
3571
-
3572
- def _GenerateContentResponse_from_mldev(
3573
- from_object: Union[dict[str, Any], object],
3574
- parent_object: Optional[dict[str, Any]] = None,
3575
- ) -> dict[str, Any]:
3576
- to_object: dict[str, Any] = {}
3577
-
3578
- if getv(from_object, ['sdkHttpResponse']) is not None:
3579
- setv(
3580
- to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
3581
- )
3582
-
3583
- if getv(from_object, ['candidates']) is not None:
3584
- setv(
3585
- to_object,
3586
- ['candidates'],
3587
- [
3588
- _Candidate_from_mldev(item, to_object)
3589
- for item in getv(from_object, ['candidates'])
3590
- ],
3591
- )
3592
-
3593
- if getv(from_object, ['modelVersion']) is not None:
3594
- setv(to_object, ['model_version'], getv(from_object, ['modelVersion']))
3595
-
3596
- if getv(from_object, ['promptFeedback']) is not None:
3597
- setv(to_object, ['prompt_feedback'], getv(from_object, ['promptFeedback']))
3598
-
3599
- if getv(from_object, ['usageMetadata']) is not None:
3600
- setv(to_object, ['usage_metadata'], getv(from_object, ['usageMetadata']))
3601
-
3602
- return to_object
3603
-
3604
-
3605
- def _InlinedResponse_from_mldev(
3606
- from_object: Union[dict[str, Any], object],
3607
- parent_object: Optional[dict[str, Any]] = None,
3608
- ) -> dict[str, Any]:
3609
- to_object: dict[str, Any] = {}
3610
- if getv(from_object, ['response']) is not None:
3611
- setv(
3612
- to_object,
3613
- ['response'],
3614
- _GenerateContentResponse_from_mldev(
3615
- getv(from_object, ['response']), to_object
3616
- ),
3617
- )
3618
-
3619
- if getv(from_object, ['error']) is not None:
3620
- setv(
3621
- to_object,
3622
- ['error'],
3623
- _JobError_from_mldev(getv(from_object, ['error']), to_object),
3624
- )
3625
-
3626
- return to_object
3627
-
3628
-
3629
- def _BatchJobDestination_from_mldev(
3630
- from_object: Union[dict[str, Any], object],
3631
- parent_object: Optional[dict[str, Any]] = None,
3632
- ) -> dict[str, Any]:
3633
- to_object: dict[str, Any] = {}
3634
-
3635
- if getv(from_object, ['responsesFile']) is not None:
3636
- setv(to_object, ['file_name'], getv(from_object, ['responsesFile']))
3637
-
3638
- if getv(from_object, ['inlinedResponses', 'inlinedResponses']) is not None:
3639
- setv(
3640
- to_object,
3641
- ['inlined_responses'],
3642
- [
3643
- _InlinedResponse_from_mldev(item, to_object)
3644
- for item in getv(
3645
- from_object, ['inlinedResponses', 'inlinedResponses']
3646
- )
3647
- ],
3648
- )
3649
-
3650
- return to_object
3651
-
3652
-
3653
- def _BatchJob_from_mldev(
3654
- from_object: Union[dict[str, Any], object],
3655
- parent_object: Optional[dict[str, Any]] = None,
3656
- ) -> dict[str, Any]:
3657
- to_object: dict[str, Any] = {}
3658
- if getv(from_object, ['name']) is not None:
3659
- setv(to_object, ['name'], getv(from_object, ['name']))
3660
-
3661
- if getv(from_object, ['metadata', 'displayName']) is not None:
3662
- setv(
3663
- to_object,
3664
- ['display_name'],
3665
- getv(from_object, ['metadata', 'displayName']),
3666
- )
3667
-
3668
- if getv(from_object, ['metadata', 'state']) is not None:
3669
- setv(
3670
- to_object,
3671
- ['state'],
3672
- t.t_job_state(getv(from_object, ['metadata', 'state'])),
3673
- )
3674
-
3675
- if getv(from_object, ['metadata', 'createTime']) is not None:
3676
- setv(
3677
- to_object,
3678
- ['create_time'],
3679
- getv(from_object, ['metadata', 'createTime']),
3680
- )
3681
-
3682
- if getv(from_object, ['metadata', 'endTime']) is not None:
3683
- setv(to_object, ['end_time'], getv(from_object, ['metadata', 'endTime']))
3684
-
3685
- if getv(from_object, ['metadata', 'updateTime']) is not None:
3686
- setv(
3687
- to_object,
3688
- ['update_time'],
3689
- getv(from_object, ['metadata', 'updateTime']),
3690
- )
3691
-
3692
- if getv(from_object, ['metadata', 'model']) is not None:
3693
- setv(to_object, ['model'], getv(from_object, ['metadata', 'model']))
3694
-
3695
- if getv(from_object, ['metadata', 'output']) is not None:
3696
- setv(
3697
- to_object,
3698
- ['dest'],
3699
- _BatchJobDestination_from_mldev(
3700
- getv(from_object, ['metadata', 'output']), to_object
3701
- ),
3702
- )
3703
-
3704
- return to_object
3705
-
3706
-
3707
- def _ListBatchJobsResponse_from_mldev(
3708
- from_object: Union[dict[str, Any], object],
3709
- parent_object: Optional[dict[str, Any]] = None,
3710
- ) -> dict[str, Any]:
3711
- to_object: dict[str, Any] = {}
3712
- if getv(from_object, ['nextPageToken']) is not None:
3713
- setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
3714
-
3715
- if getv(from_object, ['operations']) is not None:
3716
- setv(
3717
- to_object,
3718
- ['batch_jobs'],
3719
- [
3720
- _BatchJob_from_mldev(item, to_object)
3721
- for item in getv(from_object, ['operations'])
3722
- ],
3723
- )
3724
-
3725
- return to_object
3726
-
3727
-
3728
- def _DeleteResourceJob_from_mldev(
3729
- from_object: Union[dict[str, Any], object],
3730
- parent_object: Optional[dict[str, Any]] = None,
3731
- ) -> dict[str, Any]:
3732
- to_object: dict[str, Any] = {}
3733
- if getv(from_object, ['name']) is not None:
3734
- setv(to_object, ['name'], getv(from_object, ['name']))
3735
-
3736
- if getv(from_object, ['done']) is not None:
3737
- setv(to_object, ['done'], getv(from_object, ['done']))
3738
-
3739
- if getv(from_object, ['error']) is not None:
3740
- setv(
3741
- to_object,
3742
- ['error'],
3743
- _JobError_from_mldev(getv(from_object, ['error']), to_object),
3744
- )
3745
-
3746
- return to_object
3747
-
3748
-
3749
- def _JobError_from_vertex(
3750
- from_object: Union[dict[str, Any], object],
3751
- parent_object: Optional[dict[str, Any]] = None,
3752
- ) -> dict[str, Any]:
3753
- to_object: dict[str, Any] = {}
3754
- if getv(from_object, ['details']) is not None:
3755
- setv(to_object, ['details'], getv(from_object, ['details']))
3756
-
3757
- if getv(from_object, ['code']) is not None:
3758
- setv(to_object, ['code'], getv(from_object, ['code']))
3759
-
3760
- if getv(from_object, ['message']) is not None:
3761
- setv(to_object, ['message'], getv(from_object, ['message']))
3762
-
3763
- return to_object
3764
-
3765
-
3766
- def _VideoMetadata_from_vertex(
3767
- from_object: Union[dict[str, Any], object],
3768
- parent_object: Optional[dict[str, Any]] = None,
3769
- ) -> dict[str, Any]:
3770
- to_object: dict[str, Any] = {}
3771
- if getv(from_object, ['fps']) is not None:
3772
- setv(to_object, ['fps'], getv(from_object, ['fps']))
3773
-
3774
- if getv(from_object, ['endOffset']) is not None:
3775
- setv(to_object, ['end_offset'], getv(from_object, ['endOffset']))
3776
-
3777
- if getv(from_object, ['startOffset']) is not None:
3778
- setv(to_object, ['start_offset'], getv(from_object, ['startOffset']))
3779
-
3780
- return to_object
3781
-
3782
-
3783
- def _Blob_from_vertex(
3784
- from_object: Union[dict[str, Any], object],
3785
- parent_object: Optional[dict[str, Any]] = None,
3786
- ) -> dict[str, Any]:
3787
- to_object: dict[str, Any] = {}
3788
- if getv(from_object, ['displayName']) is not None:
3789
- setv(to_object, ['display_name'], getv(from_object, ['displayName']))
3790
-
3791
- if getv(from_object, ['data']) is not None:
3792
- setv(to_object, ['data'], getv(from_object, ['data']))
3793
-
3794
- if getv(from_object, ['mimeType']) is not None:
3795
- setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
3796
-
3797
- return to_object
3798
-
3799
-
3800
- def _FileData_from_vertex(
3801
- from_object: Union[dict[str, Any], object],
3802
- parent_object: Optional[dict[str, Any]] = None,
3803
- ) -> dict[str, Any]:
3804
- to_object: dict[str, Any] = {}
3805
- if getv(from_object, ['displayName']) is not None:
3806
- setv(to_object, ['display_name'], getv(from_object, ['displayName']))
3807
-
3808
- if getv(from_object, ['fileUri']) is not None:
3809
- setv(to_object, ['file_uri'], getv(from_object, ['fileUri']))
3810
-
3811
- if getv(from_object, ['mimeType']) is not None:
3812
- setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
3813
-
3814
- return to_object
3815
-
3816
-
3817
- def _Part_from_vertex(
3818
- from_object: Union[dict[str, Any], object],
3819
- parent_object: Optional[dict[str, Any]] = None,
3820
- ) -> dict[str, Any]:
3821
- to_object: dict[str, Any] = {}
3822
- if getv(from_object, ['videoMetadata']) is not None:
3823
- setv(
3824
- to_object,
3825
- ['video_metadata'],
3826
- _VideoMetadata_from_vertex(
3827
- getv(from_object, ['videoMetadata']), to_object
3828
- ),
3829
- )
3830
-
3831
- if getv(from_object, ['thought']) is not None:
3832
- setv(to_object, ['thought'], getv(from_object, ['thought']))
3833
-
3834
- if getv(from_object, ['inlineData']) is not None:
3835
- setv(
3836
- to_object,
3837
- ['inline_data'],
3838
- _Blob_from_vertex(getv(from_object, ['inlineData']), to_object),
3839
- )
3840
-
3841
- if getv(from_object, ['fileData']) is not None:
3842
- setv(
3843
- to_object,
3844
- ['file_data'],
3845
- _FileData_from_vertex(getv(from_object, ['fileData']), to_object),
3846
- )
3847
-
3848
- if getv(from_object, ['thoughtSignature']) is not None:
3849
- setv(
3850
- to_object,
3851
- ['thought_signature'],
3852
- getv(from_object, ['thoughtSignature']),
3853
- )
3854
-
3855
- if getv(from_object, ['codeExecutionResult']) is not None:
3856
- setv(
3857
- to_object,
3858
- ['code_execution_result'],
3859
- getv(from_object, ['codeExecutionResult']),
3860
- )
3861
-
3862
- if getv(from_object, ['executableCode']) is not None:
3863
- setv(to_object, ['executable_code'], getv(from_object, ['executableCode']))
3864
-
3865
- if getv(from_object, ['functionCall']) is not None:
3866
- setv(to_object, ['function_call'], getv(from_object, ['functionCall']))
3867
-
3868
- if getv(from_object, ['functionResponse']) is not None:
3869
- setv(
3870
- to_object,
3871
- ['function_response'],
3872
- getv(from_object, ['functionResponse']),
3873
- )
3874
-
3875
- if getv(from_object, ['text']) is not None:
3876
- setv(to_object, ['text'], getv(from_object, ['text']))
3877
-
3878
- return to_object
3879
-
3880
-
3881
- def _Content_from_vertex(
3882
- from_object: Union[dict[str, Any], object],
3883
- parent_object: Optional[dict[str, Any]] = None,
3884
- ) -> dict[str, Any]:
3885
- to_object: dict[str, Any] = {}
3886
- if getv(from_object, ['parts']) is not None:
3887
- setv(
3888
- to_object,
3889
- ['parts'],
3890
- [
3891
- _Part_from_vertex(item, to_object)
3892
- for item in getv(from_object, ['parts'])
3893
- ],
3894
- )
3895
-
3896
- if getv(from_object, ['role']) is not None:
3897
- setv(to_object, ['role'], getv(from_object, ['role']))
3898
-
3899
- return to_object
3900
-
3901
-
3902
- def _Schema_from_vertex(
3903
- from_object: Union[dict[str, Any], object],
3904
- parent_object: Optional[dict[str, Any]] = None,
3905
- ) -> dict[str, Any]:
3906
- to_object: dict[str, Any] = {}
3907
- if getv(from_object, ['additionalProperties']) is not None:
3908
- setv(
3909
- to_object,
3910
- ['additional_properties'],
3911
- getv(from_object, ['additionalProperties']),
3912
- )
3913
-
3914
- if getv(from_object, ['defs']) is not None:
3915
- setv(to_object, ['defs'], getv(from_object, ['defs']))
3916
-
3917
- if getv(from_object, ['ref']) is not None:
3918
- setv(to_object, ['ref'], getv(from_object, ['ref']))
3919
-
3920
- if getv(from_object, ['anyOf']) is not None:
3921
- setv(to_object, ['any_of'], getv(from_object, ['anyOf']))
3922
-
3923
- if getv(from_object, ['default']) is not None:
3924
- setv(to_object, ['default'], getv(from_object, ['default']))
3925
-
3926
- if getv(from_object, ['description']) is not None:
3927
- setv(to_object, ['description'], getv(from_object, ['description']))
3928
-
3929
- if getv(from_object, ['enum']) is not None:
3930
- setv(to_object, ['enum'], getv(from_object, ['enum']))
3931
-
3932
- if getv(from_object, ['example']) is not None:
3933
- setv(to_object, ['example'], getv(from_object, ['example']))
3934
-
3935
- if getv(from_object, ['format']) is not None:
3936
- setv(to_object, ['format'], getv(from_object, ['format']))
3937
-
3938
- if getv(from_object, ['items']) is not None:
3939
- setv(to_object, ['items'], getv(from_object, ['items']))
3940
-
3941
- if getv(from_object, ['maxItems']) is not None:
3942
- setv(to_object, ['max_items'], getv(from_object, ['maxItems']))
3943
-
3944
- if getv(from_object, ['maxLength']) is not None:
3945
- setv(to_object, ['max_length'], getv(from_object, ['maxLength']))
3946
-
3947
- if getv(from_object, ['maxProperties']) is not None:
3948
- setv(to_object, ['max_properties'], getv(from_object, ['maxProperties']))
3949
-
3950
- if getv(from_object, ['maximum']) is not None:
3951
- setv(to_object, ['maximum'], getv(from_object, ['maximum']))
3952
-
3953
- if getv(from_object, ['minItems']) is not None:
3954
- setv(to_object, ['min_items'], getv(from_object, ['minItems']))
3955
-
3956
- if getv(from_object, ['minLength']) is not None:
3957
- setv(to_object, ['min_length'], getv(from_object, ['minLength']))
3958
-
3959
- if getv(from_object, ['minProperties']) is not None:
3960
- setv(to_object, ['min_properties'], getv(from_object, ['minProperties']))
3961
-
3962
- if getv(from_object, ['minimum']) is not None:
3963
- setv(to_object, ['minimum'], getv(from_object, ['minimum']))
3964
-
3965
- if getv(from_object, ['nullable']) is not None:
3966
- setv(to_object, ['nullable'], getv(from_object, ['nullable']))
3967
-
3968
- if getv(from_object, ['pattern']) is not None:
3969
- setv(to_object, ['pattern'], getv(from_object, ['pattern']))
3970
-
3971
- if getv(from_object, ['properties']) is not None:
3972
- setv(to_object, ['properties'], getv(from_object, ['properties']))
3973
-
3974
- if getv(from_object, ['propertyOrdering']) is not None:
3975
- setv(
3976
- to_object,
3977
- ['property_ordering'],
3978
- getv(from_object, ['propertyOrdering']),
3979
- )
3980
-
3981
- if getv(from_object, ['required']) is not None:
3982
- setv(to_object, ['required'], getv(from_object, ['required']))
3983
-
3984
- if getv(from_object, ['title']) is not None:
3985
- setv(to_object, ['title'], getv(from_object, ['title']))
3986
-
3987
- if getv(from_object, ['type']) is not None:
3988
- setv(to_object, ['type'], getv(from_object, ['type']))
3989
-
3990
- return to_object
3991
-
3992
-
3993
- def _ModelSelectionConfig_from_vertex(
3994
- from_object: Union[dict[str, Any], object],
3995
- parent_object: Optional[dict[str, Any]] = None,
3996
- ) -> dict[str, Any]:
3997
- to_object: dict[str, Any] = {}
3998
- if getv(from_object, ['featureSelectionPreference']) is not None:
3999
- setv(
4000
- to_object,
4001
- ['feature_selection_preference'],
4002
- getv(from_object, ['featureSelectionPreference']),
4003
- )
4004
-
4005
- return to_object
4006
-
4007
-
4008
- def _SafetySetting_from_vertex(
4009
- from_object: Union[dict[str, Any], object],
4010
- parent_object: Optional[dict[str, Any]] = None,
4011
- ) -> dict[str, Any]:
4012
- to_object: dict[str, Any] = {}
4013
- if getv(from_object, ['method']) is not None:
4014
- setv(to_object, ['method'], getv(from_object, ['method']))
4015
-
4016
- if getv(from_object, ['category']) is not None:
4017
- setv(to_object, ['category'], getv(from_object, ['category']))
4018
-
4019
- if getv(from_object, ['threshold']) is not None:
4020
- setv(to_object, ['threshold'], getv(from_object, ['threshold']))
4021
-
4022
- return to_object
4023
-
4024
-
4025
- def _FunctionDeclaration_from_vertex(
4026
- from_object: Union[dict[str, Any], object],
4027
- parent_object: Optional[dict[str, Any]] = None,
4028
- ) -> dict[str, Any]:
4029
- to_object: dict[str, Any] = {}
4030
-
4031
- if getv(from_object, ['description']) is not None:
4032
- setv(to_object, ['description'], getv(from_object, ['description']))
4033
-
4034
- if getv(from_object, ['name']) is not None:
4035
- setv(to_object, ['name'], getv(from_object, ['name']))
4036
-
4037
- if getv(from_object, ['parameters']) is not None:
4038
- setv(to_object, ['parameters'], getv(from_object, ['parameters']))
4039
-
4040
- if getv(from_object, ['parametersJsonSchema']) is not None:
4041
- setv(
4042
- to_object,
4043
- ['parameters_json_schema'],
4044
- getv(from_object, ['parametersJsonSchema']),
4045
- )
4046
-
4047
- if getv(from_object, ['response']) is not None:
4048
- setv(to_object, ['response'], getv(from_object, ['response']))
4049
-
4050
- if getv(from_object, ['responseJsonSchema']) is not None:
4051
- setv(
4052
- to_object,
4053
- ['response_json_schema'],
4054
- getv(from_object, ['responseJsonSchema']),
4055
- )
4056
-
4057
- return to_object
4058
-
4059
-
4060
- def _Interval_from_vertex(
4061
- from_object: Union[dict[str, Any], object],
4062
- parent_object: Optional[dict[str, Any]] = None,
4063
- ) -> dict[str, Any]:
4064
- to_object: dict[str, Any] = {}
4065
- if getv(from_object, ['startTime']) is not None:
4066
- setv(to_object, ['start_time'], getv(from_object, ['startTime']))
4067
-
4068
- if getv(from_object, ['endTime']) is not None:
4069
- setv(to_object, ['end_time'], getv(from_object, ['endTime']))
4070
-
4071
- return to_object
4072
-
4073
-
4074
- def _GoogleSearch_from_vertex(
4075
- from_object: Union[dict[str, Any], object],
4076
- parent_object: Optional[dict[str, Any]] = None,
4077
- ) -> dict[str, Any]:
4078
- to_object: dict[str, Any] = {}
4079
- if getv(from_object, ['timeRangeFilter']) is not None:
4080
- setv(
4081
- to_object,
4082
- ['time_range_filter'],
4083
- _Interval_from_vertex(
4084
- getv(from_object, ['timeRangeFilter']), to_object
4085
- ),
4086
- )
4087
-
4088
- return to_object
4089
-
4090
-
4091
- def _DynamicRetrievalConfig_from_vertex(
4092
- from_object: Union[dict[str, Any], object],
4093
- parent_object: Optional[dict[str, Any]] = None,
4094
- ) -> dict[str, Any]:
4095
- to_object: dict[str, Any] = {}
4096
- if getv(from_object, ['mode']) is not None:
4097
- setv(to_object, ['mode'], getv(from_object, ['mode']))
4098
-
4099
- if getv(from_object, ['dynamicThreshold']) is not None:
4100
- setv(
4101
- to_object,
4102
- ['dynamic_threshold'],
4103
- getv(from_object, ['dynamicThreshold']),
4104
- )
4105
-
4106
- return to_object
4107
-
4108
-
4109
- def _GoogleSearchRetrieval_from_vertex(
4110
- from_object: Union[dict[str, Any], object],
4111
- parent_object: Optional[dict[str, Any]] = None,
4112
- ) -> dict[str, Any]:
4113
- to_object: dict[str, Any] = {}
4114
- if getv(from_object, ['dynamicRetrievalConfig']) is not None:
4115
- setv(
4116
- to_object,
4117
- ['dynamic_retrieval_config'],
4118
- _DynamicRetrievalConfig_from_vertex(
4119
- getv(from_object, ['dynamicRetrievalConfig']), to_object
4120
- ),
4121
- )
4122
-
4123
- return to_object
4124
-
4125
-
4126
- def _EnterpriseWebSearch_from_vertex(
4127
- from_object: Union[dict[str, Any], object],
4128
- parent_object: Optional[dict[str, Any]] = None,
4129
- ) -> dict[str, Any]:
4130
- to_object: dict[str, Any] = {}
4131
-
4132
- return to_object
4133
-
4134
-
4135
- def _ApiKeyConfig_from_vertex(
4136
- from_object: Union[dict[str, Any], object],
4137
- parent_object: Optional[dict[str, Any]] = None,
4138
- ) -> dict[str, Any]:
4139
- to_object: dict[str, Any] = {}
4140
- if getv(from_object, ['apiKeyString']) is not None:
4141
- setv(to_object, ['api_key_string'], getv(from_object, ['apiKeyString']))
4142
-
4143
- return to_object
4144
-
4145
-
4146
- def _AuthConfig_from_vertex(
4147
- from_object: Union[dict[str, Any], object],
4148
- parent_object: Optional[dict[str, Any]] = None,
4149
- ) -> dict[str, Any]:
4150
- to_object: dict[str, Any] = {}
4151
- if getv(from_object, ['apiKeyConfig']) is not None:
4152
- setv(
4153
- to_object,
4154
- ['api_key_config'],
4155
- _ApiKeyConfig_from_vertex(
4156
- getv(from_object, ['apiKeyConfig']), to_object
4157
- ),
4158
- )
4159
-
4160
- if getv(from_object, ['authType']) is not None:
4161
- setv(to_object, ['auth_type'], getv(from_object, ['authType']))
4162
-
4163
- if getv(from_object, ['googleServiceAccountConfig']) is not None:
4164
- setv(
4165
- to_object,
4166
- ['google_service_account_config'],
4167
- getv(from_object, ['googleServiceAccountConfig']),
4168
- )
4169
-
4170
- if getv(from_object, ['httpBasicAuthConfig']) is not None:
4171
- setv(
4172
- to_object,
4173
- ['http_basic_auth_config'],
4174
- getv(from_object, ['httpBasicAuthConfig']),
4175
- )
4176
-
4177
- if getv(from_object, ['oauthConfig']) is not None:
4178
- setv(to_object, ['oauth_config'], getv(from_object, ['oauthConfig']))
4179
-
4180
- if getv(from_object, ['oidcConfig']) is not None:
4181
- setv(to_object, ['oidc_config'], getv(from_object, ['oidcConfig']))
4182
-
4183
- return to_object
4184
-
4185
-
4186
- def _GoogleMaps_from_vertex(
4187
- from_object: Union[dict[str, Any], object],
4188
- parent_object: Optional[dict[str, Any]] = None,
4189
- ) -> dict[str, Any]:
4190
- to_object: dict[str, Any] = {}
4191
- if getv(from_object, ['authConfig']) is not None:
4192
- setv(
4193
- to_object,
4194
- ['auth_config'],
4195
- _AuthConfig_from_vertex(getv(from_object, ['authConfig']), to_object),
4196
- )
4197
-
4198
- return to_object
4199
-
4200
-
4201
- def _UrlContext_from_vertex(
4202
- from_object: Union[dict[str, Any], object],
4203
- parent_object: Optional[dict[str, Any]] = None,
4204
- ) -> dict[str, Any]:
4205
- to_object: dict[str, Any] = {}
4206
-
4207
- return to_object
4208
-
4209
-
4210
- def _Tool_from_vertex(
4211
- from_object: Union[dict[str, Any], object],
4212
- parent_object: Optional[dict[str, Any]] = None,
4213
- ) -> dict[str, Any]:
4214
- to_object: dict[str, Any] = {}
4215
- if getv(from_object, ['functionDeclarations']) is not None:
4216
- setv(
4217
- to_object,
4218
- ['function_declarations'],
4219
- [
4220
- _FunctionDeclaration_from_vertex(item, to_object)
4221
- for item in getv(from_object, ['functionDeclarations'])
4222
- ],
4223
- )
4224
-
4225
- if getv(from_object, ['retrieval']) is not None:
4226
- setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
4227
-
4228
- if getv(from_object, ['googleSearch']) is not None:
4229
- setv(
4230
- to_object,
4231
- ['google_search'],
4232
- _GoogleSearch_from_vertex(
4233
- getv(from_object, ['googleSearch']), to_object
4234
- ),
4235
- )
4236
-
4237
- if getv(from_object, ['googleSearchRetrieval']) is not None:
4238
- setv(
4239
- to_object,
4240
- ['google_search_retrieval'],
4241
- _GoogleSearchRetrieval_from_vertex(
4242
- getv(from_object, ['googleSearchRetrieval']), to_object
4243
- ),
4244
- )
4245
-
4246
- if getv(from_object, ['enterpriseWebSearch']) is not None:
4247
- setv(
4248
- to_object,
4249
- ['enterprise_web_search'],
4250
- _EnterpriseWebSearch_from_vertex(
4251
- getv(from_object, ['enterpriseWebSearch']), to_object
4252
- ),
4253
- )
4254
-
4255
- if getv(from_object, ['googleMaps']) is not None:
4256
- setv(
4257
- to_object,
4258
- ['google_maps'],
4259
- _GoogleMaps_from_vertex(getv(from_object, ['googleMaps']), to_object),
4260
- )
4261
-
4262
- if getv(from_object, ['urlContext']) is not None:
4263
- setv(
4264
- to_object,
4265
- ['url_context'],
4266
- _UrlContext_from_vertex(getv(from_object, ['urlContext']), to_object),
4267
- )
4268
-
4269
- if getv(from_object, ['codeExecution']) is not None:
4270
- setv(to_object, ['code_execution'], getv(from_object, ['codeExecution']))
4271
-
4272
- if getv(from_object, ['computerUse']) is not None:
4273
- setv(to_object, ['computer_use'], getv(from_object, ['computerUse']))
4274
-
4275
- return to_object
4276
-
4277
-
4278
- def _FunctionCallingConfig_from_vertex(
4279
- from_object: Union[dict[str, Any], object],
4280
- parent_object: Optional[dict[str, Any]] = None,
4281
- ) -> dict[str, Any]:
4282
- to_object: dict[str, Any] = {}
4283
- if getv(from_object, ['mode']) is not None:
4284
- setv(to_object, ['mode'], getv(from_object, ['mode']))
4285
-
4286
- if getv(from_object, ['allowedFunctionNames']) is not None:
4287
- setv(
4288
- to_object,
4289
- ['allowed_function_names'],
4290
- getv(from_object, ['allowedFunctionNames']),
4291
- )
4292
-
4293
- return to_object
4294
-
4295
-
4296
- def _LatLng_from_vertex(
4297
- from_object: Union[dict[str, Any], object],
4298
- parent_object: Optional[dict[str, Any]] = None,
4299
- ) -> dict[str, Any]:
4300
- to_object: dict[str, Any] = {}
4301
- if getv(from_object, ['latitude']) is not None:
4302
- setv(to_object, ['latitude'], getv(from_object, ['latitude']))
4303
-
4304
- if getv(from_object, ['longitude']) is not None:
4305
- setv(to_object, ['longitude'], getv(from_object, ['longitude']))
4306
-
4307
- return to_object
4308
-
4309
-
4310
- def _RetrievalConfig_from_vertex(
4311
- from_object: Union[dict[str, Any], object],
4312
- parent_object: Optional[dict[str, Any]] = None,
4313
- ) -> dict[str, Any]:
4314
- to_object: dict[str, Any] = {}
4315
- if getv(from_object, ['latLng']) is not None:
4316
- setv(
4317
- to_object,
4318
- ['lat_lng'],
4319
- _LatLng_from_vertex(getv(from_object, ['latLng']), to_object),
4320
- )
4321
-
4322
- if getv(from_object, ['languageCode']) is not None:
4323
- setv(to_object, ['language_code'], getv(from_object, ['languageCode']))
4324
-
4325
- return to_object
4326
-
4327
-
4328
- def _ToolConfig_from_vertex(
4329
- from_object: Union[dict[str, Any], object],
4330
- parent_object: Optional[dict[str, Any]] = None,
4331
- ) -> dict[str, Any]:
4332
- to_object: dict[str, Any] = {}
4333
- if getv(from_object, ['functionCallingConfig']) is not None:
4334
- setv(
4335
- to_object,
4336
- ['function_calling_config'],
4337
- _FunctionCallingConfig_from_vertex(
4338
- getv(from_object, ['functionCallingConfig']), to_object
4339
- ),
4340
- )
4341
-
4342
- if getv(from_object, ['retrievalConfig']) is not None:
4343
- setv(
4344
- to_object,
4345
- ['retrieval_config'],
4346
- _RetrievalConfig_from_vertex(
4347
- getv(from_object, ['retrievalConfig']), to_object
4348
- ),
4349
- )
4350
-
4351
- return to_object
4352
-
4353
-
4354
- def _PrebuiltVoiceConfig_from_vertex(
4355
- from_object: Union[dict[str, Any], object],
4356
- parent_object: Optional[dict[str, Any]] = None,
4357
- ) -> dict[str, Any]:
4358
- to_object: dict[str, Any] = {}
4359
- if getv(from_object, ['voiceName']) is not None:
4360
- setv(to_object, ['voice_name'], getv(from_object, ['voiceName']))
4361
-
4362
- return to_object
4363
-
4364
-
4365
- def _VoiceConfig_from_vertex(
4366
- from_object: Union[dict[str, Any], object],
4367
- parent_object: Optional[dict[str, Any]] = None,
4368
- ) -> dict[str, Any]:
4369
- to_object: dict[str, Any] = {}
4370
- if getv(from_object, ['prebuiltVoiceConfig']) is not None:
4371
- setv(
4372
- to_object,
4373
- ['prebuilt_voice_config'],
4374
- _PrebuiltVoiceConfig_from_vertex(
4375
- getv(from_object, ['prebuiltVoiceConfig']), to_object
4376
- ),
4377
- )
4378
-
4379
- return to_object
4380
-
4381
-
4382
- def _SpeakerVoiceConfig_from_vertex(
4383
- from_object: Union[dict[str, Any], object],
4384
- parent_object: Optional[dict[str, Any]] = None,
4385
- ) -> dict[str, Any]:
4386
- to_object: dict[str, Any] = {}
4387
-
4388
- return to_object
4389
-
4390
-
4391
- def _MultiSpeakerVoiceConfig_from_vertex(
4392
- from_object: Union[dict[str, Any], object],
4393
- parent_object: Optional[dict[str, Any]] = None,
4394
- ) -> dict[str, Any]:
4395
- to_object: dict[str, Any] = {}
4396
-
4397
- return to_object
4398
-
4399
-
4400
- def _SpeechConfig_from_vertex(
4401
- from_object: Union[dict[str, Any], object],
4402
- parent_object: Optional[dict[str, Any]] = None,
4403
- ) -> dict[str, Any]:
4404
- to_object: dict[str, Any] = {}
4405
- if getv(from_object, ['voiceConfig']) is not None:
4406
- setv(
4407
- to_object,
4408
- ['voice_config'],
4409
- _VoiceConfig_from_vertex(getv(from_object, ['voiceConfig']), to_object),
4410
- )
4411
-
4412
- if getv(from_object, ['languageCode']) is not None:
4413
- setv(to_object, ['language_code'], getv(from_object, ['languageCode']))
4414
-
4415
- return to_object
4416
-
4417
-
4418
- def _ThinkingConfig_from_vertex(
4419
- from_object: Union[dict[str, Any], object],
4420
- parent_object: Optional[dict[str, Any]] = None,
4421
- ) -> dict[str, Any]:
4422
- to_object: dict[str, Any] = {}
4423
- if getv(from_object, ['includeThoughts']) is not None:
4424
- setv(
4425
- to_object, ['include_thoughts'], getv(from_object, ['includeThoughts'])
4426
- )
4427
-
4428
- if getv(from_object, ['thinkingBudget']) is not None:
4429
- setv(to_object, ['thinking_budget'], getv(from_object, ['thinkingBudget']))
4430
-
4431
- return to_object
4432
-
4433
-
4434
- def _GenerateContentConfig_from_vertex(
4435
- api_client: BaseApiClient,
4436
- from_object: Union[dict[str, Any], object],
4437
- parent_object: Optional[dict[str, Any]] = None,
4438
- ) -> dict[str, Any]:
4439
- to_object: dict[str, Any] = {}
4440
-
4441
- if getv(parent_object, ['systemInstruction']) is not None:
4442
- setv(
4443
- to_object,
4444
- ['system_instruction'],
4445
- _Content_from_vertex(
4446
- t.t_content(getv(parent_object, ['systemInstruction'])), to_object
4447
- ),
4448
- )
4449
-
4450
- if getv(from_object, ['temperature']) is not None:
4451
- setv(to_object, ['temperature'], getv(from_object, ['temperature']))
4452
-
4453
- if getv(from_object, ['topP']) is not None:
4454
- setv(to_object, ['top_p'], getv(from_object, ['topP']))
4455
-
4456
- if getv(from_object, ['topK']) is not None:
4457
- setv(to_object, ['top_k'], getv(from_object, ['topK']))
4458
-
4459
- if getv(from_object, ['candidateCount']) is not None:
4460
- setv(to_object, ['candidate_count'], getv(from_object, ['candidateCount']))
4461
-
4462
- if getv(from_object, ['maxOutputTokens']) is not None:
4463
- setv(
4464
- to_object, ['max_output_tokens'], getv(from_object, ['maxOutputTokens'])
4465
- )
4466
-
4467
- if getv(from_object, ['stopSequences']) is not None:
4468
- setv(to_object, ['stop_sequences'], getv(from_object, ['stopSequences']))
4469
-
4470
- if getv(from_object, ['responseLogprobs']) is not None:
4471
- setv(
4472
- to_object,
4473
- ['response_logprobs'],
4474
- getv(from_object, ['responseLogprobs']),
4475
- )
4476
-
4477
- if getv(from_object, ['logprobs']) is not None:
4478
- setv(to_object, ['logprobs'], getv(from_object, ['logprobs']))
4479
-
4480
- if getv(from_object, ['presencePenalty']) is not None:
4481
- setv(
4482
- to_object, ['presence_penalty'], getv(from_object, ['presencePenalty'])
4483
- )
4484
-
4485
- if getv(from_object, ['frequencyPenalty']) is not None:
4486
- setv(
4487
- to_object,
4488
- ['frequency_penalty'],
4489
- getv(from_object, ['frequencyPenalty']),
4490
- )
4491
-
4492
- if getv(from_object, ['seed']) is not None:
4493
- setv(to_object, ['seed'], getv(from_object, ['seed']))
4494
-
4495
- if getv(from_object, ['responseMimeType']) is not None:
4496
- setv(
4497
- to_object,
4498
- ['response_mime_type'],
4499
- getv(from_object, ['responseMimeType']),
4500
- )
4501
-
4502
- if getv(from_object, ['responseSchema']) is not None:
4503
- setv(
4504
- to_object,
4505
- ['response_schema'],
4506
- _Schema_from_vertex(
4507
- t.t_schema(api_client, getv(from_object, ['responseSchema'])),
4508
- to_object,
4509
- ),
4510
- )
4511
-
4512
- if getv(from_object, ['responseJsonSchema']) is not None:
4513
- setv(
4514
- to_object,
4515
- ['response_json_schema'],
4516
- getv(from_object, ['responseJsonSchema']),
4517
- )
4518
-
4519
- if getv(from_object, ['routingConfig']) is not None:
4520
- setv(to_object, ['routing_config'], getv(from_object, ['routingConfig']))
4521
-
4522
- if getv(from_object, ['modelConfig']) is not None:
4523
- setv(
4524
- to_object,
4525
- ['model_selection_config'],
4526
- _ModelSelectionConfig_from_vertex(
4527
- getv(from_object, ['modelConfig']), to_object
4528
- ),
4529
- )
4530
-
4531
- if getv(parent_object, ['safetySettings']) is not None:
4532
- setv(
4533
- to_object,
4534
- ['safety_settings'],
4535
- [
4536
- _SafetySetting_from_vertex(item, to_object)
4537
- for item in getv(parent_object, ['safetySettings'])
4538
- ],
4539
- )
4540
-
4541
- if getv(parent_object, ['tools']) is not None:
4542
- setv(
4543
- to_object,
4544
- ['tools'],
4545
- [
4546
- _Tool_from_vertex(t.t_tool(api_client, item), to_object)
4547
- for item in t.t_tools(api_client, getv(parent_object, ['tools']))
4548
- ],
4549
- )
4550
-
4551
- if getv(parent_object, ['toolConfig']) is not None:
4552
- setv(
4553
- to_object,
4554
- ['tool_config'],
4555
- _ToolConfig_from_vertex(getv(parent_object, ['toolConfig']), to_object),
4556
- )
4557
-
4558
- if getv(parent_object, ['labels']) is not None:
4559
- setv(to_object, ['labels'], getv(parent_object, ['labels']))
4560
-
4561
- if getv(parent_object, ['cachedContent']) is not None:
4562
- setv(
4563
- to_object,
4564
- ['cached_content'],
4565
- t.t_cached_content_name(
4566
- api_client, getv(parent_object, ['cachedContent'])
4567
- ),
4568
- )
4569
-
4570
- if getv(from_object, ['responseModalities']) is not None:
4571
- setv(
4572
- to_object,
4573
- ['response_modalities'],
4574
- getv(from_object, ['responseModalities']),
1306
+ ['file_data'],
1307
+ _FileData_from_mldev(getv(from_object, ['fileData']), to_object),
4575
1308
  )
4576
1309
 
4577
- if getv(from_object, ['mediaResolution']) is not None:
1310
+ if getv(from_object, ['thoughtSignature']) is not None:
4578
1311
  setv(
4579
- to_object, ['media_resolution'], getv(from_object, ['mediaResolution'])
1312
+ to_object,
1313
+ ['thought_signature'],
1314
+ getv(from_object, ['thoughtSignature']),
4580
1315
  )
4581
1316
 
4582
- if getv(from_object, ['speechConfig']) is not None:
1317
+ if getv(from_object, ['codeExecutionResult']) is not None:
4583
1318
  setv(
4584
1319
  to_object,
4585
- ['speech_config'],
4586
- _SpeechConfig_from_vertex(
4587
- t.t_speech_config(getv(from_object, ['speechConfig'])), to_object
4588
- ),
1320
+ ['code_execution_result'],
1321
+ getv(from_object, ['codeExecutionResult']),
4589
1322
  )
4590
1323
 
4591
- if getv(from_object, ['audioTimestamp']) is not None:
4592
- setv(to_object, ['audio_timestamp'], getv(from_object, ['audioTimestamp']))
1324
+ if getv(from_object, ['executableCode']) is not None:
1325
+ setv(to_object, ['executable_code'], getv(from_object, ['executableCode']))
1326
+
1327
+ if getv(from_object, ['functionCall']) is not None:
1328
+ setv(to_object, ['function_call'], getv(from_object, ['functionCall']))
4593
1329
 
4594
- if getv(from_object, ['thinkingConfig']) is not None:
1330
+ if getv(from_object, ['functionResponse']) is not None:
4595
1331
  setv(
4596
1332
  to_object,
4597
- ['thinking_config'],
4598
- _ThinkingConfig_from_vertex(
4599
- getv(from_object, ['thinkingConfig']), to_object
4600
- ),
1333
+ ['function_response'],
1334
+ getv(from_object, ['functionResponse']),
4601
1335
  )
4602
1336
 
4603
- return to_object
4604
-
4605
-
4606
- def _InlinedRequest_from_vertex(
4607
- from_object: Union[dict[str, Any], object],
4608
- parent_object: Optional[dict[str, Any]] = None,
4609
- ) -> dict[str, Any]:
4610
- to_object: dict[str, Any] = {}
1337
+ if getv(from_object, ['text']) is not None:
1338
+ setv(to_object, ['text'], getv(from_object, ['text']))
4611
1339
 
4612
1340
  return to_object
4613
1341
 
4614
1342
 
4615
- def _BatchJobSource_from_vertex(
1343
+ def _Content_from_mldev(
4616
1344
  from_object: Union[dict[str, Any], object],
4617
1345
  parent_object: Optional[dict[str, Any]] = None,
4618
1346
  ) -> dict[str, Any]:
4619
1347
  to_object: dict[str, Any] = {}
4620
- if getv(from_object, ['instancesFormat']) is not None:
4621
- setv(to_object, ['format'], getv(from_object, ['instancesFormat']))
4622
-
4623
- if getv(from_object, ['gcsSource', 'uris']) is not None:
4624
- setv(to_object, ['gcs_uri'], getv(from_object, ['gcsSource', 'uris']))
4625
-
4626
- if getv(from_object, ['bigquerySource', 'inputUri']) is not None:
1348
+ if getv(from_object, ['parts']) is not None:
4627
1349
  setv(
4628
1350
  to_object,
4629
- ['bigquery_uri'],
4630
- getv(from_object, ['bigquerySource', 'inputUri']),
1351
+ ['parts'],
1352
+ [
1353
+ _Part_from_mldev(item, to_object)
1354
+ for item in getv(from_object, ['parts'])
1355
+ ],
4631
1356
  )
4632
1357
 
1358
+ if getv(from_object, ['role']) is not None:
1359
+ setv(to_object, ['role'], getv(from_object, ['role']))
1360
+
4633
1361
  return to_object
4634
1362
 
4635
1363
 
4636
- def _CitationMetadata_from_vertex(
1364
+ def _CitationMetadata_from_mldev(
4637
1365
  from_object: Union[dict[str, Any], object],
4638
1366
  parent_object: Optional[dict[str, Any]] = None,
4639
1367
  ) -> dict[str, Any]:
4640
1368
  to_object: dict[str, Any] = {}
4641
- if getv(from_object, ['citations']) is not None:
4642
- setv(to_object, ['citations'], getv(from_object, ['citations']))
1369
+ if getv(from_object, ['citationSources']) is not None:
1370
+ setv(to_object, ['citations'], getv(from_object, ['citationSources']))
4643
1371
 
4644
1372
  return to_object
4645
1373
 
4646
1374
 
4647
- def _UrlMetadata_from_vertex(
1375
+ def _UrlMetadata_from_mldev(
4648
1376
  from_object: Union[dict[str, Any], object],
4649
1377
  parent_object: Optional[dict[str, Any]] = None,
4650
1378
  ) -> dict[str, Any]:
@@ -4662,7 +1390,7 @@ def _UrlMetadata_from_vertex(
4662
1390
  return to_object
4663
1391
 
4664
1392
 
4665
- def _UrlContextMetadata_from_vertex(
1393
+ def _UrlContextMetadata_from_mldev(
4666
1394
  from_object: Union[dict[str, Any], object],
4667
1395
  parent_object: Optional[dict[str, Any]] = None,
4668
1396
  ) -> dict[str, Any]:
@@ -4672,7 +1400,7 @@ def _UrlContextMetadata_from_vertex(
4672
1400
  to_object,
4673
1401
  ['url_metadata'],
4674
1402
  [
4675
- _UrlMetadata_from_vertex(item, to_object)
1403
+ _UrlMetadata_from_mldev(item, to_object)
4676
1404
  for item in getv(from_object, ['urlMetadata'])
4677
1405
  ],
4678
1406
  )
@@ -4680,7 +1408,7 @@ def _UrlContextMetadata_from_vertex(
4680
1408
  return to_object
4681
1409
 
4682
1410
 
4683
- def _Candidate_from_vertex(
1411
+ def _Candidate_from_mldev(
4684
1412
  from_object: Union[dict[str, Any], object],
4685
1413
  parent_object: Optional[dict[str, Any]] = None,
4686
1414
  ) -> dict[str, Any]:
@@ -4689,20 +1417,20 @@ def _Candidate_from_vertex(
4689
1417
  setv(
4690
1418
  to_object,
4691
1419
  ['content'],
4692
- _Content_from_vertex(getv(from_object, ['content']), to_object),
1420
+ _Content_from_mldev(getv(from_object, ['content']), to_object),
4693
1421
  )
4694
1422
 
4695
1423
  if getv(from_object, ['citationMetadata']) is not None:
4696
1424
  setv(
4697
1425
  to_object,
4698
1426
  ['citation_metadata'],
4699
- _CitationMetadata_from_vertex(
1427
+ _CitationMetadata_from_mldev(
4700
1428
  getv(from_object, ['citationMetadata']), to_object
4701
1429
  ),
4702
1430
  )
4703
1431
 
4704
- if getv(from_object, ['finishMessage']) is not None:
4705
- setv(to_object, ['finish_message'], getv(from_object, ['finishMessage']))
1432
+ if getv(from_object, ['tokenCount']) is not None:
1433
+ setv(to_object, ['token_count'], getv(from_object, ['tokenCount']))
4706
1434
 
4707
1435
  if getv(from_object, ['finishReason']) is not None:
4708
1436
  setv(to_object, ['finish_reason'], getv(from_object, ['finishReason']))
@@ -4711,7 +1439,7 @@ def _Candidate_from_vertex(
4711
1439
  setv(
4712
1440
  to_object,
4713
1441
  ['url_context_metadata'],
4714
- _UrlContextMetadata_from_vertex(
1442
+ _UrlContextMetadata_from_mldev(
4715
1443
  getv(from_object, ['urlContextMetadata']), to_object
4716
1444
  ),
4717
1445
  )
@@ -4738,12 +1466,11 @@ def _Candidate_from_vertex(
4738
1466
  return to_object
4739
1467
 
4740
1468
 
4741
- def _GenerateContentResponse_from_vertex(
1469
+ def _GenerateContentResponse_from_mldev(
4742
1470
  from_object: Union[dict[str, Any], object],
4743
1471
  parent_object: Optional[dict[str, Any]] = None,
4744
1472
  ) -> dict[str, Any]:
4745
1473
  to_object: dict[str, Any] = {}
4746
-
4747
1474
  if getv(from_object, ['sdkHttpResponse']) is not None:
4748
1475
  setv(
4749
1476
  to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
@@ -4754,17 +1481,11 @@ def _GenerateContentResponse_from_vertex(
4754
1481
  to_object,
4755
1482
  ['candidates'],
4756
1483
  [
4757
- _Candidate_from_vertex(item, to_object)
1484
+ _Candidate_from_mldev(item, to_object)
4758
1485
  for item in getv(from_object, ['candidates'])
4759
1486
  ],
4760
1487
  )
4761
1488
 
4762
- if getv(from_object, ['createTime']) is not None:
4763
- setv(to_object, ['create_time'], getv(from_object, ['createTime']))
4764
-
4765
- if getv(from_object, ['responseId']) is not None:
4766
- setv(to_object, ['response_id'], getv(from_object, ['responseId']))
4767
-
4768
1489
  if getv(from_object, ['modelVersion']) is not None:
4769
1490
  setv(to_object, ['model_version'], getv(from_object, ['modelVersion']))
4770
1491
 
@@ -4777,11 +1498,201 @@ def _GenerateContentResponse_from_vertex(
4777
1498
  return to_object
4778
1499
 
4779
1500
 
4780
- def _InlinedResponse_from_vertex(
1501
+ def _JobError_from_mldev(
1502
+ from_object: Union[dict[str, Any], object],
1503
+ parent_object: Optional[dict[str, Any]] = None,
1504
+ ) -> dict[str, Any]:
1505
+ to_object: dict[str, Any] = {}
1506
+ if getv(from_object, ['details']) is not None:
1507
+ setv(to_object, ['details'], getv(from_object, ['details']))
1508
+
1509
+ if getv(from_object, ['code']) is not None:
1510
+ setv(to_object, ['code'], getv(from_object, ['code']))
1511
+
1512
+ if getv(from_object, ['message']) is not None:
1513
+ setv(to_object, ['message'], getv(from_object, ['message']))
1514
+
1515
+ return to_object
1516
+
1517
+
1518
+ def _InlinedResponse_from_mldev(
1519
+ from_object: Union[dict[str, Any], object],
1520
+ parent_object: Optional[dict[str, Any]] = None,
1521
+ ) -> dict[str, Any]:
1522
+ to_object: dict[str, Any] = {}
1523
+ if getv(from_object, ['response']) is not None:
1524
+ setv(
1525
+ to_object,
1526
+ ['response'],
1527
+ _GenerateContentResponse_from_mldev(
1528
+ getv(from_object, ['response']), to_object
1529
+ ),
1530
+ )
1531
+
1532
+ if getv(from_object, ['error']) is not None:
1533
+ setv(
1534
+ to_object,
1535
+ ['error'],
1536
+ _JobError_from_mldev(getv(from_object, ['error']), to_object),
1537
+ )
1538
+
1539
+ return to_object
1540
+
1541
+
1542
+ def _BatchJobDestination_from_mldev(
1543
+ from_object: Union[dict[str, Any], object],
1544
+ parent_object: Optional[dict[str, Any]] = None,
1545
+ ) -> dict[str, Any]:
1546
+ to_object: dict[str, Any] = {}
1547
+
1548
+ if getv(from_object, ['responsesFile']) is not None:
1549
+ setv(to_object, ['file_name'], getv(from_object, ['responsesFile']))
1550
+
1551
+ if getv(from_object, ['inlinedResponses', 'inlinedResponses']) is not None:
1552
+ setv(
1553
+ to_object,
1554
+ ['inlined_responses'],
1555
+ [
1556
+ _InlinedResponse_from_mldev(item, to_object)
1557
+ for item in getv(
1558
+ from_object, ['inlinedResponses', 'inlinedResponses']
1559
+ )
1560
+ ],
1561
+ )
1562
+
1563
+ return to_object
1564
+
1565
+
1566
+ def _BatchJob_from_mldev(
1567
+ from_object: Union[dict[str, Any], object],
1568
+ parent_object: Optional[dict[str, Any]] = None,
1569
+ ) -> dict[str, Any]:
1570
+ to_object: dict[str, Any] = {}
1571
+ if getv(from_object, ['name']) is not None:
1572
+ setv(to_object, ['name'], getv(from_object, ['name']))
1573
+
1574
+ if getv(from_object, ['metadata', 'displayName']) is not None:
1575
+ setv(
1576
+ to_object,
1577
+ ['display_name'],
1578
+ getv(from_object, ['metadata', 'displayName']),
1579
+ )
1580
+
1581
+ if getv(from_object, ['metadata', 'state']) is not None:
1582
+ setv(
1583
+ to_object,
1584
+ ['state'],
1585
+ t.t_job_state(getv(from_object, ['metadata', 'state'])),
1586
+ )
1587
+
1588
+ if getv(from_object, ['metadata', 'createTime']) is not None:
1589
+ setv(
1590
+ to_object,
1591
+ ['create_time'],
1592
+ getv(from_object, ['metadata', 'createTime']),
1593
+ )
1594
+
1595
+ if getv(from_object, ['metadata', 'endTime']) is not None:
1596
+ setv(to_object, ['end_time'], getv(from_object, ['metadata', 'endTime']))
1597
+
1598
+ if getv(from_object, ['metadata', 'updateTime']) is not None:
1599
+ setv(
1600
+ to_object,
1601
+ ['update_time'],
1602
+ getv(from_object, ['metadata', 'updateTime']),
1603
+ )
1604
+
1605
+ if getv(from_object, ['metadata', 'model']) is not None:
1606
+ setv(to_object, ['model'], getv(from_object, ['metadata', 'model']))
1607
+
1608
+ if getv(from_object, ['metadata', 'output']) is not None:
1609
+ setv(
1610
+ to_object,
1611
+ ['dest'],
1612
+ _BatchJobDestination_from_mldev(
1613
+ getv(from_object, ['metadata', 'output']), to_object
1614
+ ),
1615
+ )
1616
+
1617
+ return to_object
1618
+
1619
+
1620
+ def _ListBatchJobsResponse_from_mldev(
1621
+ from_object: Union[dict[str, Any], object],
1622
+ parent_object: Optional[dict[str, Any]] = None,
1623
+ ) -> dict[str, Any]:
1624
+ to_object: dict[str, Any] = {}
1625
+ if getv(from_object, ['nextPageToken']) is not None:
1626
+ setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
1627
+
1628
+ if getv(from_object, ['operations']) is not None:
1629
+ setv(
1630
+ to_object,
1631
+ ['batch_jobs'],
1632
+ [
1633
+ _BatchJob_from_mldev(item, to_object)
1634
+ for item in getv(from_object, ['operations'])
1635
+ ],
1636
+ )
1637
+
1638
+ return to_object
1639
+
1640
+
1641
+ def _DeleteResourceJob_from_mldev(
1642
+ from_object: Union[dict[str, Any], object],
1643
+ parent_object: Optional[dict[str, Any]] = None,
1644
+ ) -> dict[str, Any]:
1645
+ to_object: dict[str, Any] = {}
1646
+ if getv(from_object, ['name']) is not None:
1647
+ setv(to_object, ['name'], getv(from_object, ['name']))
1648
+
1649
+ if getv(from_object, ['done']) is not None:
1650
+ setv(to_object, ['done'], getv(from_object, ['done']))
1651
+
1652
+ if getv(from_object, ['error']) is not None:
1653
+ setv(
1654
+ to_object,
1655
+ ['error'],
1656
+ _JobError_from_mldev(getv(from_object, ['error']), to_object),
1657
+ )
1658
+
1659
+ return to_object
1660
+
1661
+
1662
+ def _JobError_from_vertex(
1663
+ from_object: Union[dict[str, Any], object],
1664
+ parent_object: Optional[dict[str, Any]] = None,
1665
+ ) -> dict[str, Any]:
1666
+ to_object: dict[str, Any] = {}
1667
+ if getv(from_object, ['details']) is not None:
1668
+ setv(to_object, ['details'], getv(from_object, ['details']))
1669
+
1670
+ if getv(from_object, ['code']) is not None:
1671
+ setv(to_object, ['code'], getv(from_object, ['code']))
1672
+
1673
+ if getv(from_object, ['message']) is not None:
1674
+ setv(to_object, ['message'], getv(from_object, ['message']))
1675
+
1676
+ return to_object
1677
+
1678
+
1679
+ def _BatchJobSource_from_vertex(
4781
1680
  from_object: Union[dict[str, Any], object],
4782
1681
  parent_object: Optional[dict[str, Any]] = None,
4783
1682
  ) -> dict[str, Any]:
4784
1683
  to_object: dict[str, Any] = {}
1684
+ if getv(from_object, ['instancesFormat']) is not None:
1685
+ setv(to_object, ['format'], getv(from_object, ['instancesFormat']))
1686
+
1687
+ if getv(from_object, ['gcsSource', 'uris']) is not None:
1688
+ setv(to_object, ['gcs_uri'], getv(from_object, ['gcsSource', 'uris']))
1689
+
1690
+ if getv(from_object, ['bigquerySource', 'inputUri']) is not None:
1691
+ setv(
1692
+ to_object,
1693
+ ['bigquery_uri'],
1694
+ getv(from_object, ['bigquerySource', 'inputUri']),
1695
+ )
4785
1696
 
4786
1697
  return to_object
4787
1698