@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/node/index.cjs
CHANGED
|
@@ -560,6 +560,26 @@ exports.Language = void 0;
|
|
|
560
560
|
*/
|
|
561
561
|
Language["PYTHON"] = "PYTHON";
|
|
562
562
|
})(exports.Language || (exports.Language = {}));
|
|
563
|
+
/** Specifies how the response should be scheduled in the conversation. */
|
|
564
|
+
exports.FunctionResponseScheduling = void 0;
|
|
565
|
+
(function (FunctionResponseScheduling) {
|
|
566
|
+
/**
|
|
567
|
+
* This value is unused.
|
|
568
|
+
*/
|
|
569
|
+
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
570
|
+
/**
|
|
571
|
+
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
572
|
+
*/
|
|
573
|
+
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
574
|
+
/**
|
|
575
|
+
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
576
|
+
*/
|
|
577
|
+
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
578
|
+
/**
|
|
579
|
+
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
580
|
+
*/
|
|
581
|
+
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
582
|
+
})(exports.FunctionResponseScheduling || (exports.FunctionResponseScheduling = {}));
|
|
563
583
|
/** Optional. The type of the data. */
|
|
564
584
|
exports.Type = void 0;
|
|
565
585
|
(function (Type) {
|
|
@@ -603,42 +623,46 @@ exports.HarmCategory = void 0;
|
|
|
603
623
|
* The harm category is unspecified.
|
|
604
624
|
*/
|
|
605
625
|
HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
|
|
606
|
-
/**
|
|
607
|
-
* The harm category is hate speech.
|
|
608
|
-
*/
|
|
609
|
-
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
610
|
-
/**
|
|
611
|
-
* The harm category is dangerous content.
|
|
612
|
-
*/
|
|
613
|
-
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
614
626
|
/**
|
|
615
627
|
* The harm category is harassment.
|
|
616
628
|
*/
|
|
617
629
|
HarmCategory["HARM_CATEGORY_HARASSMENT"] = "HARM_CATEGORY_HARASSMENT";
|
|
630
|
+
/**
|
|
631
|
+
* The harm category is hate speech.
|
|
632
|
+
*/
|
|
633
|
+
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
618
634
|
/**
|
|
619
635
|
* The harm category is sexually explicit content.
|
|
620
636
|
*/
|
|
621
637
|
HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
|
|
638
|
+
/**
|
|
639
|
+
* The harm category is dangerous content.
|
|
640
|
+
*/
|
|
641
|
+
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
622
642
|
/**
|
|
623
643
|
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
624
644
|
*/
|
|
625
645
|
HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
626
646
|
/**
|
|
627
|
-
* The harm category is image hate.
|
|
647
|
+
* The harm category is image hate. This enum value is not supported in Gemini API.
|
|
628
648
|
*/
|
|
629
649
|
HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
|
|
630
650
|
/**
|
|
631
|
-
* The harm category is image dangerous content.
|
|
651
|
+
* The harm category is image dangerous content. This enum value is not supported in Gemini API.
|
|
632
652
|
*/
|
|
633
653
|
HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
|
|
634
654
|
/**
|
|
635
|
-
* The harm category is image harassment.
|
|
655
|
+
* The harm category is image harassment. This enum value is not supported in Gemini API.
|
|
636
656
|
*/
|
|
637
657
|
HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
|
|
638
658
|
/**
|
|
639
|
-
* The harm category is image sexually explicit content.
|
|
659
|
+
* The harm category is image sexually explicit content. This enum value is not supported in Gemini API.
|
|
640
660
|
*/
|
|
641
661
|
HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
|
|
662
|
+
/**
|
|
663
|
+
* The harm category is for jailbreak prompts. This enum value is not supported in Gemini API.
|
|
664
|
+
*/
|
|
665
|
+
HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
|
|
642
666
|
})(exports.HarmCategory || (exports.HarmCategory = {}));
|
|
643
667
|
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
644
668
|
exports.HarmBlockMethod = void 0;
|
|
@@ -879,33 +903,41 @@ exports.HarmSeverity = void 0;
|
|
|
879
903
|
*/
|
|
880
904
|
HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
|
|
881
905
|
})(exports.HarmSeverity || (exports.HarmSeverity = {}));
|
|
882
|
-
/** Output only.
|
|
906
|
+
/** Output only. The reason why the prompt was blocked. */
|
|
883
907
|
exports.BlockedReason = void 0;
|
|
884
908
|
(function (BlockedReason) {
|
|
885
909
|
/**
|
|
886
|
-
*
|
|
910
|
+
* The blocked reason is unspecified.
|
|
887
911
|
*/
|
|
888
912
|
BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
|
|
889
913
|
/**
|
|
890
|
-
*
|
|
914
|
+
* The prompt was blocked for safety reasons.
|
|
891
915
|
*/
|
|
892
916
|
BlockedReason["SAFETY"] = "SAFETY";
|
|
893
917
|
/**
|
|
894
|
-
*
|
|
918
|
+
* 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.
|
|
895
919
|
*/
|
|
896
920
|
BlockedReason["OTHER"] = "OTHER";
|
|
897
921
|
/**
|
|
898
|
-
*
|
|
922
|
+
* The prompt was blocked because it contains a term from the terminology blocklist.
|
|
899
923
|
*/
|
|
900
924
|
BlockedReason["BLOCKLIST"] = "BLOCKLIST";
|
|
901
925
|
/**
|
|
902
|
-
*
|
|
926
|
+
* The prompt was blocked because it contains prohibited content.
|
|
903
927
|
*/
|
|
904
928
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
905
929
|
/**
|
|
906
|
-
*
|
|
930
|
+
* The prompt was blocked because it contains content that is unsafe for image generation.
|
|
907
931
|
*/
|
|
908
932
|
BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
933
|
+
/**
|
|
934
|
+
* The prompt was blocked by Model Armor. This enum value is not supported in Gemini API.
|
|
935
|
+
*/
|
|
936
|
+
BlockedReason["MODEL_ARMOR"] = "MODEL_ARMOR";
|
|
937
|
+
/**
|
|
938
|
+
* The prompt was blocked as a jailbreak attempt. This enum value is not supported in Gemini API.
|
|
939
|
+
*/
|
|
940
|
+
BlockedReason["JAILBREAK"] = "JAILBREAK";
|
|
909
941
|
})(exports.BlockedReason || (exports.BlockedReason = {}));
|
|
910
942
|
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
911
943
|
exports.TrafficType = void 0;
|
|
@@ -1440,26 +1472,6 @@ exports.TurnCoverage = void 0;
|
|
|
1440
1472
|
*/
|
|
1441
1473
|
TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
|
|
1442
1474
|
})(exports.TurnCoverage || (exports.TurnCoverage = {}));
|
|
1443
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
1444
|
-
exports.FunctionResponseScheduling = void 0;
|
|
1445
|
-
(function (FunctionResponseScheduling) {
|
|
1446
|
-
/**
|
|
1447
|
-
* This value is unused.
|
|
1448
|
-
*/
|
|
1449
|
-
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
1450
|
-
/**
|
|
1451
|
-
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
1452
|
-
*/
|
|
1453
|
-
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
1454
|
-
/**
|
|
1455
|
-
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
1456
|
-
*/
|
|
1457
|
-
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
1458
|
-
/**
|
|
1459
|
-
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
1460
|
-
*/
|
|
1461
|
-
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
1462
|
-
})(exports.FunctionResponseScheduling || (exports.FunctionResponseScheduling = {}));
|
|
1463
1475
|
/** Scale of the generated music. */
|
|
1464
1476
|
exports.Scale = void 0;
|
|
1465
1477
|
(function (Scale) {
|
|
@@ -1757,10 +1769,10 @@ class HttpResponse {
|
|
|
1757
1769
|
return this.responseInternal.json();
|
|
1758
1770
|
}
|
|
1759
1771
|
}
|
|
1760
|
-
/** Content filter results for a prompt sent in the request. */
|
|
1772
|
+
/** 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. */
|
|
1761
1773
|
class GenerateContentResponsePromptFeedback {
|
|
1762
1774
|
}
|
|
1763
|
-
/** Usage metadata about response(s). */
|
|
1775
|
+
/** Usage metadata about response(s). This data type is not supported in Gemini API. */
|
|
1764
1776
|
class GenerateContentResponseUsageMetadata {
|
|
1765
1777
|
}
|
|
1766
1778
|
/** Response message for PredictionService.GenerateContent. */
|
|
@@ -6812,6 +6824,10 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
6812
6824
|
if (fromTopP != null) {
|
|
6813
6825
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
6814
6826
|
}
|
|
6827
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
6828
|
+
undefined) {
|
|
6829
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
6830
|
+
}
|
|
6815
6831
|
return toObject;
|
|
6816
6832
|
}
|
|
6817
6833
|
function googleMapsToMldev$2(fromObject) {
|
|
@@ -9471,6 +9487,10 @@ function generationConfigToVertex(fromObject) {
|
|
|
9471
9487
|
if (fromTopP != null) {
|
|
9472
9488
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
9473
9489
|
}
|
|
9490
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
9491
|
+
undefined) {
|
|
9492
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
9493
|
+
}
|
|
9474
9494
|
return toObject;
|
|
9475
9495
|
}
|
|
9476
9496
|
function getModelParametersToMldev(apiClient, fromObject) {
|
|
@@ -10595,7 +10615,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10595
10615
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10596
10616
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10597
10617
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10598
|
-
const SDK_VERSION = '1.
|
|
10618
|
+
const SDK_VERSION = '1.27.0'; // x-release-please-version
|
|
10599
10619
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10600
10620
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10601
10621
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -10784,7 +10804,7 @@ class ApiClient {
|
|
|
10784
10804
|
else {
|
|
10785
10805
|
requestInit.body = request.body;
|
|
10786
10806
|
}
|
|
10787
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
10807
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
10788
10808
|
return this.unaryApiCall(url, requestInit, request.httpMethod);
|
|
10789
10809
|
}
|
|
10790
10810
|
patchHttpOptions(baseHttpOptions, requestHttpOptions) {
|
|
@@ -10818,10 +10838,10 @@ class ApiClient {
|
|
|
10818
10838
|
}
|
|
10819
10839
|
let requestInit = {};
|
|
10820
10840
|
requestInit.body = request.body;
|
|
10821
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
10841
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
10822
10842
|
return this.streamApiCall(url, requestInit, request.httpMethod);
|
|
10823
10843
|
}
|
|
10824
|
-
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, abortSignal) {
|
|
10844
|
+
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, url, abortSignal) {
|
|
10825
10845
|
if ((httpOptions && httpOptions.timeout) || abortSignal) {
|
|
10826
10846
|
const abortController = new AbortController();
|
|
10827
10847
|
const signal = abortController.signal;
|
|
@@ -10845,7 +10865,7 @@ class ApiClient {
|
|
|
10845
10865
|
if (httpOptions && httpOptions.extraBody !== null) {
|
|
10846
10866
|
includeExtraBodyToRequestInit(requestInit, httpOptions.extraBody);
|
|
10847
10867
|
}
|
|
10848
|
-
requestInit.headers = await this.getHeadersInternal(httpOptions);
|
|
10868
|
+
requestInit.headers = await this.getHeadersInternal(httpOptions, url);
|
|
10849
10869
|
return requestInit;
|
|
10850
10870
|
}
|
|
10851
10871
|
async unaryApiCall(url, requestInit, httpMethod) {
|
|
@@ -10958,7 +10978,7 @@ class ApiClient {
|
|
|
10958
10978
|
headers[CONTENT_TYPE_HEADER] = 'application/json';
|
|
10959
10979
|
return headers;
|
|
10960
10980
|
}
|
|
10961
|
-
async getHeadersInternal(httpOptions) {
|
|
10981
|
+
async getHeadersInternal(httpOptions, url) {
|
|
10962
10982
|
const headers = new Headers();
|
|
10963
10983
|
if (httpOptions && httpOptions.headers) {
|
|
10964
10984
|
for (const [key, value] of Object.entries(httpOptions.headers)) {
|
|
@@ -10970,7 +10990,7 @@ class ApiClient {
|
|
|
10970
10990
|
headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
|
|
10971
10991
|
}
|
|
10972
10992
|
}
|
|
10973
|
-
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
10993
|
+
await this.clientOptions.auth.addAuthHeaders(headers, url);
|
|
10974
10994
|
return headers;
|
|
10975
10995
|
}
|
|
10976
10996
|
/**
|
|
@@ -11683,7 +11703,7 @@ class Live {
|
|
|
11683
11703
|
const headers = mapToHeaders(clientHeaders);
|
|
11684
11704
|
if (this.apiClient.isVertexAI()) {
|
|
11685
11705
|
url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
|
|
11686
|
-
await this.auth.addAuthHeaders(headers);
|
|
11706
|
+
await this.auth.addAuthHeaders(headers, url);
|
|
11687
11707
|
}
|
|
11688
11708
|
else {
|
|
11689
11709
|
const apiKey = this.apiClient.getApiKey();
|
|
@@ -14366,7 +14386,7 @@ class NodeAuth {
|
|
|
14366
14386
|
const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
|
|
14367
14387
|
this.googleAuth = new googleAuthLibrary.GoogleAuth(vertexAuthOptions);
|
|
14368
14388
|
}
|
|
14369
|
-
async addAuthHeaders(headers) {
|
|
14389
|
+
async addAuthHeaders(headers, url) {
|
|
14370
14390
|
if (this.apiKey !== undefined) {
|
|
14371
14391
|
if (this.apiKey.startsWith('auth_tokens/')) {
|
|
14372
14392
|
throw new Error('Ephemeral tokens are only supported by the live API.');
|
|
@@ -14374,7 +14394,7 @@ class NodeAuth {
|
|
|
14374
14394
|
this.addKeyHeader(headers);
|
|
14375
14395
|
return;
|
|
14376
14396
|
}
|
|
14377
|
-
return this.addGoogleAuthHeaders(headers);
|
|
14397
|
+
return this.addGoogleAuthHeaders(headers, url);
|
|
14378
14398
|
}
|
|
14379
14399
|
addKeyHeader(headers) {
|
|
14380
14400
|
if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
|
|
@@ -14387,19 +14407,19 @@ class NodeAuth {
|
|
|
14387
14407
|
}
|
|
14388
14408
|
headers.append(GOOGLE_API_KEY_HEADER, this.apiKey);
|
|
14389
14409
|
}
|
|
14390
|
-
async addGoogleAuthHeaders(headers) {
|
|
14410
|
+
async addGoogleAuthHeaders(headers, url) {
|
|
14391
14411
|
if (this.googleAuth === undefined) {
|
|
14392
14412
|
// This should never happen, addGoogleAuthHeaders should only be
|
|
14393
14413
|
// called when there is no apiKey set and in these cases googleAuth
|
|
14394
14414
|
// is set.
|
|
14395
14415
|
throw new Error('Trying to set google-auth headers but googleAuth is unset');
|
|
14396
14416
|
}
|
|
14397
|
-
const authHeaders = await this.googleAuth.getRequestHeaders();
|
|
14398
|
-
for (const key
|
|
14417
|
+
const authHeaders = await this.googleAuth.getRequestHeaders(url);
|
|
14418
|
+
for (const [key, value] of authHeaders) {
|
|
14399
14419
|
if (headers.get(key) !== null) {
|
|
14400
14420
|
continue;
|
|
14401
14421
|
}
|
|
14402
|
-
headers.append(key,
|
|
14422
|
+
headers.append(key, value);
|
|
14403
14423
|
}
|
|
14404
14424
|
}
|
|
14405
14425
|
}
|
|
@@ -14530,7 +14550,7 @@ class NodeWebSocket {
|
|
|
14530
14550
|
* SPDX-License-Identifier: Apache-2.0
|
|
14531
14551
|
*/
|
|
14532
14552
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
14533
|
-
function cancelTuningJobParametersToMldev(fromObject) {
|
|
14553
|
+
function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
|
|
14534
14554
|
const toObject = {};
|
|
14535
14555
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14536
14556
|
if (fromName != null) {
|
|
@@ -14538,7 +14558,7 @@ function cancelTuningJobParametersToMldev(fromObject) {
|
|
|
14538
14558
|
}
|
|
14539
14559
|
return toObject;
|
|
14540
14560
|
}
|
|
14541
|
-
function cancelTuningJobParametersToVertex(fromObject) {
|
|
14561
|
+
function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
14542
14562
|
const toObject = {};
|
|
14543
14563
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14544
14564
|
if (fromName != null) {
|
|
@@ -14546,7 +14566,7 @@ function cancelTuningJobParametersToVertex(fromObject) {
|
|
|
14546
14566
|
}
|
|
14547
14567
|
return toObject;
|
|
14548
14568
|
}
|
|
14549
|
-
function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
14569
|
+
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
14550
14570
|
const toObject = {};
|
|
14551
14571
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
14552
14572
|
throw new Error('validationDataset parameter is not supported in Gemini API.');
|
|
@@ -14594,13 +14614,13 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
14594
14614
|
}
|
|
14595
14615
|
return toObject;
|
|
14596
14616
|
}
|
|
14597
|
-
function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
14617
|
+
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
14598
14618
|
const toObject = {};
|
|
14599
14619
|
const fromValidationDataset = getValueByPath(fromObject, [
|
|
14600
14620
|
'validationDataset',
|
|
14601
14621
|
]);
|
|
14602
14622
|
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
14603
|
-
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset
|
|
14623
|
+
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
14604
14624
|
}
|
|
14605
14625
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14606
14626
|
'tunedModelDisplayName',
|
|
@@ -14644,7 +14664,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
14644
14664
|
}
|
|
14645
14665
|
return toObject;
|
|
14646
14666
|
}
|
|
14647
|
-
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
14667
|
+
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
14648
14668
|
const toObject = {};
|
|
14649
14669
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
14650
14670
|
if (fromBaseModel != null) {
|
|
@@ -14668,7 +14688,7 @@ function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
|
14668
14688
|
}
|
|
14669
14689
|
return toObject;
|
|
14670
14690
|
}
|
|
14671
|
-
function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
14691
|
+
function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
|
|
14672
14692
|
const toObject = {};
|
|
14673
14693
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
14674
14694
|
if (fromBaseModel != null) {
|
|
@@ -14684,7 +14704,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
|
14684
14704
|
'trainingDataset',
|
|
14685
14705
|
]);
|
|
14686
14706
|
if (fromTrainingDataset != null) {
|
|
14687
|
-
|
|
14707
|
+
tuningDatasetToVertex(fromTrainingDataset, toObject);
|
|
14688
14708
|
}
|
|
14689
14709
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14690
14710
|
if (fromConfig != null) {
|
|
@@ -14692,7 +14712,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
|
14692
14712
|
}
|
|
14693
14713
|
return toObject;
|
|
14694
14714
|
}
|
|
14695
|
-
function getTuningJobParametersToMldev(fromObject) {
|
|
14715
|
+
function getTuningJobParametersToMldev(fromObject, _rootObject) {
|
|
14696
14716
|
const toObject = {};
|
|
14697
14717
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14698
14718
|
if (fromName != null) {
|
|
@@ -14700,7 +14720,7 @@ function getTuningJobParametersToMldev(fromObject) {
|
|
|
14700
14720
|
}
|
|
14701
14721
|
return toObject;
|
|
14702
14722
|
}
|
|
14703
|
-
function getTuningJobParametersToVertex(fromObject) {
|
|
14723
|
+
function getTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
14704
14724
|
const toObject = {};
|
|
14705
14725
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14706
14726
|
if (fromName != null) {
|
|
@@ -14708,7 +14728,7 @@ function getTuningJobParametersToVertex(fromObject) {
|
|
|
14708
14728
|
}
|
|
14709
14729
|
return toObject;
|
|
14710
14730
|
}
|
|
14711
|
-
function listTuningJobsConfigToMldev(fromObject, parentObject) {
|
|
14731
|
+
function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
14712
14732
|
const toObject = {};
|
|
14713
14733
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14714
14734
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -14724,7 +14744,7 @@ function listTuningJobsConfigToMldev(fromObject, parentObject) {
|
|
|
14724
14744
|
}
|
|
14725
14745
|
return toObject;
|
|
14726
14746
|
}
|
|
14727
|
-
function listTuningJobsConfigToVertex(fromObject, parentObject) {
|
|
14747
|
+
function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
14728
14748
|
const toObject = {};
|
|
14729
14749
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14730
14750
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -14740,7 +14760,7 @@ function listTuningJobsConfigToVertex(fromObject, parentObject) {
|
|
|
14740
14760
|
}
|
|
14741
14761
|
return toObject;
|
|
14742
14762
|
}
|
|
14743
|
-
function listTuningJobsParametersToMldev(fromObject) {
|
|
14763
|
+
function listTuningJobsParametersToMldev(fromObject, rootObject) {
|
|
14744
14764
|
const toObject = {};
|
|
14745
14765
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14746
14766
|
if (fromConfig != null) {
|
|
@@ -14748,7 +14768,7 @@ function listTuningJobsParametersToMldev(fromObject) {
|
|
|
14748
14768
|
}
|
|
14749
14769
|
return toObject;
|
|
14750
14770
|
}
|
|
14751
|
-
function listTuningJobsParametersToVertex(fromObject) {
|
|
14771
|
+
function listTuningJobsParametersToVertex(fromObject, rootObject) {
|
|
14752
14772
|
const toObject = {};
|
|
14753
14773
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14754
14774
|
if (fromConfig != null) {
|
|
@@ -14756,7 +14776,7 @@ function listTuningJobsParametersToVertex(fromObject) {
|
|
|
14756
14776
|
}
|
|
14757
14777
|
return toObject;
|
|
14758
14778
|
}
|
|
14759
|
-
function listTuningJobsResponseFromMldev(fromObject) {
|
|
14779
|
+
function listTuningJobsResponseFromMldev(fromObject, rootObject) {
|
|
14760
14780
|
const toObject = {};
|
|
14761
14781
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14762
14782
|
'sdkHttpResponse',
|
|
@@ -14782,7 +14802,7 @@ function listTuningJobsResponseFromMldev(fromObject) {
|
|
|
14782
14802
|
}
|
|
14783
14803
|
return toObject;
|
|
14784
14804
|
}
|
|
14785
|
-
function listTuningJobsResponseFromVertex(fromObject) {
|
|
14805
|
+
function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
14786
14806
|
const toObject = {};
|
|
14787
14807
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14788
14808
|
'sdkHttpResponse',
|
|
@@ -14808,7 +14828,7 @@ function listTuningJobsResponseFromVertex(fromObject) {
|
|
|
14808
14828
|
}
|
|
14809
14829
|
return toObject;
|
|
14810
14830
|
}
|
|
14811
|
-
function tunedModelFromMldev(fromObject) {
|
|
14831
|
+
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
14812
14832
|
const toObject = {};
|
|
14813
14833
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
14814
14834
|
if (fromModel != null) {
|
|
@@ -14820,7 +14840,7 @@ function tunedModelFromMldev(fromObject) {
|
|
|
14820
14840
|
}
|
|
14821
14841
|
return toObject;
|
|
14822
14842
|
}
|
|
14823
|
-
function tuningDatasetToMldev(fromObject) {
|
|
14843
|
+
function tuningDatasetToMldev(fromObject, _rootObject) {
|
|
14824
14844
|
const toObject = {};
|
|
14825
14845
|
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
14826
14846
|
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
@@ -14840,7 +14860,7 @@ function tuningDatasetToMldev(fromObject) {
|
|
|
14840
14860
|
}
|
|
14841
14861
|
return toObject;
|
|
14842
14862
|
}
|
|
14843
|
-
function tuningDatasetToVertex(fromObject, parentObject) {
|
|
14863
|
+
function tuningDatasetToVertex(fromObject, parentObject, _rootObject) {
|
|
14844
14864
|
const toObject = {};
|
|
14845
14865
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
14846
14866
|
if (parentObject !== undefined && fromGcsUri != null) {
|
|
@@ -14857,7 +14877,7 @@ function tuningDatasetToVertex(fromObject, parentObject) {
|
|
|
14857
14877
|
}
|
|
14858
14878
|
return toObject;
|
|
14859
14879
|
}
|
|
14860
|
-
function tuningJobFromMldev(fromObject) {
|
|
14880
|
+
function tuningJobFromMldev(fromObject, rootObject) {
|
|
14861
14881
|
const toObject = {};
|
|
14862
14882
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14863
14883
|
'sdkHttpResponse',
|
|
@@ -14907,49 +14927,9 @@ function tuningJobFromMldev(fromObject) {
|
|
|
14907
14927
|
if (fromTunedModel != null) {
|
|
14908
14928
|
setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
|
|
14909
14929
|
}
|
|
14910
|
-
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
14911
|
-
'customBaseModel',
|
|
14912
|
-
]);
|
|
14913
|
-
if (fromCustomBaseModel != null) {
|
|
14914
|
-
setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
|
|
14915
|
-
}
|
|
14916
|
-
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
14917
|
-
if (fromExperiment != null) {
|
|
14918
|
-
setValueByPath(toObject, ['experiment'], fromExperiment);
|
|
14919
|
-
}
|
|
14920
|
-
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
14921
|
-
if (fromLabels != null) {
|
|
14922
|
-
setValueByPath(toObject, ['labels'], fromLabels);
|
|
14923
|
-
}
|
|
14924
|
-
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
14925
|
-
if (fromOutputUri != null) {
|
|
14926
|
-
setValueByPath(toObject, ['outputUri'], fromOutputUri);
|
|
14927
|
-
}
|
|
14928
|
-
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
14929
|
-
if (fromPipelineJob != null) {
|
|
14930
|
-
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
14931
|
-
}
|
|
14932
|
-
const fromServiceAccount = getValueByPath(fromObject, [
|
|
14933
|
-
'serviceAccount',
|
|
14934
|
-
]);
|
|
14935
|
-
if (fromServiceAccount != null) {
|
|
14936
|
-
setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
|
|
14937
|
-
}
|
|
14938
|
-
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14939
|
-
'tunedModelDisplayName',
|
|
14940
|
-
]);
|
|
14941
|
-
if (fromTunedModelDisplayName != null) {
|
|
14942
|
-
setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
|
|
14943
|
-
}
|
|
14944
|
-
const fromVeoTuningSpec = getValueByPath(fromObject, [
|
|
14945
|
-
'veoTuningSpec',
|
|
14946
|
-
]);
|
|
14947
|
-
if (fromVeoTuningSpec != null) {
|
|
14948
|
-
setValueByPath(toObject, ['veoTuningSpec'], fromVeoTuningSpec);
|
|
14949
|
-
}
|
|
14950
14930
|
return toObject;
|
|
14951
14931
|
}
|
|
14952
|
-
function tuningJobFromVertex(fromObject) {
|
|
14932
|
+
function tuningJobFromVertex(fromObject, _rootObject) {
|
|
14953
14933
|
const toObject = {};
|
|
14954
14934
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14955
14935
|
'sdkHttpResponse',
|
|
@@ -15069,7 +15049,7 @@ function tuningJobFromVertex(fromObject) {
|
|
|
15069
15049
|
}
|
|
15070
15050
|
return toObject;
|
|
15071
15051
|
}
|
|
15072
|
-
function tuningOperationFromMldev(fromObject) {
|
|
15052
|
+
function tuningOperationFromMldev(fromObject, _rootObject) {
|
|
15073
15053
|
const toObject = {};
|
|
15074
15054
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
15075
15055
|
'sdkHttpResponse',
|
|
@@ -15095,7 +15075,7 @@ function tuningOperationFromMldev(fromObject) {
|
|
|
15095
15075
|
}
|
|
15096
15076
|
return toObject;
|
|
15097
15077
|
}
|
|
15098
|
-
function tuningValidationDatasetToVertex(fromObject,
|
|
15078
|
+
function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
15099
15079
|
const toObject = {};
|
|
15100
15080
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
15101
15081
|
if (fromGcsUri != null) {
|
|
@@ -15104,8 +15084,8 @@ function tuningValidationDatasetToVertex(fromObject, parentObject) {
|
|
|
15104
15084
|
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
15105
15085
|
'vertexDatasetResource',
|
|
15106
15086
|
]);
|
|
15107
|
-
if (
|
|
15108
|
-
setValueByPath(
|
|
15087
|
+
if (fromVertexDatasetResource != null) {
|
|
15088
|
+
setValueByPath(toObject, ['validationDatasetUri'], fromVertexDatasetResource);
|
|
15109
15089
|
}
|
|
15110
15090
|
return toObject;
|
|
15111
15091
|
}
|