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