@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/index.cjs
CHANGED
|
@@ -590,7 +590,7 @@ exports.Language = void 0;
|
|
|
590
590
|
*/
|
|
591
591
|
Language["PYTHON"] = "PYTHON";
|
|
592
592
|
})(exports.Language || (exports.Language = {}));
|
|
593
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
593
|
+
/** Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */
|
|
594
594
|
exports.FunctionResponseScheduling = void 0;
|
|
595
595
|
(function (FunctionResponseScheduling) {
|
|
596
596
|
/**
|
|
@@ -796,30 +796,6 @@ exports.DynamicRetrievalConfigMode = void 0;
|
|
|
796
796
|
*/
|
|
797
797
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
798
798
|
})(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
|
|
799
|
-
/** Function calling mode. */
|
|
800
|
-
exports.FunctionCallingConfigMode = void 0;
|
|
801
|
-
(function (FunctionCallingConfigMode) {
|
|
802
|
-
/**
|
|
803
|
-
* Unspecified function calling mode. This value should not be used.
|
|
804
|
-
*/
|
|
805
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
806
|
-
/**
|
|
807
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
808
|
-
*/
|
|
809
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
810
|
-
/**
|
|
811
|
-
* 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".
|
|
812
|
-
*/
|
|
813
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
814
|
-
/**
|
|
815
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
816
|
-
*/
|
|
817
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
818
|
-
/**
|
|
819
|
-
* 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".
|
|
820
|
-
*/
|
|
821
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
822
|
-
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
823
799
|
/** The number of thoughts tokens that the model should generate. */
|
|
824
800
|
exports.ThinkingLevel = void 0;
|
|
825
801
|
(function (ThinkingLevel) {
|
|
@@ -968,6 +944,30 @@ exports.HarmBlockThreshold = void 0;
|
|
|
968
944
|
*/
|
|
969
945
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
970
946
|
})(exports.HarmBlockThreshold || (exports.HarmBlockThreshold = {}));
|
|
947
|
+
/** Function calling mode. */
|
|
948
|
+
exports.FunctionCallingConfigMode = void 0;
|
|
949
|
+
(function (FunctionCallingConfigMode) {
|
|
950
|
+
/**
|
|
951
|
+
* Unspecified function calling mode. This value should not be used.
|
|
952
|
+
*/
|
|
953
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
954
|
+
/**
|
|
955
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
956
|
+
*/
|
|
957
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
958
|
+
/**
|
|
959
|
+
* Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
960
|
+
*/
|
|
961
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
962
|
+
/**
|
|
963
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
964
|
+
*/
|
|
965
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
966
|
+
/**
|
|
967
|
+
* Model is constrained to predict either function calls or natural language response. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
968
|
+
*/
|
|
969
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
970
|
+
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
971
971
|
/** Output only. The reason why the model stopped generating tokens.
|
|
972
972
|
|
|
973
973
|
If empty, the model has not stopped generating the tokens. */
|
|
@@ -1786,6 +1786,58 @@ exports.ImageResizeMode = void 0;
|
|
|
1786
1786
|
*/
|
|
1787
1787
|
ImageResizeMode["PAD"] = "PAD";
|
|
1788
1788
|
})(exports.ImageResizeMode || (exports.ImageResizeMode = {}));
|
|
1789
|
+
/** Defines how to parse sample response. */
|
|
1790
|
+
exports.ResponseParseType = void 0;
|
|
1791
|
+
(function (ResponseParseType) {
|
|
1792
|
+
/**
|
|
1793
|
+
* Default value. This value is unused.
|
|
1794
|
+
*/
|
|
1795
|
+
ResponseParseType["RESPONSE_PARSE_TYPE_UNSPECIFIED"] = "RESPONSE_PARSE_TYPE_UNSPECIFIED";
|
|
1796
|
+
/**
|
|
1797
|
+
* Use the sample response as is.
|
|
1798
|
+
*/
|
|
1799
|
+
ResponseParseType["IDENTITY"] = "IDENTITY";
|
|
1800
|
+
/**
|
|
1801
|
+
* Use regex to extract the important part of sample response.
|
|
1802
|
+
*/
|
|
1803
|
+
ResponseParseType["REGEX_EXTRACT"] = "REGEX_EXTRACT";
|
|
1804
|
+
})(exports.ResponseParseType || (exports.ResponseParseType = {}));
|
|
1805
|
+
/** Match operation to use for evaluation. */
|
|
1806
|
+
exports.MatchOperation = void 0;
|
|
1807
|
+
(function (MatchOperation) {
|
|
1808
|
+
/**
|
|
1809
|
+
* Default value. This value is unused.
|
|
1810
|
+
*/
|
|
1811
|
+
MatchOperation["MATCH_OPERATION_UNSPECIFIED"] = "MATCH_OPERATION_UNSPECIFIED";
|
|
1812
|
+
/**
|
|
1813
|
+
* Equivalent to GoogleSQL `REGEX_CONTAINS(target, expression)`.
|
|
1814
|
+
*/
|
|
1815
|
+
MatchOperation["REGEX_CONTAINS"] = "REGEX_CONTAINS";
|
|
1816
|
+
/**
|
|
1817
|
+
* `expression` is a substring of target.
|
|
1818
|
+
*/
|
|
1819
|
+
MatchOperation["PARTIAL_MATCH"] = "PARTIAL_MATCH";
|
|
1820
|
+
/**
|
|
1821
|
+
* `expression` is an exact match of target.
|
|
1822
|
+
*/
|
|
1823
|
+
MatchOperation["EXACT_MATCH"] = "EXACT_MATCH";
|
|
1824
|
+
})(exports.MatchOperation || (exports.MatchOperation = {}));
|
|
1825
|
+
/** Represents how much to think for the tuning job. */
|
|
1826
|
+
exports.ReinforcementTuningThinkingLevel = void 0;
|
|
1827
|
+
(function (ReinforcementTuningThinkingLevel) {
|
|
1828
|
+
/**
|
|
1829
|
+
* Unspecified thinking level.
|
|
1830
|
+
*/
|
|
1831
|
+
ReinforcementTuningThinkingLevel["REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED"] = "REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED";
|
|
1832
|
+
/**
|
|
1833
|
+
* Little to no thinking.
|
|
1834
|
+
*/
|
|
1835
|
+
ReinforcementTuningThinkingLevel["MINIMAL"] = "MINIMAL";
|
|
1836
|
+
/**
|
|
1837
|
+
* High thinking level.
|
|
1838
|
+
*/
|
|
1839
|
+
ReinforcementTuningThinkingLevel["HIGH"] = "HIGH";
|
|
1840
|
+
})(exports.ReinforcementTuningThinkingLevel || (exports.ReinforcementTuningThinkingLevel = {}));
|
|
1789
1841
|
/** Enum representing the tuning method. */
|
|
1790
1842
|
exports.TuningMethod = void 0;
|
|
1791
1843
|
(function (TuningMethod) {
|
|
@@ -1801,6 +1853,10 @@ exports.TuningMethod = void 0;
|
|
|
1801
1853
|
* Distillation tuning.
|
|
1802
1854
|
*/
|
|
1803
1855
|
TuningMethod["DISTILLATION"] = "DISTILLATION";
|
|
1856
|
+
/**
|
|
1857
|
+
* Reinforcement tuning.
|
|
1858
|
+
*/
|
|
1859
|
+
TuningMethod["REINFORCEMENT_TUNING"] = "REINFORCEMENT_TUNING";
|
|
1804
1860
|
})(exports.TuningMethod || (exports.TuningMethod = {}));
|
|
1805
1861
|
/** State for the lifecycle of a File. */
|
|
1806
1862
|
exports.FileState = void 0;
|
|
@@ -2175,24 +2231,13 @@ the API in a subsequent turn within a `Content` message, along with the
|
|
|
2175
2231
|
corresponding `ToolCall`. */
|
|
2176
2232
|
class ToolResponse {
|
|
2177
2233
|
}
|
|
2178
|
-
/** Raw media bytes for function response.
|
|
2179
|
-
|
|
2180
|
-
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
2181
|
-
field. */
|
|
2234
|
+
/** Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. */
|
|
2182
2235
|
class FunctionResponseBlob {
|
|
2183
2236
|
}
|
|
2184
|
-
/** URI based data for function response. */
|
|
2237
|
+
/** URI based data for function response. This data type is not supported in Gemini API. */
|
|
2185
2238
|
class FunctionResponseFileData {
|
|
2186
2239
|
}
|
|
2187
|
-
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
2188
|
-
|
|
2189
|
-
A `FunctionResponsePart` consists of data which has an associated datatype. A
|
|
2190
|
-
`FunctionResponsePart` can only contain one of the accepted types in
|
|
2191
|
-
`FunctionResponsePart.data`.
|
|
2192
|
-
|
|
2193
|
-
A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
|
|
2194
|
-
type and subtype of the media if the `inline_data` field is filled with raw
|
|
2195
|
-
bytes. */
|
|
2240
|
+
/** 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. */
|
|
2196
2241
|
class FunctionResponsePart {
|
|
2197
2242
|
}
|
|
2198
2243
|
/**
|
|
@@ -2217,7 +2262,7 @@ function createFunctionResponsePartFromUri(uri, mimeType) {
|
|
|
2217
2262
|
},
|
|
2218
2263
|
};
|
|
2219
2264
|
}
|
|
2220
|
-
/**
|
|
2265
|
+
/** 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. */
|
|
2221
2266
|
class FunctionResponse {
|
|
2222
2267
|
}
|
|
2223
2268
|
/**
|
|
@@ -2645,6 +2690,12 @@ class GenerateVideosOperation {
|
|
|
2645
2690
|
return operation;
|
|
2646
2691
|
}
|
|
2647
2692
|
}
|
|
2693
|
+
/** Defines how to parse sample response for reinforcement tuning. */
|
|
2694
|
+
class ReinforcementTuningParseResponseConfig {
|
|
2695
|
+
}
|
|
2696
|
+
/** Scores responses by directly converting parsed autorater response to float reward (reward is clipped to be within [-1, 1]). */
|
|
2697
|
+
class ReinforcementTuningAutoraterScorerParsedResponseConversionScorer {
|
|
2698
|
+
}
|
|
2648
2699
|
/** The results from an evaluation run performed by the EvaluationService. This data type is not supported in Gemini API. */
|
|
2649
2700
|
class EvaluateDatasetResponse {
|
|
2650
2701
|
}
|
|
@@ -2654,6 +2705,12 @@ class ListTuningJobsResponse {
|
|
|
2654
2705
|
/** Empty response for tunings.cancel method. */
|
|
2655
2706
|
class CancelTuningJobResponse {
|
|
2656
2707
|
}
|
|
2708
|
+
/** Response for the validate_reward method.
|
|
2709
|
+
|
|
2710
|
+
Contains the computed reward for a reinforcement tuning reward
|
|
2711
|
+
configuration. */
|
|
2712
|
+
class ValidateRewardResponse {
|
|
2713
|
+
}
|
|
2657
2714
|
/** Empty response for caches.delete method. */
|
|
2658
2715
|
class DeleteCachedContentResponse {
|
|
2659
2716
|
}
|
|
@@ -5122,6 +5179,7 @@ exports.PagedItem = void 0;
|
|
|
5122
5179
|
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
5123
5180
|
PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
|
|
5124
5181
|
PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
|
|
5182
|
+
PagedItem["PAGED_ITEM_SKILLS"] = "skills";
|
|
5125
5183
|
})(exports.PagedItem || (exports.PagedItem = {}));
|
|
5126
5184
|
/**
|
|
5127
5185
|
* Pager class for iterating through paginated results.
|
|
@@ -5842,7 +5900,7 @@ function blobToMldev$3(fromObject) {
|
|
|
5842
5900
|
}
|
|
5843
5901
|
return toObject;
|
|
5844
5902
|
}
|
|
5845
|
-
function codeExecutionResultToVertex$
|
|
5903
|
+
function codeExecutionResultToVertex$3(fromObject) {
|
|
5846
5904
|
const toObject = {};
|
|
5847
5905
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
5848
5906
|
if (fromOutcome != null) {
|
|
@@ -5857,24 +5915,6 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
5857
5915
|
}
|
|
5858
5916
|
return toObject;
|
|
5859
5917
|
}
|
|
5860
|
-
function computerUseToVertex$2(fromObject) {
|
|
5861
|
-
const toObject = {};
|
|
5862
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5863
|
-
if (fromEnvironment != null) {
|
|
5864
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5865
|
-
}
|
|
5866
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
5867
|
-
'excludedPredefinedFunctions',
|
|
5868
|
-
]);
|
|
5869
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
5870
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
5871
|
-
}
|
|
5872
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
5873
|
-
undefined) {
|
|
5874
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
5875
|
-
}
|
|
5876
|
-
return toObject;
|
|
5877
|
-
}
|
|
5878
5918
|
function contentToMldev$3(fromObject) {
|
|
5879
5919
|
const toObject = {};
|
|
5880
5920
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -5893,14 +5933,14 @@ function contentToMldev$3(fromObject) {
|
|
|
5893
5933
|
}
|
|
5894
5934
|
return toObject;
|
|
5895
5935
|
}
|
|
5896
|
-
function contentToVertex$
|
|
5936
|
+
function contentToVertex$3(fromObject) {
|
|
5897
5937
|
const toObject = {};
|
|
5898
5938
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5899
5939
|
if (fromParts != null) {
|
|
5900
5940
|
let transformedList = fromParts;
|
|
5901
5941
|
if (Array.isArray(transformedList)) {
|
|
5902
5942
|
transformedList = transformedList.map((item) => {
|
|
5903
|
-
return partToVertex$
|
|
5943
|
+
return partToVertex$3(item);
|
|
5904
5944
|
});
|
|
5905
5945
|
}
|
|
5906
5946
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5979,7 +6019,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5979
6019
|
let transformedList = tContents(fromContents);
|
|
5980
6020
|
if (Array.isArray(transformedList)) {
|
|
5981
6021
|
transformedList = transformedList.map((item) => {
|
|
5982
|
-
return contentToVertex$
|
|
6022
|
+
return contentToVertex$3(item);
|
|
5983
6023
|
});
|
|
5984
6024
|
}
|
|
5985
6025
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -5988,7 +6028,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5988
6028
|
'systemInstruction',
|
|
5989
6029
|
]);
|
|
5990
6030
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
5991
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$
|
|
6031
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$3(tContent(fromSystemInstruction)));
|
|
5992
6032
|
}
|
|
5993
6033
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5994
6034
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -6070,7 +6110,7 @@ function deleteCachedContentResponseFromVertex(fromObject) {
|
|
|
6070
6110
|
}
|
|
6071
6111
|
return toObject;
|
|
6072
6112
|
}
|
|
6073
|
-
function executableCodeToVertex$
|
|
6113
|
+
function executableCodeToVertex$3(fromObject) {
|
|
6074
6114
|
const toObject = {};
|
|
6075
6115
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
6076
6116
|
if (fromCode != null) {
|
|
@@ -6284,6 +6324,16 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
6284
6324
|
}
|
|
6285
6325
|
return toObject;
|
|
6286
6326
|
}
|
|
6327
|
+
function mcpServerToVertex$2(fromObject) {
|
|
6328
|
+
const toObject = {};
|
|
6329
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
6330
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6331
|
+
}
|
|
6332
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
6333
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6334
|
+
}
|
|
6335
|
+
return toObject;
|
|
6336
|
+
}
|
|
6287
6337
|
function partToMldev$3(fromObject) {
|
|
6288
6338
|
const toObject = {};
|
|
6289
6339
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -6356,7 +6406,7 @@ function partToMldev$3(fromObject) {
|
|
|
6356
6406
|
}
|
|
6357
6407
|
return toObject;
|
|
6358
6408
|
}
|
|
6359
|
-
function partToVertex$
|
|
6409
|
+
function partToVertex$3(fromObject) {
|
|
6360
6410
|
const toObject = {};
|
|
6361
6411
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
6362
6412
|
'mediaResolution',
|
|
@@ -6368,13 +6418,13 @@ function partToVertex$2(fromObject) {
|
|
|
6368
6418
|
'codeExecutionResult',
|
|
6369
6419
|
]);
|
|
6370
6420
|
if (fromCodeExecutionResult != null) {
|
|
6371
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
6421
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$3(fromCodeExecutionResult));
|
|
6372
6422
|
}
|
|
6373
6423
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
6374
6424
|
'executableCode',
|
|
6375
6425
|
]);
|
|
6376
6426
|
if (fromExecutableCode != null) {
|
|
6377
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
6427
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$3(fromExecutableCode));
|
|
6378
6428
|
}
|
|
6379
6429
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
6380
6430
|
if (fromFileData != null) {
|
|
@@ -6540,7 +6590,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6540
6590
|
}
|
|
6541
6591
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6542
6592
|
if (fromComputerUse != null) {
|
|
6543
|
-
setValueByPath(toObject, ['computerUse'],
|
|
6593
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6544
6594
|
}
|
|
6545
6595
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6546
6596
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -6593,8 +6643,15 @@ function toolToVertex$2(fromObject) {
|
|
|
6593
6643
|
if (fromUrlContext != null) {
|
|
6594
6644
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
6595
6645
|
}
|
|
6596
|
-
|
|
6597
|
-
|
|
6646
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
6647
|
+
if (fromMcpServers != null) {
|
|
6648
|
+
let transformedList = fromMcpServers;
|
|
6649
|
+
if (Array.isArray(transformedList)) {
|
|
6650
|
+
transformedList = transformedList.map((item) => {
|
|
6651
|
+
return mcpServerToVertex$2(item);
|
|
6652
|
+
});
|
|
6653
|
+
}
|
|
6654
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
6598
6655
|
}
|
|
6599
6656
|
return toObject;
|
|
6600
6657
|
}
|
|
@@ -7684,7 +7741,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7684
7741
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7685
7742
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7686
7743
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7687
|
-
const SDK_VERSION = '2.
|
|
7744
|
+
const SDK_VERSION = '2.8.0'; // x-release-please-version
|
|
7688
7745
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7689
7746
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7690
7747
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11721,7 +11778,7 @@ function blobToMldev$2(fromObject) {
|
|
|
11721
11778
|
}
|
|
11722
11779
|
return toObject;
|
|
11723
11780
|
}
|
|
11724
|
-
function codeExecutionResultToVertex$
|
|
11781
|
+
function codeExecutionResultToVertex$2(fromObject) {
|
|
11725
11782
|
const toObject = {};
|
|
11726
11783
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
11727
11784
|
if (fromOutcome != null) {
|
|
@@ -11736,24 +11793,6 @@ function codeExecutionResultToVertex$1(fromObject) {
|
|
|
11736
11793
|
}
|
|
11737
11794
|
return toObject;
|
|
11738
11795
|
}
|
|
11739
|
-
function computerUseToVertex$1(fromObject) {
|
|
11740
|
-
const toObject = {};
|
|
11741
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
11742
|
-
if (fromEnvironment != null) {
|
|
11743
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
11744
|
-
}
|
|
11745
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
11746
|
-
'excludedPredefinedFunctions',
|
|
11747
|
-
]);
|
|
11748
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
11749
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
11750
|
-
}
|
|
11751
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
11752
|
-
undefined) {
|
|
11753
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11754
|
-
}
|
|
11755
|
-
return toObject;
|
|
11756
|
-
}
|
|
11757
11796
|
function contentToMldev$2(fromObject) {
|
|
11758
11797
|
const toObject = {};
|
|
11759
11798
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -11772,14 +11811,14 @@ function contentToMldev$2(fromObject) {
|
|
|
11772
11811
|
}
|
|
11773
11812
|
return toObject;
|
|
11774
11813
|
}
|
|
11775
|
-
function contentToVertex$
|
|
11814
|
+
function contentToVertex$2(fromObject) {
|
|
11776
11815
|
const toObject = {};
|
|
11777
11816
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
11778
11817
|
if (fromParts != null) {
|
|
11779
11818
|
let transformedList = fromParts;
|
|
11780
11819
|
if (Array.isArray(transformedList)) {
|
|
11781
11820
|
transformedList = transformedList.map((item) => {
|
|
11782
|
-
return partToVertex$
|
|
11821
|
+
return partToVertex$2(item);
|
|
11783
11822
|
});
|
|
11784
11823
|
}
|
|
11785
11824
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -11790,7 +11829,7 @@ function contentToVertex$1(fromObject) {
|
|
|
11790
11829
|
}
|
|
11791
11830
|
return toObject;
|
|
11792
11831
|
}
|
|
11793
|
-
function executableCodeToVertex$
|
|
11832
|
+
function executableCodeToVertex$2(fromObject) {
|
|
11794
11833
|
const toObject = {};
|
|
11795
11834
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
11796
11835
|
if (fromCode != null) {
|
|
@@ -12129,11 +12168,11 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
12129
12168
|
}
|
|
12130
12169
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
12131
12170
|
}
|
|
12132
|
-
const
|
|
12133
|
-
'
|
|
12171
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
12172
|
+
'translationConfig',
|
|
12134
12173
|
]);
|
|
12135
|
-
if (parentObject !== undefined &&
|
|
12136
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
12174
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
12175
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
12137
12176
|
}
|
|
12138
12177
|
return toObject;
|
|
12139
12178
|
}
|
|
@@ -12199,7 +12238,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
12199
12238
|
'systemInstruction',
|
|
12200
12239
|
]);
|
|
12201
12240
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
12202
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$
|
|
12241
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$2(tContent(fromSystemInstruction)));
|
|
12203
12242
|
}
|
|
12204
12243
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
12205
12244
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -12267,8 +12306,8 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
12267
12306
|
}
|
|
12268
12307
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
12269
12308
|
}
|
|
12270
|
-
if (getValueByPath(fromObject, ['
|
|
12271
|
-
throw new Error('
|
|
12309
|
+
if (getValueByPath(fromObject, ['translationConfig']) !== undefined) {
|
|
12310
|
+
throw new Error('translationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
12272
12311
|
}
|
|
12273
12312
|
return toObject;
|
|
12274
12313
|
}
|
|
@@ -12460,6 +12499,16 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
12460
12499
|
}
|
|
12461
12500
|
return toObject;
|
|
12462
12501
|
}
|
|
12502
|
+
function mcpServerToVertex$1(fromObject) {
|
|
12503
|
+
const toObject = {};
|
|
12504
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
12505
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
12506
|
+
}
|
|
12507
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
12508
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
12509
|
+
}
|
|
12510
|
+
return toObject;
|
|
12511
|
+
}
|
|
12463
12512
|
function partToMldev$2(fromObject) {
|
|
12464
12513
|
const toObject = {};
|
|
12465
12514
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -12532,7 +12581,7 @@ function partToMldev$2(fromObject) {
|
|
|
12532
12581
|
}
|
|
12533
12582
|
return toObject;
|
|
12534
12583
|
}
|
|
12535
|
-
function partToVertex$
|
|
12584
|
+
function partToVertex$2(fromObject) {
|
|
12536
12585
|
const toObject = {};
|
|
12537
12586
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
12538
12587
|
'mediaResolution',
|
|
@@ -12544,13 +12593,13 @@ function partToVertex$1(fromObject) {
|
|
|
12544
12593
|
'codeExecutionResult',
|
|
12545
12594
|
]);
|
|
12546
12595
|
if (fromCodeExecutionResult != null) {
|
|
12547
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
12596
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$2(fromCodeExecutionResult));
|
|
12548
12597
|
}
|
|
12549
12598
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
12550
12599
|
'executableCode',
|
|
12551
12600
|
]);
|
|
12552
12601
|
if (fromExecutableCode != null) {
|
|
12553
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
12602
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$2(fromExecutableCode));
|
|
12554
12603
|
}
|
|
12555
12604
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
12556
12605
|
if (fromFileData != null) {
|
|
@@ -12702,7 +12751,7 @@ function toolToVertex$1(fromObject) {
|
|
|
12702
12751
|
}
|
|
12703
12752
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
12704
12753
|
if (fromComputerUse != null) {
|
|
12705
|
-
setValueByPath(toObject, ['computerUse'],
|
|
12754
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12706
12755
|
}
|
|
12707
12756
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12708
12757
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -12755,8 +12804,15 @@ function toolToVertex$1(fromObject) {
|
|
|
12755
12804
|
if (fromUrlContext != null) {
|
|
12756
12805
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
12757
12806
|
}
|
|
12758
|
-
|
|
12759
|
-
|
|
12807
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
12808
|
+
if (fromMcpServers != null) {
|
|
12809
|
+
let transformedList = fromMcpServers;
|
|
12810
|
+
if (Array.isArray(transformedList)) {
|
|
12811
|
+
transformedList = transformedList.map((item) => {
|
|
12812
|
+
return mcpServerToVertex$1(item);
|
|
12813
|
+
});
|
|
12814
|
+
}
|
|
12815
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
12760
12816
|
}
|
|
12761
12817
|
return toObject;
|
|
12762
12818
|
}
|
|
@@ -12982,7 +13038,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
12982
13038
|
}
|
|
12983
13039
|
return toObject;
|
|
12984
13040
|
}
|
|
12985
|
-
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
13041
|
+
function codeExecutionResultToVertex$1(fromObject, _rootObject) {
|
|
12986
13042
|
const toObject = {};
|
|
12987
13043
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
12988
13044
|
if (fromOutcome != null) {
|
|
@@ -13008,7 +13064,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
13008
13064
|
let transformedList = tContents(fromContents);
|
|
13009
13065
|
if (Array.isArray(transformedList)) {
|
|
13010
13066
|
transformedList = transformedList.map((item) => {
|
|
13011
|
-
return contentToVertex(item);
|
|
13067
|
+
return contentToVertex$1(item);
|
|
13012
13068
|
});
|
|
13013
13069
|
}
|
|
13014
13070
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -13035,24 +13091,6 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
13035
13091
|
}
|
|
13036
13092
|
return toObject;
|
|
13037
13093
|
}
|
|
13038
|
-
function computerUseToVertex(fromObject, _rootObject) {
|
|
13039
|
-
const toObject = {};
|
|
13040
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
13041
|
-
if (fromEnvironment != null) {
|
|
13042
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
13043
|
-
}
|
|
13044
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
13045
|
-
'excludedPredefinedFunctions',
|
|
13046
|
-
]);
|
|
13047
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
13048
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
13049
|
-
}
|
|
13050
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
13051
|
-
undefined) {
|
|
13052
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
13053
|
-
}
|
|
13054
|
-
return toObject;
|
|
13055
|
-
}
|
|
13056
13094
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
13057
13095
|
const toObject = {};
|
|
13058
13096
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -13095,14 +13133,14 @@ function contentToMldev$1(fromObject, rootObject) {
|
|
|
13095
13133
|
}
|
|
13096
13134
|
return toObject;
|
|
13097
13135
|
}
|
|
13098
|
-
function contentToVertex(fromObject, rootObject) {
|
|
13136
|
+
function contentToVertex$1(fromObject, rootObject) {
|
|
13099
13137
|
const toObject = {};
|
|
13100
13138
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13101
13139
|
if (fromParts != null) {
|
|
13102
13140
|
let transformedList = fromParts;
|
|
13103
13141
|
if (Array.isArray(transformedList)) {
|
|
13104
13142
|
transformedList = transformedList.map((item) => {
|
|
13105
|
-
return partToVertex(item);
|
|
13143
|
+
return partToVertex$1(item);
|
|
13106
13144
|
});
|
|
13107
13145
|
}
|
|
13108
13146
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -13146,7 +13184,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
13146
13184
|
'systemInstruction',
|
|
13147
13185
|
]);
|
|
13148
13186
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
13149
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
13187
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
13150
13188
|
}
|
|
13151
13189
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
13152
13190
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -13199,7 +13237,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
13199
13237
|
let transformedList = tContents(fromContents);
|
|
13200
13238
|
if (Array.isArray(transformedList)) {
|
|
13201
13239
|
transformedList = transformedList.map((item) => {
|
|
13202
|
-
return contentToVertex(item);
|
|
13240
|
+
return contentToVertex$1(item);
|
|
13203
13241
|
});
|
|
13204
13242
|
}
|
|
13205
13243
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -13635,7 +13673,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
|
|
|
13635
13673
|
if (discriminatorContent === 'EMBED_CONTENT') {
|
|
13636
13674
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
13637
13675
|
if (fromContent != null) {
|
|
13638
|
-
setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
|
|
13676
|
+
setValueByPath(toObject, ['content'], contentToVertex$1(tContent(fromContent)));
|
|
13639
13677
|
}
|
|
13640
13678
|
}
|
|
13641
13679
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -13727,7 +13765,7 @@ function endpointFromVertex(fromObject, _rootObject) {
|
|
|
13727
13765
|
}
|
|
13728
13766
|
return toObject;
|
|
13729
13767
|
}
|
|
13730
|
-
function executableCodeToVertex(fromObject, _rootObject) {
|
|
13768
|
+
function executableCodeToVertex$1(fromObject, _rootObject) {
|
|
13731
13769
|
const toObject = {};
|
|
13732
13770
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
13733
13771
|
if (fromCode != null) {
|
|
@@ -13970,7 +14008,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
13970
14008
|
'systemInstruction',
|
|
13971
14009
|
]);
|
|
13972
14010
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
13973
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
14011
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
13974
14012
|
}
|
|
13975
14013
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
13976
14014
|
if (fromTemperature != null) {
|
|
@@ -14175,7 +14213,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
14175
14213
|
let transformedList = tContents(fromContents);
|
|
14176
14214
|
if (Array.isArray(transformedList)) {
|
|
14177
14215
|
transformedList = transformedList.map((item) => {
|
|
14178
|
-
return contentToVertex(item);
|
|
14216
|
+
return contentToVertex$1(item);
|
|
14179
14217
|
});
|
|
14180
14218
|
}
|
|
14181
14219
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -15430,6 +15468,16 @@ function maskReferenceConfigToVertex(fromObject, _rootObject) {
|
|
|
15430
15468
|
}
|
|
15431
15469
|
return toObject;
|
|
15432
15470
|
}
|
|
15471
|
+
function mcpServerToVertex(fromObject, _rootObject) {
|
|
15472
|
+
const toObject = {};
|
|
15473
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
15474
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
15475
|
+
}
|
|
15476
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
15477
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
15478
|
+
}
|
|
15479
|
+
return toObject;
|
|
15480
|
+
}
|
|
15433
15481
|
function modelFromMldev(fromObject, rootObject) {
|
|
15434
15482
|
const toObject = {};
|
|
15435
15483
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -15620,7 +15668,7 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
15620
15668
|
}
|
|
15621
15669
|
return toObject;
|
|
15622
15670
|
}
|
|
15623
|
-
function partToVertex(fromObject, rootObject) {
|
|
15671
|
+
function partToVertex$1(fromObject, rootObject) {
|
|
15624
15672
|
const toObject = {};
|
|
15625
15673
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
15626
15674
|
'mediaResolution',
|
|
@@ -15632,13 +15680,13 @@ function partToVertex(fromObject, rootObject) {
|
|
|
15632
15680
|
'codeExecutionResult',
|
|
15633
15681
|
]);
|
|
15634
15682
|
if (fromCodeExecutionResult != null) {
|
|
15635
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
15683
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$1(fromCodeExecutionResult));
|
|
15636
15684
|
}
|
|
15637
15685
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
15638
15686
|
'executableCode',
|
|
15639
15687
|
]);
|
|
15640
15688
|
if (fromExecutableCode != null) {
|
|
15641
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
15689
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$1(fromExecutableCode));
|
|
15642
15690
|
}
|
|
15643
15691
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
15644
15692
|
if (fromFileData != null) {
|
|
@@ -16121,7 +16169,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
16121
16169
|
}
|
|
16122
16170
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
16123
16171
|
if (fromComputerUse != null) {
|
|
16124
|
-
setValueByPath(toObject, ['computerUse'],
|
|
16172
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
16125
16173
|
}
|
|
16126
16174
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
16127
16175
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -16174,8 +16222,15 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
16174
16222
|
if (fromUrlContext != null) {
|
|
16175
16223
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
16176
16224
|
}
|
|
16177
|
-
|
|
16178
|
-
|
|
16225
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
16226
|
+
if (fromMcpServers != null) {
|
|
16227
|
+
let transformedList = fromMcpServers;
|
|
16228
|
+
if (Array.isArray(transformedList)) {
|
|
16229
|
+
transformedList = transformedList.map((item) => {
|
|
16230
|
+
return mcpServerToVertex(item);
|
|
16231
|
+
});
|
|
16232
|
+
}
|
|
16233
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
16179
16234
|
}
|
|
16180
16235
|
return toObject;
|
|
16181
16236
|
}
|
|
@@ -19446,11 +19501,11 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
19446
19501
|
}
|
|
19447
19502
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
19448
19503
|
}
|
|
19449
|
-
const
|
|
19450
|
-
'
|
|
19504
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
19505
|
+
'translationConfig',
|
|
19451
19506
|
]);
|
|
19452
|
-
if (parentObject !== undefined &&
|
|
19453
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
19507
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
19508
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
19454
19509
|
}
|
|
19455
19510
|
return toObject;
|
|
19456
19511
|
}
|
|
@@ -19944,6 +19999,39 @@ function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
|
|
|
19944
19999
|
}
|
|
19945
20000
|
return toObject;
|
|
19946
20001
|
}
|
|
20002
|
+
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
20003
|
+
const toObject = {};
|
|
20004
|
+
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
20005
|
+
if (fromOutcome != null) {
|
|
20006
|
+
setValueByPath(toObject, ['outcome'], fromOutcome);
|
|
20007
|
+
}
|
|
20008
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
20009
|
+
if (fromOutput != null) {
|
|
20010
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
20011
|
+
}
|
|
20012
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20013
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20014
|
+
}
|
|
20015
|
+
return toObject;
|
|
20016
|
+
}
|
|
20017
|
+
function contentToVertex(fromObject, rootObject) {
|
|
20018
|
+
const toObject = {};
|
|
20019
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
20020
|
+
if (fromParts != null) {
|
|
20021
|
+
let transformedList = fromParts;
|
|
20022
|
+
if (Array.isArray(transformedList)) {
|
|
20023
|
+
transformedList = transformedList.map((item) => {
|
|
20024
|
+
return partToVertex(item);
|
|
20025
|
+
});
|
|
20026
|
+
}
|
|
20027
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
20028
|
+
}
|
|
20029
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
20030
|
+
if (fromRole != null) {
|
|
20031
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
20032
|
+
}
|
|
20033
|
+
return toObject;
|
|
20034
|
+
}
|
|
19947
20035
|
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
19948
20036
|
const toObject = {};
|
|
19949
20037
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
@@ -20014,6 +20102,30 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
20014
20102
|
if (getValueByPath(fromObject, ['encryptionSpec']) !== undefined) {
|
|
20015
20103
|
throw new Error('encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20016
20104
|
}
|
|
20105
|
+
if (getValueByPath(fromObject, ['rewardConfig']) !== undefined) {
|
|
20106
|
+
throw new Error('rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20107
|
+
}
|
|
20108
|
+
if (getValueByPath(fromObject, ['compositeRewardConfig']) !== undefined) {
|
|
20109
|
+
throw new Error('compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20110
|
+
}
|
|
20111
|
+
if (getValueByPath(fromObject, ['samplesPerPrompt']) !== undefined) {
|
|
20112
|
+
throw new Error('samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20113
|
+
}
|
|
20114
|
+
if (getValueByPath(fromObject, ['evaluateInterval']) !== undefined) {
|
|
20115
|
+
throw new Error('evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20116
|
+
}
|
|
20117
|
+
if (getValueByPath(fromObject, ['checkpointInterval']) !== undefined) {
|
|
20118
|
+
throw new Error('checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20119
|
+
}
|
|
20120
|
+
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
20121
|
+
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20122
|
+
}
|
|
20123
|
+
if (getValueByPath(fromObject, ['thinkingLevel']) !== undefined) {
|
|
20124
|
+
throw new Error('thinkingLevel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20125
|
+
}
|
|
20126
|
+
if (getValueByPath(fromObject, ['validationDatasetUri']) !== undefined) {
|
|
20127
|
+
throw new Error('validationDatasetUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20128
|
+
}
|
|
20017
20129
|
return toObject;
|
|
20018
20130
|
}
|
|
20019
20131
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -20049,6 +20161,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20049
20161
|
setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20050
20162
|
}
|
|
20051
20163
|
}
|
|
20164
|
+
else if (discriminatorValidationDataset === 'REINFORCEMENT_TUNING') {
|
|
20165
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
20166
|
+
'validationDataset',
|
|
20167
|
+
]);
|
|
20168
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
20169
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20170
|
+
}
|
|
20171
|
+
}
|
|
20052
20172
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
20053
20173
|
'tunedModelDisplayName',
|
|
20054
20174
|
]);
|
|
@@ -20084,6 +20204,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20084
20204
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20085
20205
|
}
|
|
20086
20206
|
}
|
|
20207
|
+
else if (discriminatorEpochCount === 'REINFORCEMENT_TUNING') {
|
|
20208
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
20209
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
20210
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20211
|
+
}
|
|
20212
|
+
}
|
|
20087
20213
|
let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
|
|
20088
20214
|
'config',
|
|
20089
20215
|
'method',
|
|
@@ -20119,6 +20245,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20119
20245
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
20120
20246
|
}
|
|
20121
20247
|
}
|
|
20248
|
+
else if (discriminatorLearningRateMultiplier === 'REINFORCEMENT_TUNING') {
|
|
20249
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
20250
|
+
'learningRateMultiplier',
|
|
20251
|
+
]);
|
|
20252
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
20253
|
+
setValueByPath(parentObject, [
|
|
20254
|
+
'reinforcementTuningSpec',
|
|
20255
|
+
'hyperParameters',
|
|
20256
|
+
'learningRateMultiplier',
|
|
20257
|
+
], fromLearningRateMultiplier);
|
|
20258
|
+
}
|
|
20259
|
+
}
|
|
20122
20260
|
let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
|
|
20123
20261
|
if (discriminatorExportLastCheckpointOnly === undefined) {
|
|
20124
20262
|
discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
|
|
@@ -20172,6 +20310,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20172
20310
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20173
20311
|
}
|
|
20174
20312
|
}
|
|
20313
|
+
else if (discriminatorAdapterSize === 'REINFORCEMENT_TUNING') {
|
|
20314
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
20315
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
20316
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20317
|
+
}
|
|
20318
|
+
}
|
|
20175
20319
|
let discriminatorTuningMode = getValueByPath(rootObject, [
|
|
20176
20320
|
'config',
|
|
20177
20321
|
'method',
|
|
@@ -20216,6 +20360,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20216
20360
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20217
20361
|
}
|
|
20218
20362
|
}
|
|
20363
|
+
else if (discriminatorBatchSize === 'REINFORCEMENT_TUNING') {
|
|
20364
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
20365
|
+
if (parentObject !== undefined && fromBatchSize != null) {
|
|
20366
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20367
|
+
}
|
|
20368
|
+
}
|
|
20219
20369
|
let discriminatorLearningRate = getValueByPath(rootObject, [
|
|
20220
20370
|
'config',
|
|
20221
20371
|
'method',
|
|
@@ -20275,6 +20425,52 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20275
20425
|
if (parentObject !== undefined && fromEncryptionSpec != null) {
|
|
20276
20426
|
setValueByPath(parentObject, ['encryptionSpec'], fromEncryptionSpec);
|
|
20277
20427
|
}
|
|
20428
|
+
const fromRewardConfig = getValueByPath(fromObject, ['rewardConfig']);
|
|
20429
|
+
if (parentObject !== undefined && fromRewardConfig != null) {
|
|
20430
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'singleRewardConfig'], fromRewardConfig);
|
|
20431
|
+
}
|
|
20432
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
20433
|
+
'compositeRewardConfig',
|
|
20434
|
+
]);
|
|
20435
|
+
if (parentObject !== undefined && fromCompositeRewardConfig != null) {
|
|
20436
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'compositeRewardConfig'], fromCompositeRewardConfig);
|
|
20437
|
+
}
|
|
20438
|
+
const fromSamplesPerPrompt = getValueByPath(fromObject, [
|
|
20439
|
+
'samplesPerPrompt',
|
|
20440
|
+
]);
|
|
20441
|
+
if (parentObject !== undefined && fromSamplesPerPrompt != null) {
|
|
20442
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'samplesPerPrompt'], fromSamplesPerPrompt);
|
|
20443
|
+
}
|
|
20444
|
+
const fromEvaluateInterval = getValueByPath(fromObject, [
|
|
20445
|
+
'evaluateInterval',
|
|
20446
|
+
]);
|
|
20447
|
+
if (parentObject !== undefined && fromEvaluateInterval != null) {
|
|
20448
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'evaluateInterval'], fromEvaluateInterval);
|
|
20449
|
+
}
|
|
20450
|
+
const fromCheckpointInterval = getValueByPath(fromObject, [
|
|
20451
|
+
'checkpointInterval',
|
|
20452
|
+
]);
|
|
20453
|
+
if (parentObject !== undefined && fromCheckpointInterval != null) {
|
|
20454
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'checkpointInterval'], fromCheckpointInterval);
|
|
20455
|
+
}
|
|
20456
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
20457
|
+
'maxOutputTokens',
|
|
20458
|
+
]);
|
|
20459
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20460
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20461
|
+
}
|
|
20462
|
+
const fromThinkingLevel = getValueByPath(fromObject, [
|
|
20463
|
+
'thinkingLevel',
|
|
20464
|
+
]);
|
|
20465
|
+
if (parentObject !== undefined && fromThinkingLevel != null) {
|
|
20466
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'thinkingLevel'], fromThinkingLevel);
|
|
20467
|
+
}
|
|
20468
|
+
const fromValidationDatasetUri = getValueByPath(fromObject, [
|
|
20469
|
+
'validationDatasetUri',
|
|
20470
|
+
]);
|
|
20471
|
+
if (parentObject !== undefined && fromValidationDatasetUri != null) {
|
|
20472
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'validationDatasetUri'], fromValidationDatasetUri);
|
|
20473
|
+
}
|
|
20278
20474
|
return toObject;
|
|
20279
20475
|
}
|
|
20280
20476
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20445,6 +20641,21 @@ function distillationSpecFromVertex(fromObject, rootObject) {
|
|
|
20445
20641
|
}
|
|
20446
20642
|
return toObject;
|
|
20447
20643
|
}
|
|
20644
|
+
function executableCodeToVertex(fromObject, _rootObject) {
|
|
20645
|
+
const toObject = {};
|
|
20646
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
20647
|
+
if (fromCode != null) {
|
|
20648
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
20649
|
+
}
|
|
20650
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
20651
|
+
if (fromLanguage != null) {
|
|
20652
|
+
setValueByPath(toObject, ['language'], fromLanguage);
|
|
20653
|
+
}
|
|
20654
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20655
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20656
|
+
}
|
|
20657
|
+
return toObject;
|
|
20658
|
+
}
|
|
20448
20659
|
function generationConfigFromVertex(fromObject, _rootObject) {
|
|
20449
20660
|
const toObject = {};
|
|
20450
20661
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
@@ -20635,6 +20846,99 @@ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
|
20635
20846
|
}
|
|
20636
20847
|
return toObject;
|
|
20637
20848
|
}
|
|
20849
|
+
function partToVertex(fromObject, rootObject) {
|
|
20850
|
+
const toObject = {};
|
|
20851
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
20852
|
+
'mediaResolution',
|
|
20853
|
+
]);
|
|
20854
|
+
if (fromMediaResolution != null) {
|
|
20855
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
20856
|
+
}
|
|
20857
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
20858
|
+
'codeExecutionResult',
|
|
20859
|
+
]);
|
|
20860
|
+
if (fromCodeExecutionResult != null) {
|
|
20861
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
20862
|
+
}
|
|
20863
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
20864
|
+
'executableCode',
|
|
20865
|
+
]);
|
|
20866
|
+
if (fromExecutableCode != null) {
|
|
20867
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
20868
|
+
}
|
|
20869
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
20870
|
+
if (fromFileData != null) {
|
|
20871
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
20872
|
+
}
|
|
20873
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
20874
|
+
if (fromFunctionCall != null) {
|
|
20875
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
20876
|
+
}
|
|
20877
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
20878
|
+
'functionResponse',
|
|
20879
|
+
]);
|
|
20880
|
+
if (fromFunctionResponse != null) {
|
|
20881
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
20882
|
+
}
|
|
20883
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
20884
|
+
if (fromInlineData != null) {
|
|
20885
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
20886
|
+
}
|
|
20887
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
20888
|
+
if (fromText != null) {
|
|
20889
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
20890
|
+
}
|
|
20891
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
20892
|
+
if (fromThought != null) {
|
|
20893
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
20894
|
+
}
|
|
20895
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
20896
|
+
'thoughtSignature',
|
|
20897
|
+
]);
|
|
20898
|
+
if (fromThoughtSignature != null) {
|
|
20899
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
20900
|
+
}
|
|
20901
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
20902
|
+
'videoMetadata',
|
|
20903
|
+
]);
|
|
20904
|
+
if (fromVideoMetadata != null) {
|
|
20905
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
20906
|
+
}
|
|
20907
|
+
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
20908
|
+
throw new Error('toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20909
|
+
}
|
|
20910
|
+
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
20911
|
+
throw new Error('toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20912
|
+
}
|
|
20913
|
+
if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
|
|
20914
|
+
throw new Error('partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20915
|
+
}
|
|
20916
|
+
return toObject;
|
|
20917
|
+
}
|
|
20918
|
+
function reinforcementTuningExampleToVertex(fromObject, rootObject) {
|
|
20919
|
+
const toObject = {};
|
|
20920
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
20921
|
+
if (fromContents != null) {
|
|
20922
|
+
let transformedList = fromContents;
|
|
20923
|
+
if (Array.isArray(transformedList)) {
|
|
20924
|
+
transformedList = transformedList.map((item) => {
|
|
20925
|
+
return contentToVertex(item);
|
|
20926
|
+
});
|
|
20927
|
+
}
|
|
20928
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
20929
|
+
}
|
|
20930
|
+
const fromReferences = getValueByPath(fromObject, ['references']);
|
|
20931
|
+
if (fromReferences != null) {
|
|
20932
|
+
setValueByPath(toObject, ['references'], fromReferences);
|
|
20933
|
+
}
|
|
20934
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
20935
|
+
'systemInstruction',
|
|
20936
|
+
]);
|
|
20937
|
+
if (fromSystemInstruction != null) {
|
|
20938
|
+
setValueByPath(toObject, ['systemInstruction'], contentToVertex(fromSystemInstruction));
|
|
20939
|
+
}
|
|
20940
|
+
return toObject;
|
|
20941
|
+
}
|
|
20638
20942
|
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
20639
20943
|
const toObject = {};
|
|
20640
20944
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
@@ -20694,6 +20998,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20694
20998
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
|
|
20695
20999
|
}
|
|
20696
21000
|
}
|
|
21001
|
+
else if (discriminatorGcsUri === 'REINFORCEMENT_TUNING') {
|
|
21002
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
21003
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
21004
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
21005
|
+
}
|
|
21006
|
+
}
|
|
20697
21007
|
let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
|
|
20698
21008
|
'config',
|
|
20699
21009
|
'method',
|
|
@@ -20725,6 +21035,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20725
21035
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
|
|
20726
21036
|
}
|
|
20727
21037
|
}
|
|
21038
|
+
else if (discriminatorVertexDatasetResource === 'REINFORCEMENT_TUNING') {
|
|
21039
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
21040
|
+
'vertexDatasetResource',
|
|
21041
|
+
]);
|
|
21042
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
21043
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
21044
|
+
}
|
|
21045
|
+
}
|
|
20728
21046
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
20729
21047
|
throw new Error('examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20730
21048
|
}
|
|
@@ -20854,6 +21172,12 @@ function tuningJobFromVertex(fromObject, rootObject) {
|
|
|
20854
21172
|
if (fromDistillationSpec != null) {
|
|
20855
21173
|
setValueByPath(toObject, ['distillationSpec'], distillationSpecFromVertex(fromDistillationSpec));
|
|
20856
21174
|
}
|
|
21175
|
+
const fromReinforcementTuningSpec = getValueByPath(fromObject, [
|
|
21176
|
+
'reinforcementTuningSpec',
|
|
21177
|
+
]);
|
|
21178
|
+
if (fromReinforcementTuningSpec != null) {
|
|
21179
|
+
setValueByPath(toObject, ['reinforcementTuningSpec'], fromReinforcementTuningSpec);
|
|
21180
|
+
}
|
|
20857
21181
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
20858
21182
|
'tuningDataStats',
|
|
20859
21183
|
]);
|
|
@@ -20996,6 +21320,62 @@ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
|
20996
21320
|
}
|
|
20997
21321
|
return toObject;
|
|
20998
21322
|
}
|
|
21323
|
+
function validateRewardParametersToVertex(fromObject, rootObject) {
|
|
21324
|
+
const toObject = {};
|
|
21325
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
21326
|
+
if (fromParent != null) {
|
|
21327
|
+
setValueByPath(toObject, ['_url', 'parent'], fromParent);
|
|
21328
|
+
}
|
|
21329
|
+
const fromSampleResponse = getValueByPath(fromObject, [
|
|
21330
|
+
'sampleResponse',
|
|
21331
|
+
]);
|
|
21332
|
+
if (fromSampleResponse != null) {
|
|
21333
|
+
setValueByPath(toObject, ['sampleResponse'], contentToVertex(fromSampleResponse));
|
|
21334
|
+
}
|
|
21335
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
21336
|
+
if (fromExample != null) {
|
|
21337
|
+
setValueByPath(toObject, ['example'], reinforcementTuningExampleToVertex(fromExample));
|
|
21338
|
+
}
|
|
21339
|
+
const fromSingleRewardConfig = getValueByPath(fromObject, [
|
|
21340
|
+
'singleRewardConfig',
|
|
21341
|
+
]);
|
|
21342
|
+
if (fromSingleRewardConfig != null) {
|
|
21343
|
+
setValueByPath(toObject, ['singleRewardConfig'], fromSingleRewardConfig);
|
|
21344
|
+
}
|
|
21345
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
21346
|
+
'compositeRewardConfig',
|
|
21347
|
+
]);
|
|
21348
|
+
if (fromCompositeRewardConfig != null) {
|
|
21349
|
+
setValueByPath(toObject, ['compositeRewardConfig'], fromCompositeRewardConfig);
|
|
21350
|
+
}
|
|
21351
|
+
return toObject;
|
|
21352
|
+
}
|
|
21353
|
+
function validateRewardResponseFromVertex(fromObject, _rootObject) {
|
|
21354
|
+
const toObject = {};
|
|
21355
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
21356
|
+
'sdkHttpResponse',
|
|
21357
|
+
]);
|
|
21358
|
+
if (fromSdkHttpResponse != null) {
|
|
21359
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
21360
|
+
}
|
|
21361
|
+
const fromOverallReward = getValueByPath(fromObject, [
|
|
21362
|
+
'overallReward',
|
|
21363
|
+
]);
|
|
21364
|
+
if (fromOverallReward != null) {
|
|
21365
|
+
setValueByPath(toObject, ['overallReward'], fromOverallReward);
|
|
21366
|
+
}
|
|
21367
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
21368
|
+
if (fromError != null) {
|
|
21369
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
21370
|
+
}
|
|
21371
|
+
const fromRewardInfoDetails = getValueByPath(fromObject, [
|
|
21372
|
+
'rewardInfoDetails',
|
|
21373
|
+
]);
|
|
21374
|
+
if (fromRewardInfoDetails != null) {
|
|
21375
|
+
setValueByPath(toObject, ['rewardInfoDetails'], fromRewardInfoDetails);
|
|
21376
|
+
}
|
|
21377
|
+
return toObject;
|
|
21378
|
+
}
|
|
20999
21379
|
|
|
21000
21380
|
/**
|
|
21001
21381
|
* @license
|
|
@@ -21342,6 +21722,46 @@ class Tunings extends BaseModule {
|
|
|
21342
21722
|
});
|
|
21343
21723
|
}
|
|
21344
21724
|
}
|
|
21725
|
+
async validateReward(params) {
|
|
21726
|
+
var _a, _b;
|
|
21727
|
+
let response;
|
|
21728
|
+
let path = '';
|
|
21729
|
+
let queryParams = {};
|
|
21730
|
+
if (this.apiClient.isVertexAI()) {
|
|
21731
|
+
const body = validateRewardParametersToVertex(params);
|
|
21732
|
+
path = formatMap('{parent}/tuningJobs:validateReinforcementTuningReward', body['_url']);
|
|
21733
|
+
queryParams = body['_query'];
|
|
21734
|
+
delete body['_url'];
|
|
21735
|
+
delete body['_query'];
|
|
21736
|
+
response = this.apiClient
|
|
21737
|
+
.request({
|
|
21738
|
+
path: path,
|
|
21739
|
+
queryParams: queryParams,
|
|
21740
|
+
body: JSON.stringify(body),
|
|
21741
|
+
httpMethod: 'POST',
|
|
21742
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
21743
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
21744
|
+
})
|
|
21745
|
+
.then((httpResponse) => {
|
|
21746
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
21747
|
+
const response = jsonResponse;
|
|
21748
|
+
response.sdkHttpResponse = {
|
|
21749
|
+
headers: httpResponse.headers,
|
|
21750
|
+
};
|
|
21751
|
+
return response;
|
|
21752
|
+
});
|
|
21753
|
+
});
|
|
21754
|
+
return response.then((apiResponse) => {
|
|
21755
|
+
const resp = validateRewardResponseFromVertex(apiResponse);
|
|
21756
|
+
const typedResp = new ValidateRewardResponse();
|
|
21757
|
+
Object.assign(typedResp, resp);
|
|
21758
|
+
return typedResp;
|
|
21759
|
+
});
|
|
21760
|
+
}
|
|
21761
|
+
else {
|
|
21762
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
21763
|
+
}
|
|
21764
|
+
}
|
|
21345
21765
|
}
|
|
21346
21766
|
|
|
21347
21767
|
/**
|
|
@@ -21543,6 +21963,8 @@ exports.Pager = Pager;
|
|
|
21543
21963
|
exports.RawReferenceImage = RawReferenceImage;
|
|
21544
21964
|
exports.RecontextImageResponse = RecontextImageResponse;
|
|
21545
21965
|
exports.RegisterFilesResponse = RegisterFilesResponse;
|
|
21966
|
+
exports.ReinforcementTuningAutoraterScorerParsedResponseConversionScorer = ReinforcementTuningAutoraterScorerParsedResponseConversionScorer;
|
|
21967
|
+
exports.ReinforcementTuningParseResponseConfig = ReinforcementTuningParseResponseConfig;
|
|
21546
21968
|
exports.ReplayResponse = ReplayResponse;
|
|
21547
21969
|
exports.SegmentImageResponse = SegmentImageResponse;
|
|
21548
21970
|
exports.Session = Session;
|
|
@@ -21555,6 +21977,7 @@ exports.UploadToFileSearchStoreOperation = UploadToFileSearchStoreOperation;
|
|
|
21555
21977
|
exports.UploadToFileSearchStoreResponse = UploadToFileSearchStoreResponse;
|
|
21556
21978
|
exports.UploadToFileSearchStoreResumableResponse = UploadToFileSearchStoreResumableResponse;
|
|
21557
21979
|
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
21980
|
+
exports.ValidateRewardResponse = ValidateRewardResponse;
|
|
21558
21981
|
exports.createFunctionResponsePartFromBase64 = createFunctionResponsePartFromBase64;
|
|
21559
21982
|
exports.createFunctionResponsePartFromUri = createFunctionResponsePartFromUri;
|
|
21560
21983
|
exports.createModelContent = createModelContent;
|