@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.mjs
CHANGED
|
@@ -538,6 +538,26 @@ var Language;
|
|
|
538
538
|
*/
|
|
539
539
|
Language["PYTHON"] = "PYTHON";
|
|
540
540
|
})(Language || (Language = {}));
|
|
541
|
+
/** Specifies how the response should be scheduled in the conversation. */
|
|
542
|
+
var FunctionResponseScheduling;
|
|
543
|
+
(function (FunctionResponseScheduling) {
|
|
544
|
+
/**
|
|
545
|
+
* This value is unused.
|
|
546
|
+
*/
|
|
547
|
+
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
548
|
+
/**
|
|
549
|
+
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
550
|
+
*/
|
|
551
|
+
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
552
|
+
/**
|
|
553
|
+
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
554
|
+
*/
|
|
555
|
+
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
556
|
+
/**
|
|
557
|
+
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
558
|
+
*/
|
|
559
|
+
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
560
|
+
})(FunctionResponseScheduling || (FunctionResponseScheduling = {}));
|
|
541
561
|
/** Optional. The type of the data. */
|
|
542
562
|
var Type;
|
|
543
563
|
(function (Type) {
|
|
@@ -581,42 +601,46 @@ var HarmCategory;
|
|
|
581
601
|
* The harm category is unspecified.
|
|
582
602
|
*/
|
|
583
603
|
HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
|
|
584
|
-
/**
|
|
585
|
-
* The harm category is hate speech.
|
|
586
|
-
*/
|
|
587
|
-
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
588
|
-
/**
|
|
589
|
-
* The harm category is dangerous content.
|
|
590
|
-
*/
|
|
591
|
-
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
592
604
|
/**
|
|
593
605
|
* The harm category is harassment.
|
|
594
606
|
*/
|
|
595
607
|
HarmCategory["HARM_CATEGORY_HARASSMENT"] = "HARM_CATEGORY_HARASSMENT";
|
|
608
|
+
/**
|
|
609
|
+
* The harm category is hate speech.
|
|
610
|
+
*/
|
|
611
|
+
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
596
612
|
/**
|
|
597
613
|
* The harm category is sexually explicit content.
|
|
598
614
|
*/
|
|
599
615
|
HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
|
|
616
|
+
/**
|
|
617
|
+
* The harm category is dangerous content.
|
|
618
|
+
*/
|
|
619
|
+
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
600
620
|
/**
|
|
601
621
|
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
602
622
|
*/
|
|
603
623
|
HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
604
624
|
/**
|
|
605
|
-
* The harm category is image hate.
|
|
625
|
+
* The harm category is image hate. This enum value is not supported in Gemini API.
|
|
606
626
|
*/
|
|
607
627
|
HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
|
|
608
628
|
/**
|
|
609
|
-
* The harm category is image dangerous content.
|
|
629
|
+
* The harm category is image dangerous content. This enum value is not supported in Gemini API.
|
|
610
630
|
*/
|
|
611
631
|
HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
|
|
612
632
|
/**
|
|
613
|
-
* The harm category is image harassment.
|
|
633
|
+
* The harm category is image harassment. This enum value is not supported in Gemini API.
|
|
614
634
|
*/
|
|
615
635
|
HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
|
|
616
636
|
/**
|
|
617
|
-
* The harm category is image sexually explicit content.
|
|
637
|
+
* The harm category is image sexually explicit content. This enum value is not supported in Gemini API.
|
|
618
638
|
*/
|
|
619
639
|
HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
|
|
640
|
+
/**
|
|
641
|
+
* The harm category is for jailbreak prompts. This enum value is not supported in Gemini API.
|
|
642
|
+
*/
|
|
643
|
+
HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
|
|
620
644
|
})(HarmCategory || (HarmCategory = {}));
|
|
621
645
|
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
622
646
|
var HarmBlockMethod;
|
|
@@ -857,33 +881,41 @@ var HarmSeverity;
|
|
|
857
881
|
*/
|
|
858
882
|
HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
|
|
859
883
|
})(HarmSeverity || (HarmSeverity = {}));
|
|
860
|
-
/** Output only.
|
|
884
|
+
/** Output only. The reason why the prompt was blocked. */
|
|
861
885
|
var BlockedReason;
|
|
862
886
|
(function (BlockedReason) {
|
|
863
887
|
/**
|
|
864
|
-
*
|
|
888
|
+
* The blocked reason is unspecified.
|
|
865
889
|
*/
|
|
866
890
|
BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
|
|
867
891
|
/**
|
|
868
|
-
*
|
|
892
|
+
* The prompt was blocked for safety reasons.
|
|
869
893
|
*/
|
|
870
894
|
BlockedReason["SAFETY"] = "SAFETY";
|
|
871
895
|
/**
|
|
872
|
-
*
|
|
896
|
+
* 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.
|
|
873
897
|
*/
|
|
874
898
|
BlockedReason["OTHER"] = "OTHER";
|
|
875
899
|
/**
|
|
876
|
-
*
|
|
900
|
+
* The prompt was blocked because it contains a term from the terminology blocklist.
|
|
877
901
|
*/
|
|
878
902
|
BlockedReason["BLOCKLIST"] = "BLOCKLIST";
|
|
879
903
|
/**
|
|
880
|
-
*
|
|
904
|
+
* The prompt was blocked because it contains prohibited content.
|
|
881
905
|
*/
|
|
882
906
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
883
907
|
/**
|
|
884
|
-
*
|
|
908
|
+
* The prompt was blocked because it contains content that is unsafe for image generation.
|
|
885
909
|
*/
|
|
886
910
|
BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
911
|
+
/**
|
|
912
|
+
* The prompt was blocked by Model Armor. This enum value is not supported in Gemini API.
|
|
913
|
+
*/
|
|
914
|
+
BlockedReason["MODEL_ARMOR"] = "MODEL_ARMOR";
|
|
915
|
+
/**
|
|
916
|
+
* The prompt was blocked as a jailbreak attempt. This enum value is not supported in Gemini API.
|
|
917
|
+
*/
|
|
918
|
+
BlockedReason["JAILBREAK"] = "JAILBREAK";
|
|
887
919
|
})(BlockedReason || (BlockedReason = {}));
|
|
888
920
|
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
889
921
|
var TrafficType;
|
|
@@ -1418,26 +1450,6 @@ var TurnCoverage;
|
|
|
1418
1450
|
*/
|
|
1419
1451
|
TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
|
|
1420
1452
|
})(TurnCoverage || (TurnCoverage = {}));
|
|
1421
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
1422
|
-
var FunctionResponseScheduling;
|
|
1423
|
-
(function (FunctionResponseScheduling) {
|
|
1424
|
-
/**
|
|
1425
|
-
* This value is unused.
|
|
1426
|
-
*/
|
|
1427
|
-
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
1428
|
-
/**
|
|
1429
|
-
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
1430
|
-
*/
|
|
1431
|
-
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
1432
|
-
/**
|
|
1433
|
-
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
1434
|
-
*/
|
|
1435
|
-
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
1436
|
-
/**
|
|
1437
|
-
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
1438
|
-
*/
|
|
1439
|
-
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
1440
|
-
})(FunctionResponseScheduling || (FunctionResponseScheduling = {}));
|
|
1441
1453
|
/** Scale of the generated music. */
|
|
1442
1454
|
var Scale;
|
|
1443
1455
|
(function (Scale) {
|
|
@@ -1735,10 +1747,10 @@ class HttpResponse {
|
|
|
1735
1747
|
return this.responseInternal.json();
|
|
1736
1748
|
}
|
|
1737
1749
|
}
|
|
1738
|
-
/** Content filter results for a prompt sent in the request. */
|
|
1750
|
+
/** 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. */
|
|
1739
1751
|
class GenerateContentResponsePromptFeedback {
|
|
1740
1752
|
}
|
|
1741
|
-
/** Usage metadata about response(s). */
|
|
1753
|
+
/** Usage metadata about response(s). This data type is not supported in Gemini API. */
|
|
1742
1754
|
class GenerateContentResponseUsageMetadata {
|
|
1743
1755
|
}
|
|
1744
1756
|
/** Response message for PredictionService.GenerateContent. */
|
|
@@ -6790,6 +6802,10 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
6790
6802
|
if (fromTopP != null) {
|
|
6791
6803
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
6792
6804
|
}
|
|
6805
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
6806
|
+
undefined) {
|
|
6807
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
6808
|
+
}
|
|
6793
6809
|
return toObject;
|
|
6794
6810
|
}
|
|
6795
6811
|
function googleMapsToMldev$2(fromObject) {
|
|
@@ -9449,6 +9465,10 @@ function generationConfigToVertex(fromObject) {
|
|
|
9449
9465
|
if (fromTopP != null) {
|
|
9450
9466
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
9451
9467
|
}
|
|
9468
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
9469
|
+
undefined) {
|
|
9470
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
9471
|
+
}
|
|
9452
9472
|
return toObject;
|
|
9453
9473
|
}
|
|
9454
9474
|
function getModelParametersToMldev(apiClient, fromObject) {
|
|
@@ -10573,7 +10593,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10573
10593
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10574
10594
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10575
10595
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10576
|
-
const SDK_VERSION = '1.
|
|
10596
|
+
const SDK_VERSION = '1.27.0'; // x-release-please-version
|
|
10577
10597
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10578
10598
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10579
10599
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -10762,7 +10782,7 @@ class ApiClient {
|
|
|
10762
10782
|
else {
|
|
10763
10783
|
requestInit.body = request.body;
|
|
10764
10784
|
}
|
|
10765
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
10785
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
10766
10786
|
return this.unaryApiCall(url, requestInit, request.httpMethod);
|
|
10767
10787
|
}
|
|
10768
10788
|
patchHttpOptions(baseHttpOptions, requestHttpOptions) {
|
|
@@ -10796,10 +10816,10 @@ class ApiClient {
|
|
|
10796
10816
|
}
|
|
10797
10817
|
let requestInit = {};
|
|
10798
10818
|
requestInit.body = request.body;
|
|
10799
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
10819
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
10800
10820
|
return this.streamApiCall(url, requestInit, request.httpMethod);
|
|
10801
10821
|
}
|
|
10802
|
-
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, abortSignal) {
|
|
10822
|
+
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, url, abortSignal) {
|
|
10803
10823
|
if ((httpOptions && httpOptions.timeout) || abortSignal) {
|
|
10804
10824
|
const abortController = new AbortController();
|
|
10805
10825
|
const signal = abortController.signal;
|
|
@@ -10823,7 +10843,7 @@ class ApiClient {
|
|
|
10823
10843
|
if (httpOptions && httpOptions.extraBody !== null) {
|
|
10824
10844
|
includeExtraBodyToRequestInit(requestInit, httpOptions.extraBody);
|
|
10825
10845
|
}
|
|
10826
|
-
requestInit.headers = await this.getHeadersInternal(httpOptions);
|
|
10846
|
+
requestInit.headers = await this.getHeadersInternal(httpOptions, url);
|
|
10827
10847
|
return requestInit;
|
|
10828
10848
|
}
|
|
10829
10849
|
async unaryApiCall(url, requestInit, httpMethod) {
|
|
@@ -10936,7 +10956,7 @@ class ApiClient {
|
|
|
10936
10956
|
headers[CONTENT_TYPE_HEADER] = 'application/json';
|
|
10937
10957
|
return headers;
|
|
10938
10958
|
}
|
|
10939
|
-
async getHeadersInternal(httpOptions) {
|
|
10959
|
+
async getHeadersInternal(httpOptions, url) {
|
|
10940
10960
|
const headers = new Headers();
|
|
10941
10961
|
if (httpOptions && httpOptions.headers) {
|
|
10942
10962
|
for (const [key, value] of Object.entries(httpOptions.headers)) {
|
|
@@ -10948,7 +10968,7 @@ class ApiClient {
|
|
|
10948
10968
|
headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
|
|
10949
10969
|
}
|
|
10950
10970
|
}
|
|
10951
|
-
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
10971
|
+
await this.clientOptions.auth.addAuthHeaders(headers, url);
|
|
10952
10972
|
return headers;
|
|
10953
10973
|
}
|
|
10954
10974
|
/**
|
|
@@ -11661,7 +11681,7 @@ class Live {
|
|
|
11661
11681
|
const headers = mapToHeaders(clientHeaders);
|
|
11662
11682
|
if (this.apiClient.isVertexAI()) {
|
|
11663
11683
|
url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
|
|
11664
|
-
await this.auth.addAuthHeaders(headers);
|
|
11684
|
+
await this.auth.addAuthHeaders(headers, url);
|
|
11665
11685
|
}
|
|
11666
11686
|
else {
|
|
11667
11687
|
const apiKey = this.apiClient.getApiKey();
|
|
@@ -14344,7 +14364,7 @@ class NodeAuth {
|
|
|
14344
14364
|
const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
|
|
14345
14365
|
this.googleAuth = new GoogleAuth(vertexAuthOptions);
|
|
14346
14366
|
}
|
|
14347
|
-
async addAuthHeaders(headers) {
|
|
14367
|
+
async addAuthHeaders(headers, url) {
|
|
14348
14368
|
if (this.apiKey !== undefined) {
|
|
14349
14369
|
if (this.apiKey.startsWith('auth_tokens/')) {
|
|
14350
14370
|
throw new Error('Ephemeral tokens are only supported by the live API.');
|
|
@@ -14352,7 +14372,7 @@ class NodeAuth {
|
|
|
14352
14372
|
this.addKeyHeader(headers);
|
|
14353
14373
|
return;
|
|
14354
14374
|
}
|
|
14355
|
-
return this.addGoogleAuthHeaders(headers);
|
|
14375
|
+
return this.addGoogleAuthHeaders(headers, url);
|
|
14356
14376
|
}
|
|
14357
14377
|
addKeyHeader(headers) {
|
|
14358
14378
|
if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
|
|
@@ -14365,19 +14385,19 @@ class NodeAuth {
|
|
|
14365
14385
|
}
|
|
14366
14386
|
headers.append(GOOGLE_API_KEY_HEADER, this.apiKey);
|
|
14367
14387
|
}
|
|
14368
|
-
async addGoogleAuthHeaders(headers) {
|
|
14388
|
+
async addGoogleAuthHeaders(headers, url) {
|
|
14369
14389
|
if (this.googleAuth === undefined) {
|
|
14370
14390
|
// This should never happen, addGoogleAuthHeaders should only be
|
|
14371
14391
|
// called when there is no apiKey set and in these cases googleAuth
|
|
14372
14392
|
// is set.
|
|
14373
14393
|
throw new Error('Trying to set google-auth headers but googleAuth is unset');
|
|
14374
14394
|
}
|
|
14375
|
-
const authHeaders = await this.googleAuth.getRequestHeaders();
|
|
14376
|
-
for (const key
|
|
14395
|
+
const authHeaders = await this.googleAuth.getRequestHeaders(url);
|
|
14396
|
+
for (const [key, value] of authHeaders) {
|
|
14377
14397
|
if (headers.get(key) !== null) {
|
|
14378
14398
|
continue;
|
|
14379
14399
|
}
|
|
14380
|
-
headers.append(key,
|
|
14400
|
+
headers.append(key, value);
|
|
14381
14401
|
}
|
|
14382
14402
|
}
|
|
14383
14403
|
}
|
|
@@ -14508,7 +14528,7 @@ class NodeWebSocket {
|
|
|
14508
14528
|
* SPDX-License-Identifier: Apache-2.0
|
|
14509
14529
|
*/
|
|
14510
14530
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
14511
|
-
function cancelTuningJobParametersToMldev(fromObject) {
|
|
14531
|
+
function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
|
|
14512
14532
|
const toObject = {};
|
|
14513
14533
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14514
14534
|
if (fromName != null) {
|
|
@@ -14516,7 +14536,7 @@ function cancelTuningJobParametersToMldev(fromObject) {
|
|
|
14516
14536
|
}
|
|
14517
14537
|
return toObject;
|
|
14518
14538
|
}
|
|
14519
|
-
function cancelTuningJobParametersToVertex(fromObject) {
|
|
14539
|
+
function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
14520
14540
|
const toObject = {};
|
|
14521
14541
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14522
14542
|
if (fromName != null) {
|
|
@@ -14524,7 +14544,7 @@ function cancelTuningJobParametersToVertex(fromObject) {
|
|
|
14524
14544
|
}
|
|
14525
14545
|
return toObject;
|
|
14526
14546
|
}
|
|
14527
|
-
function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
14547
|
+
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
14528
14548
|
const toObject = {};
|
|
14529
14549
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
14530
14550
|
throw new Error('validationDataset parameter is not supported in Gemini API.');
|
|
@@ -14572,13 +14592,13 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
14572
14592
|
}
|
|
14573
14593
|
return toObject;
|
|
14574
14594
|
}
|
|
14575
|
-
function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
14595
|
+
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
14576
14596
|
const toObject = {};
|
|
14577
14597
|
const fromValidationDataset = getValueByPath(fromObject, [
|
|
14578
14598
|
'validationDataset',
|
|
14579
14599
|
]);
|
|
14580
14600
|
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
14581
|
-
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset
|
|
14601
|
+
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
14582
14602
|
}
|
|
14583
14603
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14584
14604
|
'tunedModelDisplayName',
|
|
@@ -14622,7 +14642,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
14622
14642
|
}
|
|
14623
14643
|
return toObject;
|
|
14624
14644
|
}
|
|
14625
|
-
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
14645
|
+
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
14626
14646
|
const toObject = {};
|
|
14627
14647
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
14628
14648
|
if (fromBaseModel != null) {
|
|
@@ -14646,7 +14666,7 @@ function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
|
14646
14666
|
}
|
|
14647
14667
|
return toObject;
|
|
14648
14668
|
}
|
|
14649
|
-
function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
14669
|
+
function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
|
|
14650
14670
|
const toObject = {};
|
|
14651
14671
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
14652
14672
|
if (fromBaseModel != null) {
|
|
@@ -14662,7 +14682,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
|
14662
14682
|
'trainingDataset',
|
|
14663
14683
|
]);
|
|
14664
14684
|
if (fromTrainingDataset != null) {
|
|
14665
|
-
|
|
14685
|
+
tuningDatasetToVertex(fromTrainingDataset, toObject);
|
|
14666
14686
|
}
|
|
14667
14687
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14668
14688
|
if (fromConfig != null) {
|
|
@@ -14670,7 +14690,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
|
14670
14690
|
}
|
|
14671
14691
|
return toObject;
|
|
14672
14692
|
}
|
|
14673
|
-
function getTuningJobParametersToMldev(fromObject) {
|
|
14693
|
+
function getTuningJobParametersToMldev(fromObject, _rootObject) {
|
|
14674
14694
|
const toObject = {};
|
|
14675
14695
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14676
14696
|
if (fromName != null) {
|
|
@@ -14678,7 +14698,7 @@ function getTuningJobParametersToMldev(fromObject) {
|
|
|
14678
14698
|
}
|
|
14679
14699
|
return toObject;
|
|
14680
14700
|
}
|
|
14681
|
-
function getTuningJobParametersToVertex(fromObject) {
|
|
14701
|
+
function getTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
14682
14702
|
const toObject = {};
|
|
14683
14703
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14684
14704
|
if (fromName != null) {
|
|
@@ -14686,7 +14706,7 @@ function getTuningJobParametersToVertex(fromObject) {
|
|
|
14686
14706
|
}
|
|
14687
14707
|
return toObject;
|
|
14688
14708
|
}
|
|
14689
|
-
function listTuningJobsConfigToMldev(fromObject, parentObject) {
|
|
14709
|
+
function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
14690
14710
|
const toObject = {};
|
|
14691
14711
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14692
14712
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -14702,7 +14722,7 @@ function listTuningJobsConfigToMldev(fromObject, parentObject) {
|
|
|
14702
14722
|
}
|
|
14703
14723
|
return toObject;
|
|
14704
14724
|
}
|
|
14705
|
-
function listTuningJobsConfigToVertex(fromObject, parentObject) {
|
|
14725
|
+
function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
14706
14726
|
const toObject = {};
|
|
14707
14727
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14708
14728
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -14718,7 +14738,7 @@ function listTuningJobsConfigToVertex(fromObject, parentObject) {
|
|
|
14718
14738
|
}
|
|
14719
14739
|
return toObject;
|
|
14720
14740
|
}
|
|
14721
|
-
function listTuningJobsParametersToMldev(fromObject) {
|
|
14741
|
+
function listTuningJobsParametersToMldev(fromObject, rootObject) {
|
|
14722
14742
|
const toObject = {};
|
|
14723
14743
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14724
14744
|
if (fromConfig != null) {
|
|
@@ -14726,7 +14746,7 @@ function listTuningJobsParametersToMldev(fromObject) {
|
|
|
14726
14746
|
}
|
|
14727
14747
|
return toObject;
|
|
14728
14748
|
}
|
|
14729
|
-
function listTuningJobsParametersToVertex(fromObject) {
|
|
14749
|
+
function listTuningJobsParametersToVertex(fromObject, rootObject) {
|
|
14730
14750
|
const toObject = {};
|
|
14731
14751
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14732
14752
|
if (fromConfig != null) {
|
|
@@ -14734,7 +14754,7 @@ function listTuningJobsParametersToVertex(fromObject) {
|
|
|
14734
14754
|
}
|
|
14735
14755
|
return toObject;
|
|
14736
14756
|
}
|
|
14737
|
-
function listTuningJobsResponseFromMldev(fromObject) {
|
|
14757
|
+
function listTuningJobsResponseFromMldev(fromObject, rootObject) {
|
|
14738
14758
|
const toObject = {};
|
|
14739
14759
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14740
14760
|
'sdkHttpResponse',
|
|
@@ -14760,7 +14780,7 @@ function listTuningJobsResponseFromMldev(fromObject) {
|
|
|
14760
14780
|
}
|
|
14761
14781
|
return toObject;
|
|
14762
14782
|
}
|
|
14763
|
-
function listTuningJobsResponseFromVertex(fromObject) {
|
|
14783
|
+
function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
14764
14784
|
const toObject = {};
|
|
14765
14785
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14766
14786
|
'sdkHttpResponse',
|
|
@@ -14786,7 +14806,7 @@ function listTuningJobsResponseFromVertex(fromObject) {
|
|
|
14786
14806
|
}
|
|
14787
14807
|
return toObject;
|
|
14788
14808
|
}
|
|
14789
|
-
function tunedModelFromMldev(fromObject) {
|
|
14809
|
+
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
14790
14810
|
const toObject = {};
|
|
14791
14811
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
14792
14812
|
if (fromModel != null) {
|
|
@@ -14798,7 +14818,7 @@ function tunedModelFromMldev(fromObject) {
|
|
|
14798
14818
|
}
|
|
14799
14819
|
return toObject;
|
|
14800
14820
|
}
|
|
14801
|
-
function tuningDatasetToMldev(fromObject) {
|
|
14821
|
+
function tuningDatasetToMldev(fromObject, _rootObject) {
|
|
14802
14822
|
const toObject = {};
|
|
14803
14823
|
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
14804
14824
|
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
@@ -14818,7 +14838,7 @@ function tuningDatasetToMldev(fromObject) {
|
|
|
14818
14838
|
}
|
|
14819
14839
|
return toObject;
|
|
14820
14840
|
}
|
|
14821
|
-
function tuningDatasetToVertex(fromObject, parentObject) {
|
|
14841
|
+
function tuningDatasetToVertex(fromObject, parentObject, _rootObject) {
|
|
14822
14842
|
const toObject = {};
|
|
14823
14843
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
14824
14844
|
if (parentObject !== undefined && fromGcsUri != null) {
|
|
@@ -14835,7 +14855,7 @@ function tuningDatasetToVertex(fromObject, parentObject) {
|
|
|
14835
14855
|
}
|
|
14836
14856
|
return toObject;
|
|
14837
14857
|
}
|
|
14838
|
-
function tuningJobFromMldev(fromObject) {
|
|
14858
|
+
function tuningJobFromMldev(fromObject, rootObject) {
|
|
14839
14859
|
const toObject = {};
|
|
14840
14860
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14841
14861
|
'sdkHttpResponse',
|
|
@@ -14885,49 +14905,9 @@ function tuningJobFromMldev(fromObject) {
|
|
|
14885
14905
|
if (fromTunedModel != null) {
|
|
14886
14906
|
setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
|
|
14887
14907
|
}
|
|
14888
|
-
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
14889
|
-
'customBaseModel',
|
|
14890
|
-
]);
|
|
14891
|
-
if (fromCustomBaseModel != null) {
|
|
14892
|
-
setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
|
|
14893
|
-
}
|
|
14894
|
-
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
14895
|
-
if (fromExperiment != null) {
|
|
14896
|
-
setValueByPath(toObject, ['experiment'], fromExperiment);
|
|
14897
|
-
}
|
|
14898
|
-
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
14899
|
-
if (fromLabels != null) {
|
|
14900
|
-
setValueByPath(toObject, ['labels'], fromLabels);
|
|
14901
|
-
}
|
|
14902
|
-
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
14903
|
-
if (fromOutputUri != null) {
|
|
14904
|
-
setValueByPath(toObject, ['outputUri'], fromOutputUri);
|
|
14905
|
-
}
|
|
14906
|
-
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
14907
|
-
if (fromPipelineJob != null) {
|
|
14908
|
-
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
14909
|
-
}
|
|
14910
|
-
const fromServiceAccount = getValueByPath(fromObject, [
|
|
14911
|
-
'serviceAccount',
|
|
14912
|
-
]);
|
|
14913
|
-
if (fromServiceAccount != null) {
|
|
14914
|
-
setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
|
|
14915
|
-
}
|
|
14916
|
-
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14917
|
-
'tunedModelDisplayName',
|
|
14918
|
-
]);
|
|
14919
|
-
if (fromTunedModelDisplayName != null) {
|
|
14920
|
-
setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
|
|
14921
|
-
}
|
|
14922
|
-
const fromVeoTuningSpec = getValueByPath(fromObject, [
|
|
14923
|
-
'veoTuningSpec',
|
|
14924
|
-
]);
|
|
14925
|
-
if (fromVeoTuningSpec != null) {
|
|
14926
|
-
setValueByPath(toObject, ['veoTuningSpec'], fromVeoTuningSpec);
|
|
14927
|
-
}
|
|
14928
14908
|
return toObject;
|
|
14929
14909
|
}
|
|
14930
|
-
function tuningJobFromVertex(fromObject) {
|
|
14910
|
+
function tuningJobFromVertex(fromObject, _rootObject) {
|
|
14931
14911
|
const toObject = {};
|
|
14932
14912
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14933
14913
|
'sdkHttpResponse',
|
|
@@ -15047,7 +15027,7 @@ function tuningJobFromVertex(fromObject) {
|
|
|
15047
15027
|
}
|
|
15048
15028
|
return toObject;
|
|
15049
15029
|
}
|
|
15050
|
-
function tuningOperationFromMldev(fromObject) {
|
|
15030
|
+
function tuningOperationFromMldev(fromObject, _rootObject) {
|
|
15051
15031
|
const toObject = {};
|
|
15052
15032
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
15053
15033
|
'sdkHttpResponse',
|
|
@@ -15073,7 +15053,7 @@ function tuningOperationFromMldev(fromObject) {
|
|
|
15073
15053
|
}
|
|
15074
15054
|
return toObject;
|
|
15075
15055
|
}
|
|
15076
|
-
function tuningValidationDatasetToVertex(fromObject,
|
|
15056
|
+
function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
15077
15057
|
const toObject = {};
|
|
15078
15058
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
15079
15059
|
if (fromGcsUri != null) {
|
|
@@ -15082,8 +15062,8 @@ function tuningValidationDatasetToVertex(fromObject, parentObject) {
|
|
|
15082
15062
|
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
15083
15063
|
'vertexDatasetResource',
|
|
15084
15064
|
]);
|
|
15085
|
-
if (
|
|
15086
|
-
setValueByPath(
|
|
15065
|
+
if (fromVertexDatasetResource != null) {
|
|
15066
|
+
setValueByPath(toObject, ['validationDatasetUri'], fromVertexDatasetResource);
|
|
15087
15067
|
}
|
|
15088
15068
|
return toObject;
|
|
15089
15069
|
}
|