@google/genai 2.5.0 → 2.7.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 +344 -95
- package/dist/index.cjs +545 -56
- package/dist/index.mjs +546 -57
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +545 -56
- package/dist/node/index.mjs +546 -57
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +344 -95
- package/dist/tokenizer/node.cjs +84 -40
- package/dist/tokenizer/node.d.ts +28 -24
- package/dist/tokenizer/node.mjs +84 -40
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +85 -41
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +227 -90
- package/dist/vertex_internal/index.js +85 -41
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +546 -57
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +344 -95
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -558,18 +558,6 @@ function videoFromVertex$1(fromObject) {
|
|
|
558
558
|
* Copyright 2025 Google LLC
|
|
559
559
|
* SPDX-License-Identifier: Apache-2.0
|
|
560
560
|
*/
|
|
561
|
-
/** Programming language of the `code`. */
|
|
562
|
-
exports.Language = void 0;
|
|
563
|
-
(function (Language) {
|
|
564
|
-
/**
|
|
565
|
-
* Unspecified language. This value should not be used.
|
|
566
|
-
*/
|
|
567
|
-
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
568
|
-
/**
|
|
569
|
-
* Python >= 3.10, with numpy and simpy available.
|
|
570
|
-
*/
|
|
571
|
-
Language["PYTHON"] = "PYTHON";
|
|
572
|
-
})(exports.Language || (exports.Language = {}));
|
|
573
561
|
/** Outcome of the code execution. */
|
|
574
562
|
exports.Outcome = void 0;
|
|
575
563
|
(function (Outcome) {
|
|
@@ -578,18 +566,30 @@ exports.Outcome = void 0;
|
|
|
578
566
|
*/
|
|
579
567
|
Outcome["OUTCOME_UNSPECIFIED"] = "OUTCOME_UNSPECIFIED";
|
|
580
568
|
/**
|
|
581
|
-
* Code execution completed successfully.
|
|
569
|
+
* Code execution completed successfully. `output` contains the stdout, if any.
|
|
582
570
|
*/
|
|
583
571
|
Outcome["OUTCOME_OK"] = "OUTCOME_OK";
|
|
584
572
|
/**
|
|
585
|
-
* Code execution
|
|
573
|
+
* Code execution failed. `output` contains the stderr and stdout, if any.
|
|
586
574
|
*/
|
|
587
575
|
Outcome["OUTCOME_FAILED"] = "OUTCOME_FAILED";
|
|
588
576
|
/**
|
|
589
|
-
* Code execution ran for too long, and was cancelled. There may or may not be a partial output present.
|
|
577
|
+
* Code execution ran for too long, and was cancelled. There may or may not be a partial `output` present.
|
|
590
578
|
*/
|
|
591
579
|
Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
|
|
592
580
|
})(exports.Outcome || (exports.Outcome = {}));
|
|
581
|
+
/** Programming language of the `code`. */
|
|
582
|
+
exports.Language = void 0;
|
|
583
|
+
(function (Language) {
|
|
584
|
+
/**
|
|
585
|
+
* Unspecified language. This value should not be used.
|
|
586
|
+
*/
|
|
587
|
+
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
588
|
+
/**
|
|
589
|
+
* Python >= 3.10, with numpy and simpy available.
|
|
590
|
+
*/
|
|
591
|
+
Language["PYTHON"] = "PYTHON";
|
|
592
|
+
})(exports.Language || (exports.Language = {}));
|
|
593
593
|
/** Specifies how the response should be scheduled in the conversation. */
|
|
594
594
|
exports.FunctionResponseScheduling = void 0;
|
|
595
595
|
(function (FunctionResponseScheduling) {
|
|
@@ -657,6 +657,14 @@ exports.Environment = void 0;
|
|
|
657
657
|
* Operates in a web browser.
|
|
658
658
|
*/
|
|
659
659
|
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
660
|
+
/**
|
|
661
|
+
* Operates in a mobile environment.
|
|
662
|
+
*/
|
|
663
|
+
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
664
|
+
/**
|
|
665
|
+
* Operates in a desktop environment.
|
|
666
|
+
*/
|
|
667
|
+
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
660
668
|
})(exports.Environment || (exports.Environment = {}));
|
|
661
669
|
/** Type of auth scheme. This enum is not supported in Gemini API. */
|
|
662
670
|
exports.AuthType = void 0;
|
|
@@ -788,30 +796,6 @@ exports.DynamicRetrievalConfigMode = void 0;
|
|
|
788
796
|
*/
|
|
789
797
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
790
798
|
})(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
|
|
791
|
-
/** Function calling mode. */
|
|
792
|
-
exports.FunctionCallingConfigMode = void 0;
|
|
793
|
-
(function (FunctionCallingConfigMode) {
|
|
794
|
-
/**
|
|
795
|
-
* Unspecified function calling mode. This value should not be used.
|
|
796
|
-
*/
|
|
797
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
798
|
-
/**
|
|
799
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
800
|
-
*/
|
|
801
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
802
|
-
/**
|
|
803
|
-
* Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
804
|
-
*/
|
|
805
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
806
|
-
/**
|
|
807
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
808
|
-
*/
|
|
809
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
810
|
-
/**
|
|
811
|
-
* Model is constrained to predict either function calls or natural language response. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
812
|
-
*/
|
|
813
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
814
|
-
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
815
799
|
/** The number of thoughts tokens that the model should generate. */
|
|
816
800
|
exports.ThinkingLevel = void 0;
|
|
817
801
|
(function (ThinkingLevel) {
|
|
@@ -960,6 +944,30 @@ exports.HarmBlockThreshold = void 0;
|
|
|
960
944
|
*/
|
|
961
945
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
962
946
|
})(exports.HarmBlockThreshold || (exports.HarmBlockThreshold = {}));
|
|
947
|
+
/** Function calling mode. */
|
|
948
|
+
exports.FunctionCallingConfigMode = void 0;
|
|
949
|
+
(function (FunctionCallingConfigMode) {
|
|
950
|
+
/**
|
|
951
|
+
* Unspecified function calling mode. This value should not be used.
|
|
952
|
+
*/
|
|
953
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
954
|
+
/**
|
|
955
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
956
|
+
*/
|
|
957
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
958
|
+
/**
|
|
959
|
+
* Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
960
|
+
*/
|
|
961
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
962
|
+
/**
|
|
963
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
964
|
+
*/
|
|
965
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
966
|
+
/**
|
|
967
|
+
* Model is constrained to predict either function calls or natural language response. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
968
|
+
*/
|
|
969
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
970
|
+
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
963
971
|
/** Output only. The reason why the model stopped generating tokens.
|
|
964
972
|
|
|
965
973
|
If empty, the model has not stopped generating the tokens. */
|
|
@@ -1442,7 +1450,23 @@ exports.PairwiseChoice = void 0;
|
|
|
1442
1450
|
*/
|
|
1443
1451
|
PairwiseChoice["TIE"] = "TIE";
|
|
1444
1452
|
})(exports.PairwiseChoice || (exports.PairwiseChoice = {}));
|
|
1445
|
-
/** The tuning
|
|
1453
|
+
/** The speed of the tuning job. Only supported for Veo 3.0 models. This enum is not supported in Gemini API. */
|
|
1454
|
+
exports.TuningSpeed = void 0;
|
|
1455
|
+
(function (TuningSpeed) {
|
|
1456
|
+
/**
|
|
1457
|
+
* The default / unset value. For Veo 3.0 models, this defaults to FAST.
|
|
1458
|
+
*/
|
|
1459
|
+
TuningSpeed["TUNING_SPEED_UNSPECIFIED"] = "TUNING_SPEED_UNSPECIFIED";
|
|
1460
|
+
/**
|
|
1461
|
+
* Regular tuning speed.
|
|
1462
|
+
*/
|
|
1463
|
+
TuningSpeed["REGULAR"] = "REGULAR";
|
|
1464
|
+
/**
|
|
1465
|
+
* Fast tuning speed.
|
|
1466
|
+
*/
|
|
1467
|
+
TuningSpeed["FAST"] = "FAST";
|
|
1468
|
+
})(exports.TuningSpeed || (exports.TuningSpeed = {}));
|
|
1469
|
+
/** The tuning task for Veo. This enum is not supported in Gemini API. */
|
|
1446
1470
|
exports.TuningTask = void 0;
|
|
1447
1471
|
(function (TuningTask) {
|
|
1448
1472
|
/**
|
|
@@ -1462,6 +1486,22 @@ exports.TuningTask = void 0;
|
|
|
1462
1486
|
*/
|
|
1463
1487
|
TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
|
|
1464
1488
|
})(exports.TuningTask || (exports.TuningTask = {}));
|
|
1489
|
+
/** The orientation of the video. Defaults to LANDSCAPE. This enum is not supported in Gemini API. */
|
|
1490
|
+
exports.VideoOrientation = void 0;
|
|
1491
|
+
(function (VideoOrientation) {
|
|
1492
|
+
/**
|
|
1493
|
+
* Unspecified video orientation. Defaults to landscape.
|
|
1494
|
+
*/
|
|
1495
|
+
VideoOrientation["VIDEO_ORIENTATION_UNSPECIFIED"] = "VIDEO_ORIENTATION_UNSPECIFIED";
|
|
1496
|
+
/**
|
|
1497
|
+
* Landscape orientation (e.g. 16:9, 1280x720).
|
|
1498
|
+
*/
|
|
1499
|
+
VideoOrientation["LANDSCAPE"] = "LANDSCAPE";
|
|
1500
|
+
/**
|
|
1501
|
+
* Portrait orientation (e.g. 9:16, 720x1280).
|
|
1502
|
+
*/
|
|
1503
|
+
VideoOrientation["PORTRAIT"] = "PORTRAIT";
|
|
1504
|
+
})(exports.VideoOrientation || (exports.VideoOrientation = {}));
|
|
1465
1505
|
/** Output only. Current state of the `Document`. This enum is not supported in Vertex AI. */
|
|
1466
1506
|
exports.DocumentState = void 0;
|
|
1467
1507
|
(function (DocumentState) {
|
|
@@ -1761,6 +1801,10 @@ exports.TuningMethod = void 0;
|
|
|
1761
1801
|
* Distillation tuning.
|
|
1762
1802
|
*/
|
|
1763
1803
|
TuningMethod["DISTILLATION"] = "DISTILLATION";
|
|
1804
|
+
/**
|
|
1805
|
+
* Reinforcement tuning.
|
|
1806
|
+
*/
|
|
1807
|
+
TuningMethod["REINFORCEMENT_TUNING"] = "REINFORCEMENT_TUNING";
|
|
1764
1808
|
})(exports.TuningMethod || (exports.TuningMethod = {}));
|
|
1765
1809
|
/** State for the lifecycle of a File. */
|
|
1766
1810
|
exports.FileState = void 0;
|
|
@@ -5082,6 +5126,7 @@ exports.PagedItem = void 0;
|
|
|
5082
5126
|
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
5083
5127
|
PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
|
|
5084
5128
|
PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
|
|
5129
|
+
PagedItem["PAGED_ITEM_SKILLS"] = "skills";
|
|
5085
5130
|
})(exports.PagedItem || (exports.PagedItem = {}));
|
|
5086
5131
|
/**
|
|
5087
5132
|
* Pager class for iterating through paginated results.
|
|
@@ -5802,6 +5847,21 @@ function blobToMldev$3(fromObject) {
|
|
|
5802
5847
|
}
|
|
5803
5848
|
return toObject;
|
|
5804
5849
|
}
|
|
5850
|
+
function codeExecutionResultToVertex$2(fromObject) {
|
|
5851
|
+
const toObject = {};
|
|
5852
|
+
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
5853
|
+
if (fromOutcome != null) {
|
|
5854
|
+
setValueByPath(toObject, ['outcome'], fromOutcome);
|
|
5855
|
+
}
|
|
5856
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
5857
|
+
if (fromOutput != null) {
|
|
5858
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
5859
|
+
}
|
|
5860
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
5861
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
5862
|
+
}
|
|
5863
|
+
return toObject;
|
|
5864
|
+
}
|
|
5805
5865
|
function contentToMldev$3(fromObject) {
|
|
5806
5866
|
const toObject = {};
|
|
5807
5867
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -5997,6 +6057,21 @@ function deleteCachedContentResponseFromVertex(fromObject) {
|
|
|
5997
6057
|
}
|
|
5998
6058
|
return toObject;
|
|
5999
6059
|
}
|
|
6060
|
+
function executableCodeToVertex$2(fromObject) {
|
|
6061
|
+
const toObject = {};
|
|
6062
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
6063
|
+
if (fromCode != null) {
|
|
6064
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
6065
|
+
}
|
|
6066
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
6067
|
+
if (fromLanguage != null) {
|
|
6068
|
+
setValueByPath(toObject, ['language'], fromLanguage);
|
|
6069
|
+
}
|
|
6070
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
6071
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6072
|
+
}
|
|
6073
|
+
return toObject;
|
|
6074
|
+
}
|
|
6000
6075
|
function fileDataToMldev$3(fromObject) {
|
|
6001
6076
|
const toObject = {};
|
|
6002
6077
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
@@ -6280,13 +6355,13 @@ function partToVertex$2(fromObject) {
|
|
|
6280
6355
|
'codeExecutionResult',
|
|
6281
6356
|
]);
|
|
6282
6357
|
if (fromCodeExecutionResult != null) {
|
|
6283
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
6358
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$2(fromCodeExecutionResult));
|
|
6284
6359
|
}
|
|
6285
6360
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
6286
6361
|
'executableCode',
|
|
6287
6362
|
]);
|
|
6288
6363
|
if (fromExecutableCode != null) {
|
|
6289
|
-
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
6364
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$2(fromExecutableCode));
|
|
6290
6365
|
}
|
|
6291
6366
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
6292
6367
|
if (fromFileData != null) {
|
|
@@ -7596,7 +7671,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7596
7671
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7597
7672
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7598
7673
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7599
|
-
const SDK_VERSION = '2.
|
|
7674
|
+
const SDK_VERSION = '2.7.0'; // x-release-please-version
|
|
7600
7675
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7601
7676
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7602
7677
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11633,6 +11708,21 @@ function blobToMldev$2(fromObject) {
|
|
|
11633
11708
|
}
|
|
11634
11709
|
return toObject;
|
|
11635
11710
|
}
|
|
11711
|
+
function codeExecutionResultToVertex$1(fromObject) {
|
|
11712
|
+
const toObject = {};
|
|
11713
|
+
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
11714
|
+
if (fromOutcome != null) {
|
|
11715
|
+
setValueByPath(toObject, ['outcome'], fromOutcome);
|
|
11716
|
+
}
|
|
11717
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
11718
|
+
if (fromOutput != null) {
|
|
11719
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
11720
|
+
}
|
|
11721
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
11722
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11723
|
+
}
|
|
11724
|
+
return toObject;
|
|
11725
|
+
}
|
|
11636
11726
|
function contentToMldev$2(fromObject) {
|
|
11637
11727
|
const toObject = {};
|
|
11638
11728
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -11669,6 +11759,21 @@ function contentToVertex$1(fromObject) {
|
|
|
11669
11759
|
}
|
|
11670
11760
|
return toObject;
|
|
11671
11761
|
}
|
|
11762
|
+
function executableCodeToVertex$1(fromObject) {
|
|
11763
|
+
const toObject = {};
|
|
11764
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
11765
|
+
if (fromCode != null) {
|
|
11766
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
11767
|
+
}
|
|
11768
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
11769
|
+
if (fromLanguage != null) {
|
|
11770
|
+
setValueByPath(toObject, ['language'], fromLanguage);
|
|
11771
|
+
}
|
|
11772
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
11773
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11774
|
+
}
|
|
11775
|
+
return toObject;
|
|
11776
|
+
}
|
|
11672
11777
|
function fileDataToMldev$2(fromObject) {
|
|
11673
11778
|
const toObject = {};
|
|
11674
11779
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
@@ -12408,13 +12513,13 @@ function partToVertex$1(fromObject) {
|
|
|
12408
12513
|
'codeExecutionResult',
|
|
12409
12514
|
]);
|
|
12410
12515
|
if (fromCodeExecutionResult != null) {
|
|
12411
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
12516
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$1(fromCodeExecutionResult));
|
|
12412
12517
|
}
|
|
12413
12518
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
12414
12519
|
'executableCode',
|
|
12415
12520
|
]);
|
|
12416
12521
|
if (fromExecutableCode != null) {
|
|
12417
|
-
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
12522
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$1(fromExecutableCode));
|
|
12418
12523
|
}
|
|
12419
12524
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
12420
12525
|
if (fromFileData != null) {
|
|
@@ -12846,6 +12951,21 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
12846
12951
|
}
|
|
12847
12952
|
return toObject;
|
|
12848
12953
|
}
|
|
12954
|
+
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
12955
|
+
const toObject = {};
|
|
12956
|
+
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
12957
|
+
if (fromOutcome != null) {
|
|
12958
|
+
setValueByPath(toObject, ['outcome'], fromOutcome);
|
|
12959
|
+
}
|
|
12960
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
12961
|
+
if (fromOutput != null) {
|
|
12962
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
12963
|
+
}
|
|
12964
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
12965
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
12966
|
+
}
|
|
12967
|
+
return toObject;
|
|
12968
|
+
}
|
|
12849
12969
|
function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
12850
12970
|
const toObject = {};
|
|
12851
12971
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -13558,6 +13678,21 @@ function endpointFromVertex(fromObject, _rootObject) {
|
|
|
13558
13678
|
}
|
|
13559
13679
|
return toObject;
|
|
13560
13680
|
}
|
|
13681
|
+
function executableCodeToVertex(fromObject, _rootObject) {
|
|
13682
|
+
const toObject = {};
|
|
13683
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
13684
|
+
if (fromCode != null) {
|
|
13685
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
13686
|
+
}
|
|
13687
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
13688
|
+
if (fromLanguage != null) {
|
|
13689
|
+
setValueByPath(toObject, ['language'], fromLanguage);
|
|
13690
|
+
}
|
|
13691
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
13692
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
13693
|
+
}
|
|
13694
|
+
return toObject;
|
|
13695
|
+
}
|
|
13561
13696
|
function fileDataToMldev$1(fromObject, _rootObject) {
|
|
13562
13697
|
const toObject = {};
|
|
13563
13698
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
@@ -15436,7 +15571,7 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
15436
15571
|
}
|
|
15437
15572
|
return toObject;
|
|
15438
15573
|
}
|
|
15439
|
-
function partToVertex(fromObject,
|
|
15574
|
+
function partToVertex(fromObject, rootObject) {
|
|
15440
15575
|
const toObject = {};
|
|
15441
15576
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
15442
15577
|
'mediaResolution',
|
|
@@ -15448,13 +15583,13 @@ function partToVertex(fromObject, _rootObject) {
|
|
|
15448
15583
|
'codeExecutionResult',
|
|
15449
15584
|
]);
|
|
15450
15585
|
if (fromCodeExecutionResult != null) {
|
|
15451
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
15586
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
15452
15587
|
}
|
|
15453
15588
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
15454
15589
|
'executableCode',
|
|
15455
15590
|
]);
|
|
15456
15591
|
if (fromExecutableCode != null) {
|
|
15457
|
-
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
15592
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
15458
15593
|
}
|
|
15459
15594
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
15460
15595
|
if (fromFileData != null) {
|
|
@@ -19830,6 +19965,24 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
19830
19965
|
if (getValueByPath(fromObject, ['encryptionSpec']) !== undefined) {
|
|
19831
19966
|
throw new Error('encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19832
19967
|
}
|
|
19968
|
+
if (getValueByPath(fromObject, ['rewardConfig']) !== undefined) {
|
|
19969
|
+
throw new Error('rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19970
|
+
}
|
|
19971
|
+
if (getValueByPath(fromObject, ['compositeRewardConfig']) !== undefined) {
|
|
19972
|
+
throw new Error('compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19973
|
+
}
|
|
19974
|
+
if (getValueByPath(fromObject, ['samplesPerPrompt']) !== undefined) {
|
|
19975
|
+
throw new Error('samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19976
|
+
}
|
|
19977
|
+
if (getValueByPath(fromObject, ['evaluateInterval']) !== undefined) {
|
|
19978
|
+
throw new Error('evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19979
|
+
}
|
|
19980
|
+
if (getValueByPath(fromObject, ['checkpointInterval']) !== undefined) {
|
|
19981
|
+
throw new Error('checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19982
|
+
}
|
|
19983
|
+
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
19984
|
+
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19985
|
+
}
|
|
19833
19986
|
return toObject;
|
|
19834
19987
|
}
|
|
19835
19988
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -19865,6 +20018,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
19865
20018
|
setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
19866
20019
|
}
|
|
19867
20020
|
}
|
|
20021
|
+
else if (discriminatorValidationDataset === 'REINFORCEMENT_TUNING') {
|
|
20022
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
20023
|
+
'validationDataset',
|
|
20024
|
+
]);
|
|
20025
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
20026
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20027
|
+
}
|
|
20028
|
+
}
|
|
19868
20029
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
19869
20030
|
'tunedModelDisplayName',
|
|
19870
20031
|
]);
|
|
@@ -19900,6 +20061,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
19900
20061
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
19901
20062
|
}
|
|
19902
20063
|
}
|
|
20064
|
+
else if (discriminatorEpochCount === 'REINFORCEMENT_TUNING') {
|
|
20065
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
20066
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
20067
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20068
|
+
}
|
|
20069
|
+
}
|
|
19903
20070
|
let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
|
|
19904
20071
|
'config',
|
|
19905
20072
|
'method',
|
|
@@ -19935,6 +20102,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
19935
20102
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
19936
20103
|
}
|
|
19937
20104
|
}
|
|
20105
|
+
else if (discriminatorLearningRateMultiplier === 'REINFORCEMENT_TUNING') {
|
|
20106
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
20107
|
+
'learningRateMultiplier',
|
|
20108
|
+
]);
|
|
20109
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
20110
|
+
setValueByPath(parentObject, [
|
|
20111
|
+
'reinforcementTuningSpec',
|
|
20112
|
+
'hyperParameters',
|
|
20113
|
+
'learningRateMultiplier',
|
|
20114
|
+
], fromLearningRateMultiplier);
|
|
20115
|
+
}
|
|
20116
|
+
}
|
|
19938
20117
|
let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
|
|
19939
20118
|
if (discriminatorExportLastCheckpointOnly === undefined) {
|
|
19940
20119
|
discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
|
|
@@ -19988,6 +20167,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
19988
20167
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
19989
20168
|
}
|
|
19990
20169
|
}
|
|
20170
|
+
else if (discriminatorAdapterSize === 'REINFORCEMENT_TUNING') {
|
|
20171
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
20172
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
20173
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20174
|
+
}
|
|
20175
|
+
}
|
|
19991
20176
|
let discriminatorTuningMode = getValueByPath(rootObject, [
|
|
19992
20177
|
'config',
|
|
19993
20178
|
'method',
|
|
@@ -20032,6 +20217,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20032
20217
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20033
20218
|
}
|
|
20034
20219
|
}
|
|
20220
|
+
else if (discriminatorBatchSize === 'REINFORCEMENT_TUNING') {
|
|
20221
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
20222
|
+
if (parentObject !== undefined && fromBatchSize != null) {
|
|
20223
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20224
|
+
}
|
|
20225
|
+
}
|
|
20035
20226
|
let discriminatorLearningRate = getValueByPath(rootObject, [
|
|
20036
20227
|
'config',
|
|
20037
20228
|
'method',
|
|
@@ -20091,6 +20282,40 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20091
20282
|
if (parentObject !== undefined && fromEncryptionSpec != null) {
|
|
20092
20283
|
setValueByPath(parentObject, ['encryptionSpec'], fromEncryptionSpec);
|
|
20093
20284
|
}
|
|
20285
|
+
const fromRewardConfig = getValueByPath(fromObject, ['rewardConfig']);
|
|
20286
|
+
if (parentObject !== undefined && fromRewardConfig != null) {
|
|
20287
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'singleRewardConfig'], fromRewardConfig);
|
|
20288
|
+
}
|
|
20289
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
20290
|
+
'compositeRewardConfig',
|
|
20291
|
+
]);
|
|
20292
|
+
if (parentObject !== undefined && fromCompositeRewardConfig != null) {
|
|
20293
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'compositeRewardConfig'], fromCompositeRewardConfig);
|
|
20294
|
+
}
|
|
20295
|
+
const fromSamplesPerPrompt = getValueByPath(fromObject, [
|
|
20296
|
+
'samplesPerPrompt',
|
|
20297
|
+
]);
|
|
20298
|
+
if (parentObject !== undefined && fromSamplesPerPrompt != null) {
|
|
20299
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'samplesPerPrompt'], fromSamplesPerPrompt);
|
|
20300
|
+
}
|
|
20301
|
+
const fromEvaluateInterval = getValueByPath(fromObject, [
|
|
20302
|
+
'evaluateInterval',
|
|
20303
|
+
]);
|
|
20304
|
+
if (parentObject !== undefined && fromEvaluateInterval != null) {
|
|
20305
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'evaluateInterval'], fromEvaluateInterval);
|
|
20306
|
+
}
|
|
20307
|
+
const fromCheckpointInterval = getValueByPath(fromObject, [
|
|
20308
|
+
'checkpointInterval',
|
|
20309
|
+
]);
|
|
20310
|
+
if (parentObject !== undefined && fromCheckpointInterval != null) {
|
|
20311
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'checkpointInterval'], fromCheckpointInterval);
|
|
20312
|
+
}
|
|
20313
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
20314
|
+
'maxOutputTokens',
|
|
20315
|
+
]);
|
|
20316
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20317
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20318
|
+
}
|
|
20094
20319
|
return toObject;
|
|
20095
20320
|
}
|
|
20096
20321
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20141,6 +20366,250 @@ function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
|
|
|
20141
20366
|
}
|
|
20142
20367
|
return toObject;
|
|
20143
20368
|
}
|
|
20369
|
+
function distillationHyperParametersFromVertex(fromObject, rootObject) {
|
|
20370
|
+
const toObject = {};
|
|
20371
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
20372
|
+
if (fromAdapterSize != null) {
|
|
20373
|
+
setValueByPath(toObject, ['adapterSize'], fromAdapterSize);
|
|
20374
|
+
}
|
|
20375
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
20376
|
+
if (fromEpochCount != null) {
|
|
20377
|
+
setValueByPath(toObject, ['epochCount'], fromEpochCount);
|
|
20378
|
+
}
|
|
20379
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
20380
|
+
'learningRateMultiplier',
|
|
20381
|
+
]);
|
|
20382
|
+
if (fromLearningRateMultiplier != null) {
|
|
20383
|
+
setValueByPath(toObject, ['learningRateMultiplier'], fromLearningRateMultiplier);
|
|
20384
|
+
}
|
|
20385
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
20386
|
+
'generationConfig',
|
|
20387
|
+
]);
|
|
20388
|
+
if (fromGenerationConfig != null) {
|
|
20389
|
+
setValueByPath(toObject, ['generationConfig'], generationConfigFromVertex(fromGenerationConfig));
|
|
20390
|
+
}
|
|
20391
|
+
const fromLearningRate = getValueByPath(fromObject, ['learningRate']);
|
|
20392
|
+
if (fromLearningRate != null) {
|
|
20393
|
+
setValueByPath(toObject, ['learningRate'], fromLearningRate);
|
|
20394
|
+
}
|
|
20395
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
20396
|
+
if (fromBatchSize != null) {
|
|
20397
|
+
setValueByPath(toObject, ['batchSize'], fromBatchSize);
|
|
20398
|
+
}
|
|
20399
|
+
return toObject;
|
|
20400
|
+
}
|
|
20401
|
+
function distillationSamplingSpecFromVertex(fromObject, rootObject) {
|
|
20402
|
+
const toObject = {};
|
|
20403
|
+
const fromBaseTeacherModel = getValueByPath(fromObject, [
|
|
20404
|
+
'baseTeacherModel',
|
|
20405
|
+
]);
|
|
20406
|
+
if (fromBaseTeacherModel != null) {
|
|
20407
|
+
setValueByPath(toObject, ['baseTeacherModel'], fromBaseTeacherModel);
|
|
20408
|
+
}
|
|
20409
|
+
const fromTunedTeacherModelSource = getValueByPath(fromObject, [
|
|
20410
|
+
'tunedTeacherModelSource',
|
|
20411
|
+
]);
|
|
20412
|
+
if (fromTunedTeacherModelSource != null) {
|
|
20413
|
+
setValueByPath(toObject, ['tunedTeacherModelSource'], fromTunedTeacherModelSource);
|
|
20414
|
+
}
|
|
20415
|
+
const fromValidationDatasetUri = getValueByPath(fromObject, [
|
|
20416
|
+
'validationDatasetUri',
|
|
20417
|
+
]);
|
|
20418
|
+
if (fromValidationDatasetUri != null) {
|
|
20419
|
+
setValueByPath(toObject, ['validationDatasetUri'], fromValidationDatasetUri);
|
|
20420
|
+
}
|
|
20421
|
+
const fromPromptDatasetUri = getValueByPath(fromObject, [
|
|
20422
|
+
'promptDatasetUri',
|
|
20423
|
+
]);
|
|
20424
|
+
if (fromPromptDatasetUri != null) {
|
|
20425
|
+
setValueByPath(toObject, ['promptDatasetUri'], fromPromptDatasetUri);
|
|
20426
|
+
}
|
|
20427
|
+
const fromHyperparameters = getValueByPath(fromObject, [
|
|
20428
|
+
'hyperparameters',
|
|
20429
|
+
]);
|
|
20430
|
+
if (fromHyperparameters != null) {
|
|
20431
|
+
setValueByPath(toObject, ['hyperparameters'], distillationHyperParametersFromVertex(fromHyperparameters));
|
|
20432
|
+
}
|
|
20433
|
+
return toObject;
|
|
20434
|
+
}
|
|
20435
|
+
function distillationSpecFromVertex(fromObject, rootObject) {
|
|
20436
|
+
const toObject = {};
|
|
20437
|
+
const fromPromptDatasetUri = getValueByPath(fromObject, [
|
|
20438
|
+
'promptDatasetUri',
|
|
20439
|
+
]);
|
|
20440
|
+
if (fromPromptDatasetUri != null) {
|
|
20441
|
+
setValueByPath(toObject, ['promptDatasetUri'], fromPromptDatasetUri);
|
|
20442
|
+
}
|
|
20443
|
+
const fromBaseTeacherModel = getValueByPath(fromObject, [
|
|
20444
|
+
'baseTeacherModel',
|
|
20445
|
+
]);
|
|
20446
|
+
if (fromBaseTeacherModel != null) {
|
|
20447
|
+
setValueByPath(toObject, ['baseTeacherModel'], fromBaseTeacherModel);
|
|
20448
|
+
}
|
|
20449
|
+
const fromHyperParameters = getValueByPath(fromObject, [
|
|
20450
|
+
'hyperParameters',
|
|
20451
|
+
]);
|
|
20452
|
+
if (fromHyperParameters != null) {
|
|
20453
|
+
setValueByPath(toObject, ['hyperParameters'], distillationHyperParametersFromVertex(fromHyperParameters));
|
|
20454
|
+
}
|
|
20455
|
+
const fromPipelineRootDirectory = getValueByPath(fromObject, [
|
|
20456
|
+
'pipelineRootDirectory',
|
|
20457
|
+
]);
|
|
20458
|
+
if (fromPipelineRootDirectory != null) {
|
|
20459
|
+
setValueByPath(toObject, ['pipelineRootDirectory'], fromPipelineRootDirectory);
|
|
20460
|
+
}
|
|
20461
|
+
const fromStudentModel = getValueByPath(fromObject, ['studentModel']);
|
|
20462
|
+
if (fromStudentModel != null) {
|
|
20463
|
+
setValueByPath(toObject, ['studentModel'], fromStudentModel);
|
|
20464
|
+
}
|
|
20465
|
+
const fromTrainingDatasetUri = getValueByPath(fromObject, [
|
|
20466
|
+
'trainingDatasetUri',
|
|
20467
|
+
]);
|
|
20468
|
+
if (fromTrainingDatasetUri != null) {
|
|
20469
|
+
setValueByPath(toObject, ['trainingDatasetUri'], fromTrainingDatasetUri);
|
|
20470
|
+
}
|
|
20471
|
+
const fromTunedTeacherModelSource = getValueByPath(fromObject, [
|
|
20472
|
+
'tunedTeacherModelSource',
|
|
20473
|
+
]);
|
|
20474
|
+
if (fromTunedTeacherModelSource != null) {
|
|
20475
|
+
setValueByPath(toObject, ['tunedTeacherModelSource'], fromTunedTeacherModelSource);
|
|
20476
|
+
}
|
|
20477
|
+
const fromValidationDatasetUri = getValueByPath(fromObject, [
|
|
20478
|
+
'validationDatasetUri',
|
|
20479
|
+
]);
|
|
20480
|
+
if (fromValidationDatasetUri != null) {
|
|
20481
|
+
setValueByPath(toObject, ['validationDatasetUri'], fromValidationDatasetUri);
|
|
20482
|
+
}
|
|
20483
|
+
const fromTuningMode = getValueByPath(fromObject, ['tuningMode']);
|
|
20484
|
+
if (fromTuningMode != null) {
|
|
20485
|
+
setValueByPath(toObject, ['tuningMode'], fromTuningMode);
|
|
20486
|
+
}
|
|
20487
|
+
return toObject;
|
|
20488
|
+
}
|
|
20489
|
+
function generationConfigFromVertex(fromObject, _rootObject) {
|
|
20490
|
+
const toObject = {};
|
|
20491
|
+
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
20492
|
+
'modelConfig',
|
|
20493
|
+
]);
|
|
20494
|
+
if (fromModelSelectionConfig != null) {
|
|
20495
|
+
setValueByPath(toObject, ['modelSelectionConfig'], fromModelSelectionConfig);
|
|
20496
|
+
}
|
|
20497
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
20498
|
+
'responseJsonSchema',
|
|
20499
|
+
]);
|
|
20500
|
+
if (fromResponseJsonSchema != null) {
|
|
20501
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
20502
|
+
}
|
|
20503
|
+
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
20504
|
+
'audioTimestamp',
|
|
20505
|
+
]);
|
|
20506
|
+
if (fromAudioTimestamp != null) {
|
|
20507
|
+
setValueByPath(toObject, ['audioTimestamp'], fromAudioTimestamp);
|
|
20508
|
+
}
|
|
20509
|
+
const fromCandidateCount = getValueByPath(fromObject, [
|
|
20510
|
+
'candidateCount',
|
|
20511
|
+
]);
|
|
20512
|
+
if (fromCandidateCount != null) {
|
|
20513
|
+
setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
|
|
20514
|
+
}
|
|
20515
|
+
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
20516
|
+
'enableAffectiveDialog',
|
|
20517
|
+
]);
|
|
20518
|
+
if (fromEnableAffectiveDialog != null) {
|
|
20519
|
+
setValueByPath(toObject, ['enableAffectiveDialog'], fromEnableAffectiveDialog);
|
|
20520
|
+
}
|
|
20521
|
+
const fromFrequencyPenalty = getValueByPath(fromObject, [
|
|
20522
|
+
'frequencyPenalty',
|
|
20523
|
+
]);
|
|
20524
|
+
if (fromFrequencyPenalty != null) {
|
|
20525
|
+
setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
|
|
20526
|
+
}
|
|
20527
|
+
const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
|
|
20528
|
+
if (fromLogprobs != null) {
|
|
20529
|
+
setValueByPath(toObject, ['logprobs'], fromLogprobs);
|
|
20530
|
+
}
|
|
20531
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
20532
|
+
'maxOutputTokens',
|
|
20533
|
+
]);
|
|
20534
|
+
if (fromMaxOutputTokens != null) {
|
|
20535
|
+
setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
|
|
20536
|
+
}
|
|
20537
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
20538
|
+
'mediaResolution',
|
|
20539
|
+
]);
|
|
20540
|
+
if (fromMediaResolution != null) {
|
|
20541
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
20542
|
+
}
|
|
20543
|
+
const fromPresencePenalty = getValueByPath(fromObject, [
|
|
20544
|
+
'presencePenalty',
|
|
20545
|
+
]);
|
|
20546
|
+
if (fromPresencePenalty != null) {
|
|
20547
|
+
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
20548
|
+
}
|
|
20549
|
+
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
20550
|
+
'responseLogprobs',
|
|
20551
|
+
]);
|
|
20552
|
+
if (fromResponseLogprobs != null) {
|
|
20553
|
+
setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
|
|
20554
|
+
}
|
|
20555
|
+
const fromResponseMimeType = getValueByPath(fromObject, [
|
|
20556
|
+
'responseMimeType',
|
|
20557
|
+
]);
|
|
20558
|
+
if (fromResponseMimeType != null) {
|
|
20559
|
+
setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
|
|
20560
|
+
}
|
|
20561
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
20562
|
+
'responseModalities',
|
|
20563
|
+
]);
|
|
20564
|
+
if (fromResponseModalities != null) {
|
|
20565
|
+
setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
|
|
20566
|
+
}
|
|
20567
|
+
const fromResponseSchema = getValueByPath(fromObject, [
|
|
20568
|
+
'responseSchema',
|
|
20569
|
+
]);
|
|
20570
|
+
if (fromResponseSchema != null) {
|
|
20571
|
+
setValueByPath(toObject, ['responseSchema'], fromResponseSchema);
|
|
20572
|
+
}
|
|
20573
|
+
const fromRoutingConfig = getValueByPath(fromObject, [
|
|
20574
|
+
'routingConfig',
|
|
20575
|
+
]);
|
|
20576
|
+
if (fromRoutingConfig != null) {
|
|
20577
|
+
setValueByPath(toObject, ['routingConfig'], fromRoutingConfig);
|
|
20578
|
+
}
|
|
20579
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
20580
|
+
if (fromSeed != null) {
|
|
20581
|
+
setValueByPath(toObject, ['seed'], fromSeed);
|
|
20582
|
+
}
|
|
20583
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
20584
|
+
if (fromSpeechConfig != null) {
|
|
20585
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
20586
|
+
}
|
|
20587
|
+
const fromStopSequences = getValueByPath(fromObject, [
|
|
20588
|
+
'stopSequences',
|
|
20589
|
+
]);
|
|
20590
|
+
if (fromStopSequences != null) {
|
|
20591
|
+
setValueByPath(toObject, ['stopSequences'], fromStopSequences);
|
|
20592
|
+
}
|
|
20593
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
20594
|
+
if (fromTemperature != null) {
|
|
20595
|
+
setValueByPath(toObject, ['temperature'], fromTemperature);
|
|
20596
|
+
}
|
|
20597
|
+
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
20598
|
+
'thinkingConfig',
|
|
20599
|
+
]);
|
|
20600
|
+
if (fromThinkingConfig != null) {
|
|
20601
|
+
setValueByPath(toObject, ['thinkingConfig'], fromThinkingConfig);
|
|
20602
|
+
}
|
|
20603
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
20604
|
+
if (fromTopK != null) {
|
|
20605
|
+
setValueByPath(toObject, ['topK'], fromTopK);
|
|
20606
|
+
}
|
|
20607
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
20608
|
+
if (fromTopP != null) {
|
|
20609
|
+
setValueByPath(toObject, ['topP'], fromTopP);
|
|
20610
|
+
}
|
|
20611
|
+
return toObject;
|
|
20612
|
+
}
|
|
20144
20613
|
function getTuningJobParametersToMldev(fromObject, _rootObject) {
|
|
20145
20614
|
const toObject = {};
|
|
20146
20615
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -20266,6 +20735,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20266
20735
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
|
|
20267
20736
|
}
|
|
20268
20737
|
}
|
|
20738
|
+
else if (discriminatorGcsUri === 'REINFORCEMENT_TUNING') {
|
|
20739
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
20740
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
20741
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
20742
|
+
}
|
|
20743
|
+
}
|
|
20269
20744
|
let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
|
|
20270
20745
|
'config',
|
|
20271
20746
|
'method',
|
|
@@ -20297,6 +20772,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20297
20772
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
|
|
20298
20773
|
}
|
|
20299
20774
|
}
|
|
20775
|
+
else if (discriminatorVertexDatasetResource === 'REINFORCEMENT_TUNING') {
|
|
20776
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
20777
|
+
'vertexDatasetResource',
|
|
20778
|
+
]);
|
|
20779
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
20780
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
20781
|
+
}
|
|
20782
|
+
}
|
|
20300
20783
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
20301
20784
|
throw new Error('examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20302
20785
|
}
|
|
@@ -20354,7 +20837,7 @@ function tuningJobFromMldev(fromObject, rootObject) {
|
|
|
20354
20837
|
}
|
|
20355
20838
|
return toObject;
|
|
20356
20839
|
}
|
|
20357
|
-
function tuningJobFromVertex(fromObject,
|
|
20840
|
+
function tuningJobFromVertex(fromObject, rootObject) {
|
|
20358
20841
|
const toObject = {};
|
|
20359
20842
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
20360
20843
|
'sdkHttpResponse',
|
|
@@ -20424,7 +20907,7 @@ function tuningJobFromVertex(fromObject, _rootObject) {
|
|
|
20424
20907
|
'distillationSpec',
|
|
20425
20908
|
]);
|
|
20426
20909
|
if (fromDistillationSpec != null) {
|
|
20427
|
-
setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
|
|
20910
|
+
setValueByPath(toObject, ['distillationSpec'], distillationSpecFromVertex(fromDistillationSpec));
|
|
20428
20911
|
}
|
|
20429
20912
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
20430
20913
|
'tuningDataStats',
|
|
@@ -20508,18 +20991,24 @@ function tuningJobFromVertex(fromObject, _rootObject) {
|
|
|
20508
20991
|
if (fromVeoTuningSpec != null) {
|
|
20509
20992
|
setValueByPath(toObject, ['veoTuningSpec'], fromVeoTuningSpec);
|
|
20510
20993
|
}
|
|
20511
|
-
const fromDistillationSamplingSpec = getValueByPath(fromObject, [
|
|
20512
|
-
'distillationSamplingSpec',
|
|
20513
|
-
]);
|
|
20514
|
-
if (fromDistillationSamplingSpec != null) {
|
|
20515
|
-
setValueByPath(toObject, ['distillationSamplingSpec'], fromDistillationSamplingSpec);
|
|
20516
|
-
}
|
|
20517
20994
|
const fromTuningJobMetadata = getValueByPath(fromObject, [
|
|
20518
20995
|
'tuningJobMetadata',
|
|
20519
20996
|
]);
|
|
20520
20997
|
if (fromTuningJobMetadata != null) {
|
|
20521
20998
|
setValueByPath(toObject, ['tuningJobMetadata'], fromTuningJobMetadata);
|
|
20522
20999
|
}
|
|
21000
|
+
const fromVeoLoraTuningSpec = getValueByPath(fromObject, [
|
|
21001
|
+
'veoLoraTuningSpec',
|
|
21002
|
+
]);
|
|
21003
|
+
if (fromVeoLoraTuningSpec != null) {
|
|
21004
|
+
setValueByPath(toObject, ['veoLoraTuningSpec'], fromVeoLoraTuningSpec);
|
|
21005
|
+
}
|
|
21006
|
+
const fromDistillationSamplingSpec = getValueByPath(fromObject, [
|
|
21007
|
+
'distillationSamplingSpec',
|
|
21008
|
+
]);
|
|
21009
|
+
if (fromDistillationSamplingSpec != null) {
|
|
21010
|
+
setValueByPath(toObject, ['distillationSamplingSpec'], distillationSamplingSpecFromVertex(fromDistillationSamplingSpec));
|
|
21011
|
+
}
|
|
20523
21012
|
return toObject;
|
|
20524
21013
|
}
|
|
20525
21014
|
function tuningOperationFromMldev(fromObject, _rootObject) {
|