@google/genai 2.6.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 +200 -27
- package/dist/index.cjs +138 -83
- package/dist/index.mjs +138 -83
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +138 -83
- package/dist/node/index.mjs +138 -83
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +200 -27
- package/dist/tokenizer/node.cjs +28 -24
- package/dist/tokenizer/node.d.ts +2 -3
- package/dist/tokenizer/node.mjs +28 -24
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +29 -25
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +85 -24
- package/dist/vertex_internal/index.js +29 -25
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +138 -83
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +200 -27
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -854,30 +854,6 @@ exports.DynamicRetrievalConfigMode = void 0;
|
|
|
854
854
|
*/
|
|
855
855
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
856
856
|
})(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
|
|
857
|
-
/** Function calling mode. */
|
|
858
|
-
exports.FunctionCallingConfigMode = void 0;
|
|
859
|
-
(function (FunctionCallingConfigMode) {
|
|
860
|
-
/**
|
|
861
|
-
* Unspecified function calling mode. This value should not be used.
|
|
862
|
-
*/
|
|
863
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
864
|
-
/**
|
|
865
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
866
|
-
*/
|
|
867
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
868
|
-
/**
|
|
869
|
-
* 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".
|
|
870
|
-
*/
|
|
871
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
872
|
-
/**
|
|
873
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
874
|
-
*/
|
|
875
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
876
|
-
/**
|
|
877
|
-
* 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".
|
|
878
|
-
*/
|
|
879
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
880
|
-
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
881
857
|
/** The number of thoughts tokens that the model should generate. */
|
|
882
858
|
exports.ThinkingLevel = void 0;
|
|
883
859
|
(function (ThinkingLevel) {
|
|
@@ -1026,6 +1002,30 @@ exports.HarmBlockThreshold = void 0;
|
|
|
1026
1002
|
*/
|
|
1027
1003
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
1028
1004
|
})(exports.HarmBlockThreshold || (exports.HarmBlockThreshold = {}));
|
|
1005
|
+
/** Function calling mode. */
|
|
1006
|
+
exports.FunctionCallingConfigMode = void 0;
|
|
1007
|
+
(function (FunctionCallingConfigMode) {
|
|
1008
|
+
/**
|
|
1009
|
+
* Unspecified function calling mode. This value should not be used.
|
|
1010
|
+
*/
|
|
1011
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1012
|
+
/**
|
|
1013
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
1014
|
+
*/
|
|
1015
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
1016
|
+
/**
|
|
1017
|
+
* 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".
|
|
1018
|
+
*/
|
|
1019
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
1020
|
+
/**
|
|
1021
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
1022
|
+
*/
|
|
1023
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
1024
|
+
/**
|
|
1025
|
+
* 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".
|
|
1026
|
+
*/
|
|
1027
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
1028
|
+
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
1029
1029
|
/** Output only. The reason why the model stopped generating tokens.
|
|
1030
1030
|
|
|
1031
1031
|
If empty, the model has not stopped generating the tokens. */
|
|
@@ -1859,6 +1859,10 @@ exports.TuningMethod = void 0;
|
|
|
1859
1859
|
* Distillation tuning.
|
|
1860
1860
|
*/
|
|
1861
1861
|
TuningMethod["DISTILLATION"] = "DISTILLATION";
|
|
1862
|
+
/**
|
|
1863
|
+
* Reinforcement tuning.
|
|
1864
|
+
*/
|
|
1865
|
+
TuningMethod["REINFORCEMENT_TUNING"] = "REINFORCEMENT_TUNING";
|
|
1862
1866
|
})(exports.TuningMethod || (exports.TuningMethod = {}));
|
|
1863
1867
|
/** State for the lifecycle of a File. */
|
|
1864
1868
|
exports.FileState = void 0;
|
|
@@ -5180,6 +5184,7 @@ exports.PagedItem = void 0;
|
|
|
5180
5184
|
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
5181
5185
|
PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
|
|
5182
5186
|
PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
|
|
5187
|
+
PagedItem["PAGED_ITEM_SKILLS"] = "skills";
|
|
5183
5188
|
})(exports.PagedItem || (exports.PagedItem = {}));
|
|
5184
5189
|
/**
|
|
5185
5190
|
* Pager class for iterating through paginated results.
|
|
@@ -5915,24 +5920,6 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
5915
5920
|
}
|
|
5916
5921
|
return toObject;
|
|
5917
5922
|
}
|
|
5918
|
-
function computerUseToVertex$2(fromObject) {
|
|
5919
|
-
const toObject = {};
|
|
5920
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5921
|
-
if (fromEnvironment != null) {
|
|
5922
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5923
|
-
}
|
|
5924
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
5925
|
-
'excludedPredefinedFunctions',
|
|
5926
|
-
]);
|
|
5927
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
5928
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
5929
|
-
}
|
|
5930
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
5931
|
-
undefined) {
|
|
5932
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
5933
|
-
}
|
|
5934
|
-
return toObject;
|
|
5935
|
-
}
|
|
5936
5923
|
function contentToMldev$3(fromObject) {
|
|
5937
5924
|
const toObject = {};
|
|
5938
5925
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -6598,7 +6585,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6598
6585
|
}
|
|
6599
6586
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6600
6587
|
if (fromComputerUse != null) {
|
|
6601
|
-
setValueByPath(toObject, ['computerUse'],
|
|
6588
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6602
6589
|
}
|
|
6603
6590
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6604
6591
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -8005,24 +7992,6 @@ function codeExecutionResultToVertex$1(fromObject) {
|
|
|
8005
7992
|
}
|
|
8006
7993
|
return toObject;
|
|
8007
7994
|
}
|
|
8008
|
-
function computerUseToVertex$1(fromObject) {
|
|
8009
|
-
const toObject = {};
|
|
8010
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
8011
|
-
if (fromEnvironment != null) {
|
|
8012
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
8013
|
-
}
|
|
8014
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
8015
|
-
'excludedPredefinedFunctions',
|
|
8016
|
-
]);
|
|
8017
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
8018
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
8019
|
-
}
|
|
8020
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
8021
|
-
undefined) {
|
|
8022
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8023
|
-
}
|
|
8024
|
-
return toObject;
|
|
8025
|
-
}
|
|
8026
7995
|
function contentToMldev$2(fromObject) {
|
|
8027
7996
|
const toObject = {};
|
|
8028
7997
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -8971,7 +8940,7 @@ function toolToVertex$1(fromObject) {
|
|
|
8971
8940
|
}
|
|
8972
8941
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8973
8942
|
if (fromComputerUse != null) {
|
|
8974
|
-
setValueByPath(toObject, ['computerUse'],
|
|
8943
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8975
8944
|
}
|
|
8976
8945
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
8977
8946
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -9304,24 +9273,6 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
9304
9273
|
}
|
|
9305
9274
|
return toObject;
|
|
9306
9275
|
}
|
|
9307
|
-
function computerUseToVertex(fromObject, _rootObject) {
|
|
9308
|
-
const toObject = {};
|
|
9309
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
9310
|
-
if (fromEnvironment != null) {
|
|
9311
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
9312
|
-
}
|
|
9313
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
9314
|
-
'excludedPredefinedFunctions',
|
|
9315
|
-
]);
|
|
9316
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
9317
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
9318
|
-
}
|
|
9319
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
9320
|
-
undefined) {
|
|
9321
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
9322
|
-
}
|
|
9323
|
-
return toObject;
|
|
9324
|
-
}
|
|
9325
9276
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
9326
9277
|
const toObject = {};
|
|
9327
9278
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -12382,7 +12333,7 @@ function toolToMldev$1(fromObject, rootObject) {
|
|
|
12382
12333
|
}
|
|
12383
12334
|
return toObject;
|
|
12384
12335
|
}
|
|
12385
|
-
function toolToVertex(fromObject,
|
|
12336
|
+
function toolToVertex(fromObject, _rootObject) {
|
|
12386
12337
|
const toObject = {};
|
|
12387
12338
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
12388
12339
|
if (fromRetrieval != null) {
|
|
@@ -12390,7 +12341,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12390
12341
|
}
|
|
12391
12342
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
12392
12343
|
if (fromComputerUse != null) {
|
|
12393
|
-
setValueByPath(toObject, ['computerUse'],
|
|
12344
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12394
12345
|
}
|
|
12395
12346
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12396
12347
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -13007,7 +12958,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
13007
12958
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
13008
12959
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
13009
12960
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
13010
|
-
const SDK_VERSION = '2.
|
|
12961
|
+
const SDK_VERSION = '2.7.0'; // x-release-please-version
|
|
13011
12962
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
13012
12963
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
13013
12964
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -20100,6 +20051,24 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
20100
20051
|
if (getValueByPath(fromObject, ['encryptionSpec']) !== undefined) {
|
|
20101
20052
|
throw new Error('encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20102
20053
|
}
|
|
20054
|
+
if (getValueByPath(fromObject, ['rewardConfig']) !== undefined) {
|
|
20055
|
+
throw new Error('rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20056
|
+
}
|
|
20057
|
+
if (getValueByPath(fromObject, ['compositeRewardConfig']) !== undefined) {
|
|
20058
|
+
throw new Error('compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20059
|
+
}
|
|
20060
|
+
if (getValueByPath(fromObject, ['samplesPerPrompt']) !== undefined) {
|
|
20061
|
+
throw new Error('samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20062
|
+
}
|
|
20063
|
+
if (getValueByPath(fromObject, ['evaluateInterval']) !== undefined) {
|
|
20064
|
+
throw new Error('evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20065
|
+
}
|
|
20066
|
+
if (getValueByPath(fromObject, ['checkpointInterval']) !== undefined) {
|
|
20067
|
+
throw new Error('checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20068
|
+
}
|
|
20069
|
+
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
20070
|
+
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20071
|
+
}
|
|
20103
20072
|
return toObject;
|
|
20104
20073
|
}
|
|
20105
20074
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -20135,6 +20104,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20135
20104
|
setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20136
20105
|
}
|
|
20137
20106
|
}
|
|
20107
|
+
else if (discriminatorValidationDataset === 'REINFORCEMENT_TUNING') {
|
|
20108
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
20109
|
+
'validationDataset',
|
|
20110
|
+
]);
|
|
20111
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
20112
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20113
|
+
}
|
|
20114
|
+
}
|
|
20138
20115
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
20139
20116
|
'tunedModelDisplayName',
|
|
20140
20117
|
]);
|
|
@@ -20170,6 +20147,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20170
20147
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20171
20148
|
}
|
|
20172
20149
|
}
|
|
20150
|
+
else if (discriminatorEpochCount === 'REINFORCEMENT_TUNING') {
|
|
20151
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
20152
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
20153
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20154
|
+
}
|
|
20155
|
+
}
|
|
20173
20156
|
let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
|
|
20174
20157
|
'config',
|
|
20175
20158
|
'method',
|
|
@@ -20205,6 +20188,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20205
20188
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
20206
20189
|
}
|
|
20207
20190
|
}
|
|
20191
|
+
else if (discriminatorLearningRateMultiplier === 'REINFORCEMENT_TUNING') {
|
|
20192
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
20193
|
+
'learningRateMultiplier',
|
|
20194
|
+
]);
|
|
20195
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
20196
|
+
setValueByPath(parentObject, [
|
|
20197
|
+
'reinforcementTuningSpec',
|
|
20198
|
+
'hyperParameters',
|
|
20199
|
+
'learningRateMultiplier',
|
|
20200
|
+
], fromLearningRateMultiplier);
|
|
20201
|
+
}
|
|
20202
|
+
}
|
|
20208
20203
|
let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
|
|
20209
20204
|
if (discriminatorExportLastCheckpointOnly === undefined) {
|
|
20210
20205
|
discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
|
|
@@ -20258,6 +20253,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20258
20253
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20259
20254
|
}
|
|
20260
20255
|
}
|
|
20256
|
+
else if (discriminatorAdapterSize === 'REINFORCEMENT_TUNING') {
|
|
20257
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
20258
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
20259
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20260
|
+
}
|
|
20261
|
+
}
|
|
20261
20262
|
let discriminatorTuningMode = getValueByPath(rootObject, [
|
|
20262
20263
|
'config',
|
|
20263
20264
|
'method',
|
|
@@ -20302,6 +20303,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20302
20303
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20303
20304
|
}
|
|
20304
20305
|
}
|
|
20306
|
+
else if (discriminatorBatchSize === 'REINFORCEMENT_TUNING') {
|
|
20307
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
20308
|
+
if (parentObject !== undefined && fromBatchSize != null) {
|
|
20309
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20310
|
+
}
|
|
20311
|
+
}
|
|
20305
20312
|
let discriminatorLearningRate = getValueByPath(rootObject, [
|
|
20306
20313
|
'config',
|
|
20307
20314
|
'method',
|
|
@@ -20361,6 +20368,40 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20361
20368
|
if (parentObject !== undefined && fromEncryptionSpec != null) {
|
|
20362
20369
|
setValueByPath(parentObject, ['encryptionSpec'], fromEncryptionSpec);
|
|
20363
20370
|
}
|
|
20371
|
+
const fromRewardConfig = getValueByPath(fromObject, ['rewardConfig']);
|
|
20372
|
+
if (parentObject !== undefined && fromRewardConfig != null) {
|
|
20373
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'singleRewardConfig'], fromRewardConfig);
|
|
20374
|
+
}
|
|
20375
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
20376
|
+
'compositeRewardConfig',
|
|
20377
|
+
]);
|
|
20378
|
+
if (parentObject !== undefined && fromCompositeRewardConfig != null) {
|
|
20379
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'compositeRewardConfig'], fromCompositeRewardConfig);
|
|
20380
|
+
}
|
|
20381
|
+
const fromSamplesPerPrompt = getValueByPath(fromObject, [
|
|
20382
|
+
'samplesPerPrompt',
|
|
20383
|
+
]);
|
|
20384
|
+
if (parentObject !== undefined && fromSamplesPerPrompt != null) {
|
|
20385
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'samplesPerPrompt'], fromSamplesPerPrompt);
|
|
20386
|
+
}
|
|
20387
|
+
const fromEvaluateInterval = getValueByPath(fromObject, [
|
|
20388
|
+
'evaluateInterval',
|
|
20389
|
+
]);
|
|
20390
|
+
if (parentObject !== undefined && fromEvaluateInterval != null) {
|
|
20391
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'evaluateInterval'], fromEvaluateInterval);
|
|
20392
|
+
}
|
|
20393
|
+
const fromCheckpointInterval = getValueByPath(fromObject, [
|
|
20394
|
+
'checkpointInterval',
|
|
20395
|
+
]);
|
|
20396
|
+
if (parentObject !== undefined && fromCheckpointInterval != null) {
|
|
20397
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'checkpointInterval'], fromCheckpointInterval);
|
|
20398
|
+
}
|
|
20399
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
20400
|
+
'maxOutputTokens',
|
|
20401
|
+
]);
|
|
20402
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20403
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20404
|
+
}
|
|
20364
20405
|
return toObject;
|
|
20365
20406
|
}
|
|
20366
20407
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20780,6 +20821,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20780
20821
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
|
|
20781
20822
|
}
|
|
20782
20823
|
}
|
|
20824
|
+
else if (discriminatorGcsUri === 'REINFORCEMENT_TUNING') {
|
|
20825
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
20826
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
20827
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
20828
|
+
}
|
|
20829
|
+
}
|
|
20783
20830
|
let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
|
|
20784
20831
|
'config',
|
|
20785
20832
|
'method',
|
|
@@ -20811,6 +20858,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20811
20858
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
|
|
20812
20859
|
}
|
|
20813
20860
|
}
|
|
20861
|
+
else if (discriminatorVertexDatasetResource === 'REINFORCEMENT_TUNING') {
|
|
20862
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
20863
|
+
'vertexDatasetResource',
|
|
20864
|
+
]);
|
|
20865
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
20866
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
20867
|
+
}
|
|
20868
|
+
}
|
|
20814
20869
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
20815
20870
|
throw new Error('examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20816
20871
|
}
|