@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.
package/dist/index.mjs CHANGED
@@ -195,6 +195,42 @@ var Language;
195
195
  */
196
196
  Language["PYTHON"] = "PYTHON";
197
197
  })(Language || (Language = {}));
198
+ /** Optional. The type of the data. */
199
+ var Type;
200
+ (function (Type) {
201
+ /**
202
+ * Not specified, should not be used.
203
+ */
204
+ Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
205
+ /**
206
+ * OpenAPI string type
207
+ */
208
+ Type["STRING"] = "STRING";
209
+ /**
210
+ * OpenAPI number type
211
+ */
212
+ Type["NUMBER"] = "NUMBER";
213
+ /**
214
+ * OpenAPI integer type
215
+ */
216
+ Type["INTEGER"] = "INTEGER";
217
+ /**
218
+ * OpenAPI boolean type
219
+ */
220
+ Type["BOOLEAN"] = "BOOLEAN";
221
+ /**
222
+ * OpenAPI array type
223
+ */
224
+ Type["ARRAY"] = "ARRAY";
225
+ /**
226
+ * OpenAPI object type
227
+ */
228
+ Type["OBJECT"] = "OBJECT";
229
+ /**
230
+ * Null type
231
+ */
232
+ Type["NULL"] = "NULL";
233
+ })(Type || (Type = {}));
198
234
  /** Required. Harm category. */
199
235
  var HarmCategory;
200
236
  (function (HarmCategory) {
@@ -219,7 +255,7 @@ var HarmCategory;
219
255
  */
220
256
  HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
221
257
  /**
222
- * The harm category is civic integrity.
258
+ * Deprecated: Election filter is not longer supported. The harm category is civic integrity.
223
259
  */
224
260
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
225
261
  })(HarmCategory || (HarmCategory = {}));
@@ -267,38 +303,6 @@ var HarmBlockThreshold;
267
303
  */
268
304
  HarmBlockThreshold["OFF"] = "OFF";
269
305
  })(HarmBlockThreshold || (HarmBlockThreshold = {}));
270
- /** Optional. The type of the data. */
271
- var Type;
272
- (function (Type) {
273
- /**
274
- * Not specified, should not be used.
275
- */
276
- Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
277
- /**
278
- * OpenAPI string type
279
- */
280
- Type["STRING"] = "STRING";
281
- /**
282
- * OpenAPI number type
283
- */
284
- Type["NUMBER"] = "NUMBER";
285
- /**
286
- * OpenAPI integer type
287
- */
288
- Type["INTEGER"] = "INTEGER";
289
- /**
290
- * OpenAPI boolean type
291
- */
292
- Type["BOOLEAN"] = "BOOLEAN";
293
- /**
294
- * OpenAPI array type
295
- */
296
- Type["ARRAY"] = "ARRAY";
297
- /**
298
- * OpenAPI object type
299
- */
300
- Type["OBJECT"] = "OBJECT";
301
- })(Type || (Type = {}));
302
306
  /** The mode of the predictor to be used in dynamic retrieval. */
303
307
  var Mode;
304
308
  (function (Mode) {
@@ -2438,6 +2442,21 @@ function blobToMldev$2(apiClient, fromObject) {
2438
2442
  }
2439
2443
  return toObject;
2440
2444
  }
2445
+ function fileDataToMldev$2(apiClient, fromObject) {
2446
+ const toObject = {};
2447
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
2448
+ throw new Error('displayName parameter is not supported in Gemini API.');
2449
+ }
2450
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
2451
+ if (fromFileUri != null) {
2452
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
2453
+ }
2454
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2455
+ if (fromMimeType != null) {
2456
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2457
+ }
2458
+ return toObject;
2459
+ }
2441
2460
  function partToMldev$2(apiClient, fromObject) {
2442
2461
  const toObject = {};
2443
2462
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -2454,6 +2473,10 @@ function partToMldev$2(apiClient, fromObject) {
2454
2473
  if (fromInlineData != null) {
2455
2474
  setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
2456
2475
  }
2476
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
2477
+ if (fromFileData != null) {
2478
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
2479
+ }
2457
2480
  const fromCodeExecutionResult = getValueByPath(fromObject, [
2458
2481
  'codeExecutionResult',
2459
2482
  ]);
@@ -2466,10 +2489,6 @@ function partToMldev$2(apiClient, fromObject) {
2466
2489
  if (fromExecutableCode != null) {
2467
2490
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
2468
2491
  }
2469
- const fromFileData = getValueByPath(fromObject, ['fileData']);
2470
- if (fromFileData != null) {
2471
- setValueByPath(toObject, ['fileData'], fromFileData);
2472
- }
2473
2492
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2474
2493
  if (fromFunctionCall != null) {
2475
2494
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -2655,6 +2674,10 @@ function retrievalConfigToMldev$1(apiClient, fromObject) {
2655
2674
  if (fromLatLng != null) {
2656
2675
  setValueByPath(toObject, ['latLng'], latLngToMldev$1(apiClient, fromLatLng));
2657
2676
  }
2677
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
2678
+ if (fromLanguageCode != null) {
2679
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
2680
+ }
2658
2681
  return toObject;
2659
2682
  }
2660
2683
  function toolConfigToMldev$1(apiClient, fromObject) {
@@ -2834,6 +2857,22 @@ function blobToVertex$2(apiClient, fromObject) {
2834
2857
  }
2835
2858
  return toObject;
2836
2859
  }
2860
+ function fileDataToVertex$2(apiClient, fromObject) {
2861
+ const toObject = {};
2862
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
2863
+ if (fromDisplayName != null) {
2864
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
2865
+ }
2866
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
2867
+ if (fromFileUri != null) {
2868
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
2869
+ }
2870
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2871
+ if (fromMimeType != null) {
2872
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2873
+ }
2874
+ return toObject;
2875
+ }
2837
2876
  function partToVertex$2(apiClient, fromObject) {
2838
2877
  const toObject = {};
2839
2878
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -2850,6 +2889,10 @@ function partToVertex$2(apiClient, fromObject) {
2850
2889
  if (fromInlineData != null) {
2851
2890
  setValueByPath(toObject, ['inlineData'], blobToVertex$2(apiClient, fromInlineData));
2852
2891
  }
2892
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
2893
+ if (fromFileData != null) {
2894
+ setValueByPath(toObject, ['fileData'], fileDataToVertex$2(apiClient, fromFileData));
2895
+ }
2853
2896
  const fromCodeExecutionResult = getValueByPath(fromObject, [
2854
2897
  'codeExecutionResult',
2855
2898
  ]);
@@ -2862,10 +2905,6 @@ function partToVertex$2(apiClient, fromObject) {
2862
2905
  if (fromExecutableCode != null) {
2863
2906
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
2864
2907
  }
2865
- const fromFileData = getValueByPath(fromObject, ['fileData']);
2866
- if (fromFileData != null) {
2867
- setValueByPath(toObject, ['fileData'], fromFileData);
2868
- }
2869
2908
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2870
2909
  if (fromFunctionCall != null) {
2871
2910
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -3102,6 +3141,10 @@ function retrievalConfigToVertex$1(apiClient, fromObject) {
3102
3141
  if (fromLatLng != null) {
3103
3142
  setValueByPath(toObject, ['latLng'], latLngToVertex$1(apiClient, fromLatLng));
3104
3143
  }
3144
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
3145
+ if (fromLanguageCode != null) {
3146
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
3147
+ }
3105
3148
  return toObject;
3106
3149
  }
3107
3150
  function toolConfigToVertex$1(apiClient, fromObject) {
@@ -4170,7 +4213,10 @@ class Chat {
4170
4213
  this.recordHistory(inputContent, modelOutput, automaticFunctionCallingHistory);
4171
4214
  return;
4172
4215
  })();
4173
- await this.sendPromise;
4216
+ await this.sendPromise.catch(() => {
4217
+ // Resets sendPromise to avoid subsequent calls failing
4218
+ this.sendPromise = Promise.resolve();
4219
+ });
4174
4220
  return responsePromise;
4175
4221
  }
4176
4222
  /**
@@ -4308,7 +4354,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
4308
4354
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
4309
4355
  const USER_AGENT_HEADER = 'User-Agent';
4310
4356
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
4311
- const SDK_VERSION = '1.0.0'; // x-release-please-version
4357
+ const SDK_VERSION = '1.1.0'; // x-release-please-version
4312
4358
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
4313
4359
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
4314
4360
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -5632,6 +5678,37 @@ function blobToVertex$1(apiClient, fromObject) {
5632
5678
  }
5633
5679
  return toObject;
5634
5680
  }
5681
+ function fileDataToMldev$1(apiClient, fromObject) {
5682
+ const toObject = {};
5683
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
5684
+ throw new Error('displayName parameter is not supported in Gemini API.');
5685
+ }
5686
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
5687
+ if (fromFileUri != null) {
5688
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
5689
+ }
5690
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5691
+ if (fromMimeType != null) {
5692
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
5693
+ }
5694
+ return toObject;
5695
+ }
5696
+ function fileDataToVertex$1(apiClient, fromObject) {
5697
+ const toObject = {};
5698
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5699
+ if (fromDisplayName != null) {
5700
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5701
+ }
5702
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
5703
+ if (fromFileUri != null) {
5704
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
5705
+ }
5706
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5707
+ if (fromMimeType != null) {
5708
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
5709
+ }
5710
+ return toObject;
5711
+ }
5635
5712
  function partToMldev$1(apiClient, fromObject) {
5636
5713
  const toObject = {};
5637
5714
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -5648,6 +5725,10 @@ function partToMldev$1(apiClient, fromObject) {
5648
5725
  if (fromInlineData != null) {
5649
5726
  setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
5650
5727
  }
5728
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5729
+ if (fromFileData != null) {
5730
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
5731
+ }
5651
5732
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5652
5733
  'codeExecutionResult',
5653
5734
  ]);
@@ -5660,10 +5741,6 @@ function partToMldev$1(apiClient, fromObject) {
5660
5741
  if (fromExecutableCode != null) {
5661
5742
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5662
5743
  }
5663
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5664
- if (fromFileData != null) {
5665
- setValueByPath(toObject, ['fileData'], fromFileData);
5666
- }
5667
5744
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5668
5745
  if (fromFunctionCall != null) {
5669
5746
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -5696,6 +5773,10 @@ function partToVertex$1(apiClient, fromObject) {
5696
5773
  if (fromInlineData != null) {
5697
5774
  setValueByPath(toObject, ['inlineData'], blobToVertex$1(apiClient, fromInlineData));
5698
5775
  }
5776
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5777
+ if (fromFileData != null) {
5778
+ setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
5779
+ }
5699
5780
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5700
5781
  'codeExecutionResult',
5701
5782
  ]);
@@ -5708,10 +5789,6 @@ function partToVertex$1(apiClient, fromObject) {
5708
5789
  if (fromExecutableCode != null) {
5709
5790
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5710
5791
  }
5711
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5712
- if (fromFileData != null) {
5713
- setValueByPath(toObject, ['fileData'], fromFileData);
5714
- }
5715
5792
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5716
5793
  if (fromFunctionCall != null) {
5717
5794
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -6785,6 +6862,34 @@ function blobFromVertex$1(apiClient, fromObject) {
6785
6862
  }
6786
6863
  return toObject;
6787
6864
  }
6865
+ function fileDataFromMldev$1(apiClient, fromObject) {
6866
+ const toObject = {};
6867
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
6868
+ if (fromFileUri != null) {
6869
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
6870
+ }
6871
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
6872
+ if (fromMimeType != null) {
6873
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
6874
+ }
6875
+ return toObject;
6876
+ }
6877
+ function fileDataFromVertex$1(apiClient, fromObject) {
6878
+ const toObject = {};
6879
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
6880
+ if (fromDisplayName != null) {
6881
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
6882
+ }
6883
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
6884
+ if (fromFileUri != null) {
6885
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
6886
+ }
6887
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
6888
+ if (fromMimeType != null) {
6889
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
6890
+ }
6891
+ return toObject;
6892
+ }
6788
6893
  function partFromMldev$1(apiClient, fromObject) {
6789
6894
  const toObject = {};
6790
6895
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -6801,6 +6906,10 @@ function partFromMldev$1(apiClient, fromObject) {
6801
6906
  if (fromInlineData != null) {
6802
6907
  setValueByPath(toObject, ['inlineData'], blobFromMldev$1(apiClient, fromInlineData));
6803
6908
  }
6909
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
6910
+ if (fromFileData != null) {
6911
+ setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
6912
+ }
6804
6913
  const fromCodeExecutionResult = getValueByPath(fromObject, [
6805
6914
  'codeExecutionResult',
6806
6915
  ]);
@@ -6813,10 +6922,6 @@ function partFromMldev$1(apiClient, fromObject) {
6813
6922
  if (fromExecutableCode != null) {
6814
6923
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
6815
6924
  }
6816
- const fromFileData = getValueByPath(fromObject, ['fileData']);
6817
- if (fromFileData != null) {
6818
- setValueByPath(toObject, ['fileData'], fromFileData);
6819
- }
6820
6925
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
6821
6926
  if (fromFunctionCall != null) {
6822
6927
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -6849,6 +6954,10 @@ function partFromVertex$1(apiClient, fromObject) {
6849
6954
  if (fromInlineData != null) {
6850
6955
  setValueByPath(toObject, ['inlineData'], blobFromVertex$1(apiClient, fromInlineData));
6851
6956
  }
6957
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
6958
+ if (fromFileData != null) {
6959
+ setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
6960
+ }
6852
6961
  const fromCodeExecutionResult = getValueByPath(fromObject, [
6853
6962
  'codeExecutionResult',
6854
6963
  ]);
@@ -6861,10 +6970,6 @@ function partFromVertex$1(apiClient, fromObject) {
6861
6970
  if (fromExecutableCode != null) {
6862
6971
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
6863
6972
  }
6864
- const fromFileData = getValueByPath(fromObject, ['fileData']);
6865
- if (fromFileData != null) {
6866
- setValueByPath(toObject, ['fileData'], fromFileData);
6867
- }
6868
6973
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
6869
6974
  if (fromFunctionCall != null) {
6870
6975
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7680,6 +7785,21 @@ function blobToMldev(apiClient, fromObject) {
7680
7785
  }
7681
7786
  return toObject;
7682
7787
  }
7788
+ function fileDataToMldev(apiClient, fromObject) {
7789
+ const toObject = {};
7790
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7791
+ throw new Error('displayName parameter is not supported in Gemini API.');
7792
+ }
7793
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
7794
+ if (fromFileUri != null) {
7795
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
7796
+ }
7797
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
7798
+ if (fromMimeType != null) {
7799
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
7800
+ }
7801
+ return toObject;
7802
+ }
7683
7803
  function partToMldev(apiClient, fromObject) {
7684
7804
  const toObject = {};
7685
7805
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -7696,6 +7816,10 @@ function partToMldev(apiClient, fromObject) {
7696
7816
  if (fromInlineData != null) {
7697
7817
  setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
7698
7818
  }
7819
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
7820
+ if (fromFileData != null) {
7821
+ setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
7822
+ }
7699
7823
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7700
7824
  'codeExecutionResult',
7701
7825
  ]);
@@ -7708,10 +7832,6 @@ function partToMldev(apiClient, fromObject) {
7708
7832
  if (fromExecutableCode != null) {
7709
7833
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7710
7834
  }
7711
- const fromFileData = getValueByPath(fromObject, ['fileData']);
7712
- if (fromFileData != null) {
7713
- setValueByPath(toObject, ['fileData'], fromFileData);
7714
- }
7715
7835
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7716
7836
  if (fromFunctionCall != null) {
7717
7837
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7746,6 +7866,104 @@ function contentToMldev(apiClient, fromObject) {
7746
7866
  }
7747
7867
  return toObject;
7748
7868
  }
7869
+ function schemaToMldev(apiClient, fromObject) {
7870
+ const toObject = {};
7871
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
7872
+ if (fromAnyOf != null) {
7873
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
7874
+ }
7875
+ const fromDefault = getValueByPath(fromObject, ['default']);
7876
+ if (fromDefault != null) {
7877
+ setValueByPath(toObject, ['default'], fromDefault);
7878
+ }
7879
+ const fromDescription = getValueByPath(fromObject, ['description']);
7880
+ if (fromDescription != null) {
7881
+ setValueByPath(toObject, ['description'], fromDescription);
7882
+ }
7883
+ const fromEnum = getValueByPath(fromObject, ['enum']);
7884
+ if (fromEnum != null) {
7885
+ setValueByPath(toObject, ['enum'], fromEnum);
7886
+ }
7887
+ const fromExample = getValueByPath(fromObject, ['example']);
7888
+ if (fromExample != null) {
7889
+ setValueByPath(toObject, ['example'], fromExample);
7890
+ }
7891
+ const fromFormat = getValueByPath(fromObject, ['format']);
7892
+ if (fromFormat != null) {
7893
+ setValueByPath(toObject, ['format'], fromFormat);
7894
+ }
7895
+ const fromItems = getValueByPath(fromObject, ['items']);
7896
+ if (fromItems != null) {
7897
+ setValueByPath(toObject, ['items'], fromItems);
7898
+ }
7899
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
7900
+ if (fromMaxItems != null) {
7901
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
7902
+ }
7903
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
7904
+ if (fromMaxLength != null) {
7905
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
7906
+ }
7907
+ const fromMaxProperties = getValueByPath(fromObject, [
7908
+ 'maxProperties',
7909
+ ]);
7910
+ if (fromMaxProperties != null) {
7911
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
7912
+ }
7913
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
7914
+ if (fromMaximum != null) {
7915
+ setValueByPath(toObject, ['maximum'], fromMaximum);
7916
+ }
7917
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
7918
+ if (fromMinItems != null) {
7919
+ setValueByPath(toObject, ['minItems'], fromMinItems);
7920
+ }
7921
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
7922
+ if (fromMinLength != null) {
7923
+ setValueByPath(toObject, ['minLength'], fromMinLength);
7924
+ }
7925
+ const fromMinProperties = getValueByPath(fromObject, [
7926
+ 'minProperties',
7927
+ ]);
7928
+ if (fromMinProperties != null) {
7929
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
7930
+ }
7931
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
7932
+ if (fromMinimum != null) {
7933
+ setValueByPath(toObject, ['minimum'], fromMinimum);
7934
+ }
7935
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
7936
+ if (fromNullable != null) {
7937
+ setValueByPath(toObject, ['nullable'], fromNullable);
7938
+ }
7939
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
7940
+ if (fromPattern != null) {
7941
+ setValueByPath(toObject, ['pattern'], fromPattern);
7942
+ }
7943
+ const fromProperties = getValueByPath(fromObject, ['properties']);
7944
+ if (fromProperties != null) {
7945
+ setValueByPath(toObject, ['properties'], fromProperties);
7946
+ }
7947
+ const fromPropertyOrdering = getValueByPath(fromObject, [
7948
+ 'propertyOrdering',
7949
+ ]);
7950
+ if (fromPropertyOrdering != null) {
7951
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
7952
+ }
7953
+ const fromRequired = getValueByPath(fromObject, ['required']);
7954
+ if (fromRequired != null) {
7955
+ setValueByPath(toObject, ['required'], fromRequired);
7956
+ }
7957
+ const fromTitle = getValueByPath(fromObject, ['title']);
7958
+ if (fromTitle != null) {
7959
+ setValueByPath(toObject, ['title'], fromTitle);
7960
+ }
7961
+ const fromType = getValueByPath(fromObject, ['type']);
7962
+ if (fromType != null) {
7963
+ setValueByPath(toObject, ['type'], fromType);
7964
+ }
7965
+ return toObject;
7966
+ }
7749
7967
  function safetySettingToMldev(apiClient, fromObject) {
7750
7968
  const toObject = {};
7751
7969
  if (getValueByPath(fromObject, ['method']) !== undefined) {
@@ -7912,6 +8130,10 @@ function retrievalConfigToMldev(apiClient, fromObject) {
7912
8130
  if (fromLatLng != null) {
7913
8131
  setValueByPath(toObject, ['latLng'], latLngToMldev(apiClient, fromLatLng));
7914
8132
  }
8133
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
8134
+ if (fromLanguageCode != null) {
8135
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
8136
+ }
7915
8137
  return toObject;
7916
8138
  }
7917
8139
  function toolConfigToMldev(apiClient, fromObject) {
@@ -8084,7 +8306,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8084
8306
  'responseSchema',
8085
8307
  ]);
8086
8308
  if (fromResponseSchema != null) {
8087
- setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
8309
+ setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
8088
8310
  }
8089
8311
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
8090
8312
  throw new Error('routingConfig parameter is not supported in Gemini API.');
@@ -8545,6 +8767,22 @@ function blobToVertex(apiClient, fromObject) {
8545
8767
  }
8546
8768
  return toObject;
8547
8769
  }
8770
+ function fileDataToVertex(apiClient, fromObject) {
8771
+ const toObject = {};
8772
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
8773
+ if (fromDisplayName != null) {
8774
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
8775
+ }
8776
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
8777
+ if (fromFileUri != null) {
8778
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
8779
+ }
8780
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
8781
+ if (fromMimeType != null) {
8782
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
8783
+ }
8784
+ return toObject;
8785
+ }
8548
8786
  function partToVertex(apiClient, fromObject) {
8549
8787
  const toObject = {};
8550
8788
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -8561,6 +8799,10 @@ function partToVertex(apiClient, fromObject) {
8561
8799
  if (fromInlineData != null) {
8562
8800
  setValueByPath(toObject, ['inlineData'], blobToVertex(apiClient, fromInlineData));
8563
8801
  }
8802
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
8803
+ if (fromFileData != null) {
8804
+ setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
8805
+ }
8564
8806
  const fromCodeExecutionResult = getValueByPath(fromObject, [
8565
8807
  'codeExecutionResult',
8566
8808
  ]);
@@ -8573,10 +8815,6 @@ function partToVertex(apiClient, fromObject) {
8573
8815
  if (fromExecutableCode != null) {
8574
8816
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
8575
8817
  }
8576
- const fromFileData = getValueByPath(fromObject, ['fileData']);
8577
- if (fromFileData != null) {
8578
- setValueByPath(toObject, ['fileData'], fromFileData);
8579
- }
8580
8818
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
8581
8819
  if (fromFunctionCall != null) {
8582
8820
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -8611,6 +8849,104 @@ function contentToVertex(apiClient, fromObject) {
8611
8849
  }
8612
8850
  return toObject;
8613
8851
  }
8852
+ function schemaToVertex(apiClient, fromObject) {
8853
+ const toObject = {};
8854
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
8855
+ if (fromAnyOf != null) {
8856
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
8857
+ }
8858
+ const fromDefault = getValueByPath(fromObject, ['default']);
8859
+ if (fromDefault != null) {
8860
+ setValueByPath(toObject, ['default'], fromDefault);
8861
+ }
8862
+ const fromDescription = getValueByPath(fromObject, ['description']);
8863
+ if (fromDescription != null) {
8864
+ setValueByPath(toObject, ['description'], fromDescription);
8865
+ }
8866
+ const fromEnum = getValueByPath(fromObject, ['enum']);
8867
+ if (fromEnum != null) {
8868
+ setValueByPath(toObject, ['enum'], fromEnum);
8869
+ }
8870
+ const fromExample = getValueByPath(fromObject, ['example']);
8871
+ if (fromExample != null) {
8872
+ setValueByPath(toObject, ['example'], fromExample);
8873
+ }
8874
+ const fromFormat = getValueByPath(fromObject, ['format']);
8875
+ if (fromFormat != null) {
8876
+ setValueByPath(toObject, ['format'], fromFormat);
8877
+ }
8878
+ const fromItems = getValueByPath(fromObject, ['items']);
8879
+ if (fromItems != null) {
8880
+ setValueByPath(toObject, ['items'], fromItems);
8881
+ }
8882
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
8883
+ if (fromMaxItems != null) {
8884
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
8885
+ }
8886
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
8887
+ if (fromMaxLength != null) {
8888
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
8889
+ }
8890
+ const fromMaxProperties = getValueByPath(fromObject, [
8891
+ 'maxProperties',
8892
+ ]);
8893
+ if (fromMaxProperties != null) {
8894
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
8895
+ }
8896
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
8897
+ if (fromMaximum != null) {
8898
+ setValueByPath(toObject, ['maximum'], fromMaximum);
8899
+ }
8900
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
8901
+ if (fromMinItems != null) {
8902
+ setValueByPath(toObject, ['minItems'], fromMinItems);
8903
+ }
8904
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
8905
+ if (fromMinLength != null) {
8906
+ setValueByPath(toObject, ['minLength'], fromMinLength);
8907
+ }
8908
+ const fromMinProperties = getValueByPath(fromObject, [
8909
+ 'minProperties',
8910
+ ]);
8911
+ if (fromMinProperties != null) {
8912
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
8913
+ }
8914
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
8915
+ if (fromMinimum != null) {
8916
+ setValueByPath(toObject, ['minimum'], fromMinimum);
8917
+ }
8918
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
8919
+ if (fromNullable != null) {
8920
+ setValueByPath(toObject, ['nullable'], fromNullable);
8921
+ }
8922
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
8923
+ if (fromPattern != null) {
8924
+ setValueByPath(toObject, ['pattern'], fromPattern);
8925
+ }
8926
+ const fromProperties = getValueByPath(fromObject, ['properties']);
8927
+ if (fromProperties != null) {
8928
+ setValueByPath(toObject, ['properties'], fromProperties);
8929
+ }
8930
+ const fromPropertyOrdering = getValueByPath(fromObject, [
8931
+ 'propertyOrdering',
8932
+ ]);
8933
+ if (fromPropertyOrdering != null) {
8934
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
8935
+ }
8936
+ const fromRequired = getValueByPath(fromObject, ['required']);
8937
+ if (fromRequired != null) {
8938
+ setValueByPath(toObject, ['required'], fromRequired);
8939
+ }
8940
+ const fromTitle = getValueByPath(fromObject, ['title']);
8941
+ if (fromTitle != null) {
8942
+ setValueByPath(toObject, ['title'], fromTitle);
8943
+ }
8944
+ const fromType = getValueByPath(fromObject, ['type']);
8945
+ if (fromType != null) {
8946
+ setValueByPath(toObject, ['type'], fromType);
8947
+ }
8948
+ return toObject;
8949
+ }
8614
8950
  function modelSelectionConfigToVertex(apiClient, fromObject) {
8615
8951
  const toObject = {};
8616
8952
  const fromFeatureSelectionPreference = getValueByPath(fromObject, [
@@ -8839,6 +9175,10 @@ function retrievalConfigToVertex(apiClient, fromObject) {
8839
9175
  if (fromLatLng != null) {
8840
9176
  setValueByPath(toObject, ['latLng'], latLngToVertex(apiClient, fromLatLng));
8841
9177
  }
9178
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
9179
+ if (fromLanguageCode != null) {
9180
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
9181
+ }
8842
9182
  return toObject;
8843
9183
  }
8844
9184
  function toolConfigToVertex(apiClient, fromObject) {
@@ -8980,7 +9320,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8980
9320
  'responseSchema',
8981
9321
  ]);
8982
9322
  if (fromResponseSchema != null) {
8983
- setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
9323
+ setValueByPath(toObject, ['responseSchema'], schemaToVertex(apiClient, tSchema(apiClient, fromResponseSchema)));
8984
9324
  }
8985
9325
  const fromRoutingConfig = getValueByPath(fromObject, [
8986
9326
  'routingConfig',
@@ -9762,6 +10102,18 @@ function blobFromMldev(apiClient, fromObject) {
9762
10102
  }
9763
10103
  return toObject;
9764
10104
  }
10105
+ function fileDataFromMldev(apiClient, fromObject) {
10106
+ const toObject = {};
10107
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
10108
+ if (fromFileUri != null) {
10109
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
10110
+ }
10111
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
10112
+ if (fromMimeType != null) {
10113
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
10114
+ }
10115
+ return toObject;
10116
+ }
9765
10117
  function partFromMldev(apiClient, fromObject) {
9766
10118
  const toObject = {};
9767
10119
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -9778,6 +10130,10 @@ function partFromMldev(apiClient, fromObject) {
9778
10130
  if (fromInlineData != null) {
9779
10131
  setValueByPath(toObject, ['inlineData'], blobFromMldev(apiClient, fromInlineData));
9780
10132
  }
10133
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
10134
+ if (fromFileData != null) {
10135
+ setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
10136
+ }
9781
10137
  const fromCodeExecutionResult = getValueByPath(fromObject, [
9782
10138
  'codeExecutionResult',
9783
10139
  ]);
@@ -9790,10 +10146,6 @@ function partFromMldev(apiClient, fromObject) {
9790
10146
  if (fromExecutableCode != null) {
9791
10147
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9792
10148
  }
9793
- const fromFileData = getValueByPath(fromObject, ['fileData']);
9794
- if (fromFileData != null) {
9795
- setValueByPath(toObject, ['fileData'], fromFileData);
9796
- }
9797
10149
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9798
10150
  if (fromFunctionCall != null) {
9799
10151
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -10264,6 +10616,22 @@ function blobFromVertex(apiClient, fromObject) {
10264
10616
  }
10265
10617
  return toObject;
10266
10618
  }
10619
+ function fileDataFromVertex(apiClient, fromObject) {
10620
+ const toObject = {};
10621
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
10622
+ if (fromDisplayName != null) {
10623
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
10624
+ }
10625
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
10626
+ if (fromFileUri != null) {
10627
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
10628
+ }
10629
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
10630
+ if (fromMimeType != null) {
10631
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
10632
+ }
10633
+ return toObject;
10634
+ }
10267
10635
  function partFromVertex(apiClient, fromObject) {
10268
10636
  const toObject = {};
10269
10637
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -10280,6 +10648,10 @@ function partFromVertex(apiClient, fromObject) {
10280
10648
  if (fromInlineData != null) {
10281
10649
  setValueByPath(toObject, ['inlineData'], blobFromVertex(apiClient, fromInlineData));
10282
10650
  }
10651
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
10652
+ if (fromFileData != null) {
10653
+ setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
10654
+ }
10283
10655
  const fromCodeExecutionResult = getValueByPath(fromObject, [
10284
10656
  'codeExecutionResult',
10285
10657
  ]);
@@ -10292,10 +10664,6 @@ function partFromVertex(apiClient, fromObject) {
10292
10664
  if (fromExecutableCode != null) {
10293
10665
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
10294
10666
  }
10295
- const fromFileData = getValueByPath(fromObject, ['fileData']);
10296
- if (fromFileData != null) {
10297
- setValueByPath(toObject, ['fileData'], fromFileData);
10298
- }
10299
10667
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10300
10668
  if (fromFunctionCall != null) {
10301
10669
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -13619,6 +13987,12 @@ function tuningJobFromMldev(apiClient, fromObject) {
13619
13987
  if (fromPipelineJob != null) {
13620
13988
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
13621
13989
  }
13990
+ const fromServiceAccount = getValueByPath(fromObject, [
13991
+ 'serviceAccount',
13992
+ ]);
13993
+ if (fromServiceAccount != null) {
13994
+ setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
13995
+ }
13622
13996
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
13623
13997
  'tunedModelDisplayName',
13624
13998
  ]);
@@ -13793,6 +14167,12 @@ function tuningJobFromVertex(apiClient, fromObject) {
13793
14167
  if (fromPipelineJob != null) {
13794
14168
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
13795
14169
  }
14170
+ const fromServiceAccount = getValueByPath(fromObject, [
14171
+ 'serviceAccount',
14172
+ ]);
14173
+ if (fromServiceAccount != null) {
14174
+ setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
14175
+ }
13796
14176
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
13797
14177
  'tunedModelDisplayName',
13798
14178
  ]);