@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.
@@ -225,6 +225,42 @@ var Language;
225
225
  */
226
226
  Language["PYTHON"] = "PYTHON";
227
227
  })(Language || (Language = {}));
228
+ /** Optional. The type of the data. */
229
+ var Type;
230
+ (function (Type) {
231
+ /**
232
+ * Not specified, should not be used.
233
+ */
234
+ Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
235
+ /**
236
+ * OpenAPI string type
237
+ */
238
+ Type["STRING"] = "STRING";
239
+ /**
240
+ * OpenAPI number type
241
+ */
242
+ Type["NUMBER"] = "NUMBER";
243
+ /**
244
+ * OpenAPI integer type
245
+ */
246
+ Type["INTEGER"] = "INTEGER";
247
+ /**
248
+ * OpenAPI boolean type
249
+ */
250
+ Type["BOOLEAN"] = "BOOLEAN";
251
+ /**
252
+ * OpenAPI array type
253
+ */
254
+ Type["ARRAY"] = "ARRAY";
255
+ /**
256
+ * OpenAPI object type
257
+ */
258
+ Type["OBJECT"] = "OBJECT";
259
+ /**
260
+ * Null type
261
+ */
262
+ Type["NULL"] = "NULL";
263
+ })(Type || (Type = {}));
228
264
  /** Required. Harm category. */
229
265
  var HarmCategory;
230
266
  (function (HarmCategory) {
@@ -249,7 +285,7 @@ var HarmCategory;
249
285
  */
250
286
  HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
251
287
  /**
252
- * The harm category is civic integrity.
288
+ * Deprecated: Election filter is not longer supported. The harm category is civic integrity.
253
289
  */
254
290
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
255
291
  })(HarmCategory || (HarmCategory = {}));
@@ -297,38 +333,6 @@ var HarmBlockThreshold;
297
333
  */
298
334
  HarmBlockThreshold["OFF"] = "OFF";
299
335
  })(HarmBlockThreshold || (HarmBlockThreshold = {}));
300
- /** Optional. The type of the data. */
301
- var Type;
302
- (function (Type) {
303
- /**
304
- * Not specified, should not be used.
305
- */
306
- Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
307
- /**
308
- * OpenAPI string type
309
- */
310
- Type["STRING"] = "STRING";
311
- /**
312
- * OpenAPI number type
313
- */
314
- Type["NUMBER"] = "NUMBER";
315
- /**
316
- * OpenAPI integer type
317
- */
318
- Type["INTEGER"] = "INTEGER";
319
- /**
320
- * OpenAPI boolean type
321
- */
322
- Type["BOOLEAN"] = "BOOLEAN";
323
- /**
324
- * OpenAPI array type
325
- */
326
- Type["ARRAY"] = "ARRAY";
327
- /**
328
- * OpenAPI object type
329
- */
330
- Type["OBJECT"] = "OBJECT";
331
- })(Type || (Type = {}));
332
336
  /** The mode of the predictor to be used in dynamic retrieval. */
333
337
  var Mode;
334
338
  (function (Mode) {
@@ -2468,6 +2472,21 @@ function blobToMldev$2(apiClient, fromObject) {
2468
2472
  }
2469
2473
  return toObject;
2470
2474
  }
2475
+ function fileDataToMldev$2(apiClient, fromObject) {
2476
+ const toObject = {};
2477
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
2478
+ throw new Error('displayName parameter is not supported in Gemini API.');
2479
+ }
2480
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
2481
+ if (fromFileUri != null) {
2482
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
2483
+ }
2484
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2485
+ if (fromMimeType != null) {
2486
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2487
+ }
2488
+ return toObject;
2489
+ }
2471
2490
  function partToMldev$2(apiClient, fromObject) {
2472
2491
  const toObject = {};
2473
2492
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -2484,6 +2503,10 @@ function partToMldev$2(apiClient, fromObject) {
2484
2503
  if (fromInlineData != null) {
2485
2504
  setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
2486
2505
  }
2506
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
2507
+ if (fromFileData != null) {
2508
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
2509
+ }
2487
2510
  const fromCodeExecutionResult = getValueByPath(fromObject, [
2488
2511
  'codeExecutionResult',
2489
2512
  ]);
@@ -2496,10 +2519,6 @@ function partToMldev$2(apiClient, fromObject) {
2496
2519
  if (fromExecutableCode != null) {
2497
2520
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
2498
2521
  }
2499
- const fromFileData = getValueByPath(fromObject, ['fileData']);
2500
- if (fromFileData != null) {
2501
- setValueByPath(toObject, ['fileData'], fromFileData);
2502
- }
2503
2522
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2504
2523
  if (fromFunctionCall != null) {
2505
2524
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -2685,6 +2704,10 @@ function retrievalConfigToMldev$1(apiClient, fromObject) {
2685
2704
  if (fromLatLng != null) {
2686
2705
  setValueByPath(toObject, ['latLng'], latLngToMldev$1(apiClient, fromLatLng));
2687
2706
  }
2707
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
2708
+ if (fromLanguageCode != null) {
2709
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
2710
+ }
2688
2711
  return toObject;
2689
2712
  }
2690
2713
  function toolConfigToMldev$1(apiClient, fromObject) {
@@ -2864,6 +2887,22 @@ function blobToVertex$2(apiClient, fromObject) {
2864
2887
  }
2865
2888
  return toObject;
2866
2889
  }
2890
+ function fileDataToVertex$2(apiClient, fromObject) {
2891
+ const toObject = {};
2892
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
2893
+ if (fromDisplayName != null) {
2894
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
2895
+ }
2896
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
2897
+ if (fromFileUri != null) {
2898
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
2899
+ }
2900
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2901
+ if (fromMimeType != null) {
2902
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2903
+ }
2904
+ return toObject;
2905
+ }
2867
2906
  function partToVertex$2(apiClient, fromObject) {
2868
2907
  const toObject = {};
2869
2908
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -2880,6 +2919,10 @@ function partToVertex$2(apiClient, fromObject) {
2880
2919
  if (fromInlineData != null) {
2881
2920
  setValueByPath(toObject, ['inlineData'], blobToVertex$2(apiClient, fromInlineData));
2882
2921
  }
2922
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
2923
+ if (fromFileData != null) {
2924
+ setValueByPath(toObject, ['fileData'], fileDataToVertex$2(apiClient, fromFileData));
2925
+ }
2883
2926
  const fromCodeExecutionResult = getValueByPath(fromObject, [
2884
2927
  'codeExecutionResult',
2885
2928
  ]);
@@ -2892,10 +2935,6 @@ function partToVertex$2(apiClient, fromObject) {
2892
2935
  if (fromExecutableCode != null) {
2893
2936
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
2894
2937
  }
2895
- const fromFileData = getValueByPath(fromObject, ['fileData']);
2896
- if (fromFileData != null) {
2897
- setValueByPath(toObject, ['fileData'], fromFileData);
2898
- }
2899
2938
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2900
2939
  if (fromFunctionCall != null) {
2901
2940
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -3132,6 +3171,10 @@ function retrievalConfigToVertex$1(apiClient, fromObject) {
3132
3171
  if (fromLatLng != null) {
3133
3172
  setValueByPath(toObject, ['latLng'], latLngToVertex$1(apiClient, fromLatLng));
3134
3173
  }
3174
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
3175
+ if (fromLanguageCode != null) {
3176
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
3177
+ }
3135
3178
  return toObject;
3136
3179
  }
3137
3180
  function toolConfigToVertex$1(apiClient, fromObject) {
@@ -4200,7 +4243,10 @@ class Chat {
4200
4243
  this.recordHistory(inputContent, modelOutput, automaticFunctionCallingHistory);
4201
4244
  return;
4202
4245
  })();
4203
- await this.sendPromise;
4246
+ await this.sendPromise.catch(() => {
4247
+ // Resets sendPromise to avoid subsequent calls failing
4248
+ this.sendPromise = Promise.resolve();
4249
+ });
4204
4250
  return responsePromise;
4205
4251
  }
4206
4252
  /**
@@ -5015,6 +5061,37 @@ function blobToVertex$1(apiClient, fromObject) {
5015
5061
  }
5016
5062
  return toObject;
5017
5063
  }
5064
+ function fileDataToMldev$1(apiClient, fromObject) {
5065
+ const toObject = {};
5066
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
5067
+ throw new Error('displayName parameter is not supported in Gemini API.');
5068
+ }
5069
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
5070
+ if (fromFileUri != null) {
5071
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
5072
+ }
5073
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5074
+ if (fromMimeType != null) {
5075
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
5076
+ }
5077
+ return toObject;
5078
+ }
5079
+ function fileDataToVertex$1(apiClient, fromObject) {
5080
+ const toObject = {};
5081
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5082
+ if (fromDisplayName != null) {
5083
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5084
+ }
5085
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
5086
+ if (fromFileUri != null) {
5087
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
5088
+ }
5089
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5090
+ if (fromMimeType != null) {
5091
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
5092
+ }
5093
+ return toObject;
5094
+ }
5018
5095
  function partToMldev$1(apiClient, fromObject) {
5019
5096
  const toObject = {};
5020
5097
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -5031,6 +5108,10 @@ function partToMldev$1(apiClient, fromObject) {
5031
5108
  if (fromInlineData != null) {
5032
5109
  setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
5033
5110
  }
5111
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5112
+ if (fromFileData != null) {
5113
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
5114
+ }
5034
5115
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5035
5116
  'codeExecutionResult',
5036
5117
  ]);
@@ -5043,10 +5124,6 @@ function partToMldev$1(apiClient, fromObject) {
5043
5124
  if (fromExecutableCode != null) {
5044
5125
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5045
5126
  }
5046
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5047
- if (fromFileData != null) {
5048
- setValueByPath(toObject, ['fileData'], fromFileData);
5049
- }
5050
5127
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5051
5128
  if (fromFunctionCall != null) {
5052
5129
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -5079,6 +5156,10 @@ function partToVertex$1(apiClient, fromObject) {
5079
5156
  if (fromInlineData != null) {
5080
5157
  setValueByPath(toObject, ['inlineData'], blobToVertex$1(apiClient, fromInlineData));
5081
5158
  }
5159
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5160
+ if (fromFileData != null) {
5161
+ setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
5162
+ }
5082
5163
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5083
5164
  'codeExecutionResult',
5084
5165
  ]);
@@ -5091,10 +5172,6 @@ function partToVertex$1(apiClient, fromObject) {
5091
5172
  if (fromExecutableCode != null) {
5092
5173
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5093
5174
  }
5094
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5095
- if (fromFileData != null) {
5096
- setValueByPath(toObject, ['fileData'], fromFileData);
5097
- }
5098
5175
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5099
5176
  if (fromFunctionCall != null) {
5100
5177
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -6168,6 +6245,34 @@ function blobFromVertex$1(apiClient, fromObject) {
6168
6245
  }
6169
6246
  return toObject;
6170
6247
  }
6248
+ function fileDataFromMldev$1(apiClient, fromObject) {
6249
+ const toObject = {};
6250
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
6251
+ if (fromFileUri != null) {
6252
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
6253
+ }
6254
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
6255
+ if (fromMimeType != null) {
6256
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
6257
+ }
6258
+ return toObject;
6259
+ }
6260
+ function fileDataFromVertex$1(apiClient, fromObject) {
6261
+ const toObject = {};
6262
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
6263
+ if (fromDisplayName != null) {
6264
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
6265
+ }
6266
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
6267
+ if (fromFileUri != null) {
6268
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
6269
+ }
6270
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
6271
+ if (fromMimeType != null) {
6272
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
6273
+ }
6274
+ return toObject;
6275
+ }
6171
6276
  function partFromMldev$1(apiClient, fromObject) {
6172
6277
  const toObject = {};
6173
6278
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -6184,6 +6289,10 @@ function partFromMldev$1(apiClient, fromObject) {
6184
6289
  if (fromInlineData != null) {
6185
6290
  setValueByPath(toObject, ['inlineData'], blobFromMldev$1(apiClient, fromInlineData));
6186
6291
  }
6292
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
6293
+ if (fromFileData != null) {
6294
+ setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
6295
+ }
6187
6296
  const fromCodeExecutionResult = getValueByPath(fromObject, [
6188
6297
  'codeExecutionResult',
6189
6298
  ]);
@@ -6196,10 +6305,6 @@ function partFromMldev$1(apiClient, fromObject) {
6196
6305
  if (fromExecutableCode != null) {
6197
6306
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
6198
6307
  }
6199
- const fromFileData = getValueByPath(fromObject, ['fileData']);
6200
- if (fromFileData != null) {
6201
- setValueByPath(toObject, ['fileData'], fromFileData);
6202
- }
6203
6308
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
6204
6309
  if (fromFunctionCall != null) {
6205
6310
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -6232,6 +6337,10 @@ function partFromVertex$1(apiClient, fromObject) {
6232
6337
  if (fromInlineData != null) {
6233
6338
  setValueByPath(toObject, ['inlineData'], blobFromVertex$1(apiClient, fromInlineData));
6234
6339
  }
6340
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
6341
+ if (fromFileData != null) {
6342
+ setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
6343
+ }
6235
6344
  const fromCodeExecutionResult = getValueByPath(fromObject, [
6236
6345
  'codeExecutionResult',
6237
6346
  ]);
@@ -6244,10 +6353,6 @@ function partFromVertex$1(apiClient, fromObject) {
6244
6353
  if (fromExecutableCode != null) {
6245
6354
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
6246
6355
  }
6247
- const fromFileData = getValueByPath(fromObject, ['fileData']);
6248
- if (fromFileData != null) {
6249
- setValueByPath(toObject, ['fileData'], fromFileData);
6250
- }
6251
6356
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
6252
6357
  if (fromFunctionCall != null) {
6253
6358
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7063,6 +7168,21 @@ function blobToMldev(apiClient, fromObject) {
7063
7168
  }
7064
7169
  return toObject;
7065
7170
  }
7171
+ function fileDataToMldev(apiClient, fromObject) {
7172
+ const toObject = {};
7173
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7174
+ throw new Error('displayName parameter is not supported in Gemini API.');
7175
+ }
7176
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
7177
+ if (fromFileUri != null) {
7178
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
7179
+ }
7180
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
7181
+ if (fromMimeType != null) {
7182
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
7183
+ }
7184
+ return toObject;
7185
+ }
7066
7186
  function partToMldev(apiClient, fromObject) {
7067
7187
  const toObject = {};
7068
7188
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -7079,6 +7199,10 @@ function partToMldev(apiClient, fromObject) {
7079
7199
  if (fromInlineData != null) {
7080
7200
  setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
7081
7201
  }
7202
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
7203
+ if (fromFileData != null) {
7204
+ setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
7205
+ }
7082
7206
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7083
7207
  'codeExecutionResult',
7084
7208
  ]);
@@ -7091,10 +7215,6 @@ function partToMldev(apiClient, fromObject) {
7091
7215
  if (fromExecutableCode != null) {
7092
7216
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7093
7217
  }
7094
- const fromFileData = getValueByPath(fromObject, ['fileData']);
7095
- if (fromFileData != null) {
7096
- setValueByPath(toObject, ['fileData'], fromFileData);
7097
- }
7098
7218
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7099
7219
  if (fromFunctionCall != null) {
7100
7220
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7129,6 +7249,104 @@ function contentToMldev(apiClient, fromObject) {
7129
7249
  }
7130
7250
  return toObject;
7131
7251
  }
7252
+ function schemaToMldev(apiClient, fromObject) {
7253
+ const toObject = {};
7254
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
7255
+ if (fromAnyOf != null) {
7256
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
7257
+ }
7258
+ const fromDefault = getValueByPath(fromObject, ['default']);
7259
+ if (fromDefault != null) {
7260
+ setValueByPath(toObject, ['default'], fromDefault);
7261
+ }
7262
+ const fromDescription = getValueByPath(fromObject, ['description']);
7263
+ if (fromDescription != null) {
7264
+ setValueByPath(toObject, ['description'], fromDescription);
7265
+ }
7266
+ const fromEnum = getValueByPath(fromObject, ['enum']);
7267
+ if (fromEnum != null) {
7268
+ setValueByPath(toObject, ['enum'], fromEnum);
7269
+ }
7270
+ const fromExample = getValueByPath(fromObject, ['example']);
7271
+ if (fromExample != null) {
7272
+ setValueByPath(toObject, ['example'], fromExample);
7273
+ }
7274
+ const fromFormat = getValueByPath(fromObject, ['format']);
7275
+ if (fromFormat != null) {
7276
+ setValueByPath(toObject, ['format'], fromFormat);
7277
+ }
7278
+ const fromItems = getValueByPath(fromObject, ['items']);
7279
+ if (fromItems != null) {
7280
+ setValueByPath(toObject, ['items'], fromItems);
7281
+ }
7282
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
7283
+ if (fromMaxItems != null) {
7284
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
7285
+ }
7286
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
7287
+ if (fromMaxLength != null) {
7288
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
7289
+ }
7290
+ const fromMaxProperties = getValueByPath(fromObject, [
7291
+ 'maxProperties',
7292
+ ]);
7293
+ if (fromMaxProperties != null) {
7294
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
7295
+ }
7296
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
7297
+ if (fromMaximum != null) {
7298
+ setValueByPath(toObject, ['maximum'], fromMaximum);
7299
+ }
7300
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
7301
+ if (fromMinItems != null) {
7302
+ setValueByPath(toObject, ['minItems'], fromMinItems);
7303
+ }
7304
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
7305
+ if (fromMinLength != null) {
7306
+ setValueByPath(toObject, ['minLength'], fromMinLength);
7307
+ }
7308
+ const fromMinProperties = getValueByPath(fromObject, [
7309
+ 'minProperties',
7310
+ ]);
7311
+ if (fromMinProperties != null) {
7312
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
7313
+ }
7314
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
7315
+ if (fromMinimum != null) {
7316
+ setValueByPath(toObject, ['minimum'], fromMinimum);
7317
+ }
7318
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
7319
+ if (fromNullable != null) {
7320
+ setValueByPath(toObject, ['nullable'], fromNullable);
7321
+ }
7322
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
7323
+ if (fromPattern != null) {
7324
+ setValueByPath(toObject, ['pattern'], fromPattern);
7325
+ }
7326
+ const fromProperties = getValueByPath(fromObject, ['properties']);
7327
+ if (fromProperties != null) {
7328
+ setValueByPath(toObject, ['properties'], fromProperties);
7329
+ }
7330
+ const fromPropertyOrdering = getValueByPath(fromObject, [
7331
+ 'propertyOrdering',
7332
+ ]);
7333
+ if (fromPropertyOrdering != null) {
7334
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
7335
+ }
7336
+ const fromRequired = getValueByPath(fromObject, ['required']);
7337
+ if (fromRequired != null) {
7338
+ setValueByPath(toObject, ['required'], fromRequired);
7339
+ }
7340
+ const fromTitle = getValueByPath(fromObject, ['title']);
7341
+ if (fromTitle != null) {
7342
+ setValueByPath(toObject, ['title'], fromTitle);
7343
+ }
7344
+ const fromType = getValueByPath(fromObject, ['type']);
7345
+ if (fromType != null) {
7346
+ setValueByPath(toObject, ['type'], fromType);
7347
+ }
7348
+ return toObject;
7349
+ }
7132
7350
  function safetySettingToMldev(apiClient, fromObject) {
7133
7351
  const toObject = {};
7134
7352
  if (getValueByPath(fromObject, ['method']) !== undefined) {
@@ -7295,6 +7513,10 @@ function retrievalConfigToMldev(apiClient, fromObject) {
7295
7513
  if (fromLatLng != null) {
7296
7514
  setValueByPath(toObject, ['latLng'], latLngToMldev(apiClient, fromLatLng));
7297
7515
  }
7516
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7517
+ if (fromLanguageCode != null) {
7518
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7519
+ }
7298
7520
  return toObject;
7299
7521
  }
7300
7522
  function toolConfigToMldev(apiClient, fromObject) {
@@ -7467,7 +7689,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
7467
7689
  'responseSchema',
7468
7690
  ]);
7469
7691
  if (fromResponseSchema != null) {
7470
- setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
7692
+ setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
7471
7693
  }
7472
7694
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
7473
7695
  throw new Error('routingConfig parameter is not supported in Gemini API.');
@@ -7928,6 +8150,22 @@ function blobToVertex(apiClient, fromObject) {
7928
8150
  }
7929
8151
  return toObject;
7930
8152
  }
8153
+ function fileDataToVertex(apiClient, fromObject) {
8154
+ const toObject = {};
8155
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
8156
+ if (fromDisplayName != null) {
8157
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
8158
+ }
8159
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
8160
+ if (fromFileUri != null) {
8161
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
8162
+ }
8163
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
8164
+ if (fromMimeType != null) {
8165
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
8166
+ }
8167
+ return toObject;
8168
+ }
7931
8169
  function partToVertex(apiClient, fromObject) {
7932
8170
  const toObject = {};
7933
8171
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -7944,6 +8182,10 @@ function partToVertex(apiClient, fromObject) {
7944
8182
  if (fromInlineData != null) {
7945
8183
  setValueByPath(toObject, ['inlineData'], blobToVertex(apiClient, fromInlineData));
7946
8184
  }
8185
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
8186
+ if (fromFileData != null) {
8187
+ setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
8188
+ }
7947
8189
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7948
8190
  'codeExecutionResult',
7949
8191
  ]);
@@ -7956,10 +8198,6 @@ function partToVertex(apiClient, fromObject) {
7956
8198
  if (fromExecutableCode != null) {
7957
8199
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7958
8200
  }
7959
- const fromFileData = getValueByPath(fromObject, ['fileData']);
7960
- if (fromFileData != null) {
7961
- setValueByPath(toObject, ['fileData'], fromFileData);
7962
- }
7963
8201
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7964
8202
  if (fromFunctionCall != null) {
7965
8203
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7994,6 +8232,104 @@ function contentToVertex(apiClient, fromObject) {
7994
8232
  }
7995
8233
  return toObject;
7996
8234
  }
8235
+ function schemaToVertex(apiClient, fromObject) {
8236
+ const toObject = {};
8237
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
8238
+ if (fromAnyOf != null) {
8239
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
8240
+ }
8241
+ const fromDefault = getValueByPath(fromObject, ['default']);
8242
+ if (fromDefault != null) {
8243
+ setValueByPath(toObject, ['default'], fromDefault);
8244
+ }
8245
+ const fromDescription = getValueByPath(fromObject, ['description']);
8246
+ if (fromDescription != null) {
8247
+ setValueByPath(toObject, ['description'], fromDescription);
8248
+ }
8249
+ const fromEnum = getValueByPath(fromObject, ['enum']);
8250
+ if (fromEnum != null) {
8251
+ setValueByPath(toObject, ['enum'], fromEnum);
8252
+ }
8253
+ const fromExample = getValueByPath(fromObject, ['example']);
8254
+ if (fromExample != null) {
8255
+ setValueByPath(toObject, ['example'], fromExample);
8256
+ }
8257
+ const fromFormat = getValueByPath(fromObject, ['format']);
8258
+ if (fromFormat != null) {
8259
+ setValueByPath(toObject, ['format'], fromFormat);
8260
+ }
8261
+ const fromItems = getValueByPath(fromObject, ['items']);
8262
+ if (fromItems != null) {
8263
+ setValueByPath(toObject, ['items'], fromItems);
8264
+ }
8265
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
8266
+ if (fromMaxItems != null) {
8267
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
8268
+ }
8269
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
8270
+ if (fromMaxLength != null) {
8271
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
8272
+ }
8273
+ const fromMaxProperties = getValueByPath(fromObject, [
8274
+ 'maxProperties',
8275
+ ]);
8276
+ if (fromMaxProperties != null) {
8277
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
8278
+ }
8279
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
8280
+ if (fromMaximum != null) {
8281
+ setValueByPath(toObject, ['maximum'], fromMaximum);
8282
+ }
8283
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
8284
+ if (fromMinItems != null) {
8285
+ setValueByPath(toObject, ['minItems'], fromMinItems);
8286
+ }
8287
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
8288
+ if (fromMinLength != null) {
8289
+ setValueByPath(toObject, ['minLength'], fromMinLength);
8290
+ }
8291
+ const fromMinProperties = getValueByPath(fromObject, [
8292
+ 'minProperties',
8293
+ ]);
8294
+ if (fromMinProperties != null) {
8295
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
8296
+ }
8297
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
8298
+ if (fromMinimum != null) {
8299
+ setValueByPath(toObject, ['minimum'], fromMinimum);
8300
+ }
8301
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
8302
+ if (fromNullable != null) {
8303
+ setValueByPath(toObject, ['nullable'], fromNullable);
8304
+ }
8305
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
8306
+ if (fromPattern != null) {
8307
+ setValueByPath(toObject, ['pattern'], fromPattern);
8308
+ }
8309
+ const fromProperties = getValueByPath(fromObject, ['properties']);
8310
+ if (fromProperties != null) {
8311
+ setValueByPath(toObject, ['properties'], fromProperties);
8312
+ }
8313
+ const fromPropertyOrdering = getValueByPath(fromObject, [
8314
+ 'propertyOrdering',
8315
+ ]);
8316
+ if (fromPropertyOrdering != null) {
8317
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
8318
+ }
8319
+ const fromRequired = getValueByPath(fromObject, ['required']);
8320
+ if (fromRequired != null) {
8321
+ setValueByPath(toObject, ['required'], fromRequired);
8322
+ }
8323
+ const fromTitle = getValueByPath(fromObject, ['title']);
8324
+ if (fromTitle != null) {
8325
+ setValueByPath(toObject, ['title'], fromTitle);
8326
+ }
8327
+ const fromType = getValueByPath(fromObject, ['type']);
8328
+ if (fromType != null) {
8329
+ setValueByPath(toObject, ['type'], fromType);
8330
+ }
8331
+ return toObject;
8332
+ }
7997
8333
  function modelSelectionConfigToVertex(apiClient, fromObject) {
7998
8334
  const toObject = {};
7999
8335
  const fromFeatureSelectionPreference = getValueByPath(fromObject, [
@@ -8222,6 +8558,10 @@ function retrievalConfigToVertex(apiClient, fromObject) {
8222
8558
  if (fromLatLng != null) {
8223
8559
  setValueByPath(toObject, ['latLng'], latLngToVertex(apiClient, fromLatLng));
8224
8560
  }
8561
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
8562
+ if (fromLanguageCode != null) {
8563
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
8564
+ }
8225
8565
  return toObject;
8226
8566
  }
8227
8567
  function toolConfigToVertex(apiClient, fromObject) {
@@ -8363,7 +8703,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8363
8703
  'responseSchema',
8364
8704
  ]);
8365
8705
  if (fromResponseSchema != null) {
8366
- setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
8706
+ setValueByPath(toObject, ['responseSchema'], schemaToVertex(apiClient, tSchema(apiClient, fromResponseSchema)));
8367
8707
  }
8368
8708
  const fromRoutingConfig = getValueByPath(fromObject, [
8369
8709
  'routingConfig',
@@ -9145,6 +9485,18 @@ function blobFromMldev(apiClient, fromObject) {
9145
9485
  }
9146
9486
  return toObject;
9147
9487
  }
9488
+ function fileDataFromMldev(apiClient, fromObject) {
9489
+ const toObject = {};
9490
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
9491
+ if (fromFileUri != null) {
9492
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
9493
+ }
9494
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
9495
+ if (fromMimeType != null) {
9496
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
9497
+ }
9498
+ return toObject;
9499
+ }
9148
9500
  function partFromMldev(apiClient, fromObject) {
9149
9501
  const toObject = {};
9150
9502
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -9161,6 +9513,10 @@ function partFromMldev(apiClient, fromObject) {
9161
9513
  if (fromInlineData != null) {
9162
9514
  setValueByPath(toObject, ['inlineData'], blobFromMldev(apiClient, fromInlineData));
9163
9515
  }
9516
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
9517
+ if (fromFileData != null) {
9518
+ setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
9519
+ }
9164
9520
  const fromCodeExecutionResult = getValueByPath(fromObject, [
9165
9521
  'codeExecutionResult',
9166
9522
  ]);
@@ -9173,10 +9529,6 @@ function partFromMldev(apiClient, fromObject) {
9173
9529
  if (fromExecutableCode != null) {
9174
9530
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9175
9531
  }
9176
- const fromFileData = getValueByPath(fromObject, ['fileData']);
9177
- if (fromFileData != null) {
9178
- setValueByPath(toObject, ['fileData'], fromFileData);
9179
- }
9180
9532
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9181
9533
  if (fromFunctionCall != null) {
9182
9534
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -9647,6 +9999,22 @@ function blobFromVertex(apiClient, fromObject) {
9647
9999
  }
9648
10000
  return toObject;
9649
10001
  }
10002
+ function fileDataFromVertex(apiClient, fromObject) {
10003
+ const toObject = {};
10004
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
10005
+ if (fromDisplayName != null) {
10006
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
10007
+ }
10008
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
10009
+ if (fromFileUri != null) {
10010
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
10011
+ }
10012
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
10013
+ if (fromMimeType != null) {
10014
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
10015
+ }
10016
+ return toObject;
10017
+ }
9650
10018
  function partFromVertex(apiClient, fromObject) {
9651
10019
  const toObject = {};
9652
10020
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -9663,6 +10031,10 @@ function partFromVertex(apiClient, fromObject) {
9663
10031
  if (fromInlineData != null) {
9664
10032
  setValueByPath(toObject, ['inlineData'], blobFromVertex(apiClient, fromInlineData));
9665
10033
  }
10034
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
10035
+ if (fromFileData != null) {
10036
+ setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
10037
+ }
9666
10038
  const fromCodeExecutionResult = getValueByPath(fromObject, [
9667
10039
  'codeExecutionResult',
9668
10040
  ]);
@@ -9675,10 +10047,6 @@ function partFromVertex(apiClient, fromObject) {
9675
10047
  if (fromExecutableCode != null) {
9676
10048
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9677
10049
  }
9678
- const fromFileData = getValueByPath(fromObject, ['fileData']);
9679
- if (fromFileData != null) {
9680
- setValueByPath(toObject, ['fileData'], fromFileData);
9681
- }
9682
10050
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9683
10051
  if (fromFunctionCall != null) {
9684
10052
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -10209,7 +10577,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10209
10577
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10210
10578
  const USER_AGENT_HEADER = 'User-Agent';
10211
10579
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10212
- const SDK_VERSION = '1.0.0'; // x-release-please-version
10580
+ const SDK_VERSION = '1.1.0'; // x-release-please-version
10213
10581
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10214
10582
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10215
10583
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -13524,6 +13892,12 @@ function tuningJobFromMldev(apiClient, fromObject) {
13524
13892
  if (fromPipelineJob != null) {
13525
13893
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
13526
13894
  }
13895
+ const fromServiceAccount = getValueByPath(fromObject, [
13896
+ 'serviceAccount',
13897
+ ]);
13898
+ if (fromServiceAccount != null) {
13899
+ setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
13900
+ }
13527
13901
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
13528
13902
  'tunedModelDisplayName',
13529
13903
  ]);
@@ -13698,6 +14072,12 @@ function tuningJobFromVertex(apiClient, fromObject) {
13698
14072
  if (fromPipelineJob != null) {
13699
14073
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
13700
14074
  }
14075
+ const fromServiceAccount = getValueByPath(fromObject, [
14076
+ 'serviceAccount',
14077
+ ]);
14078
+ if (fromServiceAccount != null) {
14079
+ setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
14080
+ }
13701
14081
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
13702
14082
  'tunedModelDisplayName',
13703
14083
  ]);