@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/index.cjs
CHANGED
|
@@ -504,6 +504,26 @@ exports.Language = void 0;
|
|
|
504
504
|
*/
|
|
505
505
|
Language["PYTHON"] = "PYTHON";
|
|
506
506
|
})(exports.Language || (exports.Language = {}));
|
|
507
|
+
/** Specifies how the response should be scheduled in the conversation. */
|
|
508
|
+
exports.FunctionResponseScheduling = void 0;
|
|
509
|
+
(function (FunctionResponseScheduling) {
|
|
510
|
+
/**
|
|
511
|
+
* This value is unused.
|
|
512
|
+
*/
|
|
513
|
+
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
514
|
+
/**
|
|
515
|
+
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
516
|
+
*/
|
|
517
|
+
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
518
|
+
/**
|
|
519
|
+
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
520
|
+
*/
|
|
521
|
+
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
522
|
+
/**
|
|
523
|
+
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
524
|
+
*/
|
|
525
|
+
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
526
|
+
})(exports.FunctionResponseScheduling || (exports.FunctionResponseScheduling = {}));
|
|
507
527
|
/** Optional. The type of the data. */
|
|
508
528
|
exports.Type = void 0;
|
|
509
529
|
(function (Type) {
|
|
@@ -547,42 +567,46 @@ exports.HarmCategory = void 0;
|
|
|
547
567
|
* The harm category is unspecified.
|
|
548
568
|
*/
|
|
549
569
|
HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
|
|
550
|
-
/**
|
|
551
|
-
* The harm category is hate speech.
|
|
552
|
-
*/
|
|
553
|
-
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
554
|
-
/**
|
|
555
|
-
* The harm category is dangerous content.
|
|
556
|
-
*/
|
|
557
|
-
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
558
570
|
/**
|
|
559
571
|
* The harm category is harassment.
|
|
560
572
|
*/
|
|
561
573
|
HarmCategory["HARM_CATEGORY_HARASSMENT"] = "HARM_CATEGORY_HARASSMENT";
|
|
574
|
+
/**
|
|
575
|
+
* The harm category is hate speech.
|
|
576
|
+
*/
|
|
577
|
+
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
562
578
|
/**
|
|
563
579
|
* The harm category is sexually explicit content.
|
|
564
580
|
*/
|
|
565
581
|
HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
|
|
582
|
+
/**
|
|
583
|
+
* The harm category is dangerous content.
|
|
584
|
+
*/
|
|
585
|
+
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
566
586
|
/**
|
|
567
587
|
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
568
588
|
*/
|
|
569
589
|
HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
570
590
|
/**
|
|
571
|
-
* The harm category is image hate.
|
|
591
|
+
* The harm category is image hate. This enum value is not supported in Gemini API.
|
|
572
592
|
*/
|
|
573
593
|
HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
|
|
574
594
|
/**
|
|
575
|
-
* The harm category is image dangerous content.
|
|
595
|
+
* The harm category is image dangerous content. This enum value is not supported in Gemini API.
|
|
576
596
|
*/
|
|
577
597
|
HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
|
|
578
598
|
/**
|
|
579
|
-
* The harm category is image harassment.
|
|
599
|
+
* The harm category is image harassment. This enum value is not supported in Gemini API.
|
|
580
600
|
*/
|
|
581
601
|
HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
|
|
582
602
|
/**
|
|
583
|
-
* 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.
|
|
584
604
|
*/
|
|
585
605
|
HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
|
|
606
|
+
/**
|
|
607
|
+
* The harm category is for jailbreak prompts. This enum value is not supported in Gemini API.
|
|
608
|
+
*/
|
|
609
|
+
HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
|
|
586
610
|
})(exports.HarmCategory || (exports.HarmCategory = {}));
|
|
587
611
|
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
588
612
|
exports.HarmBlockMethod = void 0;
|
|
@@ -823,33 +847,41 @@ exports.HarmSeverity = void 0;
|
|
|
823
847
|
*/
|
|
824
848
|
HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
|
|
825
849
|
})(exports.HarmSeverity || (exports.HarmSeverity = {}));
|
|
826
|
-
/** Output only.
|
|
850
|
+
/** Output only. The reason why the prompt was blocked. */
|
|
827
851
|
exports.BlockedReason = void 0;
|
|
828
852
|
(function (BlockedReason) {
|
|
829
853
|
/**
|
|
830
|
-
*
|
|
854
|
+
* The blocked reason is unspecified.
|
|
831
855
|
*/
|
|
832
856
|
BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
|
|
833
857
|
/**
|
|
834
|
-
*
|
|
858
|
+
* The prompt was blocked for safety reasons.
|
|
835
859
|
*/
|
|
836
860
|
BlockedReason["SAFETY"] = "SAFETY";
|
|
837
861
|
/**
|
|
838
|
-
*
|
|
862
|
+
* 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.
|
|
839
863
|
*/
|
|
840
864
|
BlockedReason["OTHER"] = "OTHER";
|
|
841
865
|
/**
|
|
842
|
-
*
|
|
866
|
+
* The prompt was blocked because it contains a term from the terminology blocklist.
|
|
843
867
|
*/
|
|
844
868
|
BlockedReason["BLOCKLIST"] = "BLOCKLIST";
|
|
845
869
|
/**
|
|
846
|
-
*
|
|
870
|
+
* The prompt was blocked because it contains prohibited content.
|
|
847
871
|
*/
|
|
848
872
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
849
873
|
/**
|
|
850
|
-
*
|
|
874
|
+
* The prompt was blocked because it contains content that is unsafe for image generation.
|
|
851
875
|
*/
|
|
852
876
|
BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
877
|
+
/**
|
|
878
|
+
* The prompt was blocked by Model Armor. This enum value is not supported in Gemini API.
|
|
879
|
+
*/
|
|
880
|
+
BlockedReason["MODEL_ARMOR"] = "MODEL_ARMOR";
|
|
881
|
+
/**
|
|
882
|
+
* The prompt was blocked as a jailbreak attempt. This enum value is not supported in Gemini API.
|
|
883
|
+
*/
|
|
884
|
+
BlockedReason["JAILBREAK"] = "JAILBREAK";
|
|
853
885
|
})(exports.BlockedReason || (exports.BlockedReason = {}));
|
|
854
886
|
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
855
887
|
exports.TrafficType = void 0;
|
|
@@ -1384,26 +1416,6 @@ exports.TurnCoverage = void 0;
|
|
|
1384
1416
|
*/
|
|
1385
1417
|
TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
|
|
1386
1418
|
})(exports.TurnCoverage || (exports.TurnCoverage = {}));
|
|
1387
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
1388
|
-
exports.FunctionResponseScheduling = void 0;
|
|
1389
|
-
(function (FunctionResponseScheduling) {
|
|
1390
|
-
/**
|
|
1391
|
-
* This value is unused.
|
|
1392
|
-
*/
|
|
1393
|
-
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
1394
|
-
/**
|
|
1395
|
-
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
1396
|
-
*/
|
|
1397
|
-
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
1398
|
-
/**
|
|
1399
|
-
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
1400
|
-
*/
|
|
1401
|
-
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
1402
|
-
/**
|
|
1403
|
-
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
1404
|
-
*/
|
|
1405
|
-
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
1406
|
-
})(exports.FunctionResponseScheduling || (exports.FunctionResponseScheduling = {}));
|
|
1407
1419
|
/** Scale of the generated music. */
|
|
1408
1420
|
exports.Scale = void 0;
|
|
1409
1421
|
(function (Scale) {
|
|
@@ -1701,10 +1713,10 @@ class HttpResponse {
|
|
|
1701
1713
|
return this.responseInternal.json();
|
|
1702
1714
|
}
|
|
1703
1715
|
}
|
|
1704
|
-
/** Content filter results for a prompt sent in the request. */
|
|
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. */
|
|
1705
1717
|
class GenerateContentResponsePromptFeedback {
|
|
1706
1718
|
}
|
|
1707
|
-
/** Usage metadata about response(s). */
|
|
1719
|
+
/** Usage metadata about response(s). This data type is not supported in Gemini API. */
|
|
1708
1720
|
class GenerateContentResponseUsageMetadata {
|
|
1709
1721
|
}
|
|
1710
1722
|
/** Response message for PredictionService.GenerateContent. */
|
|
@@ -6181,7 +6193,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6181
6193
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6182
6194
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6183
6195
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6184
|
-
const SDK_VERSION = '1.
|
|
6196
|
+
const SDK_VERSION = '1.27.0'; // x-release-please-version
|
|
6185
6197
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6186
6198
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6187
6199
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -6370,7 +6382,7 @@ class ApiClient {
|
|
|
6370
6382
|
else {
|
|
6371
6383
|
requestInit.body = request.body;
|
|
6372
6384
|
}
|
|
6373
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
6385
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
6374
6386
|
return this.unaryApiCall(url, requestInit, request.httpMethod);
|
|
6375
6387
|
}
|
|
6376
6388
|
patchHttpOptions(baseHttpOptions, requestHttpOptions) {
|
|
@@ -6404,10 +6416,10 @@ class ApiClient {
|
|
|
6404
6416
|
}
|
|
6405
6417
|
let requestInit = {};
|
|
6406
6418
|
requestInit.body = request.body;
|
|
6407
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
6419
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
6408
6420
|
return this.streamApiCall(url, requestInit, request.httpMethod);
|
|
6409
6421
|
}
|
|
6410
|
-
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, abortSignal) {
|
|
6422
|
+
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, url, abortSignal) {
|
|
6411
6423
|
if ((httpOptions && httpOptions.timeout) || abortSignal) {
|
|
6412
6424
|
const abortController = new AbortController();
|
|
6413
6425
|
const signal = abortController.signal;
|
|
@@ -6431,7 +6443,7 @@ class ApiClient {
|
|
|
6431
6443
|
if (httpOptions && httpOptions.extraBody !== null) {
|
|
6432
6444
|
includeExtraBodyToRequestInit(requestInit, httpOptions.extraBody);
|
|
6433
6445
|
}
|
|
6434
|
-
requestInit.headers = await this.getHeadersInternal(httpOptions);
|
|
6446
|
+
requestInit.headers = await this.getHeadersInternal(httpOptions, url);
|
|
6435
6447
|
return requestInit;
|
|
6436
6448
|
}
|
|
6437
6449
|
async unaryApiCall(url, requestInit, httpMethod) {
|
|
@@ -6544,7 +6556,7 @@ class ApiClient {
|
|
|
6544
6556
|
headers[CONTENT_TYPE_HEADER] = 'application/json';
|
|
6545
6557
|
return headers;
|
|
6546
6558
|
}
|
|
6547
|
-
async getHeadersInternal(httpOptions) {
|
|
6559
|
+
async getHeadersInternal(httpOptions, url) {
|
|
6548
6560
|
const headers = new Headers();
|
|
6549
6561
|
if (httpOptions && httpOptions.headers) {
|
|
6550
6562
|
for (const [key, value] of Object.entries(httpOptions.headers)) {
|
|
@@ -6556,7 +6568,7 @@ class ApiClient {
|
|
|
6556
6568
|
headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
|
|
6557
6569
|
}
|
|
6558
6570
|
}
|
|
6559
|
-
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
6571
|
+
await this.clientOptions.auth.addAuthHeaders(headers, url);
|
|
6560
6572
|
return headers;
|
|
6561
6573
|
}
|
|
6562
6574
|
/**
|
|
@@ -7453,6 +7465,10 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
7453
7465
|
if (fromTopP != null) {
|
|
7454
7466
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
7455
7467
|
}
|
|
7468
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
7469
|
+
undefined) {
|
|
7470
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
7471
|
+
}
|
|
7456
7472
|
return toObject;
|
|
7457
7473
|
}
|
|
7458
7474
|
function googleMapsToMldev$2(fromObject) {
|
|
@@ -10112,6 +10128,10 @@ function generationConfigToVertex(fromObject) {
|
|
|
10112
10128
|
if (fromTopP != null) {
|
|
10113
10129
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
10114
10130
|
}
|
|
10131
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
10132
|
+
undefined) {
|
|
10133
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
10134
|
+
}
|
|
10115
10135
|
return toObject;
|
|
10116
10136
|
}
|
|
10117
10137
|
function getModelParametersToMldev(apiClient, fromObject) {
|
|
@@ -11750,7 +11770,7 @@ class Live {
|
|
|
11750
11770
|
const headers = mapToHeaders(clientHeaders);
|
|
11751
11771
|
if (this.apiClient.isVertexAI()) {
|
|
11752
11772
|
url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
|
|
11753
|
-
await this.auth.addAuthHeaders(headers);
|
|
11773
|
+
await this.auth.addAuthHeaders(headers, url);
|
|
11754
11774
|
}
|
|
11755
11775
|
else {
|
|
11756
11776
|
const apiKey = this.apiClient.getApiKey();
|
|
@@ -14423,7 +14443,7 @@ class Tokens extends BaseModule {
|
|
|
14423
14443
|
* SPDX-License-Identifier: Apache-2.0
|
|
14424
14444
|
*/
|
|
14425
14445
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
14426
|
-
function cancelTuningJobParametersToMldev(fromObject) {
|
|
14446
|
+
function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
|
|
14427
14447
|
const toObject = {};
|
|
14428
14448
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14429
14449
|
if (fromName != null) {
|
|
@@ -14431,7 +14451,7 @@ function cancelTuningJobParametersToMldev(fromObject) {
|
|
|
14431
14451
|
}
|
|
14432
14452
|
return toObject;
|
|
14433
14453
|
}
|
|
14434
|
-
function cancelTuningJobParametersToVertex(fromObject) {
|
|
14454
|
+
function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
14435
14455
|
const toObject = {};
|
|
14436
14456
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14437
14457
|
if (fromName != null) {
|
|
@@ -14439,7 +14459,7 @@ function cancelTuningJobParametersToVertex(fromObject) {
|
|
|
14439
14459
|
}
|
|
14440
14460
|
return toObject;
|
|
14441
14461
|
}
|
|
14442
|
-
function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
14462
|
+
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
14443
14463
|
const toObject = {};
|
|
14444
14464
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
14445
14465
|
throw new Error('validationDataset parameter is not supported in Gemini API.');
|
|
@@ -14487,13 +14507,13 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
14487
14507
|
}
|
|
14488
14508
|
return toObject;
|
|
14489
14509
|
}
|
|
14490
|
-
function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
14510
|
+
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
14491
14511
|
const toObject = {};
|
|
14492
14512
|
const fromValidationDataset = getValueByPath(fromObject, [
|
|
14493
14513
|
'validationDataset',
|
|
14494
14514
|
]);
|
|
14495
14515
|
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
14496
|
-
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset
|
|
14516
|
+
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
14497
14517
|
}
|
|
14498
14518
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14499
14519
|
'tunedModelDisplayName',
|
|
@@ -14537,7 +14557,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
14537
14557
|
}
|
|
14538
14558
|
return toObject;
|
|
14539
14559
|
}
|
|
14540
|
-
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
14560
|
+
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
14541
14561
|
const toObject = {};
|
|
14542
14562
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
14543
14563
|
if (fromBaseModel != null) {
|
|
@@ -14561,7 +14581,7 @@ function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
|
14561
14581
|
}
|
|
14562
14582
|
return toObject;
|
|
14563
14583
|
}
|
|
14564
|
-
function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
14584
|
+
function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
|
|
14565
14585
|
const toObject = {};
|
|
14566
14586
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
14567
14587
|
if (fromBaseModel != null) {
|
|
@@ -14577,7 +14597,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
|
14577
14597
|
'trainingDataset',
|
|
14578
14598
|
]);
|
|
14579
14599
|
if (fromTrainingDataset != null) {
|
|
14580
|
-
|
|
14600
|
+
tuningDatasetToVertex(fromTrainingDataset, toObject);
|
|
14581
14601
|
}
|
|
14582
14602
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14583
14603
|
if (fromConfig != null) {
|
|
@@ -14585,7 +14605,7 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
|
14585
14605
|
}
|
|
14586
14606
|
return toObject;
|
|
14587
14607
|
}
|
|
14588
|
-
function getTuningJobParametersToMldev(fromObject) {
|
|
14608
|
+
function getTuningJobParametersToMldev(fromObject, _rootObject) {
|
|
14589
14609
|
const toObject = {};
|
|
14590
14610
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14591
14611
|
if (fromName != null) {
|
|
@@ -14593,7 +14613,7 @@ function getTuningJobParametersToMldev(fromObject) {
|
|
|
14593
14613
|
}
|
|
14594
14614
|
return toObject;
|
|
14595
14615
|
}
|
|
14596
|
-
function getTuningJobParametersToVertex(fromObject) {
|
|
14616
|
+
function getTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
14597
14617
|
const toObject = {};
|
|
14598
14618
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
14599
14619
|
if (fromName != null) {
|
|
@@ -14601,7 +14621,7 @@ function getTuningJobParametersToVertex(fromObject) {
|
|
|
14601
14621
|
}
|
|
14602
14622
|
return toObject;
|
|
14603
14623
|
}
|
|
14604
|
-
function listTuningJobsConfigToMldev(fromObject, parentObject) {
|
|
14624
|
+
function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
14605
14625
|
const toObject = {};
|
|
14606
14626
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14607
14627
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -14617,7 +14637,7 @@ function listTuningJobsConfigToMldev(fromObject, parentObject) {
|
|
|
14617
14637
|
}
|
|
14618
14638
|
return toObject;
|
|
14619
14639
|
}
|
|
14620
|
-
function listTuningJobsConfigToVertex(fromObject, parentObject) {
|
|
14640
|
+
function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
14621
14641
|
const toObject = {};
|
|
14622
14642
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14623
14643
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -14633,7 +14653,7 @@ function listTuningJobsConfigToVertex(fromObject, parentObject) {
|
|
|
14633
14653
|
}
|
|
14634
14654
|
return toObject;
|
|
14635
14655
|
}
|
|
14636
|
-
function listTuningJobsParametersToMldev(fromObject) {
|
|
14656
|
+
function listTuningJobsParametersToMldev(fromObject, rootObject) {
|
|
14637
14657
|
const toObject = {};
|
|
14638
14658
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14639
14659
|
if (fromConfig != null) {
|
|
@@ -14641,7 +14661,7 @@ function listTuningJobsParametersToMldev(fromObject) {
|
|
|
14641
14661
|
}
|
|
14642
14662
|
return toObject;
|
|
14643
14663
|
}
|
|
14644
|
-
function listTuningJobsParametersToVertex(fromObject) {
|
|
14664
|
+
function listTuningJobsParametersToVertex(fromObject, rootObject) {
|
|
14645
14665
|
const toObject = {};
|
|
14646
14666
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14647
14667
|
if (fromConfig != null) {
|
|
@@ -14649,7 +14669,7 @@ function listTuningJobsParametersToVertex(fromObject) {
|
|
|
14649
14669
|
}
|
|
14650
14670
|
return toObject;
|
|
14651
14671
|
}
|
|
14652
|
-
function listTuningJobsResponseFromMldev(fromObject) {
|
|
14672
|
+
function listTuningJobsResponseFromMldev(fromObject, rootObject) {
|
|
14653
14673
|
const toObject = {};
|
|
14654
14674
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14655
14675
|
'sdkHttpResponse',
|
|
@@ -14675,7 +14695,7 @@ function listTuningJobsResponseFromMldev(fromObject) {
|
|
|
14675
14695
|
}
|
|
14676
14696
|
return toObject;
|
|
14677
14697
|
}
|
|
14678
|
-
function listTuningJobsResponseFromVertex(fromObject) {
|
|
14698
|
+
function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
14679
14699
|
const toObject = {};
|
|
14680
14700
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14681
14701
|
'sdkHttpResponse',
|
|
@@ -14701,7 +14721,7 @@ function listTuningJobsResponseFromVertex(fromObject) {
|
|
|
14701
14721
|
}
|
|
14702
14722
|
return toObject;
|
|
14703
14723
|
}
|
|
14704
|
-
function tunedModelFromMldev(fromObject) {
|
|
14724
|
+
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
14705
14725
|
const toObject = {};
|
|
14706
14726
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
14707
14727
|
if (fromModel != null) {
|
|
@@ -14713,7 +14733,7 @@ function tunedModelFromMldev(fromObject) {
|
|
|
14713
14733
|
}
|
|
14714
14734
|
return toObject;
|
|
14715
14735
|
}
|
|
14716
|
-
function tuningDatasetToMldev(fromObject) {
|
|
14736
|
+
function tuningDatasetToMldev(fromObject, _rootObject) {
|
|
14717
14737
|
const toObject = {};
|
|
14718
14738
|
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
14719
14739
|
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
@@ -14733,7 +14753,7 @@ function tuningDatasetToMldev(fromObject) {
|
|
|
14733
14753
|
}
|
|
14734
14754
|
return toObject;
|
|
14735
14755
|
}
|
|
14736
|
-
function tuningDatasetToVertex(fromObject, parentObject) {
|
|
14756
|
+
function tuningDatasetToVertex(fromObject, parentObject, _rootObject) {
|
|
14737
14757
|
const toObject = {};
|
|
14738
14758
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
14739
14759
|
if (parentObject !== undefined && fromGcsUri != null) {
|
|
@@ -14750,7 +14770,7 @@ function tuningDatasetToVertex(fromObject, parentObject) {
|
|
|
14750
14770
|
}
|
|
14751
14771
|
return toObject;
|
|
14752
14772
|
}
|
|
14753
|
-
function tuningJobFromMldev(fromObject) {
|
|
14773
|
+
function tuningJobFromMldev(fromObject, rootObject) {
|
|
14754
14774
|
const toObject = {};
|
|
14755
14775
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14756
14776
|
'sdkHttpResponse',
|
|
@@ -14800,49 +14820,9 @@ function tuningJobFromMldev(fromObject) {
|
|
|
14800
14820
|
if (fromTunedModel != null) {
|
|
14801
14821
|
setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
|
|
14802
14822
|
}
|
|
14803
|
-
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
14804
|
-
'customBaseModel',
|
|
14805
|
-
]);
|
|
14806
|
-
if (fromCustomBaseModel != null) {
|
|
14807
|
-
setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
|
|
14808
|
-
}
|
|
14809
|
-
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
14810
|
-
if (fromExperiment != null) {
|
|
14811
|
-
setValueByPath(toObject, ['experiment'], fromExperiment);
|
|
14812
|
-
}
|
|
14813
|
-
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
14814
|
-
if (fromLabels != null) {
|
|
14815
|
-
setValueByPath(toObject, ['labels'], fromLabels);
|
|
14816
|
-
}
|
|
14817
|
-
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
14818
|
-
if (fromOutputUri != null) {
|
|
14819
|
-
setValueByPath(toObject, ['outputUri'], fromOutputUri);
|
|
14820
|
-
}
|
|
14821
|
-
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
14822
|
-
if (fromPipelineJob != null) {
|
|
14823
|
-
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
14824
|
-
}
|
|
14825
|
-
const fromServiceAccount = getValueByPath(fromObject, [
|
|
14826
|
-
'serviceAccount',
|
|
14827
|
-
]);
|
|
14828
|
-
if (fromServiceAccount != null) {
|
|
14829
|
-
setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
|
|
14830
|
-
}
|
|
14831
|
-
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14832
|
-
'tunedModelDisplayName',
|
|
14833
|
-
]);
|
|
14834
|
-
if (fromTunedModelDisplayName != null) {
|
|
14835
|
-
setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
|
|
14836
|
-
}
|
|
14837
|
-
const fromVeoTuningSpec = getValueByPath(fromObject, [
|
|
14838
|
-
'veoTuningSpec',
|
|
14839
|
-
]);
|
|
14840
|
-
if (fromVeoTuningSpec != null) {
|
|
14841
|
-
setValueByPath(toObject, ['veoTuningSpec'], fromVeoTuningSpec);
|
|
14842
|
-
}
|
|
14843
14823
|
return toObject;
|
|
14844
14824
|
}
|
|
14845
|
-
function tuningJobFromVertex(fromObject) {
|
|
14825
|
+
function tuningJobFromVertex(fromObject, _rootObject) {
|
|
14846
14826
|
const toObject = {};
|
|
14847
14827
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14848
14828
|
'sdkHttpResponse',
|
|
@@ -14962,7 +14942,7 @@ function tuningJobFromVertex(fromObject) {
|
|
|
14962
14942
|
}
|
|
14963
14943
|
return toObject;
|
|
14964
14944
|
}
|
|
14965
|
-
function tuningOperationFromMldev(fromObject) {
|
|
14945
|
+
function tuningOperationFromMldev(fromObject, _rootObject) {
|
|
14966
14946
|
const toObject = {};
|
|
14967
14947
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
14968
14948
|
'sdkHttpResponse',
|
|
@@ -14988,7 +14968,7 @@ function tuningOperationFromMldev(fromObject) {
|
|
|
14988
14968
|
}
|
|
14989
14969
|
return toObject;
|
|
14990
14970
|
}
|
|
14991
|
-
function tuningValidationDatasetToVertex(fromObject,
|
|
14971
|
+
function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
14992
14972
|
const toObject = {};
|
|
14993
14973
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
14994
14974
|
if (fromGcsUri != null) {
|
|
@@ -14997,8 +14977,8 @@ function tuningValidationDatasetToVertex(fromObject, parentObject) {
|
|
|
14997
14977
|
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
14998
14978
|
'vertexDatasetResource',
|
|
14999
14979
|
]);
|
|
15000
|
-
if (
|
|
15001
|
-
setValueByPath(
|
|
14980
|
+
if (fromVertexDatasetResource != null) {
|
|
14981
|
+
setValueByPath(toObject, ['validationDatasetUri'], fromVertexDatasetResource);
|
|
15002
14982
|
}
|
|
15003
14983
|
return toObject;
|
|
15004
14984
|
}
|
|
@@ -15351,7 +15331,8 @@ class WebAuth {
|
|
|
15351
15331
|
constructor(apiKey) {
|
|
15352
15332
|
this.apiKey = apiKey;
|
|
15353
15333
|
}
|
|
15354
|
-
|
|
15334
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15335
|
+
async addAuthHeaders(headers, url) {
|
|
15355
15336
|
if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
|
|
15356
15337
|
return;
|
|
15357
15338
|
}
|