@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.mjs
CHANGED
|
@@ -832,30 +832,6 @@ var DynamicRetrievalConfigMode;
|
|
|
832
832
|
*/
|
|
833
833
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
834
834
|
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
835
|
-
/** Function calling mode. */
|
|
836
|
-
var FunctionCallingConfigMode;
|
|
837
|
-
(function (FunctionCallingConfigMode) {
|
|
838
|
-
/**
|
|
839
|
-
* Unspecified function calling mode. This value should not be used.
|
|
840
|
-
*/
|
|
841
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
842
|
-
/**
|
|
843
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
844
|
-
*/
|
|
845
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
846
|
-
/**
|
|
847
|
-
* 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".
|
|
848
|
-
*/
|
|
849
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
850
|
-
/**
|
|
851
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
852
|
-
*/
|
|
853
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
854
|
-
/**
|
|
855
|
-
* 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".
|
|
856
|
-
*/
|
|
857
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
858
|
-
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
859
835
|
/** The number of thoughts tokens that the model should generate. */
|
|
860
836
|
var ThinkingLevel;
|
|
861
837
|
(function (ThinkingLevel) {
|
|
@@ -1004,6 +980,30 @@ var HarmBlockThreshold;
|
|
|
1004
980
|
*/
|
|
1005
981
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
1006
982
|
})(HarmBlockThreshold || (HarmBlockThreshold = {}));
|
|
983
|
+
/** Function calling mode. */
|
|
984
|
+
var FunctionCallingConfigMode;
|
|
985
|
+
(function (FunctionCallingConfigMode) {
|
|
986
|
+
/**
|
|
987
|
+
* Unspecified function calling mode. This value should not be used.
|
|
988
|
+
*/
|
|
989
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
990
|
+
/**
|
|
991
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
992
|
+
*/
|
|
993
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
994
|
+
/**
|
|
995
|
+
* 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".
|
|
996
|
+
*/
|
|
997
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
998
|
+
/**
|
|
999
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
1000
|
+
*/
|
|
1001
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
1002
|
+
/**
|
|
1003
|
+
* 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".
|
|
1004
|
+
*/
|
|
1005
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
1006
|
+
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
1007
1007
|
/** Output only. The reason why the model stopped generating tokens.
|
|
1008
1008
|
|
|
1009
1009
|
If empty, the model has not stopped generating the tokens. */
|
|
@@ -1837,6 +1837,10 @@ var TuningMethod;
|
|
|
1837
1837
|
* Distillation tuning.
|
|
1838
1838
|
*/
|
|
1839
1839
|
TuningMethod["DISTILLATION"] = "DISTILLATION";
|
|
1840
|
+
/**
|
|
1841
|
+
* Reinforcement tuning.
|
|
1842
|
+
*/
|
|
1843
|
+
TuningMethod["REINFORCEMENT_TUNING"] = "REINFORCEMENT_TUNING";
|
|
1840
1844
|
})(TuningMethod || (TuningMethod = {}));
|
|
1841
1845
|
/** State for the lifecycle of a File. */
|
|
1842
1846
|
var FileState;
|
|
@@ -5158,6 +5162,7 @@ var PagedItem;
|
|
|
5158
5162
|
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
5159
5163
|
PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
|
|
5160
5164
|
PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
|
|
5165
|
+
PagedItem["PAGED_ITEM_SKILLS"] = "skills";
|
|
5161
5166
|
})(PagedItem || (PagedItem = {}));
|
|
5162
5167
|
/**
|
|
5163
5168
|
* Pager class for iterating through paginated results.
|
|
@@ -5893,24 +5898,6 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
5893
5898
|
}
|
|
5894
5899
|
return toObject;
|
|
5895
5900
|
}
|
|
5896
|
-
function computerUseToVertex$2(fromObject) {
|
|
5897
|
-
const toObject = {};
|
|
5898
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5899
|
-
if (fromEnvironment != null) {
|
|
5900
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5901
|
-
}
|
|
5902
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
5903
|
-
'excludedPredefinedFunctions',
|
|
5904
|
-
]);
|
|
5905
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
5906
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
5907
|
-
}
|
|
5908
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
5909
|
-
undefined) {
|
|
5910
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
5911
|
-
}
|
|
5912
|
-
return toObject;
|
|
5913
|
-
}
|
|
5914
5901
|
function contentToMldev$3(fromObject) {
|
|
5915
5902
|
const toObject = {};
|
|
5916
5903
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -6576,7 +6563,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6576
6563
|
}
|
|
6577
6564
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6578
6565
|
if (fromComputerUse != null) {
|
|
6579
|
-
setValueByPath(toObject, ['computerUse'],
|
|
6566
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6580
6567
|
}
|
|
6581
6568
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6582
6569
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -7983,24 +7970,6 @@ function codeExecutionResultToVertex$1(fromObject) {
|
|
|
7983
7970
|
}
|
|
7984
7971
|
return toObject;
|
|
7985
7972
|
}
|
|
7986
|
-
function computerUseToVertex$1(fromObject) {
|
|
7987
|
-
const toObject = {};
|
|
7988
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
7989
|
-
if (fromEnvironment != null) {
|
|
7990
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
7991
|
-
}
|
|
7992
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
7993
|
-
'excludedPredefinedFunctions',
|
|
7994
|
-
]);
|
|
7995
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
7996
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
7997
|
-
}
|
|
7998
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
7999
|
-
undefined) {
|
|
8000
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8001
|
-
}
|
|
8002
|
-
return toObject;
|
|
8003
|
-
}
|
|
8004
7973
|
function contentToMldev$2(fromObject) {
|
|
8005
7974
|
const toObject = {};
|
|
8006
7975
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -8949,7 +8918,7 @@ function toolToVertex$1(fromObject) {
|
|
|
8949
8918
|
}
|
|
8950
8919
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8951
8920
|
if (fromComputerUse != null) {
|
|
8952
|
-
setValueByPath(toObject, ['computerUse'],
|
|
8921
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8953
8922
|
}
|
|
8954
8923
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
8955
8924
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -9282,24 +9251,6 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
9282
9251
|
}
|
|
9283
9252
|
return toObject;
|
|
9284
9253
|
}
|
|
9285
|
-
function computerUseToVertex(fromObject, _rootObject) {
|
|
9286
|
-
const toObject = {};
|
|
9287
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
9288
|
-
if (fromEnvironment != null) {
|
|
9289
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
9290
|
-
}
|
|
9291
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
9292
|
-
'excludedPredefinedFunctions',
|
|
9293
|
-
]);
|
|
9294
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
9295
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
9296
|
-
}
|
|
9297
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
9298
|
-
undefined) {
|
|
9299
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
9300
|
-
}
|
|
9301
|
-
return toObject;
|
|
9302
|
-
}
|
|
9303
9254
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
9304
9255
|
const toObject = {};
|
|
9305
9256
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -12360,7 +12311,7 @@ function toolToMldev$1(fromObject, rootObject) {
|
|
|
12360
12311
|
}
|
|
12361
12312
|
return toObject;
|
|
12362
12313
|
}
|
|
12363
|
-
function toolToVertex(fromObject,
|
|
12314
|
+
function toolToVertex(fromObject, _rootObject) {
|
|
12364
12315
|
const toObject = {};
|
|
12365
12316
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
12366
12317
|
if (fromRetrieval != null) {
|
|
@@ -12368,7 +12319,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12368
12319
|
}
|
|
12369
12320
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
12370
12321
|
if (fromComputerUse != null) {
|
|
12371
|
-
setValueByPath(toObject, ['computerUse'],
|
|
12322
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12372
12323
|
}
|
|
12373
12324
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12374
12325
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -12985,7 +12936,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12985
12936
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12986
12937
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12987
12938
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12988
|
-
const SDK_VERSION = '2.
|
|
12939
|
+
const SDK_VERSION = '2.7.0'; // x-release-please-version
|
|
12989
12940
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12990
12941
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12991
12942
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -20078,6 +20029,24 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
20078
20029
|
if (getValueByPath(fromObject, ['encryptionSpec']) !== undefined) {
|
|
20079
20030
|
throw new Error('encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20080
20031
|
}
|
|
20032
|
+
if (getValueByPath(fromObject, ['rewardConfig']) !== undefined) {
|
|
20033
|
+
throw new Error('rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20034
|
+
}
|
|
20035
|
+
if (getValueByPath(fromObject, ['compositeRewardConfig']) !== undefined) {
|
|
20036
|
+
throw new Error('compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20037
|
+
}
|
|
20038
|
+
if (getValueByPath(fromObject, ['samplesPerPrompt']) !== undefined) {
|
|
20039
|
+
throw new Error('samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20040
|
+
}
|
|
20041
|
+
if (getValueByPath(fromObject, ['evaluateInterval']) !== undefined) {
|
|
20042
|
+
throw new Error('evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20043
|
+
}
|
|
20044
|
+
if (getValueByPath(fromObject, ['checkpointInterval']) !== undefined) {
|
|
20045
|
+
throw new Error('checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20046
|
+
}
|
|
20047
|
+
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
20048
|
+
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20049
|
+
}
|
|
20081
20050
|
return toObject;
|
|
20082
20051
|
}
|
|
20083
20052
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -20113,6 +20082,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20113
20082
|
setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20114
20083
|
}
|
|
20115
20084
|
}
|
|
20085
|
+
else if (discriminatorValidationDataset === 'REINFORCEMENT_TUNING') {
|
|
20086
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
20087
|
+
'validationDataset',
|
|
20088
|
+
]);
|
|
20089
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
20090
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20091
|
+
}
|
|
20092
|
+
}
|
|
20116
20093
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
20117
20094
|
'tunedModelDisplayName',
|
|
20118
20095
|
]);
|
|
@@ -20148,6 +20125,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20148
20125
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20149
20126
|
}
|
|
20150
20127
|
}
|
|
20128
|
+
else if (discriminatorEpochCount === 'REINFORCEMENT_TUNING') {
|
|
20129
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
20130
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
20131
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20132
|
+
}
|
|
20133
|
+
}
|
|
20151
20134
|
let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
|
|
20152
20135
|
'config',
|
|
20153
20136
|
'method',
|
|
@@ -20183,6 +20166,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20183
20166
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
20184
20167
|
}
|
|
20185
20168
|
}
|
|
20169
|
+
else if (discriminatorLearningRateMultiplier === 'REINFORCEMENT_TUNING') {
|
|
20170
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
20171
|
+
'learningRateMultiplier',
|
|
20172
|
+
]);
|
|
20173
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
20174
|
+
setValueByPath(parentObject, [
|
|
20175
|
+
'reinforcementTuningSpec',
|
|
20176
|
+
'hyperParameters',
|
|
20177
|
+
'learningRateMultiplier',
|
|
20178
|
+
], fromLearningRateMultiplier);
|
|
20179
|
+
}
|
|
20180
|
+
}
|
|
20186
20181
|
let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
|
|
20187
20182
|
if (discriminatorExportLastCheckpointOnly === undefined) {
|
|
20188
20183
|
discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
|
|
@@ -20236,6 +20231,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20236
20231
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20237
20232
|
}
|
|
20238
20233
|
}
|
|
20234
|
+
else if (discriminatorAdapterSize === 'REINFORCEMENT_TUNING') {
|
|
20235
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
20236
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
20237
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20238
|
+
}
|
|
20239
|
+
}
|
|
20239
20240
|
let discriminatorTuningMode = getValueByPath(rootObject, [
|
|
20240
20241
|
'config',
|
|
20241
20242
|
'method',
|
|
@@ -20280,6 +20281,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20280
20281
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20281
20282
|
}
|
|
20282
20283
|
}
|
|
20284
|
+
else if (discriminatorBatchSize === 'REINFORCEMENT_TUNING') {
|
|
20285
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
20286
|
+
if (parentObject !== undefined && fromBatchSize != null) {
|
|
20287
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20288
|
+
}
|
|
20289
|
+
}
|
|
20283
20290
|
let discriminatorLearningRate = getValueByPath(rootObject, [
|
|
20284
20291
|
'config',
|
|
20285
20292
|
'method',
|
|
@@ -20339,6 +20346,40 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20339
20346
|
if (parentObject !== undefined && fromEncryptionSpec != null) {
|
|
20340
20347
|
setValueByPath(parentObject, ['encryptionSpec'], fromEncryptionSpec);
|
|
20341
20348
|
}
|
|
20349
|
+
const fromRewardConfig = getValueByPath(fromObject, ['rewardConfig']);
|
|
20350
|
+
if (parentObject !== undefined && fromRewardConfig != null) {
|
|
20351
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'singleRewardConfig'], fromRewardConfig);
|
|
20352
|
+
}
|
|
20353
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
20354
|
+
'compositeRewardConfig',
|
|
20355
|
+
]);
|
|
20356
|
+
if (parentObject !== undefined && fromCompositeRewardConfig != null) {
|
|
20357
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'compositeRewardConfig'], fromCompositeRewardConfig);
|
|
20358
|
+
}
|
|
20359
|
+
const fromSamplesPerPrompt = getValueByPath(fromObject, [
|
|
20360
|
+
'samplesPerPrompt',
|
|
20361
|
+
]);
|
|
20362
|
+
if (parentObject !== undefined && fromSamplesPerPrompt != null) {
|
|
20363
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'samplesPerPrompt'], fromSamplesPerPrompt);
|
|
20364
|
+
}
|
|
20365
|
+
const fromEvaluateInterval = getValueByPath(fromObject, [
|
|
20366
|
+
'evaluateInterval',
|
|
20367
|
+
]);
|
|
20368
|
+
if (parentObject !== undefined && fromEvaluateInterval != null) {
|
|
20369
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'evaluateInterval'], fromEvaluateInterval);
|
|
20370
|
+
}
|
|
20371
|
+
const fromCheckpointInterval = getValueByPath(fromObject, [
|
|
20372
|
+
'checkpointInterval',
|
|
20373
|
+
]);
|
|
20374
|
+
if (parentObject !== undefined && fromCheckpointInterval != null) {
|
|
20375
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'checkpointInterval'], fromCheckpointInterval);
|
|
20376
|
+
}
|
|
20377
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
20378
|
+
'maxOutputTokens',
|
|
20379
|
+
]);
|
|
20380
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20381
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20382
|
+
}
|
|
20342
20383
|
return toObject;
|
|
20343
20384
|
}
|
|
20344
20385
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20758,6 +20799,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20758
20799
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
|
|
20759
20800
|
}
|
|
20760
20801
|
}
|
|
20802
|
+
else if (discriminatorGcsUri === 'REINFORCEMENT_TUNING') {
|
|
20803
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
20804
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
20805
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
20806
|
+
}
|
|
20807
|
+
}
|
|
20761
20808
|
let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
|
|
20762
20809
|
'config',
|
|
20763
20810
|
'method',
|
|
@@ -20789,6 +20836,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20789
20836
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
|
|
20790
20837
|
}
|
|
20791
20838
|
}
|
|
20839
|
+
else if (discriminatorVertexDatasetResource === 'REINFORCEMENT_TUNING') {
|
|
20840
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
20841
|
+
'vertexDatasetResource',
|
|
20842
|
+
]);
|
|
20843
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
20844
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
20845
|
+
}
|
|
20846
|
+
}
|
|
20792
20847
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
20793
20848
|
throw new Error('examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20794
20849
|
}
|