@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/web/index.mjs
CHANGED
|
@@ -824,30 +824,6 @@ var DynamicRetrievalConfigMode;
|
|
|
824
824
|
*/
|
|
825
825
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
826
826
|
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
827
|
-
/** Function calling mode. */
|
|
828
|
-
var FunctionCallingConfigMode;
|
|
829
|
-
(function (FunctionCallingConfigMode) {
|
|
830
|
-
/**
|
|
831
|
-
* Unspecified function calling mode. This value should not be used.
|
|
832
|
-
*/
|
|
833
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
834
|
-
/**
|
|
835
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
836
|
-
*/
|
|
837
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
838
|
-
/**
|
|
839
|
-
* 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".
|
|
840
|
-
*/
|
|
841
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
842
|
-
/**
|
|
843
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
844
|
-
*/
|
|
845
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
846
|
-
/**
|
|
847
|
-
* 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".
|
|
848
|
-
*/
|
|
849
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
850
|
-
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
851
827
|
/** The number of thoughts tokens that the model should generate. */
|
|
852
828
|
var ThinkingLevel;
|
|
853
829
|
(function (ThinkingLevel) {
|
|
@@ -996,6 +972,30 @@ var HarmBlockThreshold;
|
|
|
996
972
|
*/
|
|
997
973
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
998
974
|
})(HarmBlockThreshold || (HarmBlockThreshold = {}));
|
|
975
|
+
/** Function calling mode. */
|
|
976
|
+
var FunctionCallingConfigMode;
|
|
977
|
+
(function (FunctionCallingConfigMode) {
|
|
978
|
+
/**
|
|
979
|
+
* Unspecified function calling mode. This value should not be used.
|
|
980
|
+
*/
|
|
981
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
982
|
+
/**
|
|
983
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
984
|
+
*/
|
|
985
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
986
|
+
/**
|
|
987
|
+
* 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".
|
|
988
|
+
*/
|
|
989
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
990
|
+
/**
|
|
991
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
992
|
+
*/
|
|
993
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
994
|
+
/**
|
|
995
|
+
* 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".
|
|
996
|
+
*/
|
|
997
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
998
|
+
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
999
999
|
/** Output only. The reason why the model stopped generating tokens.
|
|
1000
1000
|
|
|
1001
1001
|
If empty, the model has not stopped generating the tokens. */
|
|
@@ -1829,6 +1829,10 @@ var TuningMethod;
|
|
|
1829
1829
|
* Distillation tuning.
|
|
1830
1830
|
*/
|
|
1831
1831
|
TuningMethod["DISTILLATION"] = "DISTILLATION";
|
|
1832
|
+
/**
|
|
1833
|
+
* Reinforcement tuning.
|
|
1834
|
+
*/
|
|
1835
|
+
TuningMethod["REINFORCEMENT_TUNING"] = "REINFORCEMENT_TUNING";
|
|
1832
1836
|
})(TuningMethod || (TuningMethod = {}));
|
|
1833
1837
|
/** State for the lifecycle of a File. */
|
|
1834
1838
|
var FileState;
|
|
@@ -5150,6 +5154,7 @@ var PagedItem;
|
|
|
5150
5154
|
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
5151
5155
|
PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
|
|
5152
5156
|
PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
|
|
5157
|
+
PagedItem["PAGED_ITEM_SKILLS"] = "skills";
|
|
5153
5158
|
})(PagedItem || (PagedItem = {}));
|
|
5154
5159
|
/**
|
|
5155
5160
|
* Pager class for iterating through paginated results.
|
|
@@ -5885,24 +5890,6 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
5885
5890
|
}
|
|
5886
5891
|
return toObject;
|
|
5887
5892
|
}
|
|
5888
|
-
function computerUseToVertex$2(fromObject) {
|
|
5889
|
-
const toObject = {};
|
|
5890
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5891
|
-
if (fromEnvironment != null) {
|
|
5892
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5893
|
-
}
|
|
5894
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
5895
|
-
'excludedPredefinedFunctions',
|
|
5896
|
-
]);
|
|
5897
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
5898
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
5899
|
-
}
|
|
5900
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
5901
|
-
undefined) {
|
|
5902
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
5903
|
-
}
|
|
5904
|
-
return toObject;
|
|
5905
|
-
}
|
|
5906
5893
|
function contentToMldev$3(fromObject) {
|
|
5907
5894
|
const toObject = {};
|
|
5908
5895
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -6568,7 +6555,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6568
6555
|
}
|
|
6569
6556
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6570
6557
|
if (fromComputerUse != null) {
|
|
6571
|
-
setValueByPath(toObject, ['computerUse'],
|
|
6558
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6572
6559
|
}
|
|
6573
6560
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6574
6561
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -7975,24 +7962,6 @@ function codeExecutionResultToVertex$1(fromObject) {
|
|
|
7975
7962
|
}
|
|
7976
7963
|
return toObject;
|
|
7977
7964
|
}
|
|
7978
|
-
function computerUseToVertex$1(fromObject) {
|
|
7979
|
-
const toObject = {};
|
|
7980
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
7981
|
-
if (fromEnvironment != null) {
|
|
7982
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
7983
|
-
}
|
|
7984
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
7985
|
-
'excludedPredefinedFunctions',
|
|
7986
|
-
]);
|
|
7987
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
7988
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
7989
|
-
}
|
|
7990
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
7991
|
-
undefined) {
|
|
7992
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
7993
|
-
}
|
|
7994
|
-
return toObject;
|
|
7995
|
-
}
|
|
7996
7965
|
function contentToMldev$2(fromObject) {
|
|
7997
7966
|
const toObject = {};
|
|
7998
7967
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -8941,7 +8910,7 @@ function toolToVertex$1(fromObject) {
|
|
|
8941
8910
|
}
|
|
8942
8911
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8943
8912
|
if (fromComputerUse != null) {
|
|
8944
|
-
setValueByPath(toObject, ['computerUse'],
|
|
8913
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8945
8914
|
}
|
|
8946
8915
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
8947
8916
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -9274,24 +9243,6 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
9274
9243
|
}
|
|
9275
9244
|
return toObject;
|
|
9276
9245
|
}
|
|
9277
|
-
function computerUseToVertex(fromObject, _rootObject) {
|
|
9278
|
-
const toObject = {};
|
|
9279
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
9280
|
-
if (fromEnvironment != null) {
|
|
9281
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
9282
|
-
}
|
|
9283
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
9284
|
-
'excludedPredefinedFunctions',
|
|
9285
|
-
]);
|
|
9286
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
9287
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
9288
|
-
}
|
|
9289
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
9290
|
-
undefined) {
|
|
9291
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
9292
|
-
}
|
|
9293
|
-
return toObject;
|
|
9294
|
-
}
|
|
9295
9246
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
9296
9247
|
const toObject = {};
|
|
9297
9248
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -12352,7 +12303,7 @@ function toolToMldev$1(fromObject, rootObject) {
|
|
|
12352
12303
|
}
|
|
12353
12304
|
return toObject;
|
|
12354
12305
|
}
|
|
12355
|
-
function toolToVertex(fromObject,
|
|
12306
|
+
function toolToVertex(fromObject, _rootObject) {
|
|
12356
12307
|
const toObject = {};
|
|
12357
12308
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
12358
12309
|
if (fromRetrieval != null) {
|
|
@@ -12360,7 +12311,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12360
12311
|
}
|
|
12361
12312
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
12362
12313
|
if (fromComputerUse != null) {
|
|
12363
|
-
setValueByPath(toObject, ['computerUse'],
|
|
12314
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12364
12315
|
}
|
|
12365
12316
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12366
12317
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -12977,7 +12928,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12977
12928
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12978
12929
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12979
12930
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12980
|
-
const SDK_VERSION = '2.
|
|
12931
|
+
const SDK_VERSION = '2.7.0'; // x-release-please-version
|
|
12981
12932
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12982
12933
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12983
12934
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -19891,6 +19842,24 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
19891
19842
|
if (getValueByPath(fromObject, ['encryptionSpec']) !== undefined) {
|
|
19892
19843
|
throw new Error('encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19893
19844
|
}
|
|
19845
|
+
if (getValueByPath(fromObject, ['rewardConfig']) !== undefined) {
|
|
19846
|
+
throw new Error('rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19847
|
+
}
|
|
19848
|
+
if (getValueByPath(fromObject, ['compositeRewardConfig']) !== undefined) {
|
|
19849
|
+
throw new Error('compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19850
|
+
}
|
|
19851
|
+
if (getValueByPath(fromObject, ['samplesPerPrompt']) !== undefined) {
|
|
19852
|
+
throw new Error('samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19853
|
+
}
|
|
19854
|
+
if (getValueByPath(fromObject, ['evaluateInterval']) !== undefined) {
|
|
19855
|
+
throw new Error('evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19856
|
+
}
|
|
19857
|
+
if (getValueByPath(fromObject, ['checkpointInterval']) !== undefined) {
|
|
19858
|
+
throw new Error('checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19859
|
+
}
|
|
19860
|
+
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
19861
|
+
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19862
|
+
}
|
|
19894
19863
|
return toObject;
|
|
19895
19864
|
}
|
|
19896
19865
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -19926,6 +19895,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
19926
19895
|
setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
19927
19896
|
}
|
|
19928
19897
|
}
|
|
19898
|
+
else if (discriminatorValidationDataset === 'REINFORCEMENT_TUNING') {
|
|
19899
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
19900
|
+
'validationDataset',
|
|
19901
|
+
]);
|
|
19902
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
19903
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
19904
|
+
}
|
|
19905
|
+
}
|
|
19929
19906
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
19930
19907
|
'tunedModelDisplayName',
|
|
19931
19908
|
]);
|
|
@@ -19961,6 +19938,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
19961
19938
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
19962
19939
|
}
|
|
19963
19940
|
}
|
|
19941
|
+
else if (discriminatorEpochCount === 'REINFORCEMENT_TUNING') {
|
|
19942
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
19943
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
19944
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
19945
|
+
}
|
|
19946
|
+
}
|
|
19964
19947
|
let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
|
|
19965
19948
|
'config',
|
|
19966
19949
|
'method',
|
|
@@ -19996,6 +19979,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
19996
19979
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
19997
19980
|
}
|
|
19998
19981
|
}
|
|
19982
|
+
else if (discriminatorLearningRateMultiplier === 'REINFORCEMENT_TUNING') {
|
|
19983
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
19984
|
+
'learningRateMultiplier',
|
|
19985
|
+
]);
|
|
19986
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
19987
|
+
setValueByPath(parentObject, [
|
|
19988
|
+
'reinforcementTuningSpec',
|
|
19989
|
+
'hyperParameters',
|
|
19990
|
+
'learningRateMultiplier',
|
|
19991
|
+
], fromLearningRateMultiplier);
|
|
19992
|
+
}
|
|
19993
|
+
}
|
|
19999
19994
|
let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
|
|
20000
19995
|
if (discriminatorExportLastCheckpointOnly === undefined) {
|
|
20001
19996
|
discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
|
|
@@ -20049,6 +20044,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20049
20044
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20050
20045
|
}
|
|
20051
20046
|
}
|
|
20047
|
+
else if (discriminatorAdapterSize === 'REINFORCEMENT_TUNING') {
|
|
20048
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
20049
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
20050
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20051
|
+
}
|
|
20052
|
+
}
|
|
20052
20053
|
let discriminatorTuningMode = getValueByPath(rootObject, [
|
|
20053
20054
|
'config',
|
|
20054
20055
|
'method',
|
|
@@ -20093,6 +20094,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20093
20094
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20094
20095
|
}
|
|
20095
20096
|
}
|
|
20097
|
+
else if (discriminatorBatchSize === 'REINFORCEMENT_TUNING') {
|
|
20098
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
20099
|
+
if (parentObject !== undefined && fromBatchSize != null) {
|
|
20100
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20101
|
+
}
|
|
20102
|
+
}
|
|
20096
20103
|
let discriminatorLearningRate = getValueByPath(rootObject, [
|
|
20097
20104
|
'config',
|
|
20098
20105
|
'method',
|
|
@@ -20152,6 +20159,40 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20152
20159
|
if (parentObject !== undefined && fromEncryptionSpec != null) {
|
|
20153
20160
|
setValueByPath(parentObject, ['encryptionSpec'], fromEncryptionSpec);
|
|
20154
20161
|
}
|
|
20162
|
+
const fromRewardConfig = getValueByPath(fromObject, ['rewardConfig']);
|
|
20163
|
+
if (parentObject !== undefined && fromRewardConfig != null) {
|
|
20164
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'singleRewardConfig'], fromRewardConfig);
|
|
20165
|
+
}
|
|
20166
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
20167
|
+
'compositeRewardConfig',
|
|
20168
|
+
]);
|
|
20169
|
+
if (parentObject !== undefined && fromCompositeRewardConfig != null) {
|
|
20170
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'compositeRewardConfig'], fromCompositeRewardConfig);
|
|
20171
|
+
}
|
|
20172
|
+
const fromSamplesPerPrompt = getValueByPath(fromObject, [
|
|
20173
|
+
'samplesPerPrompt',
|
|
20174
|
+
]);
|
|
20175
|
+
if (parentObject !== undefined && fromSamplesPerPrompt != null) {
|
|
20176
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'samplesPerPrompt'], fromSamplesPerPrompt);
|
|
20177
|
+
}
|
|
20178
|
+
const fromEvaluateInterval = getValueByPath(fromObject, [
|
|
20179
|
+
'evaluateInterval',
|
|
20180
|
+
]);
|
|
20181
|
+
if (parentObject !== undefined && fromEvaluateInterval != null) {
|
|
20182
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'evaluateInterval'], fromEvaluateInterval);
|
|
20183
|
+
}
|
|
20184
|
+
const fromCheckpointInterval = getValueByPath(fromObject, [
|
|
20185
|
+
'checkpointInterval',
|
|
20186
|
+
]);
|
|
20187
|
+
if (parentObject !== undefined && fromCheckpointInterval != null) {
|
|
20188
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'checkpointInterval'], fromCheckpointInterval);
|
|
20189
|
+
}
|
|
20190
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
20191
|
+
'maxOutputTokens',
|
|
20192
|
+
]);
|
|
20193
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20194
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20195
|
+
}
|
|
20155
20196
|
return toObject;
|
|
20156
20197
|
}
|
|
20157
20198
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20571,6 +20612,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20571
20612
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
|
|
20572
20613
|
}
|
|
20573
20614
|
}
|
|
20615
|
+
else if (discriminatorGcsUri === 'REINFORCEMENT_TUNING') {
|
|
20616
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
20617
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
20618
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
20619
|
+
}
|
|
20620
|
+
}
|
|
20574
20621
|
let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
|
|
20575
20622
|
'config',
|
|
20576
20623
|
'method',
|
|
@@ -20602,6 +20649,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20602
20649
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
|
|
20603
20650
|
}
|
|
20604
20651
|
}
|
|
20652
|
+
else if (discriminatorVertexDatasetResource === 'REINFORCEMENT_TUNING') {
|
|
20653
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
20654
|
+
'vertexDatasetResource',
|
|
20655
|
+
]);
|
|
20656
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
20657
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
20658
|
+
}
|
|
20659
|
+
}
|
|
20605
20660
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
20606
20661
|
throw new Error('examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20607
20662
|
}
|