@google/genai 1.25.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/genai.d.ts +139 -116
- package/dist/index.cjs +96 -115
- package/dist/index.mjs +96 -115
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +100 -120
- package/dist/node/index.mjs +100 -120
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +139 -116
- package/dist/web/index.mjs +96 -115
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +139 -116
- package/package.json +13 -12
package/dist/web/index.mjs
CHANGED
|
@@ -532,6 +532,26 @@ var Language;
|
|
|
532
532
|
*/
|
|
533
533
|
Language["PYTHON"] = "PYTHON";
|
|
534
534
|
})(Language || (Language = {}));
|
|
535
|
+
/** Specifies how the response should be scheduled in the conversation. */
|
|
536
|
+
var FunctionResponseScheduling;
|
|
537
|
+
(function (FunctionResponseScheduling) {
|
|
538
|
+
/**
|
|
539
|
+
* This value is unused.
|
|
540
|
+
*/
|
|
541
|
+
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
542
|
+
/**
|
|
543
|
+
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
544
|
+
*/
|
|
545
|
+
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
546
|
+
/**
|
|
547
|
+
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
548
|
+
*/
|
|
549
|
+
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
550
|
+
/**
|
|
551
|
+
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
552
|
+
*/
|
|
553
|
+
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
554
|
+
})(FunctionResponseScheduling || (FunctionResponseScheduling = {}));
|
|
535
555
|
/** Optional. The type of the data. */
|
|
536
556
|
var Type;
|
|
537
557
|
(function (Type) {
|
|
@@ -575,42 +595,46 @@ var HarmCategory;
|
|
|
575
595
|
* The harm category is unspecified.
|
|
576
596
|
*/
|
|
577
597
|
HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
|
|
578
|
-
/**
|
|
579
|
-
* The harm category is hate speech.
|
|
580
|
-
*/
|
|
581
|
-
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
582
|
-
/**
|
|
583
|
-
* The harm category is dangerous content.
|
|
584
|
-
*/
|
|
585
|
-
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
586
598
|
/**
|
|
587
599
|
* The harm category is harassment.
|
|
588
600
|
*/
|
|
589
601
|
HarmCategory["HARM_CATEGORY_HARASSMENT"] = "HARM_CATEGORY_HARASSMENT";
|
|
602
|
+
/**
|
|
603
|
+
* The harm category is hate speech.
|
|
604
|
+
*/
|
|
605
|
+
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
590
606
|
/**
|
|
591
607
|
* The harm category is sexually explicit content.
|
|
592
608
|
*/
|
|
593
609
|
HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
|
|
610
|
+
/**
|
|
611
|
+
* The harm category is dangerous content.
|
|
612
|
+
*/
|
|
613
|
+
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
594
614
|
/**
|
|
595
615
|
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
596
616
|
*/
|
|
597
617
|
HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
598
618
|
/**
|
|
599
|
-
* The harm category is image hate.
|
|
619
|
+
* The harm category is image hate. This enum value is not supported in Gemini API.
|
|
600
620
|
*/
|
|
601
621
|
HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
|
|
602
622
|
/**
|
|
603
|
-
* The harm category is image dangerous content.
|
|
623
|
+
* The harm category is image dangerous content. This enum value is not supported in Gemini API.
|
|
604
624
|
*/
|
|
605
625
|
HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
|
|
606
626
|
/**
|
|
607
|
-
* The harm category is image harassment.
|
|
627
|
+
* The harm category is image harassment. This enum value is not supported in Gemini API.
|
|
608
628
|
*/
|
|
609
629
|
HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
|
|
610
630
|
/**
|
|
611
|
-
* The harm category is image sexually explicit content.
|
|
631
|
+
* The harm category is image sexually explicit content. This enum value is not supported in Gemini API.
|
|
612
632
|
*/
|
|
613
633
|
HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
|
|
634
|
+
/**
|
|
635
|
+
* The harm category is for jailbreak prompts. This enum value is not supported in Gemini API.
|
|
636
|
+
*/
|
|
637
|
+
HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
|
|
614
638
|
})(HarmCategory || (HarmCategory = {}));
|
|
615
639
|
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
616
640
|
var HarmBlockMethod;
|
|
@@ -851,33 +875,41 @@ var HarmSeverity;
|
|
|
851
875
|
*/
|
|
852
876
|
HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
|
|
853
877
|
})(HarmSeverity || (HarmSeverity = {}));
|
|
854
|
-
/** Output only.
|
|
878
|
+
/** Output only. The reason why the prompt was blocked. */
|
|
855
879
|
var BlockedReason;
|
|
856
880
|
(function (BlockedReason) {
|
|
857
881
|
/**
|
|
858
|
-
*
|
|
882
|
+
* The blocked reason is unspecified.
|
|
859
883
|
*/
|
|
860
884
|
BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
|
|
861
885
|
/**
|
|
862
|
-
*
|
|
886
|
+
* The prompt was blocked for safety reasons.
|
|
863
887
|
*/
|
|
864
888
|
BlockedReason["SAFETY"] = "SAFETY";
|
|
865
889
|
/**
|
|
866
|
-
*
|
|
890
|
+
* The prompt was blocked for other reasons. For example, it may be due to the prompt's language, or because it contains other harmful content.
|
|
867
891
|
*/
|
|
868
892
|
BlockedReason["OTHER"] = "OTHER";
|
|
869
893
|
/**
|
|
870
|
-
*
|
|
894
|
+
* The prompt was blocked because it contains a term from the terminology blocklist.
|
|
871
895
|
*/
|
|
872
896
|
BlockedReason["BLOCKLIST"] = "BLOCKLIST";
|
|
873
897
|
/**
|
|
874
|
-
*
|
|
898
|
+
* The prompt was blocked because it contains prohibited content.
|
|
875
899
|
*/
|
|
876
900
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
877
901
|
/**
|
|
878
|
-
*
|
|
902
|
+
* The prompt was blocked because it contains content that is unsafe for image generation.
|
|
879
903
|
*/
|
|
880
904
|
BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
905
|
+
/**
|
|
906
|
+
* The prompt was blocked by Model Armor. This enum value is not supported in Gemini API.
|
|
907
|
+
*/
|
|
908
|
+
BlockedReason["MODEL_ARMOR"] = "MODEL_ARMOR";
|
|
909
|
+
/**
|
|
910
|
+
* The prompt was blocked as a jailbreak attempt. This enum value is not supported in Gemini API.
|
|
911
|
+
*/
|
|
912
|
+
BlockedReason["JAILBREAK"] = "JAILBREAK";
|
|
881
913
|
})(BlockedReason || (BlockedReason = {}));
|
|
882
914
|
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
883
915
|
var TrafficType;
|
|
@@ -1412,26 +1444,6 @@ var TurnCoverage;
|
|
|
1412
1444
|
*/
|
|
1413
1445
|
TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
|
|
1414
1446
|
})(TurnCoverage || (TurnCoverage = {}));
|
|
1415
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
1416
|
-
var FunctionResponseScheduling;
|
|
1417
|
-
(function (FunctionResponseScheduling) {
|
|
1418
|
-
/**
|
|
1419
|
-
* This value is unused.
|
|
1420
|
-
*/
|
|
1421
|
-
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
1422
|
-
/**
|
|
1423
|
-
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
1424
|
-
*/
|
|
1425
|
-
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
1426
|
-
/**
|
|
1427
|
-
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
1428
|
-
*/
|
|
1429
|
-
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
1430
|
-
/**
|
|
1431
|
-
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
1432
|
-
*/
|
|
1433
|
-
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
1434
|
-
})(FunctionResponseScheduling || (FunctionResponseScheduling = {}));
|
|
1435
1447
|
/** Scale of the generated music. */
|
|
1436
1448
|
var Scale;
|
|
1437
1449
|
(function (Scale) {
|
|
@@ -1729,10 +1741,10 @@ class HttpResponse {
|
|
|
1729
1741
|
return this.responseInternal.json();
|
|
1730
1742
|
}
|
|
1731
1743
|
}
|
|
1732
|
-
/** Content filter results for a prompt sent in the request. */
|
|
1744
|
+
/** 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. */
|
|
1733
1745
|
class GenerateContentResponsePromptFeedback {
|
|
1734
1746
|
}
|
|
1735
|
-
/** Usage metadata about response(s). */
|
|
1747
|
+
/** Usage metadata about response(s). This data type is not supported in Gemini API. */
|
|
1736
1748
|
class GenerateContentResponseUsageMetadata {
|
|
1737
1749
|
}
|
|
1738
1750
|
/** Response message for PredictionService.GenerateContent. */
|
|
@@ -6784,6 +6796,10 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
6784
6796
|
if (fromTopP != null) {
|
|
6785
6797
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
6786
6798
|
}
|
|
6799
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
6800
|
+
undefined) {
|
|
6801
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
6802
|
+
}
|
|
6787
6803
|
return toObject;
|
|
6788
6804
|
}
|
|
6789
6805
|
function googleMapsToMldev$2(fromObject) {
|
|
@@ -9443,6 +9459,10 @@ function generationConfigToVertex(fromObject) {
|
|
|
9443
9459
|
if (fromTopP != null) {
|
|
9444
9460
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
9445
9461
|
}
|
|
9462
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
9463
|
+
undefined) {
|
|
9464
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
9465
|
+
}
|
|
9446
9466
|
return toObject;
|
|
9447
9467
|
}
|
|
9448
9468
|
function getModelParametersToMldev(apiClient, fromObject) {
|
|
@@ -10567,7 +10587,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10567
10587
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10568
10588
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10569
10589
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10570
|
-
const SDK_VERSION = '1.
|
|
10590
|
+
const SDK_VERSION = '1.27.0'; // x-release-please-version
|
|
10571
10591
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10572
10592
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10573
10593
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -10756,7 +10776,7 @@ class ApiClient {
|
|
|
10756
10776
|
else {
|
|
10757
10777
|
requestInit.body = request.body;
|
|
10758
10778
|
}
|
|
10759
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
10779
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
10760
10780
|
return this.unaryApiCall(url, requestInit, request.httpMethod);
|
|
10761
10781
|
}
|
|
10762
10782
|
patchHttpOptions(baseHttpOptions, requestHttpOptions) {
|
|
@@ -10790,10 +10810,10 @@ class ApiClient {
|
|
|
10790
10810
|
}
|
|
10791
10811
|
let requestInit = {};
|
|
10792
10812
|
requestInit.body = request.body;
|
|
10793
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
10813
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
10794
10814
|
return this.streamApiCall(url, requestInit, request.httpMethod);
|
|
10795
10815
|
}
|
|
10796
|
-
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, abortSignal) {
|
|
10816
|
+
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, url, abortSignal) {
|
|
10797
10817
|
if ((httpOptions && httpOptions.timeout) || abortSignal) {
|
|
10798
10818
|
const abortController = new AbortController();
|
|
10799
10819
|
const signal = abortController.signal;
|
|
@@ -10817,7 +10837,7 @@ class ApiClient {
|
|
|
10817
10837
|
if (httpOptions && httpOptions.extraBody !== null) {
|
|
10818
10838
|
includeExtraBodyToRequestInit(requestInit, httpOptions.extraBody);
|
|
10819
10839
|
}
|
|
10820
|
-
requestInit.headers = await this.getHeadersInternal(httpOptions);
|
|
10840
|
+
requestInit.headers = await this.getHeadersInternal(httpOptions, url);
|
|
10821
10841
|
return requestInit;
|
|
10822
10842
|
}
|
|
10823
10843
|
async unaryApiCall(url, requestInit, httpMethod) {
|
|
@@ -10930,7 +10950,7 @@ class ApiClient {
|
|
|
10930
10950
|
headers[CONTENT_TYPE_HEADER] = 'application/json';
|
|
10931
10951
|
return headers;
|
|
10932
10952
|
}
|
|
10933
|
-
async getHeadersInternal(httpOptions) {
|
|
10953
|
+
async getHeadersInternal(httpOptions, url) {
|
|
10934
10954
|
const headers = new Headers();
|
|
10935
10955
|
if (httpOptions && httpOptions.headers) {
|
|
10936
10956
|
for (const [key, value] of Object.entries(httpOptions.headers)) {
|
|
@@ -10942,7 +10962,7 @@ class ApiClient {
|
|
|
10942
10962
|
headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
|
|
10943
10963
|
}
|
|
10944
10964
|
}
|
|
10945
|
-
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
10965
|
+
await this.clientOptions.auth.addAuthHeaders(headers, url);
|
|
10946
10966
|
return headers;
|
|
10947
10967
|
}
|
|
10948
10968
|
/**
|
|
@@ -11655,7 +11675,7 @@ class Live {
|
|
|
11655
11675
|
const headers = mapToHeaders(clientHeaders);
|
|
11656
11676
|
if (this.apiClient.isVertexAI()) {
|
|
11657
11677
|
url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
|
|
11658
|
-
await this.auth.addAuthHeaders(headers);
|
|
11678
|
+
await this.auth.addAuthHeaders(headers, url);
|
|
11659
11679
|
}
|
|
11660
11680
|
else {
|
|
11661
11681
|
const apiKey = this.apiClient.getApiKey();
|
|
@@ -14328,7 +14348,7 @@ class Tokens extends BaseModule {
|
|
|
14328
14348
|
* SPDX-License-Identifier: Apache-2.0
|
|
14329
14349
|
*/
|
|
14330
14350
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
14331
|
-
function cancelTuningJobParametersToMldev(fromObject) {
|
|
14351
|
+
function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
|
|
14332
14352
|
const toObject = {};
|
|
14333
14353
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14334
14354
|
if (fromName != null) {
|
|
@@ -14336,7 +14356,7 @@ function cancelTuningJobParametersToMldev(fromObject) {
|
|
|
14336
14356
|
}
|
|
14337
14357
|
return toObject;
|
|
14338
14358
|
}
|
|
14339
|
-
function cancelTuningJobParametersToVertex(fromObject) {
|
|
14359
|
+
function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
14340
14360
|
const toObject = {};
|
|
14341
14361
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14342
14362
|
if (fromName != null) {
|
|
@@ -14344,7 +14364,7 @@ function cancelTuningJobParametersToVertex(fromObject) {
|
|
|
14344
14364
|
}
|
|
14345
14365
|
return toObject;
|
|
14346
14366
|
}
|
|
14347
|
-
function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
14367
|
+
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
14348
14368
|
const toObject = {};
|
|
14349
14369
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
14350
14370
|
throw new Error('validationDataset parameter is not supported in Gemini API.');
|
|
@@ -14392,13 +14412,13 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
14392
14412
|
}
|
|
14393
14413
|
return toObject;
|
|
14394
14414
|
}
|
|
14395
|
-
function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
14415
|
+
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
14396
14416
|
const toObject = {};
|
|
14397
14417
|
const fromValidationDataset = getValueByPath(fromObject, [
|
|
14398
14418
|
'validationDataset',
|
|
14399
14419
|
]);
|
|
14400
14420
|
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
14401
|
-
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset
|
|
14421
|
+
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
14402
14422
|
}
|
|
14403
14423
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14404
14424
|
'tunedModelDisplayName',
|
|
@@ -14442,7 +14462,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
14442
14462
|
}
|
|
14443
14463
|
return toObject;
|
|
14444
14464
|
}
|
|
14445
|
-
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
14465
|
+
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
14446
14466
|
const toObject = {};
|
|
14447
14467
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
14448
14468
|
if (fromBaseModel != null) {
|
|
@@ -14466,7 +14486,7 @@ function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
|
14466
14486
|
}
|
|
14467
14487
|
return toObject;
|
|
14468
14488
|
}
|
|
14469
|
-
function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
14489
|
+
function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
|
|
14470
14490
|
const toObject = {};
|
|
14471
14491
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
14472
14492
|
if (fromBaseModel != null) {
|
|
@@ -14482,7 +14502,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
|
14482
14502
|
'trainingDataset',
|
|
14483
14503
|
]);
|
|
14484
14504
|
if (fromTrainingDataset != null) {
|
|
14485
|
-
|
|
14505
|
+
tuningDatasetToVertex(fromTrainingDataset, toObject);
|
|
14486
14506
|
}
|
|
14487
14507
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14488
14508
|
if (fromConfig != null) {
|
|
@@ -14490,7 +14510,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
|
14490
14510
|
}
|
|
14491
14511
|
return toObject;
|
|
14492
14512
|
}
|
|
14493
|
-
function getTuningJobParametersToMldev(fromObject) {
|
|
14513
|
+
function getTuningJobParametersToMldev(fromObject, _rootObject) {
|
|
14494
14514
|
const toObject = {};
|
|
14495
14515
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14496
14516
|
if (fromName != null) {
|
|
@@ -14498,7 +14518,7 @@ function getTuningJobParametersToMldev(fromObject) {
|
|
|
14498
14518
|
}
|
|
14499
14519
|
return toObject;
|
|
14500
14520
|
}
|
|
14501
|
-
function getTuningJobParametersToVertex(fromObject) {
|
|
14521
|
+
function getTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
14502
14522
|
const toObject = {};
|
|
14503
14523
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14504
14524
|
if (fromName != null) {
|
|
@@ -14506,7 +14526,7 @@ function getTuningJobParametersToVertex(fromObject) {
|
|
|
14506
14526
|
}
|
|
14507
14527
|
return toObject;
|
|
14508
14528
|
}
|
|
14509
|
-
function listTuningJobsConfigToMldev(fromObject, parentObject) {
|
|
14529
|
+
function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
14510
14530
|
const toObject = {};
|
|
14511
14531
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14512
14532
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -14522,7 +14542,7 @@ function listTuningJobsConfigToMldev(fromObject, parentObject) {
|
|
|
14522
14542
|
}
|
|
14523
14543
|
return toObject;
|
|
14524
14544
|
}
|
|
14525
|
-
function listTuningJobsConfigToVertex(fromObject, parentObject) {
|
|
14545
|
+
function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
14526
14546
|
const toObject = {};
|
|
14527
14547
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14528
14548
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -14538,7 +14558,7 @@ function listTuningJobsConfigToVertex(fromObject, parentObject) {
|
|
|
14538
14558
|
}
|
|
14539
14559
|
return toObject;
|
|
14540
14560
|
}
|
|
14541
|
-
function listTuningJobsParametersToMldev(fromObject) {
|
|
14561
|
+
function listTuningJobsParametersToMldev(fromObject, rootObject) {
|
|
14542
14562
|
const toObject = {};
|
|
14543
14563
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14544
14564
|
if (fromConfig != null) {
|
|
@@ -14546,7 +14566,7 @@ function listTuningJobsParametersToMldev(fromObject) {
|
|
|
14546
14566
|
}
|
|
14547
14567
|
return toObject;
|
|
14548
14568
|
}
|
|
14549
|
-
function listTuningJobsParametersToVertex(fromObject) {
|
|
14569
|
+
function listTuningJobsParametersToVertex(fromObject, rootObject) {
|
|
14550
14570
|
const toObject = {};
|
|
14551
14571
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14552
14572
|
if (fromConfig != null) {
|
|
@@ -14554,7 +14574,7 @@ function listTuningJobsParametersToVertex(fromObject) {
|
|
|
14554
14574
|
}
|
|
14555
14575
|
return toObject;
|
|
14556
14576
|
}
|
|
14557
|
-
function listTuningJobsResponseFromMldev(fromObject) {
|
|
14577
|
+
function listTuningJobsResponseFromMldev(fromObject, rootObject) {
|
|
14558
14578
|
const toObject = {};
|
|
14559
14579
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14560
14580
|
'sdkHttpResponse',
|
|
@@ -14580,7 +14600,7 @@ function listTuningJobsResponseFromMldev(fromObject) {
|
|
|
14580
14600
|
}
|
|
14581
14601
|
return toObject;
|
|
14582
14602
|
}
|
|
14583
|
-
function listTuningJobsResponseFromVertex(fromObject) {
|
|
14603
|
+
function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
14584
14604
|
const toObject = {};
|
|
14585
14605
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14586
14606
|
'sdkHttpResponse',
|
|
@@ -14606,7 +14626,7 @@ function listTuningJobsResponseFromVertex(fromObject) {
|
|
|
14606
14626
|
}
|
|
14607
14627
|
return toObject;
|
|
14608
14628
|
}
|
|
14609
|
-
function tunedModelFromMldev(fromObject) {
|
|
14629
|
+
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
14610
14630
|
const toObject = {};
|
|
14611
14631
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
14612
14632
|
if (fromModel != null) {
|
|
@@ -14618,7 +14638,7 @@ function tunedModelFromMldev(fromObject) {
|
|
|
14618
14638
|
}
|
|
14619
14639
|
return toObject;
|
|
14620
14640
|
}
|
|
14621
|
-
function tuningDatasetToMldev(fromObject) {
|
|
14641
|
+
function tuningDatasetToMldev(fromObject, _rootObject) {
|
|
14622
14642
|
const toObject = {};
|
|
14623
14643
|
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
14624
14644
|
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
@@ -14638,7 +14658,7 @@ function tuningDatasetToMldev(fromObject) {
|
|
|
14638
14658
|
}
|
|
14639
14659
|
return toObject;
|
|
14640
14660
|
}
|
|
14641
|
-
function tuningDatasetToVertex(fromObject, parentObject) {
|
|
14661
|
+
function tuningDatasetToVertex(fromObject, parentObject, _rootObject) {
|
|
14642
14662
|
const toObject = {};
|
|
14643
14663
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
14644
14664
|
if (parentObject !== undefined && fromGcsUri != null) {
|
|
@@ -14655,7 +14675,7 @@ function tuningDatasetToVertex(fromObject, parentObject) {
|
|
|
14655
14675
|
}
|
|
14656
14676
|
return toObject;
|
|
14657
14677
|
}
|
|
14658
|
-
function tuningJobFromMldev(fromObject) {
|
|
14678
|
+
function tuningJobFromMldev(fromObject, rootObject) {
|
|
14659
14679
|
const toObject = {};
|
|
14660
14680
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14661
14681
|
'sdkHttpResponse',
|
|
@@ -14705,49 +14725,9 @@ function tuningJobFromMldev(fromObject) {
|
|
|
14705
14725
|
if (fromTunedModel != null) {
|
|
14706
14726
|
setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
|
|
14707
14727
|
}
|
|
14708
|
-
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
14709
|
-
'customBaseModel',
|
|
14710
|
-
]);
|
|
14711
|
-
if (fromCustomBaseModel != null) {
|
|
14712
|
-
setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
|
|
14713
|
-
}
|
|
14714
|
-
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
14715
|
-
if (fromExperiment != null) {
|
|
14716
|
-
setValueByPath(toObject, ['experiment'], fromExperiment);
|
|
14717
|
-
}
|
|
14718
|
-
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
14719
|
-
if (fromLabels != null) {
|
|
14720
|
-
setValueByPath(toObject, ['labels'], fromLabels);
|
|
14721
|
-
}
|
|
14722
|
-
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
14723
|
-
if (fromOutputUri != null) {
|
|
14724
|
-
setValueByPath(toObject, ['outputUri'], fromOutputUri);
|
|
14725
|
-
}
|
|
14726
|
-
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
14727
|
-
if (fromPipelineJob != null) {
|
|
14728
|
-
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
14729
|
-
}
|
|
14730
|
-
const fromServiceAccount = getValueByPath(fromObject, [
|
|
14731
|
-
'serviceAccount',
|
|
14732
|
-
]);
|
|
14733
|
-
if (fromServiceAccount != null) {
|
|
14734
|
-
setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
|
|
14735
|
-
}
|
|
14736
|
-
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14737
|
-
'tunedModelDisplayName',
|
|
14738
|
-
]);
|
|
14739
|
-
if (fromTunedModelDisplayName != null) {
|
|
14740
|
-
setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
|
|
14741
|
-
}
|
|
14742
|
-
const fromVeoTuningSpec = getValueByPath(fromObject, [
|
|
14743
|
-
'veoTuningSpec',
|
|
14744
|
-
]);
|
|
14745
|
-
if (fromVeoTuningSpec != null) {
|
|
14746
|
-
setValueByPath(toObject, ['veoTuningSpec'], fromVeoTuningSpec);
|
|
14747
|
-
}
|
|
14748
14728
|
return toObject;
|
|
14749
14729
|
}
|
|
14750
|
-
function tuningJobFromVertex(fromObject) {
|
|
14730
|
+
function tuningJobFromVertex(fromObject, _rootObject) {
|
|
14751
14731
|
const toObject = {};
|
|
14752
14732
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14753
14733
|
'sdkHttpResponse',
|
|
@@ -14867,7 +14847,7 @@ function tuningJobFromVertex(fromObject) {
|
|
|
14867
14847
|
}
|
|
14868
14848
|
return toObject;
|
|
14869
14849
|
}
|
|
14870
|
-
function tuningOperationFromMldev(fromObject) {
|
|
14850
|
+
function tuningOperationFromMldev(fromObject, _rootObject) {
|
|
14871
14851
|
const toObject = {};
|
|
14872
14852
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14873
14853
|
'sdkHttpResponse',
|
|
@@ -14893,7 +14873,7 @@ function tuningOperationFromMldev(fromObject) {
|
|
|
14893
14873
|
}
|
|
14894
14874
|
return toObject;
|
|
14895
14875
|
}
|
|
14896
|
-
function tuningValidationDatasetToVertex(fromObject,
|
|
14876
|
+
function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
14897
14877
|
const toObject = {};
|
|
14898
14878
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
14899
14879
|
if (fromGcsUri != null) {
|
|
@@ -14902,8 +14882,8 @@ function tuningValidationDatasetToVertex(fromObject, parentObject) {
|
|
|
14902
14882
|
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
14903
14883
|
'vertexDatasetResource',
|
|
14904
14884
|
]);
|
|
14905
|
-
if (
|
|
14906
|
-
setValueByPath(
|
|
14885
|
+
if (fromVertexDatasetResource != null) {
|
|
14886
|
+
setValueByPath(toObject, ['validationDatasetUri'], fromVertexDatasetResource);
|
|
14907
14887
|
}
|
|
14908
14888
|
return toObject;
|
|
14909
14889
|
}
|
|
@@ -15389,7 +15369,8 @@ class WebAuth {
|
|
|
15389
15369
|
constructor(apiKey) {
|
|
15390
15370
|
this.apiKey = apiKey;
|
|
15391
15371
|
}
|
|
15392
|
-
|
|
15372
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15373
|
+
async addAuthHeaders(headers, url) {
|
|
15393
15374
|
if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
|
|
15394
15375
|
return;
|
|
15395
15376
|
}
|