@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.mjs
CHANGED
|
@@ -588,7 +588,7 @@ var Language;
|
|
|
588
588
|
*/
|
|
589
589
|
Language["PYTHON"] = "PYTHON";
|
|
590
590
|
})(Language || (Language = {}));
|
|
591
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
591
|
+
/** Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */
|
|
592
592
|
var FunctionResponseScheduling;
|
|
593
593
|
(function (FunctionResponseScheduling) {
|
|
594
594
|
/**
|
|
@@ -794,30 +794,6 @@ var DynamicRetrievalConfigMode;
|
|
|
794
794
|
*/
|
|
795
795
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
796
796
|
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
797
|
-
/** Function calling mode. */
|
|
798
|
-
var FunctionCallingConfigMode;
|
|
799
|
-
(function (FunctionCallingConfigMode) {
|
|
800
|
-
/**
|
|
801
|
-
* Unspecified function calling mode. This value should not be used.
|
|
802
|
-
*/
|
|
803
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
804
|
-
/**
|
|
805
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
806
|
-
*/
|
|
807
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
808
|
-
/**
|
|
809
|
-
* 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".
|
|
810
|
-
*/
|
|
811
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
812
|
-
/**
|
|
813
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
814
|
-
*/
|
|
815
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
816
|
-
/**
|
|
817
|
-
* 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".
|
|
818
|
-
*/
|
|
819
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
820
|
-
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
821
797
|
/** The number of thoughts tokens that the model should generate. */
|
|
822
798
|
var ThinkingLevel;
|
|
823
799
|
(function (ThinkingLevel) {
|
|
@@ -966,6 +942,30 @@ var HarmBlockThreshold;
|
|
|
966
942
|
*/
|
|
967
943
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
968
944
|
})(HarmBlockThreshold || (HarmBlockThreshold = {}));
|
|
945
|
+
/** Function calling mode. */
|
|
946
|
+
var FunctionCallingConfigMode;
|
|
947
|
+
(function (FunctionCallingConfigMode) {
|
|
948
|
+
/**
|
|
949
|
+
* Unspecified function calling mode. This value should not be used.
|
|
950
|
+
*/
|
|
951
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
952
|
+
/**
|
|
953
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
954
|
+
*/
|
|
955
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
956
|
+
/**
|
|
957
|
+
* 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".
|
|
958
|
+
*/
|
|
959
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
960
|
+
/**
|
|
961
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
962
|
+
*/
|
|
963
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
964
|
+
/**
|
|
965
|
+
* 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".
|
|
966
|
+
*/
|
|
967
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
968
|
+
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
969
969
|
/** Output only. The reason why the model stopped generating tokens.
|
|
970
970
|
|
|
971
971
|
If empty, the model has not stopped generating the tokens. */
|
|
@@ -1784,6 +1784,58 @@ var ImageResizeMode;
|
|
|
1784
1784
|
*/
|
|
1785
1785
|
ImageResizeMode["PAD"] = "PAD";
|
|
1786
1786
|
})(ImageResizeMode || (ImageResizeMode = {}));
|
|
1787
|
+
/** Defines how to parse sample response. */
|
|
1788
|
+
var ResponseParseType;
|
|
1789
|
+
(function (ResponseParseType) {
|
|
1790
|
+
/**
|
|
1791
|
+
* Default value. This value is unused.
|
|
1792
|
+
*/
|
|
1793
|
+
ResponseParseType["RESPONSE_PARSE_TYPE_UNSPECIFIED"] = "RESPONSE_PARSE_TYPE_UNSPECIFIED";
|
|
1794
|
+
/**
|
|
1795
|
+
* Use the sample response as is.
|
|
1796
|
+
*/
|
|
1797
|
+
ResponseParseType["IDENTITY"] = "IDENTITY";
|
|
1798
|
+
/**
|
|
1799
|
+
* Use regex to extract the important part of sample response.
|
|
1800
|
+
*/
|
|
1801
|
+
ResponseParseType["REGEX_EXTRACT"] = "REGEX_EXTRACT";
|
|
1802
|
+
})(ResponseParseType || (ResponseParseType = {}));
|
|
1803
|
+
/** Match operation to use for evaluation. */
|
|
1804
|
+
var MatchOperation;
|
|
1805
|
+
(function (MatchOperation) {
|
|
1806
|
+
/**
|
|
1807
|
+
* Default value. This value is unused.
|
|
1808
|
+
*/
|
|
1809
|
+
MatchOperation["MATCH_OPERATION_UNSPECIFIED"] = "MATCH_OPERATION_UNSPECIFIED";
|
|
1810
|
+
/**
|
|
1811
|
+
* Equivalent to GoogleSQL `REGEX_CONTAINS(target, expression)`.
|
|
1812
|
+
*/
|
|
1813
|
+
MatchOperation["REGEX_CONTAINS"] = "REGEX_CONTAINS";
|
|
1814
|
+
/**
|
|
1815
|
+
* `expression` is a substring of target.
|
|
1816
|
+
*/
|
|
1817
|
+
MatchOperation["PARTIAL_MATCH"] = "PARTIAL_MATCH";
|
|
1818
|
+
/**
|
|
1819
|
+
* `expression` is an exact match of target.
|
|
1820
|
+
*/
|
|
1821
|
+
MatchOperation["EXACT_MATCH"] = "EXACT_MATCH";
|
|
1822
|
+
})(MatchOperation || (MatchOperation = {}));
|
|
1823
|
+
/** Represents how much to think for the tuning job. */
|
|
1824
|
+
var ReinforcementTuningThinkingLevel;
|
|
1825
|
+
(function (ReinforcementTuningThinkingLevel) {
|
|
1826
|
+
/**
|
|
1827
|
+
* Unspecified thinking level.
|
|
1828
|
+
*/
|
|
1829
|
+
ReinforcementTuningThinkingLevel["REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED"] = "REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED";
|
|
1830
|
+
/**
|
|
1831
|
+
* Little to no thinking.
|
|
1832
|
+
*/
|
|
1833
|
+
ReinforcementTuningThinkingLevel["MINIMAL"] = "MINIMAL";
|
|
1834
|
+
/**
|
|
1835
|
+
* High thinking level.
|
|
1836
|
+
*/
|
|
1837
|
+
ReinforcementTuningThinkingLevel["HIGH"] = "HIGH";
|
|
1838
|
+
})(ReinforcementTuningThinkingLevel || (ReinforcementTuningThinkingLevel = {}));
|
|
1787
1839
|
/** Enum representing the tuning method. */
|
|
1788
1840
|
var TuningMethod;
|
|
1789
1841
|
(function (TuningMethod) {
|
|
@@ -1799,6 +1851,10 @@ var TuningMethod;
|
|
|
1799
1851
|
* Distillation tuning.
|
|
1800
1852
|
*/
|
|
1801
1853
|
TuningMethod["DISTILLATION"] = "DISTILLATION";
|
|
1854
|
+
/**
|
|
1855
|
+
* Reinforcement tuning.
|
|
1856
|
+
*/
|
|
1857
|
+
TuningMethod["REINFORCEMENT_TUNING"] = "REINFORCEMENT_TUNING";
|
|
1802
1858
|
})(TuningMethod || (TuningMethod = {}));
|
|
1803
1859
|
/** State for the lifecycle of a File. */
|
|
1804
1860
|
var FileState;
|
|
@@ -2173,24 +2229,13 @@ the API in a subsequent turn within a `Content` message, along with the
|
|
|
2173
2229
|
corresponding `ToolCall`. */
|
|
2174
2230
|
class ToolResponse {
|
|
2175
2231
|
}
|
|
2176
|
-
/** Raw media bytes for function response.
|
|
2177
|
-
|
|
2178
|
-
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
2179
|
-
field. */
|
|
2232
|
+
/** Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. */
|
|
2180
2233
|
class FunctionResponseBlob {
|
|
2181
2234
|
}
|
|
2182
|
-
/** URI based data for function response. */
|
|
2235
|
+
/** URI based data for function response. This data type is not supported in Gemini API. */
|
|
2183
2236
|
class FunctionResponseFileData {
|
|
2184
2237
|
}
|
|
2185
|
-
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
2186
|
-
|
|
2187
|
-
A `FunctionResponsePart` consists of data which has an associated datatype. A
|
|
2188
|
-
`FunctionResponsePart` can only contain one of the accepted types in
|
|
2189
|
-
`FunctionResponsePart.data`.
|
|
2190
|
-
|
|
2191
|
-
A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
|
|
2192
|
-
type and subtype of the media if the `inline_data` field is filled with raw
|
|
2193
|
-
bytes. */
|
|
2238
|
+
/** 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. */
|
|
2194
2239
|
class FunctionResponsePart {
|
|
2195
2240
|
}
|
|
2196
2241
|
/**
|
|
@@ -2215,7 +2260,7 @@ function createFunctionResponsePartFromUri(uri, mimeType) {
|
|
|
2215
2260
|
},
|
|
2216
2261
|
};
|
|
2217
2262
|
}
|
|
2218
|
-
/**
|
|
2263
|
+
/** 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. */
|
|
2219
2264
|
class FunctionResponse {
|
|
2220
2265
|
}
|
|
2221
2266
|
/**
|
|
@@ -2643,6 +2688,12 @@ class GenerateVideosOperation {
|
|
|
2643
2688
|
return operation;
|
|
2644
2689
|
}
|
|
2645
2690
|
}
|
|
2691
|
+
/** Defines how to parse sample response for reinforcement tuning. */
|
|
2692
|
+
class ReinforcementTuningParseResponseConfig {
|
|
2693
|
+
}
|
|
2694
|
+
/** Scores responses by directly converting parsed autorater response to float reward (reward is clipped to be within [-1, 1]). */
|
|
2695
|
+
class ReinforcementTuningAutoraterScorerParsedResponseConversionScorer {
|
|
2696
|
+
}
|
|
2646
2697
|
/** The results from an evaluation run performed by the EvaluationService. This data type is not supported in Gemini API. */
|
|
2647
2698
|
class EvaluateDatasetResponse {
|
|
2648
2699
|
}
|
|
@@ -2652,6 +2703,12 @@ class ListTuningJobsResponse {
|
|
|
2652
2703
|
/** Empty response for tunings.cancel method. */
|
|
2653
2704
|
class CancelTuningJobResponse {
|
|
2654
2705
|
}
|
|
2706
|
+
/** Response for the validate_reward method.
|
|
2707
|
+
|
|
2708
|
+
Contains the computed reward for a reinforcement tuning reward
|
|
2709
|
+
configuration. */
|
|
2710
|
+
class ValidateRewardResponse {
|
|
2711
|
+
}
|
|
2655
2712
|
/** Empty response for caches.delete method. */
|
|
2656
2713
|
class DeleteCachedContentResponse {
|
|
2657
2714
|
}
|
|
@@ -5120,6 +5177,7 @@ var PagedItem;
|
|
|
5120
5177
|
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
5121
5178
|
PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
|
|
5122
5179
|
PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
|
|
5180
|
+
PagedItem["PAGED_ITEM_SKILLS"] = "skills";
|
|
5123
5181
|
})(PagedItem || (PagedItem = {}));
|
|
5124
5182
|
/**
|
|
5125
5183
|
* Pager class for iterating through paginated results.
|
|
@@ -5840,7 +5898,7 @@ function blobToMldev$3(fromObject) {
|
|
|
5840
5898
|
}
|
|
5841
5899
|
return toObject;
|
|
5842
5900
|
}
|
|
5843
|
-
function codeExecutionResultToVertex$
|
|
5901
|
+
function codeExecutionResultToVertex$3(fromObject) {
|
|
5844
5902
|
const toObject = {};
|
|
5845
5903
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
5846
5904
|
if (fromOutcome != null) {
|
|
@@ -5855,24 +5913,6 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
5855
5913
|
}
|
|
5856
5914
|
return toObject;
|
|
5857
5915
|
}
|
|
5858
|
-
function computerUseToVertex$2(fromObject) {
|
|
5859
|
-
const toObject = {};
|
|
5860
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5861
|
-
if (fromEnvironment != null) {
|
|
5862
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5863
|
-
}
|
|
5864
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
5865
|
-
'excludedPredefinedFunctions',
|
|
5866
|
-
]);
|
|
5867
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
5868
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
5869
|
-
}
|
|
5870
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
5871
|
-
undefined) {
|
|
5872
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
5873
|
-
}
|
|
5874
|
-
return toObject;
|
|
5875
|
-
}
|
|
5876
5916
|
function contentToMldev$3(fromObject) {
|
|
5877
5917
|
const toObject = {};
|
|
5878
5918
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -5891,14 +5931,14 @@ function contentToMldev$3(fromObject) {
|
|
|
5891
5931
|
}
|
|
5892
5932
|
return toObject;
|
|
5893
5933
|
}
|
|
5894
|
-
function contentToVertex$
|
|
5934
|
+
function contentToVertex$3(fromObject) {
|
|
5895
5935
|
const toObject = {};
|
|
5896
5936
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5897
5937
|
if (fromParts != null) {
|
|
5898
5938
|
let transformedList = fromParts;
|
|
5899
5939
|
if (Array.isArray(transformedList)) {
|
|
5900
5940
|
transformedList = transformedList.map((item) => {
|
|
5901
|
-
return partToVertex$
|
|
5941
|
+
return partToVertex$3(item);
|
|
5902
5942
|
});
|
|
5903
5943
|
}
|
|
5904
5944
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5977,7 +6017,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5977
6017
|
let transformedList = tContents(fromContents);
|
|
5978
6018
|
if (Array.isArray(transformedList)) {
|
|
5979
6019
|
transformedList = transformedList.map((item) => {
|
|
5980
|
-
return contentToVertex$
|
|
6020
|
+
return contentToVertex$3(item);
|
|
5981
6021
|
});
|
|
5982
6022
|
}
|
|
5983
6023
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -5986,7 +6026,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5986
6026
|
'systemInstruction',
|
|
5987
6027
|
]);
|
|
5988
6028
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
5989
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$
|
|
6029
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$3(tContent(fromSystemInstruction)));
|
|
5990
6030
|
}
|
|
5991
6031
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5992
6032
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -6068,7 +6108,7 @@ function deleteCachedContentResponseFromVertex(fromObject) {
|
|
|
6068
6108
|
}
|
|
6069
6109
|
return toObject;
|
|
6070
6110
|
}
|
|
6071
|
-
function executableCodeToVertex$
|
|
6111
|
+
function executableCodeToVertex$3(fromObject) {
|
|
6072
6112
|
const toObject = {};
|
|
6073
6113
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
6074
6114
|
if (fromCode != null) {
|
|
@@ -6282,6 +6322,16 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
6282
6322
|
}
|
|
6283
6323
|
return toObject;
|
|
6284
6324
|
}
|
|
6325
|
+
function mcpServerToVertex$2(fromObject) {
|
|
6326
|
+
const toObject = {};
|
|
6327
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
6328
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6329
|
+
}
|
|
6330
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
6331
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6332
|
+
}
|
|
6333
|
+
return toObject;
|
|
6334
|
+
}
|
|
6285
6335
|
function partToMldev$3(fromObject) {
|
|
6286
6336
|
const toObject = {};
|
|
6287
6337
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -6354,7 +6404,7 @@ function partToMldev$3(fromObject) {
|
|
|
6354
6404
|
}
|
|
6355
6405
|
return toObject;
|
|
6356
6406
|
}
|
|
6357
|
-
function partToVertex$
|
|
6407
|
+
function partToVertex$3(fromObject) {
|
|
6358
6408
|
const toObject = {};
|
|
6359
6409
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
6360
6410
|
'mediaResolution',
|
|
@@ -6366,13 +6416,13 @@ function partToVertex$2(fromObject) {
|
|
|
6366
6416
|
'codeExecutionResult',
|
|
6367
6417
|
]);
|
|
6368
6418
|
if (fromCodeExecutionResult != null) {
|
|
6369
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
6419
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$3(fromCodeExecutionResult));
|
|
6370
6420
|
}
|
|
6371
6421
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
6372
6422
|
'executableCode',
|
|
6373
6423
|
]);
|
|
6374
6424
|
if (fromExecutableCode != null) {
|
|
6375
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
6425
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$3(fromExecutableCode));
|
|
6376
6426
|
}
|
|
6377
6427
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
6378
6428
|
if (fromFileData != null) {
|
|
@@ -6538,7 +6588,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6538
6588
|
}
|
|
6539
6589
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6540
6590
|
if (fromComputerUse != null) {
|
|
6541
|
-
setValueByPath(toObject, ['computerUse'],
|
|
6591
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6542
6592
|
}
|
|
6543
6593
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6544
6594
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -6591,8 +6641,15 @@ function toolToVertex$2(fromObject) {
|
|
|
6591
6641
|
if (fromUrlContext != null) {
|
|
6592
6642
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
6593
6643
|
}
|
|
6594
|
-
|
|
6595
|
-
|
|
6644
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
6645
|
+
if (fromMcpServers != null) {
|
|
6646
|
+
let transformedList = fromMcpServers;
|
|
6647
|
+
if (Array.isArray(transformedList)) {
|
|
6648
|
+
transformedList = transformedList.map((item) => {
|
|
6649
|
+
return mcpServerToVertex$2(item);
|
|
6650
|
+
});
|
|
6651
|
+
}
|
|
6652
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
6596
6653
|
}
|
|
6597
6654
|
return toObject;
|
|
6598
6655
|
}
|
|
@@ -7682,7 +7739,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7682
7739
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7683
7740
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7684
7741
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7685
|
-
const SDK_VERSION = '2.
|
|
7742
|
+
const SDK_VERSION = '2.8.0'; // x-release-please-version
|
|
7686
7743
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7687
7744
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7688
7745
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11719,7 +11776,7 @@ function blobToMldev$2(fromObject) {
|
|
|
11719
11776
|
}
|
|
11720
11777
|
return toObject;
|
|
11721
11778
|
}
|
|
11722
|
-
function codeExecutionResultToVertex$
|
|
11779
|
+
function codeExecutionResultToVertex$2(fromObject) {
|
|
11723
11780
|
const toObject = {};
|
|
11724
11781
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
11725
11782
|
if (fromOutcome != null) {
|
|
@@ -11734,24 +11791,6 @@ function codeExecutionResultToVertex$1(fromObject) {
|
|
|
11734
11791
|
}
|
|
11735
11792
|
return toObject;
|
|
11736
11793
|
}
|
|
11737
|
-
function computerUseToVertex$1(fromObject) {
|
|
11738
|
-
const toObject = {};
|
|
11739
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
11740
|
-
if (fromEnvironment != null) {
|
|
11741
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
11742
|
-
}
|
|
11743
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
11744
|
-
'excludedPredefinedFunctions',
|
|
11745
|
-
]);
|
|
11746
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
11747
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
11748
|
-
}
|
|
11749
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
11750
|
-
undefined) {
|
|
11751
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11752
|
-
}
|
|
11753
|
-
return toObject;
|
|
11754
|
-
}
|
|
11755
11794
|
function contentToMldev$2(fromObject) {
|
|
11756
11795
|
const toObject = {};
|
|
11757
11796
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -11770,14 +11809,14 @@ function contentToMldev$2(fromObject) {
|
|
|
11770
11809
|
}
|
|
11771
11810
|
return toObject;
|
|
11772
11811
|
}
|
|
11773
|
-
function contentToVertex$
|
|
11812
|
+
function contentToVertex$2(fromObject) {
|
|
11774
11813
|
const toObject = {};
|
|
11775
11814
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
11776
11815
|
if (fromParts != null) {
|
|
11777
11816
|
let transformedList = fromParts;
|
|
11778
11817
|
if (Array.isArray(transformedList)) {
|
|
11779
11818
|
transformedList = transformedList.map((item) => {
|
|
11780
|
-
return partToVertex$
|
|
11819
|
+
return partToVertex$2(item);
|
|
11781
11820
|
});
|
|
11782
11821
|
}
|
|
11783
11822
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -11788,7 +11827,7 @@ function contentToVertex$1(fromObject) {
|
|
|
11788
11827
|
}
|
|
11789
11828
|
return toObject;
|
|
11790
11829
|
}
|
|
11791
|
-
function executableCodeToVertex$
|
|
11830
|
+
function executableCodeToVertex$2(fromObject) {
|
|
11792
11831
|
const toObject = {};
|
|
11793
11832
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
11794
11833
|
if (fromCode != null) {
|
|
@@ -12127,11 +12166,11 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
12127
12166
|
}
|
|
12128
12167
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
12129
12168
|
}
|
|
12130
|
-
const
|
|
12131
|
-
'
|
|
12169
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
12170
|
+
'translationConfig',
|
|
12132
12171
|
]);
|
|
12133
|
-
if (parentObject !== undefined &&
|
|
12134
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
12172
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
12173
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
12135
12174
|
}
|
|
12136
12175
|
return toObject;
|
|
12137
12176
|
}
|
|
@@ -12197,7 +12236,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
12197
12236
|
'systemInstruction',
|
|
12198
12237
|
]);
|
|
12199
12238
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
12200
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$
|
|
12239
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$2(tContent(fromSystemInstruction)));
|
|
12201
12240
|
}
|
|
12202
12241
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
12203
12242
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -12265,8 +12304,8 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
12265
12304
|
}
|
|
12266
12305
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
12267
12306
|
}
|
|
12268
|
-
if (getValueByPath(fromObject, ['
|
|
12269
|
-
throw new Error('
|
|
12307
|
+
if (getValueByPath(fromObject, ['translationConfig']) !== undefined) {
|
|
12308
|
+
throw new Error('translationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
12270
12309
|
}
|
|
12271
12310
|
return toObject;
|
|
12272
12311
|
}
|
|
@@ -12458,6 +12497,16 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
12458
12497
|
}
|
|
12459
12498
|
return toObject;
|
|
12460
12499
|
}
|
|
12500
|
+
function mcpServerToVertex$1(fromObject) {
|
|
12501
|
+
const toObject = {};
|
|
12502
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
12503
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
12504
|
+
}
|
|
12505
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
12506
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
12507
|
+
}
|
|
12508
|
+
return toObject;
|
|
12509
|
+
}
|
|
12461
12510
|
function partToMldev$2(fromObject) {
|
|
12462
12511
|
const toObject = {};
|
|
12463
12512
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -12530,7 +12579,7 @@ function partToMldev$2(fromObject) {
|
|
|
12530
12579
|
}
|
|
12531
12580
|
return toObject;
|
|
12532
12581
|
}
|
|
12533
|
-
function partToVertex$
|
|
12582
|
+
function partToVertex$2(fromObject) {
|
|
12534
12583
|
const toObject = {};
|
|
12535
12584
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
12536
12585
|
'mediaResolution',
|
|
@@ -12542,13 +12591,13 @@ function partToVertex$1(fromObject) {
|
|
|
12542
12591
|
'codeExecutionResult',
|
|
12543
12592
|
]);
|
|
12544
12593
|
if (fromCodeExecutionResult != null) {
|
|
12545
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
12594
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$2(fromCodeExecutionResult));
|
|
12546
12595
|
}
|
|
12547
12596
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
12548
12597
|
'executableCode',
|
|
12549
12598
|
]);
|
|
12550
12599
|
if (fromExecutableCode != null) {
|
|
12551
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
12600
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$2(fromExecutableCode));
|
|
12552
12601
|
}
|
|
12553
12602
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
12554
12603
|
if (fromFileData != null) {
|
|
@@ -12700,7 +12749,7 @@ function toolToVertex$1(fromObject) {
|
|
|
12700
12749
|
}
|
|
12701
12750
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
12702
12751
|
if (fromComputerUse != null) {
|
|
12703
|
-
setValueByPath(toObject, ['computerUse'],
|
|
12752
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12704
12753
|
}
|
|
12705
12754
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12706
12755
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -12753,8 +12802,15 @@ function toolToVertex$1(fromObject) {
|
|
|
12753
12802
|
if (fromUrlContext != null) {
|
|
12754
12803
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
12755
12804
|
}
|
|
12756
|
-
|
|
12757
|
-
|
|
12805
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
12806
|
+
if (fromMcpServers != null) {
|
|
12807
|
+
let transformedList = fromMcpServers;
|
|
12808
|
+
if (Array.isArray(transformedList)) {
|
|
12809
|
+
transformedList = transformedList.map((item) => {
|
|
12810
|
+
return mcpServerToVertex$1(item);
|
|
12811
|
+
});
|
|
12812
|
+
}
|
|
12813
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
12758
12814
|
}
|
|
12759
12815
|
return toObject;
|
|
12760
12816
|
}
|
|
@@ -12980,7 +13036,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
12980
13036
|
}
|
|
12981
13037
|
return toObject;
|
|
12982
13038
|
}
|
|
12983
|
-
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
13039
|
+
function codeExecutionResultToVertex$1(fromObject, _rootObject) {
|
|
12984
13040
|
const toObject = {};
|
|
12985
13041
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
12986
13042
|
if (fromOutcome != null) {
|
|
@@ -13006,7 +13062,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
13006
13062
|
let transformedList = tContents(fromContents);
|
|
13007
13063
|
if (Array.isArray(transformedList)) {
|
|
13008
13064
|
transformedList = transformedList.map((item) => {
|
|
13009
|
-
return contentToVertex(item);
|
|
13065
|
+
return contentToVertex$1(item);
|
|
13010
13066
|
});
|
|
13011
13067
|
}
|
|
13012
13068
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -13033,24 +13089,6 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
13033
13089
|
}
|
|
13034
13090
|
return toObject;
|
|
13035
13091
|
}
|
|
13036
|
-
function computerUseToVertex(fromObject, _rootObject) {
|
|
13037
|
-
const toObject = {};
|
|
13038
|
-
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
13039
|
-
if (fromEnvironment != null) {
|
|
13040
|
-
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
13041
|
-
}
|
|
13042
|
-
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
13043
|
-
'excludedPredefinedFunctions',
|
|
13044
|
-
]);
|
|
13045
|
-
if (fromExcludedPredefinedFunctions != null) {
|
|
13046
|
-
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
13047
|
-
}
|
|
13048
|
-
if (getValueByPath(fromObject, ['enablePromptInjectionDetection']) !==
|
|
13049
|
-
undefined) {
|
|
13050
|
-
throw new Error('enablePromptInjectionDetection parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
13051
|
-
}
|
|
13052
|
-
return toObject;
|
|
13053
|
-
}
|
|
13054
13092
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
13055
13093
|
const toObject = {};
|
|
13056
13094
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -13093,14 +13131,14 @@ function contentToMldev$1(fromObject, rootObject) {
|
|
|
13093
13131
|
}
|
|
13094
13132
|
return toObject;
|
|
13095
13133
|
}
|
|
13096
|
-
function contentToVertex(fromObject, rootObject) {
|
|
13134
|
+
function contentToVertex$1(fromObject, rootObject) {
|
|
13097
13135
|
const toObject = {};
|
|
13098
13136
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13099
13137
|
if (fromParts != null) {
|
|
13100
13138
|
let transformedList = fromParts;
|
|
13101
13139
|
if (Array.isArray(transformedList)) {
|
|
13102
13140
|
transformedList = transformedList.map((item) => {
|
|
13103
|
-
return partToVertex(item);
|
|
13141
|
+
return partToVertex$1(item);
|
|
13104
13142
|
});
|
|
13105
13143
|
}
|
|
13106
13144
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -13144,7 +13182,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
13144
13182
|
'systemInstruction',
|
|
13145
13183
|
]);
|
|
13146
13184
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
13147
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
13185
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
13148
13186
|
}
|
|
13149
13187
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
13150
13188
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -13197,7 +13235,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
13197
13235
|
let transformedList = tContents(fromContents);
|
|
13198
13236
|
if (Array.isArray(transformedList)) {
|
|
13199
13237
|
transformedList = transformedList.map((item) => {
|
|
13200
|
-
return contentToVertex(item);
|
|
13238
|
+
return contentToVertex$1(item);
|
|
13201
13239
|
});
|
|
13202
13240
|
}
|
|
13203
13241
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -13633,7 +13671,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
|
|
|
13633
13671
|
if (discriminatorContent === 'EMBED_CONTENT') {
|
|
13634
13672
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
13635
13673
|
if (fromContent != null) {
|
|
13636
|
-
setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
|
|
13674
|
+
setValueByPath(toObject, ['content'], contentToVertex$1(tContent(fromContent)));
|
|
13637
13675
|
}
|
|
13638
13676
|
}
|
|
13639
13677
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -13725,7 +13763,7 @@ function endpointFromVertex(fromObject, _rootObject) {
|
|
|
13725
13763
|
}
|
|
13726
13764
|
return toObject;
|
|
13727
13765
|
}
|
|
13728
|
-
function executableCodeToVertex(fromObject, _rootObject) {
|
|
13766
|
+
function executableCodeToVertex$1(fromObject, _rootObject) {
|
|
13729
13767
|
const toObject = {};
|
|
13730
13768
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
13731
13769
|
if (fromCode != null) {
|
|
@@ -13968,7 +14006,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
13968
14006
|
'systemInstruction',
|
|
13969
14007
|
]);
|
|
13970
14008
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
13971
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
14009
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
13972
14010
|
}
|
|
13973
14011
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
13974
14012
|
if (fromTemperature != null) {
|
|
@@ -14173,7 +14211,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
14173
14211
|
let transformedList = tContents(fromContents);
|
|
14174
14212
|
if (Array.isArray(transformedList)) {
|
|
14175
14213
|
transformedList = transformedList.map((item) => {
|
|
14176
|
-
return contentToVertex(item);
|
|
14214
|
+
return contentToVertex$1(item);
|
|
14177
14215
|
});
|
|
14178
14216
|
}
|
|
14179
14217
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -15428,6 +15466,16 @@ function maskReferenceConfigToVertex(fromObject, _rootObject) {
|
|
|
15428
15466
|
}
|
|
15429
15467
|
return toObject;
|
|
15430
15468
|
}
|
|
15469
|
+
function mcpServerToVertex(fromObject, _rootObject) {
|
|
15470
|
+
const toObject = {};
|
|
15471
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
15472
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
15473
|
+
}
|
|
15474
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
15475
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
15476
|
+
}
|
|
15477
|
+
return toObject;
|
|
15478
|
+
}
|
|
15431
15479
|
function modelFromMldev(fromObject, rootObject) {
|
|
15432
15480
|
const toObject = {};
|
|
15433
15481
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -15618,7 +15666,7 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
15618
15666
|
}
|
|
15619
15667
|
return toObject;
|
|
15620
15668
|
}
|
|
15621
|
-
function partToVertex(fromObject, rootObject) {
|
|
15669
|
+
function partToVertex$1(fromObject, rootObject) {
|
|
15622
15670
|
const toObject = {};
|
|
15623
15671
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
15624
15672
|
'mediaResolution',
|
|
@@ -15630,13 +15678,13 @@ function partToVertex(fromObject, rootObject) {
|
|
|
15630
15678
|
'codeExecutionResult',
|
|
15631
15679
|
]);
|
|
15632
15680
|
if (fromCodeExecutionResult != null) {
|
|
15633
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
15681
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$1(fromCodeExecutionResult));
|
|
15634
15682
|
}
|
|
15635
15683
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
15636
15684
|
'executableCode',
|
|
15637
15685
|
]);
|
|
15638
15686
|
if (fromExecutableCode != null) {
|
|
15639
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
15687
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$1(fromExecutableCode));
|
|
15640
15688
|
}
|
|
15641
15689
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
15642
15690
|
if (fromFileData != null) {
|
|
@@ -16119,7 +16167,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
16119
16167
|
}
|
|
16120
16168
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
16121
16169
|
if (fromComputerUse != null) {
|
|
16122
|
-
setValueByPath(toObject, ['computerUse'],
|
|
16170
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
16123
16171
|
}
|
|
16124
16172
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
16125
16173
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -16172,8 +16220,15 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
16172
16220
|
if (fromUrlContext != null) {
|
|
16173
16221
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
16174
16222
|
}
|
|
16175
|
-
|
|
16176
|
-
|
|
16223
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
16224
|
+
if (fromMcpServers != null) {
|
|
16225
|
+
let transformedList = fromMcpServers;
|
|
16226
|
+
if (Array.isArray(transformedList)) {
|
|
16227
|
+
transformedList = transformedList.map((item) => {
|
|
16228
|
+
return mcpServerToVertex(item);
|
|
16229
|
+
});
|
|
16230
|
+
}
|
|
16231
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
16177
16232
|
}
|
|
16178
16233
|
return toObject;
|
|
16179
16234
|
}
|
|
@@ -19444,11 +19499,11 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
19444
19499
|
}
|
|
19445
19500
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
19446
19501
|
}
|
|
19447
|
-
const
|
|
19448
|
-
'
|
|
19502
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
19503
|
+
'translationConfig',
|
|
19449
19504
|
]);
|
|
19450
|
-
if (parentObject !== undefined &&
|
|
19451
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
19505
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
19506
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
19452
19507
|
}
|
|
19453
19508
|
return toObject;
|
|
19454
19509
|
}
|
|
@@ -19942,6 +19997,39 @@ function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
|
|
|
19942
19997
|
}
|
|
19943
19998
|
return toObject;
|
|
19944
19999
|
}
|
|
20000
|
+
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
20001
|
+
const toObject = {};
|
|
20002
|
+
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
20003
|
+
if (fromOutcome != null) {
|
|
20004
|
+
setValueByPath(toObject, ['outcome'], fromOutcome);
|
|
20005
|
+
}
|
|
20006
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
20007
|
+
if (fromOutput != null) {
|
|
20008
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
20009
|
+
}
|
|
20010
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20011
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20012
|
+
}
|
|
20013
|
+
return toObject;
|
|
20014
|
+
}
|
|
20015
|
+
function contentToVertex(fromObject, rootObject) {
|
|
20016
|
+
const toObject = {};
|
|
20017
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
20018
|
+
if (fromParts != null) {
|
|
20019
|
+
let transformedList = fromParts;
|
|
20020
|
+
if (Array.isArray(transformedList)) {
|
|
20021
|
+
transformedList = transformedList.map((item) => {
|
|
20022
|
+
return partToVertex(item);
|
|
20023
|
+
});
|
|
20024
|
+
}
|
|
20025
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
20026
|
+
}
|
|
20027
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
20028
|
+
if (fromRole != null) {
|
|
20029
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
20030
|
+
}
|
|
20031
|
+
return toObject;
|
|
20032
|
+
}
|
|
19945
20033
|
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
19946
20034
|
const toObject = {};
|
|
19947
20035
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
@@ -20012,6 +20100,30 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
20012
20100
|
if (getValueByPath(fromObject, ['encryptionSpec']) !== undefined) {
|
|
20013
20101
|
throw new Error('encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20014
20102
|
}
|
|
20103
|
+
if (getValueByPath(fromObject, ['rewardConfig']) !== undefined) {
|
|
20104
|
+
throw new Error('rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20105
|
+
}
|
|
20106
|
+
if (getValueByPath(fromObject, ['compositeRewardConfig']) !== undefined) {
|
|
20107
|
+
throw new Error('compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20108
|
+
}
|
|
20109
|
+
if (getValueByPath(fromObject, ['samplesPerPrompt']) !== undefined) {
|
|
20110
|
+
throw new Error('samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20111
|
+
}
|
|
20112
|
+
if (getValueByPath(fromObject, ['evaluateInterval']) !== undefined) {
|
|
20113
|
+
throw new Error('evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20114
|
+
}
|
|
20115
|
+
if (getValueByPath(fromObject, ['checkpointInterval']) !== undefined) {
|
|
20116
|
+
throw new Error('checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20117
|
+
}
|
|
20118
|
+
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
20119
|
+
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20120
|
+
}
|
|
20121
|
+
if (getValueByPath(fromObject, ['thinkingLevel']) !== undefined) {
|
|
20122
|
+
throw new Error('thinkingLevel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20123
|
+
}
|
|
20124
|
+
if (getValueByPath(fromObject, ['validationDatasetUri']) !== undefined) {
|
|
20125
|
+
throw new Error('validationDatasetUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20126
|
+
}
|
|
20015
20127
|
return toObject;
|
|
20016
20128
|
}
|
|
20017
20129
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -20047,6 +20159,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20047
20159
|
setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20048
20160
|
}
|
|
20049
20161
|
}
|
|
20162
|
+
else if (discriminatorValidationDataset === 'REINFORCEMENT_TUNING') {
|
|
20163
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
20164
|
+
'validationDataset',
|
|
20165
|
+
]);
|
|
20166
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
20167
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
20168
|
+
}
|
|
20169
|
+
}
|
|
20050
20170
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
20051
20171
|
'tunedModelDisplayName',
|
|
20052
20172
|
]);
|
|
@@ -20082,6 +20202,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20082
20202
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20083
20203
|
}
|
|
20084
20204
|
}
|
|
20205
|
+
else if (discriminatorEpochCount === 'REINFORCEMENT_TUNING') {
|
|
20206
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
20207
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
20208
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
20209
|
+
}
|
|
20210
|
+
}
|
|
20085
20211
|
let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
|
|
20086
20212
|
'config',
|
|
20087
20213
|
'method',
|
|
@@ -20117,6 +20243,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20117
20243
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
20118
20244
|
}
|
|
20119
20245
|
}
|
|
20246
|
+
else if (discriminatorLearningRateMultiplier === 'REINFORCEMENT_TUNING') {
|
|
20247
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
20248
|
+
'learningRateMultiplier',
|
|
20249
|
+
]);
|
|
20250
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
20251
|
+
setValueByPath(parentObject, [
|
|
20252
|
+
'reinforcementTuningSpec',
|
|
20253
|
+
'hyperParameters',
|
|
20254
|
+
'learningRateMultiplier',
|
|
20255
|
+
], fromLearningRateMultiplier);
|
|
20256
|
+
}
|
|
20257
|
+
}
|
|
20120
20258
|
let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
|
|
20121
20259
|
if (discriminatorExportLastCheckpointOnly === undefined) {
|
|
20122
20260
|
discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
|
|
@@ -20170,6 +20308,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20170
20308
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20171
20309
|
}
|
|
20172
20310
|
}
|
|
20311
|
+
else if (discriminatorAdapterSize === 'REINFORCEMENT_TUNING') {
|
|
20312
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
20313
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
20314
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
20315
|
+
}
|
|
20316
|
+
}
|
|
20173
20317
|
let discriminatorTuningMode = getValueByPath(rootObject, [
|
|
20174
20318
|
'config',
|
|
20175
20319
|
'method',
|
|
@@ -20214,6 +20358,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20214
20358
|
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20215
20359
|
}
|
|
20216
20360
|
}
|
|
20361
|
+
else if (discriminatorBatchSize === 'REINFORCEMENT_TUNING') {
|
|
20362
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
20363
|
+
if (parentObject !== undefined && fromBatchSize != null) {
|
|
20364
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
20365
|
+
}
|
|
20366
|
+
}
|
|
20217
20367
|
let discriminatorLearningRate = getValueByPath(rootObject, [
|
|
20218
20368
|
'config',
|
|
20219
20369
|
'method',
|
|
@@ -20273,6 +20423,52 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20273
20423
|
if (parentObject !== undefined && fromEncryptionSpec != null) {
|
|
20274
20424
|
setValueByPath(parentObject, ['encryptionSpec'], fromEncryptionSpec);
|
|
20275
20425
|
}
|
|
20426
|
+
const fromRewardConfig = getValueByPath(fromObject, ['rewardConfig']);
|
|
20427
|
+
if (parentObject !== undefined && fromRewardConfig != null) {
|
|
20428
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'singleRewardConfig'], fromRewardConfig);
|
|
20429
|
+
}
|
|
20430
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
20431
|
+
'compositeRewardConfig',
|
|
20432
|
+
]);
|
|
20433
|
+
if (parentObject !== undefined && fromCompositeRewardConfig != null) {
|
|
20434
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'compositeRewardConfig'], fromCompositeRewardConfig);
|
|
20435
|
+
}
|
|
20436
|
+
const fromSamplesPerPrompt = getValueByPath(fromObject, [
|
|
20437
|
+
'samplesPerPrompt',
|
|
20438
|
+
]);
|
|
20439
|
+
if (parentObject !== undefined && fromSamplesPerPrompt != null) {
|
|
20440
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'samplesPerPrompt'], fromSamplesPerPrompt);
|
|
20441
|
+
}
|
|
20442
|
+
const fromEvaluateInterval = getValueByPath(fromObject, [
|
|
20443
|
+
'evaluateInterval',
|
|
20444
|
+
]);
|
|
20445
|
+
if (parentObject !== undefined && fromEvaluateInterval != null) {
|
|
20446
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'evaluateInterval'], fromEvaluateInterval);
|
|
20447
|
+
}
|
|
20448
|
+
const fromCheckpointInterval = getValueByPath(fromObject, [
|
|
20449
|
+
'checkpointInterval',
|
|
20450
|
+
]);
|
|
20451
|
+
if (parentObject !== undefined && fromCheckpointInterval != null) {
|
|
20452
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'checkpointInterval'], fromCheckpointInterval);
|
|
20453
|
+
}
|
|
20454
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
20455
|
+
'maxOutputTokens',
|
|
20456
|
+
]);
|
|
20457
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20458
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20459
|
+
}
|
|
20460
|
+
const fromThinkingLevel = getValueByPath(fromObject, [
|
|
20461
|
+
'thinkingLevel',
|
|
20462
|
+
]);
|
|
20463
|
+
if (parentObject !== undefined && fromThinkingLevel != null) {
|
|
20464
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'thinkingLevel'], fromThinkingLevel);
|
|
20465
|
+
}
|
|
20466
|
+
const fromValidationDatasetUri = getValueByPath(fromObject, [
|
|
20467
|
+
'validationDatasetUri',
|
|
20468
|
+
]);
|
|
20469
|
+
if (parentObject !== undefined && fromValidationDatasetUri != null) {
|
|
20470
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'validationDatasetUri'], fromValidationDatasetUri);
|
|
20471
|
+
}
|
|
20276
20472
|
return toObject;
|
|
20277
20473
|
}
|
|
20278
20474
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20443,6 +20639,21 @@ function distillationSpecFromVertex(fromObject, rootObject) {
|
|
|
20443
20639
|
}
|
|
20444
20640
|
return toObject;
|
|
20445
20641
|
}
|
|
20642
|
+
function executableCodeToVertex(fromObject, _rootObject) {
|
|
20643
|
+
const toObject = {};
|
|
20644
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
20645
|
+
if (fromCode != null) {
|
|
20646
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
20647
|
+
}
|
|
20648
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
20649
|
+
if (fromLanguage != null) {
|
|
20650
|
+
setValueByPath(toObject, ['language'], fromLanguage);
|
|
20651
|
+
}
|
|
20652
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20653
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20654
|
+
}
|
|
20655
|
+
return toObject;
|
|
20656
|
+
}
|
|
20446
20657
|
function generationConfigFromVertex(fromObject, _rootObject) {
|
|
20447
20658
|
const toObject = {};
|
|
20448
20659
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
@@ -20633,6 +20844,99 @@ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
|
20633
20844
|
}
|
|
20634
20845
|
return toObject;
|
|
20635
20846
|
}
|
|
20847
|
+
function partToVertex(fromObject, rootObject) {
|
|
20848
|
+
const toObject = {};
|
|
20849
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
20850
|
+
'mediaResolution',
|
|
20851
|
+
]);
|
|
20852
|
+
if (fromMediaResolution != null) {
|
|
20853
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
20854
|
+
}
|
|
20855
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
20856
|
+
'codeExecutionResult',
|
|
20857
|
+
]);
|
|
20858
|
+
if (fromCodeExecutionResult != null) {
|
|
20859
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
20860
|
+
}
|
|
20861
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
20862
|
+
'executableCode',
|
|
20863
|
+
]);
|
|
20864
|
+
if (fromExecutableCode != null) {
|
|
20865
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
20866
|
+
}
|
|
20867
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
20868
|
+
if (fromFileData != null) {
|
|
20869
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
20870
|
+
}
|
|
20871
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
20872
|
+
if (fromFunctionCall != null) {
|
|
20873
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
20874
|
+
}
|
|
20875
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
20876
|
+
'functionResponse',
|
|
20877
|
+
]);
|
|
20878
|
+
if (fromFunctionResponse != null) {
|
|
20879
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
20880
|
+
}
|
|
20881
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
20882
|
+
if (fromInlineData != null) {
|
|
20883
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
20884
|
+
}
|
|
20885
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
20886
|
+
if (fromText != null) {
|
|
20887
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
20888
|
+
}
|
|
20889
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
20890
|
+
if (fromThought != null) {
|
|
20891
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
20892
|
+
}
|
|
20893
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
20894
|
+
'thoughtSignature',
|
|
20895
|
+
]);
|
|
20896
|
+
if (fromThoughtSignature != null) {
|
|
20897
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
20898
|
+
}
|
|
20899
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
20900
|
+
'videoMetadata',
|
|
20901
|
+
]);
|
|
20902
|
+
if (fromVideoMetadata != null) {
|
|
20903
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
20904
|
+
}
|
|
20905
|
+
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
20906
|
+
throw new Error('toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20907
|
+
}
|
|
20908
|
+
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
20909
|
+
throw new Error('toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20910
|
+
}
|
|
20911
|
+
if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
|
|
20912
|
+
throw new Error('partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20913
|
+
}
|
|
20914
|
+
return toObject;
|
|
20915
|
+
}
|
|
20916
|
+
function reinforcementTuningExampleToVertex(fromObject, rootObject) {
|
|
20917
|
+
const toObject = {};
|
|
20918
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
20919
|
+
if (fromContents != null) {
|
|
20920
|
+
let transformedList = fromContents;
|
|
20921
|
+
if (Array.isArray(transformedList)) {
|
|
20922
|
+
transformedList = transformedList.map((item) => {
|
|
20923
|
+
return contentToVertex(item);
|
|
20924
|
+
});
|
|
20925
|
+
}
|
|
20926
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
20927
|
+
}
|
|
20928
|
+
const fromReferences = getValueByPath(fromObject, ['references']);
|
|
20929
|
+
if (fromReferences != null) {
|
|
20930
|
+
setValueByPath(toObject, ['references'], fromReferences);
|
|
20931
|
+
}
|
|
20932
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
20933
|
+
'systemInstruction',
|
|
20934
|
+
]);
|
|
20935
|
+
if (fromSystemInstruction != null) {
|
|
20936
|
+
setValueByPath(toObject, ['systemInstruction'], contentToVertex(fromSystemInstruction));
|
|
20937
|
+
}
|
|
20938
|
+
return toObject;
|
|
20939
|
+
}
|
|
20636
20940
|
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
20637
20941
|
const toObject = {};
|
|
20638
20942
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
@@ -20692,6 +20996,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20692
20996
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
|
|
20693
20997
|
}
|
|
20694
20998
|
}
|
|
20999
|
+
else if (discriminatorGcsUri === 'REINFORCEMENT_TUNING') {
|
|
21000
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
21001
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
21002
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
21003
|
+
}
|
|
21004
|
+
}
|
|
20695
21005
|
let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
|
|
20696
21006
|
'config',
|
|
20697
21007
|
'method',
|
|
@@ -20723,6 +21033,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20723
21033
|
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
|
|
20724
21034
|
}
|
|
20725
21035
|
}
|
|
21036
|
+
else if (discriminatorVertexDatasetResource === 'REINFORCEMENT_TUNING') {
|
|
21037
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
21038
|
+
'vertexDatasetResource',
|
|
21039
|
+
]);
|
|
21040
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
21041
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
21042
|
+
}
|
|
21043
|
+
}
|
|
20726
21044
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
20727
21045
|
throw new Error('examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20728
21046
|
}
|
|
@@ -20852,6 +21170,12 @@ function tuningJobFromVertex(fromObject, rootObject) {
|
|
|
20852
21170
|
if (fromDistillationSpec != null) {
|
|
20853
21171
|
setValueByPath(toObject, ['distillationSpec'], distillationSpecFromVertex(fromDistillationSpec));
|
|
20854
21172
|
}
|
|
21173
|
+
const fromReinforcementTuningSpec = getValueByPath(fromObject, [
|
|
21174
|
+
'reinforcementTuningSpec',
|
|
21175
|
+
]);
|
|
21176
|
+
if (fromReinforcementTuningSpec != null) {
|
|
21177
|
+
setValueByPath(toObject, ['reinforcementTuningSpec'], fromReinforcementTuningSpec);
|
|
21178
|
+
}
|
|
20855
21179
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
20856
21180
|
'tuningDataStats',
|
|
20857
21181
|
]);
|
|
@@ -20994,6 +21318,62 @@ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
|
20994
21318
|
}
|
|
20995
21319
|
return toObject;
|
|
20996
21320
|
}
|
|
21321
|
+
function validateRewardParametersToVertex(fromObject, rootObject) {
|
|
21322
|
+
const toObject = {};
|
|
21323
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
21324
|
+
if (fromParent != null) {
|
|
21325
|
+
setValueByPath(toObject, ['_url', 'parent'], fromParent);
|
|
21326
|
+
}
|
|
21327
|
+
const fromSampleResponse = getValueByPath(fromObject, [
|
|
21328
|
+
'sampleResponse',
|
|
21329
|
+
]);
|
|
21330
|
+
if (fromSampleResponse != null) {
|
|
21331
|
+
setValueByPath(toObject, ['sampleResponse'], contentToVertex(fromSampleResponse));
|
|
21332
|
+
}
|
|
21333
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
21334
|
+
if (fromExample != null) {
|
|
21335
|
+
setValueByPath(toObject, ['example'], reinforcementTuningExampleToVertex(fromExample));
|
|
21336
|
+
}
|
|
21337
|
+
const fromSingleRewardConfig = getValueByPath(fromObject, [
|
|
21338
|
+
'singleRewardConfig',
|
|
21339
|
+
]);
|
|
21340
|
+
if (fromSingleRewardConfig != null) {
|
|
21341
|
+
setValueByPath(toObject, ['singleRewardConfig'], fromSingleRewardConfig);
|
|
21342
|
+
}
|
|
21343
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
21344
|
+
'compositeRewardConfig',
|
|
21345
|
+
]);
|
|
21346
|
+
if (fromCompositeRewardConfig != null) {
|
|
21347
|
+
setValueByPath(toObject, ['compositeRewardConfig'], fromCompositeRewardConfig);
|
|
21348
|
+
}
|
|
21349
|
+
return toObject;
|
|
21350
|
+
}
|
|
21351
|
+
function validateRewardResponseFromVertex(fromObject, _rootObject) {
|
|
21352
|
+
const toObject = {};
|
|
21353
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
21354
|
+
'sdkHttpResponse',
|
|
21355
|
+
]);
|
|
21356
|
+
if (fromSdkHttpResponse != null) {
|
|
21357
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
21358
|
+
}
|
|
21359
|
+
const fromOverallReward = getValueByPath(fromObject, [
|
|
21360
|
+
'overallReward',
|
|
21361
|
+
]);
|
|
21362
|
+
if (fromOverallReward != null) {
|
|
21363
|
+
setValueByPath(toObject, ['overallReward'], fromOverallReward);
|
|
21364
|
+
}
|
|
21365
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
21366
|
+
if (fromError != null) {
|
|
21367
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
21368
|
+
}
|
|
21369
|
+
const fromRewardInfoDetails = getValueByPath(fromObject, [
|
|
21370
|
+
'rewardInfoDetails',
|
|
21371
|
+
]);
|
|
21372
|
+
if (fromRewardInfoDetails != null) {
|
|
21373
|
+
setValueByPath(toObject, ['rewardInfoDetails'], fromRewardInfoDetails);
|
|
21374
|
+
}
|
|
21375
|
+
return toObject;
|
|
21376
|
+
}
|
|
20997
21377
|
|
|
20998
21378
|
/**
|
|
20999
21379
|
* @license
|
|
@@ -21340,6 +21720,46 @@ class Tunings extends BaseModule {
|
|
|
21340
21720
|
});
|
|
21341
21721
|
}
|
|
21342
21722
|
}
|
|
21723
|
+
async validateReward(params) {
|
|
21724
|
+
var _a, _b;
|
|
21725
|
+
let response;
|
|
21726
|
+
let path = '';
|
|
21727
|
+
let queryParams = {};
|
|
21728
|
+
if (this.apiClient.isVertexAI()) {
|
|
21729
|
+
const body = validateRewardParametersToVertex(params);
|
|
21730
|
+
path = formatMap('{parent}/tuningJobs:validateReinforcementTuningReward', body['_url']);
|
|
21731
|
+
queryParams = body['_query'];
|
|
21732
|
+
delete body['_url'];
|
|
21733
|
+
delete body['_query'];
|
|
21734
|
+
response = this.apiClient
|
|
21735
|
+
.request({
|
|
21736
|
+
path: path,
|
|
21737
|
+
queryParams: queryParams,
|
|
21738
|
+
body: JSON.stringify(body),
|
|
21739
|
+
httpMethod: 'POST',
|
|
21740
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
21741
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
21742
|
+
})
|
|
21743
|
+
.then((httpResponse) => {
|
|
21744
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
21745
|
+
const response = jsonResponse;
|
|
21746
|
+
response.sdkHttpResponse = {
|
|
21747
|
+
headers: httpResponse.headers,
|
|
21748
|
+
};
|
|
21749
|
+
return response;
|
|
21750
|
+
});
|
|
21751
|
+
});
|
|
21752
|
+
return response.then((apiResponse) => {
|
|
21753
|
+
const resp = validateRewardResponseFromVertex(apiResponse);
|
|
21754
|
+
const typedResp = new ValidateRewardResponse();
|
|
21755
|
+
Object.assign(typedResp, resp);
|
|
21756
|
+
return typedResp;
|
|
21757
|
+
});
|
|
21758
|
+
}
|
|
21759
|
+
else {
|
|
21760
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
21761
|
+
}
|
|
21762
|
+
}
|
|
21343
21763
|
}
|
|
21344
21764
|
|
|
21345
21765
|
/**
|
|
@@ -21488,5 +21908,5 @@ class GoogleGenAI {
|
|
|
21488
21908
|
}
|
|
21489
21909
|
}
|
|
21490
21910
|
|
|
21491
|
-
export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImageResizeMode, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, ModelStage, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReplayResponse, ResourceScope, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, ServiceTier, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, ToolResponse, ToolType, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningSpeed, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VideoOrientation, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
21911
|
+
export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImageResizeMode, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MatchOperation, MediaModality, MediaResolution, Modality, ModelStage, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReinforcementTuningAutoraterScorerParsedResponseConversionScorer, ReinforcementTuningParseResponseConfig, ReinforcementTuningThinkingLevel, ReplayResponse, ResourceScope, ResponseParseType, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, ServiceTier, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, ToolResponse, ToolType, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningSpeed, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, ValidateRewardResponse, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VideoOrientation, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
21492
21912
|
//# sourceMappingURL=index.mjs.map
|