@google/genai 1.26.0 → 1.27.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.cjs CHANGED
@@ -588,23 +588,23 @@ exports.HarmCategory = void 0;
588
588
  */
589
589
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
590
590
  /**
591
- * The harm category is image hate.
591
+ * The harm category is image hate. This enum value is not supported in Gemini API.
592
592
  */
593
593
  HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
594
594
  /**
595
- * The harm category is image dangerous content.
595
+ * The harm category is image dangerous content. This enum value is not supported in Gemini API.
596
596
  */
597
597
  HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
598
598
  /**
599
- * The harm category is image harassment.
599
+ * The harm category is image harassment. This enum value is not supported in Gemini API.
600
600
  */
601
601
  HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
602
602
  /**
603
- * The harm category is image sexually explicit content.
603
+ * The harm category is image sexually explicit content. This enum value is not supported in Gemini API.
604
604
  */
605
605
  HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
606
606
  /**
607
- * The harm category is for jailbreak prompts.
607
+ * The harm category is for jailbreak prompts. This enum value is not supported in Gemini API.
608
608
  */
609
609
  HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
610
610
  })(exports.HarmCategory || (exports.HarmCategory = {}));
@@ -875,11 +875,11 @@ exports.BlockedReason = void 0;
875
875
  */
876
876
  BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
877
877
  /**
878
- * The prompt was blocked by Model Armor.
878
+ * The prompt was blocked by Model Armor. This enum value is not supported in Gemini API.
879
879
  */
880
880
  BlockedReason["MODEL_ARMOR"] = "MODEL_ARMOR";
881
881
  /**
882
- * The prompt was blocked as a jailbreak attempt.
882
+ * The prompt was blocked as a jailbreak attempt. This enum value is not supported in Gemini API.
883
883
  */
884
884
  BlockedReason["JAILBREAK"] = "JAILBREAK";
885
885
  })(exports.BlockedReason || (exports.BlockedReason = {}));
@@ -1716,7 +1716,7 @@ class HttpResponse {
1716
1716
  /** Content filter results for a prompt sent in the request. Note: This is sent only in the first stream chunk and only if no candidates were generated due to content violations. */
1717
1717
  class GenerateContentResponsePromptFeedback {
1718
1718
  }
1719
- /** Usage metadata about response(s). */
1719
+ /** Usage metadata about response(s). This data type is not supported in Gemini API. */
1720
1720
  class GenerateContentResponseUsageMetadata {
1721
1721
  }
1722
1722
  /** Response message for PredictionService.GenerateContent. */
@@ -6193,7 +6193,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6193
6193
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6194
6194
  const USER_AGENT_HEADER = 'User-Agent';
6195
6195
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6196
- const SDK_VERSION = '1.26.0'; // x-release-please-version
6196
+ const SDK_VERSION = '1.27.0'; // x-release-please-version
6197
6197
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6198
6198
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6199
6199
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -6382,7 +6382,7 @@ class ApiClient {
6382
6382
  else {
6383
6383
  requestInit.body = request.body;
6384
6384
  }
6385
- requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
6385
+ requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
6386
6386
  return this.unaryApiCall(url, requestInit, request.httpMethod);
6387
6387
  }
6388
6388
  patchHttpOptions(baseHttpOptions, requestHttpOptions) {
@@ -6416,10 +6416,10 @@ class ApiClient {
6416
6416
  }
6417
6417
  let requestInit = {};
6418
6418
  requestInit.body = request.body;
6419
- requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
6419
+ requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
6420
6420
  return this.streamApiCall(url, requestInit, request.httpMethod);
6421
6421
  }
6422
- async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, abortSignal) {
6422
+ async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, url, abortSignal) {
6423
6423
  if ((httpOptions && httpOptions.timeout) || abortSignal) {
6424
6424
  const abortController = new AbortController();
6425
6425
  const signal = abortController.signal;
@@ -6443,7 +6443,7 @@ class ApiClient {
6443
6443
  if (httpOptions && httpOptions.extraBody !== null) {
6444
6444
  includeExtraBodyToRequestInit(requestInit, httpOptions.extraBody);
6445
6445
  }
6446
- requestInit.headers = await this.getHeadersInternal(httpOptions);
6446
+ requestInit.headers = await this.getHeadersInternal(httpOptions, url);
6447
6447
  return requestInit;
6448
6448
  }
6449
6449
  async unaryApiCall(url, requestInit, httpMethod) {
@@ -6556,7 +6556,7 @@ class ApiClient {
6556
6556
  headers[CONTENT_TYPE_HEADER] = 'application/json';
6557
6557
  return headers;
6558
6558
  }
6559
- async getHeadersInternal(httpOptions) {
6559
+ async getHeadersInternal(httpOptions, url) {
6560
6560
  const headers = new Headers();
6561
6561
  if (httpOptions && httpOptions.headers) {
6562
6562
  for (const [key, value] of Object.entries(httpOptions.headers)) {
@@ -6568,7 +6568,7 @@ class ApiClient {
6568
6568
  headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
6569
6569
  }
6570
6570
  }
6571
- await this.clientOptions.auth.addAuthHeaders(headers);
6571
+ await this.clientOptions.auth.addAuthHeaders(headers, url);
6572
6572
  return headers;
6573
6573
  }
6574
6574
  /**
@@ -11770,7 +11770,7 @@ class Live {
11770
11770
  const headers = mapToHeaders(clientHeaders);
11771
11771
  if (this.apiClient.isVertexAI()) {
11772
11772
  url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
11773
- await this.auth.addAuthHeaders(headers);
11773
+ await this.auth.addAuthHeaders(headers, url);
11774
11774
  }
11775
11775
  else {
11776
11776
  const apiKey = this.apiClient.getApiKey();
@@ -14443,7 +14443,7 @@ class Tokens extends BaseModule {
14443
14443
  * SPDX-License-Identifier: Apache-2.0
14444
14444
  */
14445
14445
  // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14446
- function cancelTuningJobParametersToMldev(fromObject) {
14446
+ function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
14447
14447
  const toObject = {};
14448
14448
  const fromName = getValueByPath(fromObject, ['name']);
14449
14449
  if (fromName != null) {
@@ -14451,7 +14451,7 @@ function cancelTuningJobParametersToMldev(fromObject) {
14451
14451
  }
14452
14452
  return toObject;
14453
14453
  }
14454
- function cancelTuningJobParametersToVertex(fromObject) {
14454
+ function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
14455
14455
  const toObject = {};
14456
14456
  const fromName = getValueByPath(fromObject, ['name']);
14457
14457
  if (fromName != null) {
@@ -14459,7 +14459,7 @@ function cancelTuningJobParametersToVertex(fromObject) {
14459
14459
  }
14460
14460
  return toObject;
14461
14461
  }
14462
- function createTuningJobConfigToMldev(fromObject, parentObject) {
14462
+ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
14463
14463
  const toObject = {};
14464
14464
  if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
14465
14465
  throw new Error('validationDataset parameter is not supported in Gemini API.');
@@ -14507,13 +14507,13 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
14507
14507
  }
14508
14508
  return toObject;
14509
14509
  }
14510
- function createTuningJobConfigToVertex(fromObject, parentObject) {
14510
+ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14511
14511
  const toObject = {};
14512
14512
  const fromValidationDataset = getValueByPath(fromObject, [
14513
14513
  'validationDataset',
14514
14514
  ]);
14515
14515
  if (parentObject !== undefined && fromValidationDataset != null) {
14516
- setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset, toObject));
14516
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
14517
14517
  }
14518
14518
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
14519
14519
  'tunedModelDisplayName',
@@ -14557,7 +14557,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
14557
14557
  }
14558
14558
  return toObject;
14559
14559
  }
14560
- function createTuningJobParametersPrivateToMldev(fromObject) {
14560
+ function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
14561
14561
  const toObject = {};
14562
14562
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
14563
14563
  if (fromBaseModel != null) {
@@ -14581,7 +14581,7 @@ function createTuningJobParametersPrivateToMldev(fromObject) {
14581
14581
  }
14582
14582
  return toObject;
14583
14583
  }
14584
- function createTuningJobParametersPrivateToVertex(fromObject) {
14584
+ function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
14585
14585
  const toObject = {};
14586
14586
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
14587
14587
  if (fromBaseModel != null) {
@@ -14597,7 +14597,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
14597
14597
  'trainingDataset',
14598
14598
  ]);
14599
14599
  if (fromTrainingDataset != null) {
14600
- setValueByPath(toObject, ['supervisedTuningSpec', 'trainingDatasetUri'], tuningDatasetToVertex(fromTrainingDataset, toObject));
14600
+ tuningDatasetToVertex(fromTrainingDataset, toObject);
14601
14601
  }
14602
14602
  const fromConfig = getValueByPath(fromObject, ['config']);
14603
14603
  if (fromConfig != null) {
@@ -14605,7 +14605,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
14605
14605
  }
14606
14606
  return toObject;
14607
14607
  }
14608
- function getTuningJobParametersToMldev(fromObject) {
14608
+ function getTuningJobParametersToMldev(fromObject, _rootObject) {
14609
14609
  const toObject = {};
14610
14610
  const fromName = getValueByPath(fromObject, ['name']);
14611
14611
  if (fromName != null) {
@@ -14613,7 +14613,7 @@ function getTuningJobParametersToMldev(fromObject) {
14613
14613
  }
14614
14614
  return toObject;
14615
14615
  }
14616
- function getTuningJobParametersToVertex(fromObject) {
14616
+ function getTuningJobParametersToVertex(fromObject, _rootObject) {
14617
14617
  const toObject = {};
14618
14618
  const fromName = getValueByPath(fromObject, ['name']);
14619
14619
  if (fromName != null) {
@@ -14621,7 +14621,7 @@ function getTuningJobParametersToVertex(fromObject) {
14621
14621
  }
14622
14622
  return toObject;
14623
14623
  }
14624
- function listTuningJobsConfigToMldev(fromObject, parentObject) {
14624
+ function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
14625
14625
  const toObject = {};
14626
14626
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14627
14627
  if (parentObject !== undefined && fromPageSize != null) {
@@ -14637,7 +14637,7 @@ function listTuningJobsConfigToMldev(fromObject, parentObject) {
14637
14637
  }
14638
14638
  return toObject;
14639
14639
  }
14640
- function listTuningJobsConfigToVertex(fromObject, parentObject) {
14640
+ function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
14641
14641
  const toObject = {};
14642
14642
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14643
14643
  if (parentObject !== undefined && fromPageSize != null) {
@@ -14653,7 +14653,7 @@ function listTuningJobsConfigToVertex(fromObject, parentObject) {
14653
14653
  }
14654
14654
  return toObject;
14655
14655
  }
14656
- function listTuningJobsParametersToMldev(fromObject) {
14656
+ function listTuningJobsParametersToMldev(fromObject, rootObject) {
14657
14657
  const toObject = {};
14658
14658
  const fromConfig = getValueByPath(fromObject, ['config']);
14659
14659
  if (fromConfig != null) {
@@ -14661,7 +14661,7 @@ function listTuningJobsParametersToMldev(fromObject) {
14661
14661
  }
14662
14662
  return toObject;
14663
14663
  }
14664
- function listTuningJobsParametersToVertex(fromObject) {
14664
+ function listTuningJobsParametersToVertex(fromObject, rootObject) {
14665
14665
  const toObject = {};
14666
14666
  const fromConfig = getValueByPath(fromObject, ['config']);
14667
14667
  if (fromConfig != null) {
@@ -14669,7 +14669,7 @@ function listTuningJobsParametersToVertex(fromObject) {
14669
14669
  }
14670
14670
  return toObject;
14671
14671
  }
14672
- function listTuningJobsResponseFromMldev(fromObject) {
14672
+ function listTuningJobsResponseFromMldev(fromObject, rootObject) {
14673
14673
  const toObject = {};
14674
14674
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14675
14675
  'sdkHttpResponse',
@@ -14695,7 +14695,7 @@ function listTuningJobsResponseFromMldev(fromObject) {
14695
14695
  }
14696
14696
  return toObject;
14697
14697
  }
14698
- function listTuningJobsResponseFromVertex(fromObject) {
14698
+ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
14699
14699
  const toObject = {};
14700
14700
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14701
14701
  'sdkHttpResponse',
@@ -14721,7 +14721,7 @@ function listTuningJobsResponseFromVertex(fromObject) {
14721
14721
  }
14722
14722
  return toObject;
14723
14723
  }
14724
- function tunedModelFromMldev(fromObject) {
14724
+ function tunedModelFromMldev(fromObject, _rootObject) {
14725
14725
  const toObject = {};
14726
14726
  const fromModel = getValueByPath(fromObject, ['name']);
14727
14727
  if (fromModel != null) {
@@ -14733,7 +14733,7 @@ function tunedModelFromMldev(fromObject) {
14733
14733
  }
14734
14734
  return toObject;
14735
14735
  }
14736
- function tuningDatasetToMldev(fromObject) {
14736
+ function tuningDatasetToMldev(fromObject, _rootObject) {
14737
14737
  const toObject = {};
14738
14738
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
14739
14739
  throw new Error('gcsUri parameter is not supported in Gemini API.');
@@ -14753,7 +14753,7 @@ function tuningDatasetToMldev(fromObject) {
14753
14753
  }
14754
14754
  return toObject;
14755
14755
  }
14756
- function tuningDatasetToVertex(fromObject, parentObject) {
14756
+ function tuningDatasetToVertex(fromObject, parentObject, _rootObject) {
14757
14757
  const toObject = {};
14758
14758
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14759
14759
  if (parentObject !== undefined && fromGcsUri != null) {
@@ -14770,7 +14770,7 @@ function tuningDatasetToVertex(fromObject, parentObject) {
14770
14770
  }
14771
14771
  return toObject;
14772
14772
  }
14773
- function tuningJobFromMldev(fromObject) {
14773
+ function tuningJobFromMldev(fromObject, rootObject) {
14774
14774
  const toObject = {};
14775
14775
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14776
14776
  'sdkHttpResponse',
@@ -14822,7 +14822,7 @@ function tuningJobFromMldev(fromObject) {
14822
14822
  }
14823
14823
  return toObject;
14824
14824
  }
14825
- function tuningJobFromVertex(fromObject) {
14825
+ function tuningJobFromVertex(fromObject, _rootObject) {
14826
14826
  const toObject = {};
14827
14827
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14828
14828
  'sdkHttpResponse',
@@ -14942,7 +14942,7 @@ function tuningJobFromVertex(fromObject) {
14942
14942
  }
14943
14943
  return toObject;
14944
14944
  }
14945
- function tuningOperationFromMldev(fromObject) {
14945
+ function tuningOperationFromMldev(fromObject, _rootObject) {
14946
14946
  const toObject = {};
14947
14947
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14948
14948
  'sdkHttpResponse',
@@ -14968,7 +14968,7 @@ function tuningOperationFromMldev(fromObject) {
14968
14968
  }
14969
14969
  return toObject;
14970
14970
  }
14971
- function tuningValidationDatasetToVertex(fromObject, parentObject) {
14971
+ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
14972
14972
  const toObject = {};
14973
14973
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14974
14974
  if (fromGcsUri != null) {
@@ -14977,8 +14977,8 @@ function tuningValidationDatasetToVertex(fromObject, parentObject) {
14977
14977
  const fromVertexDatasetResource = getValueByPath(fromObject, [
14978
14978
  'vertexDatasetResource',
14979
14979
  ]);
14980
- if (parentObject !== undefined && fromVertexDatasetResource != null) {
14981
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
14980
+ if (fromVertexDatasetResource != null) {
14981
+ setValueByPath(toObject, ['validationDatasetUri'], fromVertexDatasetResource);
14982
14982
  }
14983
14983
  return toObject;
14984
14984
  }
@@ -15331,7 +15331,8 @@ class WebAuth {
15331
15331
  constructor(apiKey) {
15332
15332
  this.apiKey = apiKey;
15333
15333
  }
15334
- async addAuthHeaders(headers) {
15334
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15335
+ async addAuthHeaders(headers, url) {
15335
15336
  if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
15336
15337
  return;
15337
15338
  }
package/dist/index.mjs CHANGED
@@ -586,23 +586,23 @@ var HarmCategory;
586
586
  */
587
587
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
588
588
  /**
589
- * The harm category is image hate.
589
+ * The harm category is image hate. This enum value is not supported in Gemini API.
590
590
  */
591
591
  HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
592
592
  /**
593
- * The harm category is image dangerous content.
593
+ * The harm category is image dangerous content. This enum value is not supported in Gemini API.
594
594
  */
595
595
  HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
596
596
  /**
597
- * The harm category is image harassment.
597
+ * The harm category is image harassment. This enum value is not supported in Gemini API.
598
598
  */
599
599
  HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
600
600
  /**
601
- * The harm category is image sexually explicit content.
601
+ * The harm category is image sexually explicit content. This enum value is not supported in Gemini API.
602
602
  */
603
603
  HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
604
604
  /**
605
- * The harm category is for jailbreak prompts.
605
+ * The harm category is for jailbreak prompts. This enum value is not supported in Gemini API.
606
606
  */
607
607
  HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
608
608
  })(HarmCategory || (HarmCategory = {}));
@@ -873,11 +873,11 @@ var BlockedReason;
873
873
  */
874
874
  BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
875
875
  /**
876
- * The prompt was blocked by Model Armor.
876
+ * The prompt was blocked by Model Armor. This enum value is not supported in Gemini API.
877
877
  */
878
878
  BlockedReason["MODEL_ARMOR"] = "MODEL_ARMOR";
879
879
  /**
880
- * The prompt was blocked as a jailbreak attempt.
880
+ * The prompt was blocked as a jailbreak attempt. This enum value is not supported in Gemini API.
881
881
  */
882
882
  BlockedReason["JAILBREAK"] = "JAILBREAK";
883
883
  })(BlockedReason || (BlockedReason = {}));
@@ -1714,7 +1714,7 @@ class HttpResponse {
1714
1714
  /** Content filter results for a prompt sent in the request. Note: This is sent only in the first stream chunk and only if no candidates were generated due to content violations. */
1715
1715
  class GenerateContentResponsePromptFeedback {
1716
1716
  }
1717
- /** Usage metadata about response(s). */
1717
+ /** Usage metadata about response(s). This data type is not supported in Gemini API. */
1718
1718
  class GenerateContentResponseUsageMetadata {
1719
1719
  }
1720
1720
  /** Response message for PredictionService.GenerateContent. */
@@ -6191,7 +6191,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6191
6191
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6192
6192
  const USER_AGENT_HEADER = 'User-Agent';
6193
6193
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6194
- const SDK_VERSION = '1.26.0'; // x-release-please-version
6194
+ const SDK_VERSION = '1.27.0'; // x-release-please-version
6195
6195
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6196
6196
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6197
6197
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -6380,7 +6380,7 @@ class ApiClient {
6380
6380
  else {
6381
6381
  requestInit.body = request.body;
6382
6382
  }
6383
- requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
6383
+ requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
6384
6384
  return this.unaryApiCall(url, requestInit, request.httpMethod);
6385
6385
  }
6386
6386
  patchHttpOptions(baseHttpOptions, requestHttpOptions) {
@@ -6414,10 +6414,10 @@ class ApiClient {
6414
6414
  }
6415
6415
  let requestInit = {};
6416
6416
  requestInit.body = request.body;
6417
- requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
6417
+ requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
6418
6418
  return this.streamApiCall(url, requestInit, request.httpMethod);
6419
6419
  }
6420
- async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, abortSignal) {
6420
+ async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, url, abortSignal) {
6421
6421
  if ((httpOptions && httpOptions.timeout) || abortSignal) {
6422
6422
  const abortController = new AbortController();
6423
6423
  const signal = abortController.signal;
@@ -6441,7 +6441,7 @@ class ApiClient {
6441
6441
  if (httpOptions && httpOptions.extraBody !== null) {
6442
6442
  includeExtraBodyToRequestInit(requestInit, httpOptions.extraBody);
6443
6443
  }
6444
- requestInit.headers = await this.getHeadersInternal(httpOptions);
6444
+ requestInit.headers = await this.getHeadersInternal(httpOptions, url);
6445
6445
  return requestInit;
6446
6446
  }
6447
6447
  async unaryApiCall(url, requestInit, httpMethod) {
@@ -6554,7 +6554,7 @@ class ApiClient {
6554
6554
  headers[CONTENT_TYPE_HEADER] = 'application/json';
6555
6555
  return headers;
6556
6556
  }
6557
- async getHeadersInternal(httpOptions) {
6557
+ async getHeadersInternal(httpOptions, url) {
6558
6558
  const headers = new Headers();
6559
6559
  if (httpOptions && httpOptions.headers) {
6560
6560
  for (const [key, value] of Object.entries(httpOptions.headers)) {
@@ -6566,7 +6566,7 @@ class ApiClient {
6566
6566
  headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
6567
6567
  }
6568
6568
  }
6569
- await this.clientOptions.auth.addAuthHeaders(headers);
6569
+ await this.clientOptions.auth.addAuthHeaders(headers, url);
6570
6570
  return headers;
6571
6571
  }
6572
6572
  /**
@@ -11768,7 +11768,7 @@ class Live {
11768
11768
  const headers = mapToHeaders(clientHeaders);
11769
11769
  if (this.apiClient.isVertexAI()) {
11770
11770
  url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
11771
- await this.auth.addAuthHeaders(headers);
11771
+ await this.auth.addAuthHeaders(headers, url);
11772
11772
  }
11773
11773
  else {
11774
11774
  const apiKey = this.apiClient.getApiKey();
@@ -14441,7 +14441,7 @@ class Tokens extends BaseModule {
14441
14441
  * SPDX-License-Identifier: Apache-2.0
14442
14442
  */
14443
14443
  // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14444
- function cancelTuningJobParametersToMldev(fromObject) {
14444
+ function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
14445
14445
  const toObject = {};
14446
14446
  const fromName = getValueByPath(fromObject, ['name']);
14447
14447
  if (fromName != null) {
@@ -14449,7 +14449,7 @@ function cancelTuningJobParametersToMldev(fromObject) {
14449
14449
  }
14450
14450
  return toObject;
14451
14451
  }
14452
- function cancelTuningJobParametersToVertex(fromObject) {
14452
+ function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
14453
14453
  const toObject = {};
14454
14454
  const fromName = getValueByPath(fromObject, ['name']);
14455
14455
  if (fromName != null) {
@@ -14457,7 +14457,7 @@ function cancelTuningJobParametersToVertex(fromObject) {
14457
14457
  }
14458
14458
  return toObject;
14459
14459
  }
14460
- function createTuningJobConfigToMldev(fromObject, parentObject) {
14460
+ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
14461
14461
  const toObject = {};
14462
14462
  if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
14463
14463
  throw new Error('validationDataset parameter is not supported in Gemini API.');
@@ -14505,13 +14505,13 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
14505
14505
  }
14506
14506
  return toObject;
14507
14507
  }
14508
- function createTuningJobConfigToVertex(fromObject, parentObject) {
14508
+ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14509
14509
  const toObject = {};
14510
14510
  const fromValidationDataset = getValueByPath(fromObject, [
14511
14511
  'validationDataset',
14512
14512
  ]);
14513
14513
  if (parentObject !== undefined && fromValidationDataset != null) {
14514
- setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset, toObject));
14514
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
14515
14515
  }
14516
14516
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
14517
14517
  'tunedModelDisplayName',
@@ -14555,7 +14555,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
14555
14555
  }
14556
14556
  return toObject;
14557
14557
  }
14558
- function createTuningJobParametersPrivateToMldev(fromObject) {
14558
+ function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
14559
14559
  const toObject = {};
14560
14560
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
14561
14561
  if (fromBaseModel != null) {
@@ -14579,7 +14579,7 @@ function createTuningJobParametersPrivateToMldev(fromObject) {
14579
14579
  }
14580
14580
  return toObject;
14581
14581
  }
14582
- function createTuningJobParametersPrivateToVertex(fromObject) {
14582
+ function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
14583
14583
  const toObject = {};
14584
14584
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
14585
14585
  if (fromBaseModel != null) {
@@ -14595,7 +14595,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
14595
14595
  'trainingDataset',
14596
14596
  ]);
14597
14597
  if (fromTrainingDataset != null) {
14598
- setValueByPath(toObject, ['supervisedTuningSpec', 'trainingDatasetUri'], tuningDatasetToVertex(fromTrainingDataset, toObject));
14598
+ tuningDatasetToVertex(fromTrainingDataset, toObject);
14599
14599
  }
14600
14600
  const fromConfig = getValueByPath(fromObject, ['config']);
14601
14601
  if (fromConfig != null) {
@@ -14603,7 +14603,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
14603
14603
  }
14604
14604
  return toObject;
14605
14605
  }
14606
- function getTuningJobParametersToMldev(fromObject) {
14606
+ function getTuningJobParametersToMldev(fromObject, _rootObject) {
14607
14607
  const toObject = {};
14608
14608
  const fromName = getValueByPath(fromObject, ['name']);
14609
14609
  if (fromName != null) {
@@ -14611,7 +14611,7 @@ function getTuningJobParametersToMldev(fromObject) {
14611
14611
  }
14612
14612
  return toObject;
14613
14613
  }
14614
- function getTuningJobParametersToVertex(fromObject) {
14614
+ function getTuningJobParametersToVertex(fromObject, _rootObject) {
14615
14615
  const toObject = {};
14616
14616
  const fromName = getValueByPath(fromObject, ['name']);
14617
14617
  if (fromName != null) {
@@ -14619,7 +14619,7 @@ function getTuningJobParametersToVertex(fromObject) {
14619
14619
  }
14620
14620
  return toObject;
14621
14621
  }
14622
- function listTuningJobsConfigToMldev(fromObject, parentObject) {
14622
+ function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
14623
14623
  const toObject = {};
14624
14624
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14625
14625
  if (parentObject !== undefined && fromPageSize != null) {
@@ -14635,7 +14635,7 @@ function listTuningJobsConfigToMldev(fromObject, parentObject) {
14635
14635
  }
14636
14636
  return toObject;
14637
14637
  }
14638
- function listTuningJobsConfigToVertex(fromObject, parentObject) {
14638
+ function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
14639
14639
  const toObject = {};
14640
14640
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14641
14641
  if (parentObject !== undefined && fromPageSize != null) {
@@ -14651,7 +14651,7 @@ function listTuningJobsConfigToVertex(fromObject, parentObject) {
14651
14651
  }
14652
14652
  return toObject;
14653
14653
  }
14654
- function listTuningJobsParametersToMldev(fromObject) {
14654
+ function listTuningJobsParametersToMldev(fromObject, rootObject) {
14655
14655
  const toObject = {};
14656
14656
  const fromConfig = getValueByPath(fromObject, ['config']);
14657
14657
  if (fromConfig != null) {
@@ -14659,7 +14659,7 @@ function listTuningJobsParametersToMldev(fromObject) {
14659
14659
  }
14660
14660
  return toObject;
14661
14661
  }
14662
- function listTuningJobsParametersToVertex(fromObject) {
14662
+ function listTuningJobsParametersToVertex(fromObject, rootObject) {
14663
14663
  const toObject = {};
14664
14664
  const fromConfig = getValueByPath(fromObject, ['config']);
14665
14665
  if (fromConfig != null) {
@@ -14667,7 +14667,7 @@ function listTuningJobsParametersToVertex(fromObject) {
14667
14667
  }
14668
14668
  return toObject;
14669
14669
  }
14670
- function listTuningJobsResponseFromMldev(fromObject) {
14670
+ function listTuningJobsResponseFromMldev(fromObject, rootObject) {
14671
14671
  const toObject = {};
14672
14672
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14673
14673
  'sdkHttpResponse',
@@ -14693,7 +14693,7 @@ function listTuningJobsResponseFromMldev(fromObject) {
14693
14693
  }
14694
14694
  return toObject;
14695
14695
  }
14696
- function listTuningJobsResponseFromVertex(fromObject) {
14696
+ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
14697
14697
  const toObject = {};
14698
14698
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14699
14699
  'sdkHttpResponse',
@@ -14719,7 +14719,7 @@ function listTuningJobsResponseFromVertex(fromObject) {
14719
14719
  }
14720
14720
  return toObject;
14721
14721
  }
14722
- function tunedModelFromMldev(fromObject) {
14722
+ function tunedModelFromMldev(fromObject, _rootObject) {
14723
14723
  const toObject = {};
14724
14724
  const fromModel = getValueByPath(fromObject, ['name']);
14725
14725
  if (fromModel != null) {
@@ -14731,7 +14731,7 @@ function tunedModelFromMldev(fromObject) {
14731
14731
  }
14732
14732
  return toObject;
14733
14733
  }
14734
- function tuningDatasetToMldev(fromObject) {
14734
+ function tuningDatasetToMldev(fromObject, _rootObject) {
14735
14735
  const toObject = {};
14736
14736
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
14737
14737
  throw new Error('gcsUri parameter is not supported in Gemini API.');
@@ -14751,7 +14751,7 @@ function tuningDatasetToMldev(fromObject) {
14751
14751
  }
14752
14752
  return toObject;
14753
14753
  }
14754
- function tuningDatasetToVertex(fromObject, parentObject) {
14754
+ function tuningDatasetToVertex(fromObject, parentObject, _rootObject) {
14755
14755
  const toObject = {};
14756
14756
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14757
14757
  if (parentObject !== undefined && fromGcsUri != null) {
@@ -14768,7 +14768,7 @@ function tuningDatasetToVertex(fromObject, parentObject) {
14768
14768
  }
14769
14769
  return toObject;
14770
14770
  }
14771
- function tuningJobFromMldev(fromObject) {
14771
+ function tuningJobFromMldev(fromObject, rootObject) {
14772
14772
  const toObject = {};
14773
14773
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14774
14774
  'sdkHttpResponse',
@@ -14820,7 +14820,7 @@ function tuningJobFromMldev(fromObject) {
14820
14820
  }
14821
14821
  return toObject;
14822
14822
  }
14823
- function tuningJobFromVertex(fromObject) {
14823
+ function tuningJobFromVertex(fromObject, _rootObject) {
14824
14824
  const toObject = {};
14825
14825
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14826
14826
  'sdkHttpResponse',
@@ -14940,7 +14940,7 @@ function tuningJobFromVertex(fromObject) {
14940
14940
  }
14941
14941
  return toObject;
14942
14942
  }
14943
- function tuningOperationFromMldev(fromObject) {
14943
+ function tuningOperationFromMldev(fromObject, _rootObject) {
14944
14944
  const toObject = {};
14945
14945
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14946
14946
  'sdkHttpResponse',
@@ -14966,7 +14966,7 @@ function tuningOperationFromMldev(fromObject) {
14966
14966
  }
14967
14967
  return toObject;
14968
14968
  }
14969
- function tuningValidationDatasetToVertex(fromObject, parentObject) {
14969
+ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
14970
14970
  const toObject = {};
14971
14971
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14972
14972
  if (fromGcsUri != null) {
@@ -14975,8 +14975,8 @@ function tuningValidationDatasetToVertex(fromObject, parentObject) {
14975
14975
  const fromVertexDatasetResource = getValueByPath(fromObject, [
14976
14976
  'vertexDatasetResource',
14977
14977
  ]);
14978
- if (parentObject !== undefined && fromVertexDatasetResource != null) {
14979
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
14978
+ if (fromVertexDatasetResource != null) {
14979
+ setValueByPath(toObject, ['validationDatasetUri'], fromVertexDatasetResource);
14980
14980
  }
14981
14981
  return toObject;
14982
14982
  }
@@ -15329,7 +15329,8 @@ class WebAuth {
15329
15329
  constructor(apiKey) {
15330
15330
  this.apiKey = apiKey;
15331
15331
  }
15332
- async addAuthHeaders(headers) {
15332
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15333
+ async addAuthHeaders(headers, url) {
15333
15334
  if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
15334
15335
  return;
15335
15336
  }