@google/genai 1.0.0 → 1.1.0

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.
@@ -230,6 +230,42 @@ var Language;
230
230
  */
231
231
  Language["PYTHON"] = "PYTHON";
232
232
  })(Language || (Language = {}));
233
+ /** Optional. The type of the data. */
234
+ var Type;
235
+ (function (Type) {
236
+ /**
237
+ * Not specified, should not be used.
238
+ */
239
+ Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
240
+ /**
241
+ * OpenAPI string type
242
+ */
243
+ Type["STRING"] = "STRING";
244
+ /**
245
+ * OpenAPI number type
246
+ */
247
+ Type["NUMBER"] = "NUMBER";
248
+ /**
249
+ * OpenAPI integer type
250
+ */
251
+ Type["INTEGER"] = "INTEGER";
252
+ /**
253
+ * OpenAPI boolean type
254
+ */
255
+ Type["BOOLEAN"] = "BOOLEAN";
256
+ /**
257
+ * OpenAPI array type
258
+ */
259
+ Type["ARRAY"] = "ARRAY";
260
+ /**
261
+ * OpenAPI object type
262
+ */
263
+ Type["OBJECT"] = "OBJECT";
264
+ /**
265
+ * Null type
266
+ */
267
+ Type["NULL"] = "NULL";
268
+ })(Type || (Type = {}));
233
269
  /** Required. Harm category. */
234
270
  var HarmCategory;
235
271
  (function (HarmCategory) {
@@ -254,7 +290,7 @@ var HarmCategory;
254
290
  */
255
291
  HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
256
292
  /**
257
- * The harm category is civic integrity.
293
+ * Deprecated: Election filter is not longer supported. The harm category is civic integrity.
258
294
  */
259
295
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
260
296
  })(HarmCategory || (HarmCategory = {}));
@@ -302,38 +338,6 @@ var HarmBlockThreshold;
302
338
  */
303
339
  HarmBlockThreshold["OFF"] = "OFF";
304
340
  })(HarmBlockThreshold || (HarmBlockThreshold = {}));
305
- /** Optional. The type of the data. */
306
- var Type;
307
- (function (Type) {
308
- /**
309
- * Not specified, should not be used.
310
- */
311
- Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
312
- /**
313
- * OpenAPI string type
314
- */
315
- Type["STRING"] = "STRING";
316
- /**
317
- * OpenAPI number type
318
- */
319
- Type["NUMBER"] = "NUMBER";
320
- /**
321
- * OpenAPI integer type
322
- */
323
- Type["INTEGER"] = "INTEGER";
324
- /**
325
- * OpenAPI boolean type
326
- */
327
- Type["BOOLEAN"] = "BOOLEAN";
328
- /**
329
- * OpenAPI array type
330
- */
331
- Type["ARRAY"] = "ARRAY";
332
- /**
333
- * OpenAPI object type
334
- */
335
- Type["OBJECT"] = "OBJECT";
336
- })(Type || (Type = {}));
337
341
  /** The mode of the predictor to be used in dynamic retrieval. */
338
342
  var Mode;
339
343
  (function (Mode) {
@@ -2473,6 +2477,21 @@ function blobToMldev$2(apiClient, fromObject) {
2473
2477
  }
2474
2478
  return toObject;
2475
2479
  }
2480
+ function fileDataToMldev$2(apiClient, fromObject) {
2481
+ const toObject = {};
2482
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
2483
+ throw new Error('displayName parameter is not supported in Gemini API.');
2484
+ }
2485
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
2486
+ if (fromFileUri != null) {
2487
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
2488
+ }
2489
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2490
+ if (fromMimeType != null) {
2491
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2492
+ }
2493
+ return toObject;
2494
+ }
2476
2495
  function partToMldev$2(apiClient, fromObject) {
2477
2496
  const toObject = {};
2478
2497
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -2489,6 +2508,10 @@ function partToMldev$2(apiClient, fromObject) {
2489
2508
  if (fromInlineData != null) {
2490
2509
  setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
2491
2510
  }
2511
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
2512
+ if (fromFileData != null) {
2513
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
2514
+ }
2492
2515
  const fromCodeExecutionResult = getValueByPath(fromObject, [
2493
2516
  'codeExecutionResult',
2494
2517
  ]);
@@ -2501,10 +2524,6 @@ function partToMldev$2(apiClient, fromObject) {
2501
2524
  if (fromExecutableCode != null) {
2502
2525
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
2503
2526
  }
2504
- const fromFileData = getValueByPath(fromObject, ['fileData']);
2505
- if (fromFileData != null) {
2506
- setValueByPath(toObject, ['fileData'], fromFileData);
2507
- }
2508
2527
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2509
2528
  if (fromFunctionCall != null) {
2510
2529
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -2690,6 +2709,10 @@ function retrievalConfigToMldev$1(apiClient, fromObject) {
2690
2709
  if (fromLatLng != null) {
2691
2710
  setValueByPath(toObject, ['latLng'], latLngToMldev$1(apiClient, fromLatLng));
2692
2711
  }
2712
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
2713
+ if (fromLanguageCode != null) {
2714
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
2715
+ }
2693
2716
  return toObject;
2694
2717
  }
2695
2718
  function toolConfigToMldev$1(apiClient, fromObject) {
@@ -2869,6 +2892,22 @@ function blobToVertex$2(apiClient, fromObject) {
2869
2892
  }
2870
2893
  return toObject;
2871
2894
  }
2895
+ function fileDataToVertex$2(apiClient, fromObject) {
2896
+ const toObject = {};
2897
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
2898
+ if (fromDisplayName != null) {
2899
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
2900
+ }
2901
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
2902
+ if (fromFileUri != null) {
2903
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
2904
+ }
2905
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2906
+ if (fromMimeType != null) {
2907
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2908
+ }
2909
+ return toObject;
2910
+ }
2872
2911
  function partToVertex$2(apiClient, fromObject) {
2873
2912
  const toObject = {};
2874
2913
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -2885,6 +2924,10 @@ function partToVertex$2(apiClient, fromObject) {
2885
2924
  if (fromInlineData != null) {
2886
2925
  setValueByPath(toObject, ['inlineData'], blobToVertex$2(apiClient, fromInlineData));
2887
2926
  }
2927
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
2928
+ if (fromFileData != null) {
2929
+ setValueByPath(toObject, ['fileData'], fileDataToVertex$2(apiClient, fromFileData));
2930
+ }
2888
2931
  const fromCodeExecutionResult = getValueByPath(fromObject, [
2889
2932
  'codeExecutionResult',
2890
2933
  ]);
@@ -2897,10 +2940,6 @@ function partToVertex$2(apiClient, fromObject) {
2897
2940
  if (fromExecutableCode != null) {
2898
2941
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
2899
2942
  }
2900
- const fromFileData = getValueByPath(fromObject, ['fileData']);
2901
- if (fromFileData != null) {
2902
- setValueByPath(toObject, ['fileData'], fromFileData);
2903
- }
2904
2943
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2905
2944
  if (fromFunctionCall != null) {
2906
2945
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -3137,6 +3176,10 @@ function retrievalConfigToVertex$1(apiClient, fromObject) {
3137
3176
  if (fromLatLng != null) {
3138
3177
  setValueByPath(toObject, ['latLng'], latLngToVertex$1(apiClient, fromLatLng));
3139
3178
  }
3179
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
3180
+ if (fromLanguageCode != null) {
3181
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
3182
+ }
3140
3183
  return toObject;
3141
3184
  }
3142
3185
  function toolConfigToVertex$1(apiClient, fromObject) {
@@ -4205,7 +4248,10 @@ class Chat {
4205
4248
  this.recordHistory(inputContent, modelOutput, automaticFunctionCallingHistory);
4206
4249
  return;
4207
4250
  })();
4208
- await this.sendPromise;
4251
+ await this.sendPromise.catch(() => {
4252
+ // Resets sendPromise to avoid subsequent calls failing
4253
+ this.sendPromise = Promise.resolve();
4254
+ });
4209
4255
  return responsePromise;
4210
4256
  }
4211
4257
  /**
@@ -5020,6 +5066,37 @@ function blobToVertex$1(apiClient, fromObject) {
5020
5066
  }
5021
5067
  return toObject;
5022
5068
  }
5069
+ function fileDataToMldev$1(apiClient, fromObject) {
5070
+ const toObject = {};
5071
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
5072
+ throw new Error('displayName parameter is not supported in Gemini API.');
5073
+ }
5074
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
5075
+ if (fromFileUri != null) {
5076
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
5077
+ }
5078
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5079
+ if (fromMimeType != null) {
5080
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
5081
+ }
5082
+ return toObject;
5083
+ }
5084
+ function fileDataToVertex$1(apiClient, fromObject) {
5085
+ const toObject = {};
5086
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5087
+ if (fromDisplayName != null) {
5088
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5089
+ }
5090
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
5091
+ if (fromFileUri != null) {
5092
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
5093
+ }
5094
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5095
+ if (fromMimeType != null) {
5096
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
5097
+ }
5098
+ return toObject;
5099
+ }
5023
5100
  function partToMldev$1(apiClient, fromObject) {
5024
5101
  const toObject = {};
5025
5102
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -5036,6 +5113,10 @@ function partToMldev$1(apiClient, fromObject) {
5036
5113
  if (fromInlineData != null) {
5037
5114
  setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
5038
5115
  }
5116
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5117
+ if (fromFileData != null) {
5118
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
5119
+ }
5039
5120
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5040
5121
  'codeExecutionResult',
5041
5122
  ]);
@@ -5048,10 +5129,6 @@ function partToMldev$1(apiClient, fromObject) {
5048
5129
  if (fromExecutableCode != null) {
5049
5130
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5050
5131
  }
5051
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5052
- if (fromFileData != null) {
5053
- setValueByPath(toObject, ['fileData'], fromFileData);
5054
- }
5055
5132
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5056
5133
  if (fromFunctionCall != null) {
5057
5134
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -5084,6 +5161,10 @@ function partToVertex$1(apiClient, fromObject) {
5084
5161
  if (fromInlineData != null) {
5085
5162
  setValueByPath(toObject, ['inlineData'], blobToVertex$1(apiClient, fromInlineData));
5086
5163
  }
5164
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5165
+ if (fromFileData != null) {
5166
+ setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
5167
+ }
5087
5168
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5088
5169
  'codeExecutionResult',
5089
5170
  ]);
@@ -5096,10 +5177,6 @@ function partToVertex$1(apiClient, fromObject) {
5096
5177
  if (fromExecutableCode != null) {
5097
5178
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5098
5179
  }
5099
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5100
- if (fromFileData != null) {
5101
- setValueByPath(toObject, ['fileData'], fromFileData);
5102
- }
5103
5180
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5104
5181
  if (fromFunctionCall != null) {
5105
5182
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -6173,6 +6250,34 @@ function blobFromVertex$1(apiClient, fromObject) {
6173
6250
  }
6174
6251
  return toObject;
6175
6252
  }
6253
+ function fileDataFromMldev$1(apiClient, fromObject) {
6254
+ const toObject = {};
6255
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
6256
+ if (fromFileUri != null) {
6257
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
6258
+ }
6259
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
6260
+ if (fromMimeType != null) {
6261
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
6262
+ }
6263
+ return toObject;
6264
+ }
6265
+ function fileDataFromVertex$1(apiClient, fromObject) {
6266
+ const toObject = {};
6267
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
6268
+ if (fromDisplayName != null) {
6269
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
6270
+ }
6271
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
6272
+ if (fromFileUri != null) {
6273
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
6274
+ }
6275
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
6276
+ if (fromMimeType != null) {
6277
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
6278
+ }
6279
+ return toObject;
6280
+ }
6176
6281
  function partFromMldev$1(apiClient, fromObject) {
6177
6282
  const toObject = {};
6178
6283
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -6189,6 +6294,10 @@ function partFromMldev$1(apiClient, fromObject) {
6189
6294
  if (fromInlineData != null) {
6190
6295
  setValueByPath(toObject, ['inlineData'], blobFromMldev$1(apiClient, fromInlineData));
6191
6296
  }
6297
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
6298
+ if (fromFileData != null) {
6299
+ setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
6300
+ }
6192
6301
  const fromCodeExecutionResult = getValueByPath(fromObject, [
6193
6302
  'codeExecutionResult',
6194
6303
  ]);
@@ -6201,10 +6310,6 @@ function partFromMldev$1(apiClient, fromObject) {
6201
6310
  if (fromExecutableCode != null) {
6202
6311
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
6203
6312
  }
6204
- const fromFileData = getValueByPath(fromObject, ['fileData']);
6205
- if (fromFileData != null) {
6206
- setValueByPath(toObject, ['fileData'], fromFileData);
6207
- }
6208
6313
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
6209
6314
  if (fromFunctionCall != null) {
6210
6315
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -6237,6 +6342,10 @@ function partFromVertex$1(apiClient, fromObject) {
6237
6342
  if (fromInlineData != null) {
6238
6343
  setValueByPath(toObject, ['inlineData'], blobFromVertex$1(apiClient, fromInlineData));
6239
6344
  }
6345
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
6346
+ if (fromFileData != null) {
6347
+ setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
6348
+ }
6240
6349
  const fromCodeExecutionResult = getValueByPath(fromObject, [
6241
6350
  'codeExecutionResult',
6242
6351
  ]);
@@ -6249,10 +6358,6 @@ function partFromVertex$1(apiClient, fromObject) {
6249
6358
  if (fromExecutableCode != null) {
6250
6359
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
6251
6360
  }
6252
- const fromFileData = getValueByPath(fromObject, ['fileData']);
6253
- if (fromFileData != null) {
6254
- setValueByPath(toObject, ['fileData'], fromFileData);
6255
- }
6256
6361
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
6257
6362
  if (fromFunctionCall != null) {
6258
6363
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7068,6 +7173,21 @@ function blobToMldev(apiClient, fromObject) {
7068
7173
  }
7069
7174
  return toObject;
7070
7175
  }
7176
+ function fileDataToMldev(apiClient, fromObject) {
7177
+ const toObject = {};
7178
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7179
+ throw new Error('displayName parameter is not supported in Gemini API.');
7180
+ }
7181
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
7182
+ if (fromFileUri != null) {
7183
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
7184
+ }
7185
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
7186
+ if (fromMimeType != null) {
7187
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
7188
+ }
7189
+ return toObject;
7190
+ }
7071
7191
  function partToMldev(apiClient, fromObject) {
7072
7192
  const toObject = {};
7073
7193
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -7084,6 +7204,10 @@ function partToMldev(apiClient, fromObject) {
7084
7204
  if (fromInlineData != null) {
7085
7205
  setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
7086
7206
  }
7207
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
7208
+ if (fromFileData != null) {
7209
+ setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
7210
+ }
7087
7211
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7088
7212
  'codeExecutionResult',
7089
7213
  ]);
@@ -7096,10 +7220,6 @@ function partToMldev(apiClient, fromObject) {
7096
7220
  if (fromExecutableCode != null) {
7097
7221
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7098
7222
  }
7099
- const fromFileData = getValueByPath(fromObject, ['fileData']);
7100
- if (fromFileData != null) {
7101
- setValueByPath(toObject, ['fileData'], fromFileData);
7102
- }
7103
7223
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7104
7224
  if (fromFunctionCall != null) {
7105
7225
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7134,6 +7254,104 @@ function contentToMldev(apiClient, fromObject) {
7134
7254
  }
7135
7255
  return toObject;
7136
7256
  }
7257
+ function schemaToMldev(apiClient, fromObject) {
7258
+ const toObject = {};
7259
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
7260
+ if (fromAnyOf != null) {
7261
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
7262
+ }
7263
+ const fromDefault = getValueByPath(fromObject, ['default']);
7264
+ if (fromDefault != null) {
7265
+ setValueByPath(toObject, ['default'], fromDefault);
7266
+ }
7267
+ const fromDescription = getValueByPath(fromObject, ['description']);
7268
+ if (fromDescription != null) {
7269
+ setValueByPath(toObject, ['description'], fromDescription);
7270
+ }
7271
+ const fromEnum = getValueByPath(fromObject, ['enum']);
7272
+ if (fromEnum != null) {
7273
+ setValueByPath(toObject, ['enum'], fromEnum);
7274
+ }
7275
+ const fromExample = getValueByPath(fromObject, ['example']);
7276
+ if (fromExample != null) {
7277
+ setValueByPath(toObject, ['example'], fromExample);
7278
+ }
7279
+ const fromFormat = getValueByPath(fromObject, ['format']);
7280
+ if (fromFormat != null) {
7281
+ setValueByPath(toObject, ['format'], fromFormat);
7282
+ }
7283
+ const fromItems = getValueByPath(fromObject, ['items']);
7284
+ if (fromItems != null) {
7285
+ setValueByPath(toObject, ['items'], fromItems);
7286
+ }
7287
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
7288
+ if (fromMaxItems != null) {
7289
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
7290
+ }
7291
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
7292
+ if (fromMaxLength != null) {
7293
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
7294
+ }
7295
+ const fromMaxProperties = getValueByPath(fromObject, [
7296
+ 'maxProperties',
7297
+ ]);
7298
+ if (fromMaxProperties != null) {
7299
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
7300
+ }
7301
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
7302
+ if (fromMaximum != null) {
7303
+ setValueByPath(toObject, ['maximum'], fromMaximum);
7304
+ }
7305
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
7306
+ if (fromMinItems != null) {
7307
+ setValueByPath(toObject, ['minItems'], fromMinItems);
7308
+ }
7309
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
7310
+ if (fromMinLength != null) {
7311
+ setValueByPath(toObject, ['minLength'], fromMinLength);
7312
+ }
7313
+ const fromMinProperties = getValueByPath(fromObject, [
7314
+ 'minProperties',
7315
+ ]);
7316
+ if (fromMinProperties != null) {
7317
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
7318
+ }
7319
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
7320
+ if (fromMinimum != null) {
7321
+ setValueByPath(toObject, ['minimum'], fromMinimum);
7322
+ }
7323
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
7324
+ if (fromNullable != null) {
7325
+ setValueByPath(toObject, ['nullable'], fromNullable);
7326
+ }
7327
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
7328
+ if (fromPattern != null) {
7329
+ setValueByPath(toObject, ['pattern'], fromPattern);
7330
+ }
7331
+ const fromProperties = getValueByPath(fromObject, ['properties']);
7332
+ if (fromProperties != null) {
7333
+ setValueByPath(toObject, ['properties'], fromProperties);
7334
+ }
7335
+ const fromPropertyOrdering = getValueByPath(fromObject, [
7336
+ 'propertyOrdering',
7337
+ ]);
7338
+ if (fromPropertyOrdering != null) {
7339
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
7340
+ }
7341
+ const fromRequired = getValueByPath(fromObject, ['required']);
7342
+ if (fromRequired != null) {
7343
+ setValueByPath(toObject, ['required'], fromRequired);
7344
+ }
7345
+ const fromTitle = getValueByPath(fromObject, ['title']);
7346
+ if (fromTitle != null) {
7347
+ setValueByPath(toObject, ['title'], fromTitle);
7348
+ }
7349
+ const fromType = getValueByPath(fromObject, ['type']);
7350
+ if (fromType != null) {
7351
+ setValueByPath(toObject, ['type'], fromType);
7352
+ }
7353
+ return toObject;
7354
+ }
7137
7355
  function safetySettingToMldev(apiClient, fromObject) {
7138
7356
  const toObject = {};
7139
7357
  if (getValueByPath(fromObject, ['method']) !== undefined) {
@@ -7300,6 +7518,10 @@ function retrievalConfigToMldev(apiClient, fromObject) {
7300
7518
  if (fromLatLng != null) {
7301
7519
  setValueByPath(toObject, ['latLng'], latLngToMldev(apiClient, fromLatLng));
7302
7520
  }
7521
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7522
+ if (fromLanguageCode != null) {
7523
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7524
+ }
7303
7525
  return toObject;
7304
7526
  }
7305
7527
  function toolConfigToMldev(apiClient, fromObject) {
@@ -7472,7 +7694,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
7472
7694
  'responseSchema',
7473
7695
  ]);
7474
7696
  if (fromResponseSchema != null) {
7475
- setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
7697
+ setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
7476
7698
  }
7477
7699
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
7478
7700
  throw new Error('routingConfig parameter is not supported in Gemini API.');
@@ -7933,6 +8155,22 @@ function blobToVertex(apiClient, fromObject) {
7933
8155
  }
7934
8156
  return toObject;
7935
8157
  }
8158
+ function fileDataToVertex(apiClient, fromObject) {
8159
+ const toObject = {};
8160
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
8161
+ if (fromDisplayName != null) {
8162
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
8163
+ }
8164
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
8165
+ if (fromFileUri != null) {
8166
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
8167
+ }
8168
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
8169
+ if (fromMimeType != null) {
8170
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
8171
+ }
8172
+ return toObject;
8173
+ }
7936
8174
  function partToVertex(apiClient, fromObject) {
7937
8175
  const toObject = {};
7938
8176
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -7949,6 +8187,10 @@ function partToVertex(apiClient, fromObject) {
7949
8187
  if (fromInlineData != null) {
7950
8188
  setValueByPath(toObject, ['inlineData'], blobToVertex(apiClient, fromInlineData));
7951
8189
  }
8190
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
8191
+ if (fromFileData != null) {
8192
+ setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
8193
+ }
7952
8194
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7953
8195
  'codeExecutionResult',
7954
8196
  ]);
@@ -7961,10 +8203,6 @@ function partToVertex(apiClient, fromObject) {
7961
8203
  if (fromExecutableCode != null) {
7962
8204
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7963
8205
  }
7964
- const fromFileData = getValueByPath(fromObject, ['fileData']);
7965
- if (fromFileData != null) {
7966
- setValueByPath(toObject, ['fileData'], fromFileData);
7967
- }
7968
8206
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7969
8207
  if (fromFunctionCall != null) {
7970
8208
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7999,6 +8237,104 @@ function contentToVertex(apiClient, fromObject) {
7999
8237
  }
8000
8238
  return toObject;
8001
8239
  }
8240
+ function schemaToVertex(apiClient, fromObject) {
8241
+ const toObject = {};
8242
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
8243
+ if (fromAnyOf != null) {
8244
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
8245
+ }
8246
+ const fromDefault = getValueByPath(fromObject, ['default']);
8247
+ if (fromDefault != null) {
8248
+ setValueByPath(toObject, ['default'], fromDefault);
8249
+ }
8250
+ const fromDescription = getValueByPath(fromObject, ['description']);
8251
+ if (fromDescription != null) {
8252
+ setValueByPath(toObject, ['description'], fromDescription);
8253
+ }
8254
+ const fromEnum = getValueByPath(fromObject, ['enum']);
8255
+ if (fromEnum != null) {
8256
+ setValueByPath(toObject, ['enum'], fromEnum);
8257
+ }
8258
+ const fromExample = getValueByPath(fromObject, ['example']);
8259
+ if (fromExample != null) {
8260
+ setValueByPath(toObject, ['example'], fromExample);
8261
+ }
8262
+ const fromFormat = getValueByPath(fromObject, ['format']);
8263
+ if (fromFormat != null) {
8264
+ setValueByPath(toObject, ['format'], fromFormat);
8265
+ }
8266
+ const fromItems = getValueByPath(fromObject, ['items']);
8267
+ if (fromItems != null) {
8268
+ setValueByPath(toObject, ['items'], fromItems);
8269
+ }
8270
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
8271
+ if (fromMaxItems != null) {
8272
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
8273
+ }
8274
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
8275
+ if (fromMaxLength != null) {
8276
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
8277
+ }
8278
+ const fromMaxProperties = getValueByPath(fromObject, [
8279
+ 'maxProperties',
8280
+ ]);
8281
+ if (fromMaxProperties != null) {
8282
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
8283
+ }
8284
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
8285
+ if (fromMaximum != null) {
8286
+ setValueByPath(toObject, ['maximum'], fromMaximum);
8287
+ }
8288
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
8289
+ if (fromMinItems != null) {
8290
+ setValueByPath(toObject, ['minItems'], fromMinItems);
8291
+ }
8292
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
8293
+ if (fromMinLength != null) {
8294
+ setValueByPath(toObject, ['minLength'], fromMinLength);
8295
+ }
8296
+ const fromMinProperties = getValueByPath(fromObject, [
8297
+ 'minProperties',
8298
+ ]);
8299
+ if (fromMinProperties != null) {
8300
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
8301
+ }
8302
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
8303
+ if (fromMinimum != null) {
8304
+ setValueByPath(toObject, ['minimum'], fromMinimum);
8305
+ }
8306
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
8307
+ if (fromNullable != null) {
8308
+ setValueByPath(toObject, ['nullable'], fromNullable);
8309
+ }
8310
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
8311
+ if (fromPattern != null) {
8312
+ setValueByPath(toObject, ['pattern'], fromPattern);
8313
+ }
8314
+ const fromProperties = getValueByPath(fromObject, ['properties']);
8315
+ if (fromProperties != null) {
8316
+ setValueByPath(toObject, ['properties'], fromProperties);
8317
+ }
8318
+ const fromPropertyOrdering = getValueByPath(fromObject, [
8319
+ 'propertyOrdering',
8320
+ ]);
8321
+ if (fromPropertyOrdering != null) {
8322
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
8323
+ }
8324
+ const fromRequired = getValueByPath(fromObject, ['required']);
8325
+ if (fromRequired != null) {
8326
+ setValueByPath(toObject, ['required'], fromRequired);
8327
+ }
8328
+ const fromTitle = getValueByPath(fromObject, ['title']);
8329
+ if (fromTitle != null) {
8330
+ setValueByPath(toObject, ['title'], fromTitle);
8331
+ }
8332
+ const fromType = getValueByPath(fromObject, ['type']);
8333
+ if (fromType != null) {
8334
+ setValueByPath(toObject, ['type'], fromType);
8335
+ }
8336
+ return toObject;
8337
+ }
8002
8338
  function modelSelectionConfigToVertex(apiClient, fromObject) {
8003
8339
  const toObject = {};
8004
8340
  const fromFeatureSelectionPreference = getValueByPath(fromObject, [
@@ -8227,6 +8563,10 @@ function retrievalConfigToVertex(apiClient, fromObject) {
8227
8563
  if (fromLatLng != null) {
8228
8564
  setValueByPath(toObject, ['latLng'], latLngToVertex(apiClient, fromLatLng));
8229
8565
  }
8566
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
8567
+ if (fromLanguageCode != null) {
8568
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
8569
+ }
8230
8570
  return toObject;
8231
8571
  }
8232
8572
  function toolConfigToVertex(apiClient, fromObject) {
@@ -8368,7 +8708,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8368
8708
  'responseSchema',
8369
8709
  ]);
8370
8710
  if (fromResponseSchema != null) {
8371
- setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
8711
+ setValueByPath(toObject, ['responseSchema'], schemaToVertex(apiClient, tSchema(apiClient, fromResponseSchema)));
8372
8712
  }
8373
8713
  const fromRoutingConfig = getValueByPath(fromObject, [
8374
8714
  'routingConfig',
@@ -9150,6 +9490,18 @@ function blobFromMldev(apiClient, fromObject) {
9150
9490
  }
9151
9491
  return toObject;
9152
9492
  }
9493
+ function fileDataFromMldev(apiClient, fromObject) {
9494
+ const toObject = {};
9495
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
9496
+ if (fromFileUri != null) {
9497
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
9498
+ }
9499
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
9500
+ if (fromMimeType != null) {
9501
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
9502
+ }
9503
+ return toObject;
9504
+ }
9153
9505
  function partFromMldev(apiClient, fromObject) {
9154
9506
  const toObject = {};
9155
9507
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -9166,6 +9518,10 @@ function partFromMldev(apiClient, fromObject) {
9166
9518
  if (fromInlineData != null) {
9167
9519
  setValueByPath(toObject, ['inlineData'], blobFromMldev(apiClient, fromInlineData));
9168
9520
  }
9521
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
9522
+ if (fromFileData != null) {
9523
+ setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
9524
+ }
9169
9525
  const fromCodeExecutionResult = getValueByPath(fromObject, [
9170
9526
  'codeExecutionResult',
9171
9527
  ]);
@@ -9178,10 +9534,6 @@ function partFromMldev(apiClient, fromObject) {
9178
9534
  if (fromExecutableCode != null) {
9179
9535
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9180
9536
  }
9181
- const fromFileData = getValueByPath(fromObject, ['fileData']);
9182
- if (fromFileData != null) {
9183
- setValueByPath(toObject, ['fileData'], fromFileData);
9184
- }
9185
9537
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9186
9538
  if (fromFunctionCall != null) {
9187
9539
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -9652,6 +10004,22 @@ function blobFromVertex(apiClient, fromObject) {
9652
10004
  }
9653
10005
  return toObject;
9654
10006
  }
10007
+ function fileDataFromVertex(apiClient, fromObject) {
10008
+ const toObject = {};
10009
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
10010
+ if (fromDisplayName != null) {
10011
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
10012
+ }
10013
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
10014
+ if (fromFileUri != null) {
10015
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
10016
+ }
10017
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
10018
+ if (fromMimeType != null) {
10019
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
10020
+ }
10021
+ return toObject;
10022
+ }
9655
10023
  function partFromVertex(apiClient, fromObject) {
9656
10024
  const toObject = {};
9657
10025
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -9668,6 +10036,10 @@ function partFromVertex(apiClient, fromObject) {
9668
10036
  if (fromInlineData != null) {
9669
10037
  setValueByPath(toObject, ['inlineData'], blobFromVertex(apiClient, fromInlineData));
9670
10038
  }
10039
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
10040
+ if (fromFileData != null) {
10041
+ setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
10042
+ }
9671
10043
  const fromCodeExecutionResult = getValueByPath(fromObject, [
9672
10044
  'codeExecutionResult',
9673
10045
  ]);
@@ -9680,10 +10052,6 @@ function partFromVertex(apiClient, fromObject) {
9680
10052
  if (fromExecutableCode != null) {
9681
10053
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9682
10054
  }
9683
- const fromFileData = getValueByPath(fromObject, ['fileData']);
9684
- if (fromFileData != null) {
9685
- setValueByPath(toObject, ['fileData'], fromFileData);
9686
- }
9687
10055
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9688
10056
  if (fromFunctionCall != null) {
9689
10057
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -10214,7 +10582,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10214
10582
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10215
10583
  const USER_AGENT_HEADER = 'User-Agent';
10216
10584
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10217
- const SDK_VERSION = '1.0.0'; // x-release-please-version
10585
+ const SDK_VERSION = '1.1.0'; // x-release-please-version
10218
10586
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10219
10587
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10220
10588
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -13700,6 +14068,12 @@ function tuningJobFromMldev(apiClient, fromObject) {
13700
14068
  if (fromPipelineJob != null) {
13701
14069
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
13702
14070
  }
14071
+ const fromServiceAccount = getValueByPath(fromObject, [
14072
+ 'serviceAccount',
14073
+ ]);
14074
+ if (fromServiceAccount != null) {
14075
+ setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
14076
+ }
13703
14077
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
13704
14078
  'tunedModelDisplayName',
13705
14079
  ]);
@@ -13874,6 +14248,12 @@ function tuningJobFromVertex(apiClient, fromObject) {
13874
14248
  if (fromPipelineJob != null) {
13875
14249
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
13876
14250
  }
14251
+ const fromServiceAccount = getValueByPath(fromObject, [
14252
+ 'serviceAccount',
14253
+ ]);
14254
+ if (fromServiceAccount != null) {
14255
+ setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
14256
+ }
13877
14257
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
13878
14258
  'tunedModelDisplayName',
13879
14259
  ]);