@google/genai 2.6.0 → 2.8.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 +487 -69
- package/dist/index.cjs +567 -144
- package/dist/index.mjs +565 -145
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +567 -144
- package/dist/node/index.mjs +565 -145
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +487 -69
- package/dist/tokenizer/node.cjs +81 -25
- package/dist/tokenizer/node.d.ts +16 -31
- package/dist/tokenizer/node.mjs +81 -25
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +82 -26
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +371 -66
- package/dist/vertex_internal/index.js +82 -26
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +565 -145
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +487 -69
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -648,7 +648,7 @@ exports.Language = void 0;
|
|
|
648
648
|
*/
|
|
649
649
|
Language["PYTHON"] = "PYTHON";
|
|
650
650
|
})(exports.Language || (exports.Language = {}));
|
|
651
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
651
|
+
/** Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */
|
|
652
652
|
exports.FunctionResponseScheduling = void 0;
|
|
653
653
|
(function (FunctionResponseScheduling) {
|
|
654
654
|
/**
|
|
@@ -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. */
|
|
@@ -1844,6 +1844,58 @@ exports.ImageResizeMode = void 0;
|
|
|
1844
1844
|
*/
|
|
1845
1845
|
ImageResizeMode["PAD"] = "PAD";
|
|
1846
1846
|
})(exports.ImageResizeMode || (exports.ImageResizeMode = {}));
|
|
1847
|
+
/** Defines how to parse sample response. */
|
|
1848
|
+
exports.ResponseParseType = void 0;
|
|
1849
|
+
(function (ResponseParseType) {
|
|
1850
|
+
/**
|
|
1851
|
+
* Default value. This value is unused.
|
|
1852
|
+
*/
|
|
1853
|
+
ResponseParseType["RESPONSE_PARSE_TYPE_UNSPECIFIED"] = "RESPONSE_PARSE_TYPE_UNSPECIFIED";
|
|
1854
|
+
/**
|
|
1855
|
+
* Use the sample response as is.
|
|
1856
|
+
*/
|
|
1857
|
+
ResponseParseType["IDENTITY"] = "IDENTITY";
|
|
1858
|
+
/**
|
|
1859
|
+
* Use regex to extract the important part of sample response.
|
|
1860
|
+
*/
|
|
1861
|
+
ResponseParseType["REGEX_EXTRACT"] = "REGEX_EXTRACT";
|
|
1862
|
+
})(exports.ResponseParseType || (exports.ResponseParseType = {}));
|
|
1863
|
+
/** Match operation to use for evaluation. */
|
|
1864
|
+
exports.MatchOperation = void 0;
|
|
1865
|
+
(function (MatchOperation) {
|
|
1866
|
+
/**
|
|
1867
|
+
* Default value. This value is unused.
|
|
1868
|
+
*/
|
|
1869
|
+
MatchOperation["MATCH_OPERATION_UNSPECIFIED"] = "MATCH_OPERATION_UNSPECIFIED";
|
|
1870
|
+
/**
|
|
1871
|
+
* Equivalent to GoogleSQL `REGEX_CONTAINS(target, expression)`.
|
|
1872
|
+
*/
|
|
1873
|
+
MatchOperation["REGEX_CONTAINS"] = "REGEX_CONTAINS";
|
|
1874
|
+
/**
|
|
1875
|
+
* `expression` is a substring of target.
|
|
1876
|
+
*/
|
|
1877
|
+
MatchOperation["PARTIAL_MATCH"] = "PARTIAL_MATCH";
|
|
1878
|
+
/**
|
|
1879
|
+
* `expression` is an exact match of target.
|
|
1880
|
+
*/
|
|
1881
|
+
MatchOperation["EXACT_MATCH"] = "EXACT_MATCH";
|
|
1882
|
+
})(exports.MatchOperation || (exports.MatchOperation = {}));
|
|
1883
|
+
/** Represents how much to think for the tuning job. */
|
|
1884
|
+
exports.ReinforcementTuningThinkingLevel = void 0;
|
|
1885
|
+
(function (ReinforcementTuningThinkingLevel) {
|
|
1886
|
+
/**
|
|
1887
|
+
* Unspecified thinking level.
|
|
1888
|
+
*/
|
|
1889
|
+
ReinforcementTuningThinkingLevel["REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED"] = "REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED";
|
|
1890
|
+
/**
|
|
1891
|
+
* Little to no thinking.
|
|
1892
|
+
*/
|
|
1893
|
+
ReinforcementTuningThinkingLevel["MINIMAL"] = "MINIMAL";
|
|
1894
|
+
/**
|
|
1895
|
+
* High thinking level.
|
|
1896
|
+
*/
|
|
1897
|
+
ReinforcementTuningThinkingLevel["HIGH"] = "HIGH";
|
|
1898
|
+
})(exports.ReinforcementTuningThinkingLevel || (exports.ReinforcementTuningThinkingLevel = {}));
|
|
1847
1899
|
/** Enum representing the tuning method. */
|
|
1848
1900
|
exports.TuningMethod = void 0;
|
|
1849
1901
|
(function (TuningMethod) {
|
|
@@ -1859,6 +1911,10 @@ exports.TuningMethod = void 0;
|
|
|
1859
1911
|
* Distillation tuning.
|
|
1860
1912
|
*/
|
|
1861
1913
|
TuningMethod["DISTILLATION"] = "DISTILLATION";
|
|
1914
|
+
/**
|
|
1915
|
+
* Reinforcement tuning.
|
|
1916
|
+
*/
|
|
1917
|
+
TuningMethod["REINFORCEMENT_TUNING"] = "REINFORCEMENT_TUNING";
|
|
1862
1918
|
})(exports.TuningMethod || (exports.TuningMethod = {}));
|
|
1863
1919
|
/** State for the lifecycle of a File. */
|
|
1864
1920
|
exports.FileState = void 0;
|
|
@@ -2233,24 +2289,13 @@ the API in a subsequent turn within a `Content` message, along with the
|
|
|
2233
2289
|
corresponding `ToolCall`. */
|
|
2234
2290
|
class ToolResponse {
|
|
2235
2291
|
}
|
|
2236
|
-
/** Raw media bytes for function response.
|
|
2237
|
-
|
|
2238
|
-
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
2239
|
-
field. */
|
|
2292
|
+
/** Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. */
|
|
2240
2293
|
class FunctionResponseBlob {
|
|
2241
2294
|
}
|
|
2242
|
-
/** URI based data for function response. */
|
|
2295
|
+
/** URI based data for function response. This data type is not supported in Gemini API. */
|
|
2243
2296
|
class FunctionResponseFileData {
|
|
2244
2297
|
}
|
|
2245
|
-
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
2246
|
-
|
|
2247
|
-
A `FunctionResponsePart` consists of data which has an associated datatype. A
|
|
2248
|
-
`FunctionResponsePart` can only contain one of the accepted types in
|
|
2249
|
-
`FunctionResponsePart.data`.
|
|
2250
|
-
|
|
2251
|
-
A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
|
|
2252
|
-
type and subtype of the media if the `inline_data` field is filled with raw
|
|
2253
|
-
bytes. */
|
|
2298
|
+
/** A datatype containing media that is part of a `FunctionResponse` message. A `FunctionResponsePart` consists of data which has an associated datatype. A `FunctionResponsePart` can only contain one of the accepted types in `FunctionResponsePart.data`. A `FunctionResponsePart` must have a fixed IANA MIME type identifying the type and subtype of the media if the `inline_data` field is filled with raw bytes. */
|
|
2254
2299
|
class FunctionResponsePart {
|
|
2255
2300
|
}
|
|
2256
2301
|
/**
|
|
@@ -2275,7 +2320,7 @@ function createFunctionResponsePartFromUri(uri, mimeType) {
|
|
|
2275
2320
|
},
|
|
2276
2321
|
};
|
|
2277
2322
|
}
|
|
2278
|
-
/**
|
|
2323
|
+
/** The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a `FunctionCall` made based on model prediction. */
|
|
2279
2324
|
class FunctionResponse {
|
|
2280
2325
|
}
|
|
2281
2326
|
/**
|
|
@@ -2703,6 +2748,12 @@ class GenerateVideosOperation {
|
|
|
2703
2748
|
return operation;
|
|
2704
2749
|
}
|
|
2705
2750
|
}
|
|
2751
|
+
/** Defines how to parse sample response for reinforcement tuning. */
|
|
2752
|
+
class ReinforcementTuningParseResponseConfig {
|
|
2753
|
+
}
|
|
2754
|
+
/** Scores responses by directly converting parsed autorater response to float reward (reward is clipped to be within [-1, 1]). */
|
|
2755
|
+
class ReinforcementTuningAutoraterScorerParsedResponseConversionScorer {
|
|
2756
|
+
}
|
|
2706
2757
|
/** The results from an evaluation run performed by the EvaluationService. This data type is not supported in Gemini API. */
|
|
2707
2758
|
class EvaluateDatasetResponse {
|
|
2708
2759
|
}
|
|
@@ -2712,6 +2763,12 @@ class ListTuningJobsResponse {
|
|
|
2712
2763
|
/** Empty response for tunings.cancel method. */
|
|
2713
2764
|
class CancelTuningJobResponse {
|
|
2714
2765
|
}
|
|
2766
|
+
/** Response for the validate_reward method.
|
|
2767
|
+
|
|
2768
|
+
Contains the computed reward for a reinforcement tuning reward
|
|
2769
|
+
configuration. */
|
|
2770
|
+
class ValidateRewardResponse {
|
|
2771
|
+
}
|
|
2715
2772
|
/** Empty response for caches.delete method. */
|
|
2716
2773
|
class DeleteCachedContentResponse {
|
|
2717
2774
|
}
|
|
@@ -5180,6 +5237,7 @@ exports.PagedItem = void 0;
|
|
|
5180
5237
|
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
5181
5238
|
PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
|
|
5182
5239
|
PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
|
|
5240
|
+
PagedItem["PAGED_ITEM_SKILLS"] = "skills";
|
|
5183
5241
|
})(exports.PagedItem || (exports.PagedItem = {}));
|
|
5184
5242
|
/**
|
|
5185
5243
|
* Pager class for iterating through paginated results.
|
|
@@ -5900,7 +5958,7 @@ function blobToMldev$3(fromObject) {
|
|
|
5900
5958
|
}
|
|
5901
5959
|
return toObject;
|
|
5902
5960
|
}
|
|
5903
|
-
function codeExecutionResultToVertex$
|
|
5961
|
+
function codeExecutionResultToVertex$3(fromObject) {
|
|
5904
5962
|
const toObject = {};
|
|
5905
5963
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
5906
5964
|
if (fromOutcome != null) {
|
|
@@ -5915,24 +5973,6 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
5915
5973
|
}
|
|
5916
5974
|
return toObject;
|
|
5917
5975
|
}
|
|
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
5976
|
function contentToMldev$3(fromObject) {
|
|
5937
5977
|
const toObject = {};
|
|
5938
5978
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -5951,14 +5991,14 @@ function contentToMldev$3(fromObject) {
|
|
|
5951
5991
|
}
|
|
5952
5992
|
return toObject;
|
|
5953
5993
|
}
|
|
5954
|
-
function contentToVertex$
|
|
5994
|
+
function contentToVertex$3(fromObject) {
|
|
5955
5995
|
const toObject = {};
|
|
5956
5996
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5957
5997
|
if (fromParts != null) {
|
|
5958
5998
|
let transformedList = fromParts;
|
|
5959
5999
|
if (Array.isArray(transformedList)) {
|
|
5960
6000
|
transformedList = transformedList.map((item) => {
|
|
5961
|
-
return partToVertex$
|
|
6001
|
+
return partToVertex$3(item);
|
|
5962
6002
|
});
|
|
5963
6003
|
}
|
|
5964
6004
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -6037,7 +6077,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
6037
6077
|
let transformedList = tContents(fromContents);
|
|
6038
6078
|
if (Array.isArray(transformedList)) {
|
|
6039
6079
|
transformedList = transformedList.map((item) => {
|
|
6040
|
-
return contentToVertex$
|
|
6080
|
+
return contentToVertex$3(item);
|
|
6041
6081
|
});
|
|
6042
6082
|
}
|
|
6043
6083
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -6046,7 +6086,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
6046
6086
|
'systemInstruction',
|
|
6047
6087
|
]);
|
|
6048
6088
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
6049
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$
|
|
6089
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$3(tContent(fromSystemInstruction)));
|
|
6050
6090
|
}
|
|
6051
6091
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
6052
6092
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -6128,7 +6168,7 @@ function deleteCachedContentResponseFromVertex(fromObject) {
|
|
|
6128
6168
|
}
|
|
6129
6169
|
return toObject;
|
|
6130
6170
|
}
|
|
6131
|
-
function executableCodeToVertex$
|
|
6171
|
+
function executableCodeToVertex$3(fromObject) {
|
|
6132
6172
|
const toObject = {};
|
|
6133
6173
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
6134
6174
|
if (fromCode != null) {
|
|
@@ -6342,6 +6382,16 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
6342
6382
|
}
|
|
6343
6383
|
return toObject;
|
|
6344
6384
|
}
|
|
6385
|
+
function mcpServerToVertex$2(fromObject) {
|
|
6386
|
+
const toObject = {};
|
|
6387
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
6388
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6389
|
+
}
|
|
6390
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
6391
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6392
|
+
}
|
|
6393
|
+
return toObject;
|
|
6394
|
+
}
|
|
6345
6395
|
function partToMldev$3(fromObject) {
|
|
6346
6396
|
const toObject = {};
|
|
6347
6397
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -6414,7 +6464,7 @@ function partToMldev$3(fromObject) {
|
|
|
6414
6464
|
}
|
|
6415
6465
|
return toObject;
|
|
6416
6466
|
}
|
|
6417
|
-
function partToVertex$
|
|
6467
|
+
function partToVertex$3(fromObject) {
|
|
6418
6468
|
const toObject = {};
|
|
6419
6469
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
6420
6470
|
'mediaResolution',
|
|
@@ -6426,13 +6476,13 @@ function partToVertex$2(fromObject) {
|
|
|
6426
6476
|
'codeExecutionResult',
|
|
6427
6477
|
]);
|
|
6428
6478
|
if (fromCodeExecutionResult != null) {
|
|
6429
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
6479
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$3(fromCodeExecutionResult));
|
|
6430
6480
|
}
|
|
6431
6481
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
6432
6482
|
'executableCode',
|
|
6433
6483
|
]);
|
|
6434
6484
|
if (fromExecutableCode != null) {
|
|
6435
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
6485
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$3(fromExecutableCode));
|
|
6436
6486
|
}
|
|
6437
6487
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
6438
6488
|
if (fromFileData != null) {
|
|
@@ -6598,7 +6648,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6598
6648
|
}
|
|
6599
6649
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6600
6650
|
if (fromComputerUse != null) {
|
|
6601
|
-
setValueByPath(toObject, ['computerUse'],
|
|
6651
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6602
6652
|
}
|
|
6603
6653
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6604
6654
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -6651,8 +6701,15 @@ function toolToVertex$2(fromObject) {
|
|
|
6651
6701
|
if (fromUrlContext != null) {
|
|
6652
6702
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
6653
6703
|
}
|
|
6654
|
-
|
|
6655
|
-
|
|
6704
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
6705
|
+
if (fromMcpServers != null) {
|
|
6706
|
+
let transformedList = fromMcpServers;
|
|
6707
|
+
if (Array.isArray(transformedList)) {
|
|
6708
|
+
transformedList = transformedList.map((item) => {
|
|
6709
|
+
return mcpServerToVertex$2(item);
|
|
6710
|
+
});
|
|
6711
|
+
}
|
|
6712
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
6656
6713
|
}
|
|
6657
6714
|
return toObject;
|
|
6658
6715
|
}
|
|
@@ -7990,7 +8047,7 @@ function blobToMldev$2(fromObject) {
|
|
|
7990
8047
|
}
|
|
7991
8048
|
return toObject;
|
|
7992
8049
|
}
|
|
7993
|
-
function codeExecutionResultToVertex$
|
|
8050
|
+
function codeExecutionResultToVertex$2(fromObject) {
|
|
7994
8051
|
const toObject = {};
|
|
7995
8052
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
7996
8053
|
if (fromOutcome != null) {
|
|
@@ -8005,24 +8062,6 @@ function codeExecutionResultToVertex$1(fromObject) {
|
|
|
8005
8062
|
}
|
|
8006
8063
|
return toObject;
|
|
8007
8064
|
}
|
|
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
8065
|
function contentToMldev$2(fromObject) {
|
|
8027
8066
|
const toObject = {};
|
|
8028
8067
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -8041,14 +8080,14 @@ function contentToMldev$2(fromObject) {
|
|
|
8041
8080
|
}
|
|
8042
8081
|
return toObject;
|
|
8043
8082
|
}
|
|
8044
|
-
function contentToVertex$
|
|
8083
|
+
function contentToVertex$2(fromObject) {
|
|
8045
8084
|
const toObject = {};
|
|
8046
8085
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
8047
8086
|
if (fromParts != null) {
|
|
8048
8087
|
let transformedList = fromParts;
|
|
8049
8088
|
if (Array.isArray(transformedList)) {
|
|
8050
8089
|
transformedList = transformedList.map((item) => {
|
|
8051
|
-
return partToVertex$
|
|
8090
|
+
return partToVertex$2(item);
|
|
8052
8091
|
});
|
|
8053
8092
|
}
|
|
8054
8093
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -8059,7 +8098,7 @@ function contentToVertex$1(fromObject) {
|
|
|
8059
8098
|
}
|
|
8060
8099
|
return toObject;
|
|
8061
8100
|
}
|
|
8062
|
-
function executableCodeToVertex$
|
|
8101
|
+
function executableCodeToVertex$2(fromObject) {
|
|
8063
8102
|
const toObject = {};
|
|
8064
8103
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
8065
8104
|
if (fromCode != null) {
|
|
@@ -8398,11 +8437,11 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
8398
8437
|
}
|
|
8399
8438
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8400
8439
|
}
|
|
8401
|
-
const
|
|
8402
|
-
'
|
|
8440
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
8441
|
+
'translationConfig',
|
|
8403
8442
|
]);
|
|
8404
|
-
if (parentObject !== undefined &&
|
|
8405
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
8443
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
8444
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
8406
8445
|
}
|
|
8407
8446
|
return toObject;
|
|
8408
8447
|
}
|
|
@@ -8468,7 +8507,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8468
8507
|
'systemInstruction',
|
|
8469
8508
|
]);
|
|
8470
8509
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
8471
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$
|
|
8510
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$2(tContent(fromSystemInstruction)));
|
|
8472
8511
|
}
|
|
8473
8512
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
8474
8513
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -8536,8 +8575,8 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8536
8575
|
}
|
|
8537
8576
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8538
8577
|
}
|
|
8539
|
-
if (getValueByPath(fromObject, ['
|
|
8540
|
-
throw new Error('
|
|
8578
|
+
if (getValueByPath(fromObject, ['translationConfig']) !== undefined) {
|
|
8579
|
+
throw new Error('translationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8541
8580
|
}
|
|
8542
8581
|
return toObject;
|
|
8543
8582
|
}
|
|
@@ -8729,6 +8768,16 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
8729
8768
|
}
|
|
8730
8769
|
return toObject;
|
|
8731
8770
|
}
|
|
8771
|
+
function mcpServerToVertex$1(fromObject) {
|
|
8772
|
+
const toObject = {};
|
|
8773
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
8774
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8775
|
+
}
|
|
8776
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
8777
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8778
|
+
}
|
|
8779
|
+
return toObject;
|
|
8780
|
+
}
|
|
8732
8781
|
function partToMldev$2(fromObject) {
|
|
8733
8782
|
const toObject = {};
|
|
8734
8783
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -8801,7 +8850,7 @@ function partToMldev$2(fromObject) {
|
|
|
8801
8850
|
}
|
|
8802
8851
|
return toObject;
|
|
8803
8852
|
}
|
|
8804
|
-
function partToVertex$
|
|
8853
|
+
function partToVertex$2(fromObject) {
|
|
8805
8854
|
const toObject = {};
|
|
8806
8855
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
8807
8856
|
'mediaResolution',
|
|
@@ -8813,13 +8862,13 @@ function partToVertex$1(fromObject) {
|
|
|
8813
8862
|
'codeExecutionResult',
|
|
8814
8863
|
]);
|
|
8815
8864
|
if (fromCodeExecutionResult != null) {
|
|
8816
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
8865
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$2(fromCodeExecutionResult));
|
|
8817
8866
|
}
|
|
8818
8867
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
8819
8868
|
'executableCode',
|
|
8820
8869
|
]);
|
|
8821
8870
|
if (fromExecutableCode != null) {
|
|
8822
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
8871
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$2(fromExecutableCode));
|
|
8823
8872
|
}
|
|
8824
8873
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
8825
8874
|
if (fromFileData != null) {
|
|
@@ -8971,7 +9020,7 @@ function toolToVertex$1(fromObject) {
|
|
|
8971
9020
|
}
|
|
8972
9021
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8973
9022
|
if (fromComputerUse != null) {
|
|
8974
|
-
setValueByPath(toObject, ['computerUse'],
|
|
9023
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8975
9024
|
}
|
|
8976
9025
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
8977
9026
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -9024,8 +9073,15 @@ function toolToVertex$1(fromObject) {
|
|
|
9024
9073
|
if (fromUrlContext != null) {
|
|
9025
9074
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
9026
9075
|
}
|
|
9027
|
-
|
|
9028
|
-
|
|
9076
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
9077
|
+
if (fromMcpServers != null) {
|
|
9078
|
+
let transformedList = fromMcpServers;
|
|
9079
|
+
if (Array.isArray(transformedList)) {
|
|
9080
|
+
transformedList = transformedList.map((item) => {
|
|
9081
|
+
return mcpServerToVertex$1(item);
|
|
9082
|
+
});
|
|
9083
|
+
}
|
|
9084
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
9029
9085
|
}
|
|
9030
9086
|
return toObject;
|
|
9031
9087
|
}
|
|
@@ -9251,7 +9307,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
9251
9307
|
}
|
|
9252
9308
|
return toObject;
|
|
9253
9309
|
}
|
|
9254
|
-
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
9310
|
+
function codeExecutionResultToVertex$1(fromObject, _rootObject) {
|
|
9255
9311
|
const toObject = {};
|
|
9256
9312
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
9257
9313
|
if (fromOutcome != null) {
|
|
@@ -9277,7 +9333,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
9277
9333
|
let transformedList = tContents(fromContents);
|
|
9278
9334
|
if (Array.isArray(transformedList)) {
|
|
9279
9335
|
transformedList = transformedList.map((item) => {
|
|
9280
|
-
return contentToVertex(item);
|
|
9336
|
+
return contentToVertex$1(item);
|
|
9281
9337
|
});
|
|
9282
9338
|
}
|
|
9283
9339
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -9304,24 +9360,6 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
9304
9360
|
}
|
|
9305
9361
|
return toObject;
|
|
9306
9362
|
}
|
|
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
9363
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
9326
9364
|
const toObject = {};
|
|
9327
9365
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -9364,14 +9402,14 @@ function contentToMldev$1(fromObject, rootObject) {
|
|
|
9364
9402
|
}
|
|
9365
9403
|
return toObject;
|
|
9366
9404
|
}
|
|
9367
|
-
function contentToVertex(fromObject, rootObject) {
|
|
9405
|
+
function contentToVertex$1(fromObject, rootObject) {
|
|
9368
9406
|
const toObject = {};
|
|
9369
9407
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
9370
9408
|
if (fromParts != null) {
|
|
9371
9409
|
let transformedList = fromParts;
|
|
9372
9410
|
if (Array.isArray(transformedList)) {
|
|
9373
9411
|
transformedList = transformedList.map((item) => {
|
|
9374
|
-
return partToVertex(item);
|
|
9412
|
+
return partToVertex$1(item);
|
|
9375
9413
|
});
|
|
9376
9414
|
}
|
|
9377
9415
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -9415,7 +9453,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
9415
9453
|
'systemInstruction',
|
|
9416
9454
|
]);
|
|
9417
9455
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
9418
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
9456
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
9419
9457
|
}
|
|
9420
9458
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
9421
9459
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -9468,7 +9506,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
9468
9506
|
let transformedList = tContents(fromContents);
|
|
9469
9507
|
if (Array.isArray(transformedList)) {
|
|
9470
9508
|
transformedList = transformedList.map((item) => {
|
|
9471
|
-
return contentToVertex(item);
|
|
9509
|
+
return contentToVertex$1(item);
|
|
9472
9510
|
});
|
|
9473
9511
|
}
|
|
9474
9512
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -9904,7 +9942,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
|
|
|
9904
9942
|
if (discriminatorContent === 'EMBED_CONTENT') {
|
|
9905
9943
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
9906
9944
|
if (fromContent != null) {
|
|
9907
|
-
setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
|
|
9945
|
+
setValueByPath(toObject, ['content'], contentToVertex$1(tContent(fromContent)));
|
|
9908
9946
|
}
|
|
9909
9947
|
}
|
|
9910
9948
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -9996,7 +10034,7 @@ function endpointFromVertex(fromObject, _rootObject) {
|
|
|
9996
10034
|
}
|
|
9997
10035
|
return toObject;
|
|
9998
10036
|
}
|
|
9999
|
-
function executableCodeToVertex(fromObject, _rootObject) {
|
|
10037
|
+
function executableCodeToVertex$1(fromObject, _rootObject) {
|
|
10000
10038
|
const toObject = {};
|
|
10001
10039
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
10002
10040
|
if (fromCode != null) {
|
|
@@ -10239,7 +10277,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
10239
10277
|
'systemInstruction',
|
|
10240
10278
|
]);
|
|
10241
10279
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
10242
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
10280
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
10243
10281
|
}
|
|
10244
10282
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
10245
10283
|
if (fromTemperature != null) {
|
|
@@ -10444,7 +10482,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
10444
10482
|
let transformedList = tContents(fromContents);
|
|
10445
10483
|
if (Array.isArray(transformedList)) {
|
|
10446
10484
|
transformedList = transformedList.map((item) => {
|
|
10447
|
-
return contentToVertex(item);
|
|
10485
|
+
return contentToVertex$1(item);
|
|
10448
10486
|
});
|
|
10449
10487
|
}
|
|
10450
10488
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -11699,6 +11737,16 @@ function maskReferenceConfigToVertex(fromObject, _rootObject) {
|
|
|
11699
11737
|
}
|
|
11700
11738
|
return toObject;
|
|
11701
11739
|
}
|
|
11740
|
+
function mcpServerToVertex(fromObject, _rootObject) {
|
|
11741
|
+
const toObject = {};
|
|
11742
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
11743
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11744
|
+
}
|
|
11745
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
11746
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11747
|
+
}
|
|
11748
|
+
return toObject;
|
|
11749
|
+
}
|
|
11702
11750
|
function modelFromMldev(fromObject, rootObject) {
|
|
11703
11751
|
const toObject = {};
|
|
11704
11752
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -11889,7 +11937,7 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
11889
11937
|
}
|
|
11890
11938
|
return toObject;
|
|
11891
11939
|
}
|
|
11892
|
-
function partToVertex(fromObject, rootObject) {
|
|
11940
|
+
function partToVertex$1(fromObject, rootObject) {
|
|
11893
11941
|
const toObject = {};
|
|
11894
11942
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
11895
11943
|
'mediaResolution',
|
|
@@ -11901,13 +11949,13 @@ function partToVertex(fromObject, rootObject) {
|
|
|
11901
11949
|
'codeExecutionResult',
|
|
11902
11950
|
]);
|
|
11903
11951
|
if (fromCodeExecutionResult != null) {
|
|
11904
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
11952
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$1(fromCodeExecutionResult));
|
|
11905
11953
|
}
|
|
11906
11954
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
11907
11955
|
'executableCode',
|
|
11908
11956
|
]);
|
|
11909
11957
|
if (fromExecutableCode != null) {
|
|
11910
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
11958
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$1(fromExecutableCode));
|
|
11911
11959
|
}
|
|
11912
11960
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
11913
11961
|
if (fromFileData != null) {
|
|
@@ -12390,7 +12438,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12390
12438
|
}
|
|
12391
12439
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
12392
12440
|
if (fromComputerUse != null) {
|
|
12393
|
-
setValueByPath(toObject, ['computerUse'],
|
|
12441
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12394
12442
|
}
|
|
12395
12443
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12396
12444
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -12443,8 +12491,15 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12443
12491
|
if (fromUrlContext != null) {
|
|
12444
12492
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
12445
12493
|
}
|
|
12446
|
-
|
|
12447
|
-
|
|
12494
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
12495
|
+
if (fromMcpServers != null) {
|
|
12496
|
+
let transformedList = fromMcpServers;
|
|
12497
|
+
if (Array.isArray(transformedList)) {
|
|
12498
|
+
transformedList = transformedList.map((item) => {
|
|
12499
|
+
return mcpServerToVertex(item);
|
|
12500
|
+
});
|
|
12501
|
+
}
|
|
12502
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
12448
12503
|
}
|
|
12449
12504
|
return toObject;
|
|
12450
12505
|
}
|
|
@@ -13007,7 +13062,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
13007
13062
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
13008
13063
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
13009
13064
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
13010
|
-
const SDK_VERSION = '2.
|
|
13065
|
+
const SDK_VERSION = '2.8.0'; // x-release-please-version
|
|
13011
13066
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
13012
13067
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
13013
13068
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -16657,11 +16712,11 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
16657
16712
|
}
|
|
16658
16713
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
16659
16714
|
}
|
|
16660
|
-
const
|
|
16661
|
-
'
|
|
16715
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
16716
|
+
'translationConfig',
|
|
16662
16717
|
]);
|
|
16663
|
-
if (parentObject !== undefined &&
|
|
16664
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
16718
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
16719
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
16665
16720
|
}
|
|
16666
16721
|
return toObject;
|
|
16667
16722
|
}
|
|
@@ -20030,6 +20085,39 @@ function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
|
|
|
20030
20085
|
}
|
|
20031
20086
|
return toObject;
|
|
20032
20087
|
}
|
|
20088
|
+
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
20089
|
+
const toObject = {};
|
|
20090
|
+
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
20091
|
+
if (fromOutcome != null) {
|
|
20092
|
+
setValueByPath(toObject, ['outcome'], fromOutcome);
|
|
20093
|
+
}
|
|
20094
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
20095
|
+
if (fromOutput != null) {
|
|
20096
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
20097
|
+
}
|
|
20098
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20099
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20100
|
+
}
|
|
20101
|
+
return toObject;
|
|
20102
|
+
}
|
|
20103
|
+
function contentToVertex(fromObject, rootObject) {
|
|
20104
|
+
const toObject = {};
|
|
20105
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
20106
|
+
if (fromParts != null) {
|
|
20107
|
+
let transformedList = fromParts;
|
|
20108
|
+
if (Array.isArray(transformedList)) {
|
|
20109
|
+
transformedList = transformedList.map((item) => {
|
|
20110
|
+
return partToVertex(item);
|
|
20111
|
+
});
|
|
20112
|
+
}
|
|
20113
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
20114
|
+
}
|
|
20115
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
20116
|
+
if (fromRole != null) {
|
|
20117
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
20118
|
+
}
|
|
20119
|
+
return toObject;
|
|
20120
|
+
}
|
|
20033
20121
|
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
20034
20122
|
const toObject = {};
|
|
20035
20123
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
@@ -20100,6 +20188,30 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
20100
20188
|
if (getValueByPath(fromObject, ['encryptionSpec']) !== undefined) {
|
|
20101
20189
|
throw new Error('encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20102
20190
|
}
|
|
20191
|
+
if (getValueByPath(fromObject, ['rewardConfig']) !== undefined) {
|
|
20192
|
+
throw new Error('rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20193
|
+
}
|
|
20194
|
+
if (getValueByPath(fromObject, ['compositeRewardConfig']) !== undefined) {
|
|
20195
|
+
throw new Error('compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20196
|
+
}
|
|
20197
|
+
if (getValueByPath(fromObject, ['samplesPerPrompt']) !== undefined) {
|
|
20198
|
+
throw new Error('samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20199
|
+
}
|
|
20200
|
+
if (getValueByPath(fromObject, ['evaluateInterval']) !== undefined) {
|
|
20201
|
+
throw new Error('evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20202
|
+
}
|
|
20203
|
+
if (getValueByPath(fromObject, ['checkpointInterval']) !== undefined) {
|
|
20204
|
+
throw new Error('checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20205
|
+
}
|
|
20206
|
+
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
20207
|
+
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20208
|
+
}
|
|
20209
|
+
if (getValueByPath(fromObject, ['thinkingLevel']) !== undefined) {
|
|
20210
|
+
throw new Error('thinkingLevel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20211
|
+
}
|
|
20212
|
+
if (getValueByPath(fromObject, ['validationDatasetUri']) !== undefined) {
|
|
20213
|
+
throw new Error('validationDatasetUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20214
|
+
}
|
|
20103
20215
|
return toObject;
|
|
20104
20216
|
}
|
|
20105
20217
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -20135,6 +20247,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20135
20247
|
setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20136
20248
|
}
|
|
20137
20249
|
}
|
|
20250
|
+
else if (discriminatorValidationDataset === 'REINFORCEMENT_TUNING') {
|
|
20251
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
20252
|
+
'validationDataset',
|
|
20253
|
+
]);
|
|
20254
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
20255
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20256
|
+
}
|
|
20257
|
+
}
|
|
20138
20258
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
20139
20259
|
'tunedModelDisplayName',
|
|
20140
20260
|
]);
|
|
@@ -20170,6 +20290,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20170
20290
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20171
20291
|
}
|
|
20172
20292
|
}
|
|
20293
|
+
else if (discriminatorEpochCount === 'REINFORCEMENT_TUNING') {
|
|
20294
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
20295
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
20296
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20297
|
+
}
|
|
20298
|
+
}
|
|
20173
20299
|
let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
|
|
20174
20300
|
'config',
|
|
20175
20301
|
'method',
|
|
@@ -20205,6 +20331,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20205
20331
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
20206
20332
|
}
|
|
20207
20333
|
}
|
|
20334
|
+
else if (discriminatorLearningRateMultiplier === 'REINFORCEMENT_TUNING') {
|
|
20335
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
20336
|
+
'learningRateMultiplier',
|
|
20337
|
+
]);
|
|
20338
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
20339
|
+
setValueByPath(parentObject, [
|
|
20340
|
+
'reinforcementTuningSpec',
|
|
20341
|
+
'hyperParameters',
|
|
20342
|
+
'learningRateMultiplier',
|
|
20343
|
+
], fromLearningRateMultiplier);
|
|
20344
|
+
}
|
|
20345
|
+
}
|
|
20208
20346
|
let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
|
|
20209
20347
|
if (discriminatorExportLastCheckpointOnly === undefined) {
|
|
20210
20348
|
discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
|
|
@@ -20258,6 +20396,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20258
20396
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20259
20397
|
}
|
|
20260
20398
|
}
|
|
20399
|
+
else if (discriminatorAdapterSize === 'REINFORCEMENT_TUNING') {
|
|
20400
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
20401
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
20402
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20403
|
+
}
|
|
20404
|
+
}
|
|
20261
20405
|
let discriminatorTuningMode = getValueByPath(rootObject, [
|
|
20262
20406
|
'config',
|
|
20263
20407
|
'method',
|
|
@@ -20302,6 +20446,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20302
20446
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20303
20447
|
}
|
|
20304
20448
|
}
|
|
20449
|
+
else if (discriminatorBatchSize === 'REINFORCEMENT_TUNING') {
|
|
20450
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
20451
|
+
if (parentObject !== undefined && fromBatchSize != null) {
|
|
20452
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20453
|
+
}
|
|
20454
|
+
}
|
|
20305
20455
|
let discriminatorLearningRate = getValueByPath(rootObject, [
|
|
20306
20456
|
'config',
|
|
20307
20457
|
'method',
|
|
@@ -20361,6 +20511,52 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20361
20511
|
if (parentObject !== undefined && fromEncryptionSpec != null) {
|
|
20362
20512
|
setValueByPath(parentObject, ['encryptionSpec'], fromEncryptionSpec);
|
|
20363
20513
|
}
|
|
20514
|
+
const fromRewardConfig = getValueByPath(fromObject, ['rewardConfig']);
|
|
20515
|
+
if (parentObject !== undefined && fromRewardConfig != null) {
|
|
20516
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'singleRewardConfig'], fromRewardConfig);
|
|
20517
|
+
}
|
|
20518
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
20519
|
+
'compositeRewardConfig',
|
|
20520
|
+
]);
|
|
20521
|
+
if (parentObject !== undefined && fromCompositeRewardConfig != null) {
|
|
20522
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'compositeRewardConfig'], fromCompositeRewardConfig);
|
|
20523
|
+
}
|
|
20524
|
+
const fromSamplesPerPrompt = getValueByPath(fromObject, [
|
|
20525
|
+
'samplesPerPrompt',
|
|
20526
|
+
]);
|
|
20527
|
+
if (parentObject !== undefined && fromSamplesPerPrompt != null) {
|
|
20528
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'samplesPerPrompt'], fromSamplesPerPrompt);
|
|
20529
|
+
}
|
|
20530
|
+
const fromEvaluateInterval = getValueByPath(fromObject, [
|
|
20531
|
+
'evaluateInterval',
|
|
20532
|
+
]);
|
|
20533
|
+
if (parentObject !== undefined && fromEvaluateInterval != null) {
|
|
20534
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'evaluateInterval'], fromEvaluateInterval);
|
|
20535
|
+
}
|
|
20536
|
+
const fromCheckpointInterval = getValueByPath(fromObject, [
|
|
20537
|
+
'checkpointInterval',
|
|
20538
|
+
]);
|
|
20539
|
+
if (parentObject !== undefined && fromCheckpointInterval != null) {
|
|
20540
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'checkpointInterval'], fromCheckpointInterval);
|
|
20541
|
+
}
|
|
20542
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
20543
|
+
'maxOutputTokens',
|
|
20544
|
+
]);
|
|
20545
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20546
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20547
|
+
}
|
|
20548
|
+
const fromThinkingLevel = getValueByPath(fromObject, [
|
|
20549
|
+
'thinkingLevel',
|
|
20550
|
+
]);
|
|
20551
|
+
if (parentObject !== undefined && fromThinkingLevel != null) {
|
|
20552
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'thinkingLevel'], fromThinkingLevel);
|
|
20553
|
+
}
|
|
20554
|
+
const fromValidationDatasetUri = getValueByPath(fromObject, [
|
|
20555
|
+
'validationDatasetUri',
|
|
20556
|
+
]);
|
|
20557
|
+
if (parentObject !== undefined && fromValidationDatasetUri != null) {
|
|
20558
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'validationDatasetUri'], fromValidationDatasetUri);
|
|
20559
|
+
}
|
|
20364
20560
|
return toObject;
|
|
20365
20561
|
}
|
|
20366
20562
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20531,6 +20727,21 @@ function distillationSpecFromVertex(fromObject, rootObject) {
|
|
|
20531
20727
|
}
|
|
20532
20728
|
return toObject;
|
|
20533
20729
|
}
|
|
20730
|
+
function executableCodeToVertex(fromObject, _rootObject) {
|
|
20731
|
+
const toObject = {};
|
|
20732
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
20733
|
+
if (fromCode != null) {
|
|
20734
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
20735
|
+
}
|
|
20736
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
20737
|
+
if (fromLanguage != null) {
|
|
20738
|
+
setValueByPath(toObject, ['language'], fromLanguage);
|
|
20739
|
+
}
|
|
20740
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20741
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20742
|
+
}
|
|
20743
|
+
return toObject;
|
|
20744
|
+
}
|
|
20534
20745
|
function generationConfigFromVertex(fromObject, _rootObject) {
|
|
20535
20746
|
const toObject = {};
|
|
20536
20747
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
@@ -20721,6 +20932,99 @@ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
|
20721
20932
|
}
|
|
20722
20933
|
return toObject;
|
|
20723
20934
|
}
|
|
20935
|
+
function partToVertex(fromObject, rootObject) {
|
|
20936
|
+
const toObject = {};
|
|
20937
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
20938
|
+
'mediaResolution',
|
|
20939
|
+
]);
|
|
20940
|
+
if (fromMediaResolution != null) {
|
|
20941
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
20942
|
+
}
|
|
20943
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
20944
|
+
'codeExecutionResult',
|
|
20945
|
+
]);
|
|
20946
|
+
if (fromCodeExecutionResult != null) {
|
|
20947
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
20948
|
+
}
|
|
20949
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
20950
|
+
'executableCode',
|
|
20951
|
+
]);
|
|
20952
|
+
if (fromExecutableCode != null) {
|
|
20953
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
20954
|
+
}
|
|
20955
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
20956
|
+
if (fromFileData != null) {
|
|
20957
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
20958
|
+
}
|
|
20959
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
20960
|
+
if (fromFunctionCall != null) {
|
|
20961
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
20962
|
+
}
|
|
20963
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
20964
|
+
'functionResponse',
|
|
20965
|
+
]);
|
|
20966
|
+
if (fromFunctionResponse != null) {
|
|
20967
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
20968
|
+
}
|
|
20969
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
20970
|
+
if (fromInlineData != null) {
|
|
20971
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
20972
|
+
}
|
|
20973
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
20974
|
+
if (fromText != null) {
|
|
20975
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
20976
|
+
}
|
|
20977
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
20978
|
+
if (fromThought != null) {
|
|
20979
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
20980
|
+
}
|
|
20981
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
20982
|
+
'thoughtSignature',
|
|
20983
|
+
]);
|
|
20984
|
+
if (fromThoughtSignature != null) {
|
|
20985
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
20986
|
+
}
|
|
20987
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
20988
|
+
'videoMetadata',
|
|
20989
|
+
]);
|
|
20990
|
+
if (fromVideoMetadata != null) {
|
|
20991
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
20992
|
+
}
|
|
20993
|
+
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
20994
|
+
throw new Error('toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20995
|
+
}
|
|
20996
|
+
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
20997
|
+
throw new Error('toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20998
|
+
}
|
|
20999
|
+
if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
|
|
21000
|
+
throw new Error('partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
21001
|
+
}
|
|
21002
|
+
return toObject;
|
|
21003
|
+
}
|
|
21004
|
+
function reinforcementTuningExampleToVertex(fromObject, rootObject) {
|
|
21005
|
+
const toObject = {};
|
|
21006
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
21007
|
+
if (fromContents != null) {
|
|
21008
|
+
let transformedList = fromContents;
|
|
21009
|
+
if (Array.isArray(transformedList)) {
|
|
21010
|
+
transformedList = transformedList.map((item) => {
|
|
21011
|
+
return contentToVertex(item);
|
|
21012
|
+
});
|
|
21013
|
+
}
|
|
21014
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
21015
|
+
}
|
|
21016
|
+
const fromReferences = getValueByPath(fromObject, ['references']);
|
|
21017
|
+
if (fromReferences != null) {
|
|
21018
|
+
setValueByPath(toObject, ['references'], fromReferences);
|
|
21019
|
+
}
|
|
21020
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
21021
|
+
'systemInstruction',
|
|
21022
|
+
]);
|
|
21023
|
+
if (fromSystemInstruction != null) {
|
|
21024
|
+
setValueByPath(toObject, ['systemInstruction'], contentToVertex(fromSystemInstruction));
|
|
21025
|
+
}
|
|
21026
|
+
return toObject;
|
|
21027
|
+
}
|
|
20724
21028
|
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
20725
21029
|
const toObject = {};
|
|
20726
21030
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
@@ -20780,6 +21084,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20780
21084
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
|
|
20781
21085
|
}
|
|
20782
21086
|
}
|
|
21087
|
+
else if (discriminatorGcsUri === 'REINFORCEMENT_TUNING') {
|
|
21088
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
21089
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
21090
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
21091
|
+
}
|
|
21092
|
+
}
|
|
20783
21093
|
let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
|
|
20784
21094
|
'config',
|
|
20785
21095
|
'method',
|
|
@@ -20811,6 +21121,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20811
21121
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
|
|
20812
21122
|
}
|
|
20813
21123
|
}
|
|
21124
|
+
else if (discriminatorVertexDatasetResource === 'REINFORCEMENT_TUNING') {
|
|
21125
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
21126
|
+
'vertexDatasetResource',
|
|
21127
|
+
]);
|
|
21128
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
21129
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
21130
|
+
}
|
|
21131
|
+
}
|
|
20814
21132
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
20815
21133
|
throw new Error('examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20816
21134
|
}
|
|
@@ -20940,6 +21258,12 @@ function tuningJobFromVertex(fromObject, rootObject) {
|
|
|
20940
21258
|
if (fromDistillationSpec != null) {
|
|
20941
21259
|
setValueByPath(toObject, ['distillationSpec'], distillationSpecFromVertex(fromDistillationSpec));
|
|
20942
21260
|
}
|
|
21261
|
+
const fromReinforcementTuningSpec = getValueByPath(fromObject, [
|
|
21262
|
+
'reinforcementTuningSpec',
|
|
21263
|
+
]);
|
|
21264
|
+
if (fromReinforcementTuningSpec != null) {
|
|
21265
|
+
setValueByPath(toObject, ['reinforcementTuningSpec'], fromReinforcementTuningSpec);
|
|
21266
|
+
}
|
|
20943
21267
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
20944
21268
|
'tuningDataStats',
|
|
20945
21269
|
]);
|
|
@@ -21082,6 +21406,62 @@ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
|
21082
21406
|
}
|
|
21083
21407
|
return toObject;
|
|
21084
21408
|
}
|
|
21409
|
+
function validateRewardParametersToVertex(fromObject, rootObject) {
|
|
21410
|
+
const toObject = {};
|
|
21411
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
21412
|
+
if (fromParent != null) {
|
|
21413
|
+
setValueByPath(toObject, ['_url', 'parent'], fromParent);
|
|
21414
|
+
}
|
|
21415
|
+
const fromSampleResponse = getValueByPath(fromObject, [
|
|
21416
|
+
'sampleResponse',
|
|
21417
|
+
]);
|
|
21418
|
+
if (fromSampleResponse != null) {
|
|
21419
|
+
setValueByPath(toObject, ['sampleResponse'], contentToVertex(fromSampleResponse));
|
|
21420
|
+
}
|
|
21421
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
21422
|
+
if (fromExample != null) {
|
|
21423
|
+
setValueByPath(toObject, ['example'], reinforcementTuningExampleToVertex(fromExample));
|
|
21424
|
+
}
|
|
21425
|
+
const fromSingleRewardConfig = getValueByPath(fromObject, [
|
|
21426
|
+
'singleRewardConfig',
|
|
21427
|
+
]);
|
|
21428
|
+
if (fromSingleRewardConfig != null) {
|
|
21429
|
+
setValueByPath(toObject, ['singleRewardConfig'], fromSingleRewardConfig);
|
|
21430
|
+
}
|
|
21431
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
21432
|
+
'compositeRewardConfig',
|
|
21433
|
+
]);
|
|
21434
|
+
if (fromCompositeRewardConfig != null) {
|
|
21435
|
+
setValueByPath(toObject, ['compositeRewardConfig'], fromCompositeRewardConfig);
|
|
21436
|
+
}
|
|
21437
|
+
return toObject;
|
|
21438
|
+
}
|
|
21439
|
+
function validateRewardResponseFromVertex(fromObject, _rootObject) {
|
|
21440
|
+
const toObject = {};
|
|
21441
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
21442
|
+
'sdkHttpResponse',
|
|
21443
|
+
]);
|
|
21444
|
+
if (fromSdkHttpResponse != null) {
|
|
21445
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
21446
|
+
}
|
|
21447
|
+
const fromOverallReward = getValueByPath(fromObject, [
|
|
21448
|
+
'overallReward',
|
|
21449
|
+
]);
|
|
21450
|
+
if (fromOverallReward != null) {
|
|
21451
|
+
setValueByPath(toObject, ['overallReward'], fromOverallReward);
|
|
21452
|
+
}
|
|
21453
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
21454
|
+
if (fromError != null) {
|
|
21455
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
21456
|
+
}
|
|
21457
|
+
const fromRewardInfoDetails = getValueByPath(fromObject, [
|
|
21458
|
+
'rewardInfoDetails',
|
|
21459
|
+
]);
|
|
21460
|
+
if (fromRewardInfoDetails != null) {
|
|
21461
|
+
setValueByPath(toObject, ['rewardInfoDetails'], fromRewardInfoDetails);
|
|
21462
|
+
}
|
|
21463
|
+
return toObject;
|
|
21464
|
+
}
|
|
21085
21465
|
|
|
21086
21466
|
/**
|
|
21087
21467
|
* @license
|
|
@@ -21428,6 +21808,46 @@ class Tunings extends BaseModule {
|
|
|
21428
21808
|
});
|
|
21429
21809
|
}
|
|
21430
21810
|
}
|
|
21811
|
+
async validateReward(params) {
|
|
21812
|
+
var _a, _b;
|
|
21813
|
+
let response;
|
|
21814
|
+
let path = '';
|
|
21815
|
+
let queryParams = {};
|
|
21816
|
+
if (this.apiClient.isVertexAI()) {
|
|
21817
|
+
const body = validateRewardParametersToVertex(params);
|
|
21818
|
+
path = formatMap('{parent}/tuningJobs:validateReinforcementTuningReward', body['_url']);
|
|
21819
|
+
queryParams = body['_query'];
|
|
21820
|
+
delete body['_url'];
|
|
21821
|
+
delete body['_query'];
|
|
21822
|
+
response = this.apiClient
|
|
21823
|
+
.request({
|
|
21824
|
+
path: path,
|
|
21825
|
+
queryParams: queryParams,
|
|
21826
|
+
body: JSON.stringify(body),
|
|
21827
|
+
httpMethod: 'POST',
|
|
21828
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
21829
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
21830
|
+
})
|
|
21831
|
+
.then((httpResponse) => {
|
|
21832
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
21833
|
+
const response = jsonResponse;
|
|
21834
|
+
response.sdkHttpResponse = {
|
|
21835
|
+
headers: httpResponse.headers,
|
|
21836
|
+
};
|
|
21837
|
+
return response;
|
|
21838
|
+
});
|
|
21839
|
+
});
|
|
21840
|
+
return response.then((apiResponse) => {
|
|
21841
|
+
const resp = validateRewardResponseFromVertex(apiResponse);
|
|
21842
|
+
const typedResp = new ValidateRewardResponse();
|
|
21843
|
+
Object.assign(typedResp, resp);
|
|
21844
|
+
return typedResp;
|
|
21845
|
+
});
|
|
21846
|
+
}
|
|
21847
|
+
else {
|
|
21848
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
21849
|
+
}
|
|
21850
|
+
}
|
|
21431
21851
|
}
|
|
21432
21852
|
|
|
21433
21853
|
const MAX_CHUNK_SIZE = 1024 * 1024 * 8; // bytes
|
|
@@ -22054,6 +22474,8 @@ exports.Pager = Pager;
|
|
|
22054
22474
|
exports.RawReferenceImage = RawReferenceImage;
|
|
22055
22475
|
exports.RecontextImageResponse = RecontextImageResponse;
|
|
22056
22476
|
exports.RegisterFilesResponse = RegisterFilesResponse;
|
|
22477
|
+
exports.ReinforcementTuningAutoraterScorerParsedResponseConversionScorer = ReinforcementTuningAutoraterScorerParsedResponseConversionScorer;
|
|
22478
|
+
exports.ReinforcementTuningParseResponseConfig = ReinforcementTuningParseResponseConfig;
|
|
22057
22479
|
exports.ReplayResponse = ReplayResponse;
|
|
22058
22480
|
exports.SegmentImageResponse = SegmentImageResponse;
|
|
22059
22481
|
exports.Session = Session;
|
|
@@ -22066,6 +22488,7 @@ exports.UploadToFileSearchStoreOperation = UploadToFileSearchStoreOperation;
|
|
|
22066
22488
|
exports.UploadToFileSearchStoreResponse = UploadToFileSearchStoreResponse;
|
|
22067
22489
|
exports.UploadToFileSearchStoreResumableResponse = UploadToFileSearchStoreResumableResponse;
|
|
22068
22490
|
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
22491
|
+
exports.ValidateRewardResponse = ValidateRewardResponse;
|
|
22069
22492
|
exports.createFunctionResponsePartFromBase64 = createFunctionResponsePartFromBase64;
|
|
22070
22493
|
exports.createFunctionResponsePartFromUri = createFunctionResponsePartFromUri;
|
|
22071
22494
|
exports.createModelContent = createModelContent;
|