@google/genai 2.7.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 +292 -47
- package/dist/index.cjs +432 -64
- package/dist/index.mjs +430 -65
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +432 -64
- package/dist/node/index.mjs +430 -65
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +292 -47
- package/dist/tokenizer/node.cjs +53 -1
- package/dist/tokenizer/node.d.ts +14 -28
- package/dist/tokenizer/node.mjs +53 -1
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +54 -2
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +291 -47
- package/dist/vertex_internal/index.js +54 -2
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +430 -65
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +292 -47
- 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
|
/**
|
|
@@ -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) {
|
|
@@ -2179,24 +2231,13 @@ the API in a subsequent turn within a `Content` message, along with the
|
|
|
2179
2231
|
corresponding `ToolCall`. */
|
|
2180
2232
|
class ToolResponse {
|
|
2181
2233
|
}
|
|
2182
|
-
/** Raw media bytes for function response.
|
|
2183
|
-
|
|
2184
|
-
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
2185
|
-
field. */
|
|
2234
|
+
/** Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. */
|
|
2186
2235
|
class FunctionResponseBlob {
|
|
2187
2236
|
}
|
|
2188
|
-
/** URI based data for function response. */
|
|
2237
|
+
/** URI based data for function response. This data type is not supported in Gemini API. */
|
|
2189
2238
|
class FunctionResponseFileData {
|
|
2190
2239
|
}
|
|
2191
|
-
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
2192
|
-
|
|
2193
|
-
A `FunctionResponsePart` consists of data which has an associated datatype. A
|
|
2194
|
-
`FunctionResponsePart` can only contain one of the accepted types in
|
|
2195
|
-
`FunctionResponsePart.data`.
|
|
2196
|
-
|
|
2197
|
-
A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
|
|
2198
|
-
type and subtype of the media if the `inline_data` field is filled with raw
|
|
2199
|
-
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. */
|
|
2200
2241
|
class FunctionResponsePart {
|
|
2201
2242
|
}
|
|
2202
2243
|
/**
|
|
@@ -2221,7 +2262,7 @@ function createFunctionResponsePartFromUri(uri, mimeType) {
|
|
|
2221
2262
|
},
|
|
2222
2263
|
};
|
|
2223
2264
|
}
|
|
2224
|
-
/**
|
|
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. */
|
|
2225
2266
|
class FunctionResponse {
|
|
2226
2267
|
}
|
|
2227
2268
|
/**
|
|
@@ -2649,6 +2690,12 @@ class GenerateVideosOperation {
|
|
|
2649
2690
|
return operation;
|
|
2650
2691
|
}
|
|
2651
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
|
+
}
|
|
2652
2699
|
/** The results from an evaluation run performed by the EvaluationService. This data type is not supported in Gemini API. */
|
|
2653
2700
|
class EvaluateDatasetResponse {
|
|
2654
2701
|
}
|
|
@@ -2658,6 +2705,12 @@ class ListTuningJobsResponse {
|
|
|
2658
2705
|
/** Empty response for tunings.cancel method. */
|
|
2659
2706
|
class CancelTuningJobResponse {
|
|
2660
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
|
+
}
|
|
2661
2714
|
/** Empty response for caches.delete method. */
|
|
2662
2715
|
class DeleteCachedContentResponse {
|
|
2663
2716
|
}
|
|
@@ -5847,7 +5900,7 @@ function blobToMldev$3(fromObject) {
|
|
|
5847
5900
|
}
|
|
5848
5901
|
return toObject;
|
|
5849
5902
|
}
|
|
5850
|
-
function codeExecutionResultToVertex$
|
|
5903
|
+
function codeExecutionResultToVertex$3(fromObject) {
|
|
5851
5904
|
const toObject = {};
|
|
5852
5905
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
5853
5906
|
if (fromOutcome != null) {
|
|
@@ -5880,14 +5933,14 @@ function contentToMldev$3(fromObject) {
|
|
|
5880
5933
|
}
|
|
5881
5934
|
return toObject;
|
|
5882
5935
|
}
|
|
5883
|
-
function contentToVertex$
|
|
5936
|
+
function contentToVertex$3(fromObject) {
|
|
5884
5937
|
const toObject = {};
|
|
5885
5938
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5886
5939
|
if (fromParts != null) {
|
|
5887
5940
|
let transformedList = fromParts;
|
|
5888
5941
|
if (Array.isArray(transformedList)) {
|
|
5889
5942
|
transformedList = transformedList.map((item) => {
|
|
5890
|
-
return partToVertex$
|
|
5943
|
+
return partToVertex$3(item);
|
|
5891
5944
|
});
|
|
5892
5945
|
}
|
|
5893
5946
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5966,7 +6019,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5966
6019
|
let transformedList = tContents(fromContents);
|
|
5967
6020
|
if (Array.isArray(transformedList)) {
|
|
5968
6021
|
transformedList = transformedList.map((item) => {
|
|
5969
|
-
return contentToVertex$
|
|
6022
|
+
return contentToVertex$3(item);
|
|
5970
6023
|
});
|
|
5971
6024
|
}
|
|
5972
6025
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -5975,7 +6028,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5975
6028
|
'systemInstruction',
|
|
5976
6029
|
]);
|
|
5977
6030
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
5978
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$
|
|
6031
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$3(tContent(fromSystemInstruction)));
|
|
5979
6032
|
}
|
|
5980
6033
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5981
6034
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -6057,7 +6110,7 @@ function deleteCachedContentResponseFromVertex(fromObject) {
|
|
|
6057
6110
|
}
|
|
6058
6111
|
return toObject;
|
|
6059
6112
|
}
|
|
6060
|
-
function executableCodeToVertex$
|
|
6113
|
+
function executableCodeToVertex$3(fromObject) {
|
|
6061
6114
|
const toObject = {};
|
|
6062
6115
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
6063
6116
|
if (fromCode != null) {
|
|
@@ -6271,6 +6324,16 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
6271
6324
|
}
|
|
6272
6325
|
return toObject;
|
|
6273
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
|
+
}
|
|
6274
6337
|
function partToMldev$3(fromObject) {
|
|
6275
6338
|
const toObject = {};
|
|
6276
6339
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -6343,7 +6406,7 @@ function partToMldev$3(fromObject) {
|
|
|
6343
6406
|
}
|
|
6344
6407
|
return toObject;
|
|
6345
6408
|
}
|
|
6346
|
-
function partToVertex$
|
|
6409
|
+
function partToVertex$3(fromObject) {
|
|
6347
6410
|
const toObject = {};
|
|
6348
6411
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
6349
6412
|
'mediaResolution',
|
|
@@ -6355,13 +6418,13 @@ function partToVertex$2(fromObject) {
|
|
|
6355
6418
|
'codeExecutionResult',
|
|
6356
6419
|
]);
|
|
6357
6420
|
if (fromCodeExecutionResult != null) {
|
|
6358
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
6421
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$3(fromCodeExecutionResult));
|
|
6359
6422
|
}
|
|
6360
6423
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
6361
6424
|
'executableCode',
|
|
6362
6425
|
]);
|
|
6363
6426
|
if (fromExecutableCode != null) {
|
|
6364
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
6427
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$3(fromExecutableCode));
|
|
6365
6428
|
}
|
|
6366
6429
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
6367
6430
|
if (fromFileData != null) {
|
|
@@ -6580,8 +6643,15 @@ function toolToVertex$2(fromObject) {
|
|
|
6580
6643
|
if (fromUrlContext != null) {
|
|
6581
6644
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
6582
6645
|
}
|
|
6583
|
-
|
|
6584
|
-
|
|
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);
|
|
6585
6655
|
}
|
|
6586
6656
|
return toObject;
|
|
6587
6657
|
}
|
|
@@ -7671,7 +7741,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7671
7741
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7672
7742
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7673
7743
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7674
|
-
const SDK_VERSION = '2.
|
|
7744
|
+
const SDK_VERSION = '2.8.0'; // x-release-please-version
|
|
7675
7745
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7676
7746
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7677
7747
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11708,7 +11778,7 @@ function blobToMldev$2(fromObject) {
|
|
|
11708
11778
|
}
|
|
11709
11779
|
return toObject;
|
|
11710
11780
|
}
|
|
11711
|
-
function codeExecutionResultToVertex$
|
|
11781
|
+
function codeExecutionResultToVertex$2(fromObject) {
|
|
11712
11782
|
const toObject = {};
|
|
11713
11783
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
11714
11784
|
if (fromOutcome != null) {
|
|
@@ -11741,14 +11811,14 @@ function contentToMldev$2(fromObject) {
|
|
|
11741
11811
|
}
|
|
11742
11812
|
return toObject;
|
|
11743
11813
|
}
|
|
11744
|
-
function contentToVertex$
|
|
11814
|
+
function contentToVertex$2(fromObject) {
|
|
11745
11815
|
const toObject = {};
|
|
11746
11816
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
11747
11817
|
if (fromParts != null) {
|
|
11748
11818
|
let transformedList = fromParts;
|
|
11749
11819
|
if (Array.isArray(transformedList)) {
|
|
11750
11820
|
transformedList = transformedList.map((item) => {
|
|
11751
|
-
return partToVertex$
|
|
11821
|
+
return partToVertex$2(item);
|
|
11752
11822
|
});
|
|
11753
11823
|
}
|
|
11754
11824
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -11759,7 +11829,7 @@ function contentToVertex$1(fromObject) {
|
|
|
11759
11829
|
}
|
|
11760
11830
|
return toObject;
|
|
11761
11831
|
}
|
|
11762
|
-
function executableCodeToVertex$
|
|
11832
|
+
function executableCodeToVertex$2(fromObject) {
|
|
11763
11833
|
const toObject = {};
|
|
11764
11834
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
11765
11835
|
if (fromCode != null) {
|
|
@@ -12098,11 +12168,11 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
12098
12168
|
}
|
|
12099
12169
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
12100
12170
|
}
|
|
12101
|
-
const
|
|
12102
|
-
'
|
|
12171
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
12172
|
+
'translationConfig',
|
|
12103
12173
|
]);
|
|
12104
|
-
if (parentObject !== undefined &&
|
|
12105
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
12174
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
12175
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
12106
12176
|
}
|
|
12107
12177
|
return toObject;
|
|
12108
12178
|
}
|
|
@@ -12168,7 +12238,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
12168
12238
|
'systemInstruction',
|
|
12169
12239
|
]);
|
|
12170
12240
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
12171
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$
|
|
12241
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$2(tContent(fromSystemInstruction)));
|
|
12172
12242
|
}
|
|
12173
12243
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
12174
12244
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -12236,8 +12306,8 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
12236
12306
|
}
|
|
12237
12307
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
12238
12308
|
}
|
|
12239
|
-
if (getValueByPath(fromObject, ['
|
|
12240
|
-
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.');
|
|
12241
12311
|
}
|
|
12242
12312
|
return toObject;
|
|
12243
12313
|
}
|
|
@@ -12429,6 +12499,16 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
12429
12499
|
}
|
|
12430
12500
|
return toObject;
|
|
12431
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
|
+
}
|
|
12432
12512
|
function partToMldev$2(fromObject) {
|
|
12433
12513
|
const toObject = {};
|
|
12434
12514
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -12501,7 +12581,7 @@ function partToMldev$2(fromObject) {
|
|
|
12501
12581
|
}
|
|
12502
12582
|
return toObject;
|
|
12503
12583
|
}
|
|
12504
|
-
function partToVertex$
|
|
12584
|
+
function partToVertex$2(fromObject) {
|
|
12505
12585
|
const toObject = {};
|
|
12506
12586
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
12507
12587
|
'mediaResolution',
|
|
@@ -12513,13 +12593,13 @@ function partToVertex$1(fromObject) {
|
|
|
12513
12593
|
'codeExecutionResult',
|
|
12514
12594
|
]);
|
|
12515
12595
|
if (fromCodeExecutionResult != null) {
|
|
12516
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
12596
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$2(fromCodeExecutionResult));
|
|
12517
12597
|
}
|
|
12518
12598
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
12519
12599
|
'executableCode',
|
|
12520
12600
|
]);
|
|
12521
12601
|
if (fromExecutableCode != null) {
|
|
12522
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
12602
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$2(fromExecutableCode));
|
|
12523
12603
|
}
|
|
12524
12604
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
12525
12605
|
if (fromFileData != null) {
|
|
@@ -12724,8 +12804,15 @@ function toolToVertex$1(fromObject) {
|
|
|
12724
12804
|
if (fromUrlContext != null) {
|
|
12725
12805
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
12726
12806
|
}
|
|
12727
|
-
|
|
12728
|
-
|
|
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);
|
|
12729
12816
|
}
|
|
12730
12817
|
return toObject;
|
|
12731
12818
|
}
|
|
@@ -12951,7 +13038,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
12951
13038
|
}
|
|
12952
13039
|
return toObject;
|
|
12953
13040
|
}
|
|
12954
|
-
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
13041
|
+
function codeExecutionResultToVertex$1(fromObject, _rootObject) {
|
|
12955
13042
|
const toObject = {};
|
|
12956
13043
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
12957
13044
|
if (fromOutcome != null) {
|
|
@@ -12977,7 +13064,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
12977
13064
|
let transformedList = tContents(fromContents);
|
|
12978
13065
|
if (Array.isArray(transformedList)) {
|
|
12979
13066
|
transformedList = transformedList.map((item) => {
|
|
12980
|
-
return contentToVertex(item);
|
|
13067
|
+
return contentToVertex$1(item);
|
|
12981
13068
|
});
|
|
12982
13069
|
}
|
|
12983
13070
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -13046,14 +13133,14 @@ function contentToMldev$1(fromObject, rootObject) {
|
|
|
13046
13133
|
}
|
|
13047
13134
|
return toObject;
|
|
13048
13135
|
}
|
|
13049
|
-
function contentToVertex(fromObject, rootObject) {
|
|
13136
|
+
function contentToVertex$1(fromObject, rootObject) {
|
|
13050
13137
|
const toObject = {};
|
|
13051
13138
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13052
13139
|
if (fromParts != null) {
|
|
13053
13140
|
let transformedList = fromParts;
|
|
13054
13141
|
if (Array.isArray(transformedList)) {
|
|
13055
13142
|
transformedList = transformedList.map((item) => {
|
|
13056
|
-
return partToVertex(item);
|
|
13143
|
+
return partToVertex$1(item);
|
|
13057
13144
|
});
|
|
13058
13145
|
}
|
|
13059
13146
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -13097,7 +13184,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
13097
13184
|
'systemInstruction',
|
|
13098
13185
|
]);
|
|
13099
13186
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
13100
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
13187
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
13101
13188
|
}
|
|
13102
13189
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
13103
13190
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -13150,7 +13237,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
13150
13237
|
let transformedList = tContents(fromContents);
|
|
13151
13238
|
if (Array.isArray(transformedList)) {
|
|
13152
13239
|
transformedList = transformedList.map((item) => {
|
|
13153
|
-
return contentToVertex(item);
|
|
13240
|
+
return contentToVertex$1(item);
|
|
13154
13241
|
});
|
|
13155
13242
|
}
|
|
13156
13243
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -13586,7 +13673,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
|
|
|
13586
13673
|
if (discriminatorContent === 'EMBED_CONTENT') {
|
|
13587
13674
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
13588
13675
|
if (fromContent != null) {
|
|
13589
|
-
setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
|
|
13676
|
+
setValueByPath(toObject, ['content'], contentToVertex$1(tContent(fromContent)));
|
|
13590
13677
|
}
|
|
13591
13678
|
}
|
|
13592
13679
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -13678,7 +13765,7 @@ function endpointFromVertex(fromObject, _rootObject) {
|
|
|
13678
13765
|
}
|
|
13679
13766
|
return toObject;
|
|
13680
13767
|
}
|
|
13681
|
-
function executableCodeToVertex(fromObject, _rootObject) {
|
|
13768
|
+
function executableCodeToVertex$1(fromObject, _rootObject) {
|
|
13682
13769
|
const toObject = {};
|
|
13683
13770
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
13684
13771
|
if (fromCode != null) {
|
|
@@ -13921,7 +14008,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
13921
14008
|
'systemInstruction',
|
|
13922
14009
|
]);
|
|
13923
14010
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
13924
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
14011
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
13925
14012
|
}
|
|
13926
14013
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
13927
14014
|
if (fromTemperature != null) {
|
|
@@ -14126,7 +14213,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
14126
14213
|
let transformedList = tContents(fromContents);
|
|
14127
14214
|
if (Array.isArray(transformedList)) {
|
|
14128
14215
|
transformedList = transformedList.map((item) => {
|
|
14129
|
-
return contentToVertex(item);
|
|
14216
|
+
return contentToVertex$1(item);
|
|
14130
14217
|
});
|
|
14131
14218
|
}
|
|
14132
14219
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -15381,6 +15468,16 @@ function maskReferenceConfigToVertex(fromObject, _rootObject) {
|
|
|
15381
15468
|
}
|
|
15382
15469
|
return toObject;
|
|
15383
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
|
+
}
|
|
15384
15481
|
function modelFromMldev(fromObject, rootObject) {
|
|
15385
15482
|
const toObject = {};
|
|
15386
15483
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -15571,7 +15668,7 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
15571
15668
|
}
|
|
15572
15669
|
return toObject;
|
|
15573
15670
|
}
|
|
15574
|
-
function partToVertex(fromObject, rootObject) {
|
|
15671
|
+
function partToVertex$1(fromObject, rootObject) {
|
|
15575
15672
|
const toObject = {};
|
|
15576
15673
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
15577
15674
|
'mediaResolution',
|
|
@@ -15583,13 +15680,13 @@ function partToVertex(fromObject, rootObject) {
|
|
|
15583
15680
|
'codeExecutionResult',
|
|
15584
15681
|
]);
|
|
15585
15682
|
if (fromCodeExecutionResult != null) {
|
|
15586
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
15683
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$1(fromCodeExecutionResult));
|
|
15587
15684
|
}
|
|
15588
15685
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
15589
15686
|
'executableCode',
|
|
15590
15687
|
]);
|
|
15591
15688
|
if (fromExecutableCode != null) {
|
|
15592
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
15689
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$1(fromExecutableCode));
|
|
15593
15690
|
}
|
|
15594
15691
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
15595
15692
|
if (fromFileData != null) {
|
|
@@ -16064,7 +16161,7 @@ function toolToMldev$1(fromObject, rootObject) {
|
|
|
16064
16161
|
}
|
|
16065
16162
|
return toObject;
|
|
16066
16163
|
}
|
|
16067
|
-
function toolToVertex(fromObject,
|
|
16164
|
+
function toolToVertex(fromObject, rootObject) {
|
|
16068
16165
|
const toObject = {};
|
|
16069
16166
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
16070
16167
|
if (fromRetrieval != null) {
|
|
@@ -16125,8 +16222,15 @@ function toolToVertex(fromObject, _rootObject) {
|
|
|
16125
16222
|
if (fromUrlContext != null) {
|
|
16126
16223
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
16127
16224
|
}
|
|
16128
|
-
|
|
16129
|
-
|
|
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);
|
|
16130
16234
|
}
|
|
16131
16235
|
return toObject;
|
|
16132
16236
|
}
|
|
@@ -19397,11 +19501,11 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
19397
19501
|
}
|
|
19398
19502
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
19399
19503
|
}
|
|
19400
|
-
const
|
|
19401
|
-
'
|
|
19504
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
19505
|
+
'translationConfig',
|
|
19402
19506
|
]);
|
|
19403
|
-
if (parentObject !== undefined &&
|
|
19404
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
19507
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
19508
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
19405
19509
|
}
|
|
19406
19510
|
return toObject;
|
|
19407
19511
|
}
|
|
@@ -19895,6 +19999,39 @@ function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
|
|
|
19895
19999
|
}
|
|
19896
20000
|
return toObject;
|
|
19897
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
|
+
}
|
|
19898
20035
|
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
19899
20036
|
const toObject = {};
|
|
19900
20037
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
@@ -19983,6 +20120,12 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
19983
20120
|
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
19984
20121
|
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19985
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
|
+
}
|
|
19986
20129
|
return toObject;
|
|
19987
20130
|
}
|
|
19988
20131
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -20316,6 +20459,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20316
20459
|
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20317
20460
|
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20318
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
|
+
}
|
|
20319
20474
|
return toObject;
|
|
20320
20475
|
}
|
|
20321
20476
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20486,6 +20641,21 @@ function distillationSpecFromVertex(fromObject, rootObject) {
|
|
|
20486
20641
|
}
|
|
20487
20642
|
return toObject;
|
|
20488
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
|
+
}
|
|
20489
20659
|
function generationConfigFromVertex(fromObject, _rootObject) {
|
|
20490
20660
|
const toObject = {};
|
|
20491
20661
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
@@ -20676,6 +20846,99 @@ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
|
20676
20846
|
}
|
|
20677
20847
|
return toObject;
|
|
20678
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
|
+
}
|
|
20679
20942
|
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
20680
20943
|
const toObject = {};
|
|
20681
20944
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
@@ -20909,6 +21172,12 @@ function tuningJobFromVertex(fromObject, rootObject) {
|
|
|
20909
21172
|
if (fromDistillationSpec != null) {
|
|
20910
21173
|
setValueByPath(toObject, ['distillationSpec'], distillationSpecFromVertex(fromDistillationSpec));
|
|
20911
21174
|
}
|
|
21175
|
+
const fromReinforcementTuningSpec = getValueByPath(fromObject, [
|
|
21176
|
+
'reinforcementTuningSpec',
|
|
21177
|
+
]);
|
|
21178
|
+
if (fromReinforcementTuningSpec != null) {
|
|
21179
|
+
setValueByPath(toObject, ['reinforcementTuningSpec'], fromReinforcementTuningSpec);
|
|
21180
|
+
}
|
|
20912
21181
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
20913
21182
|
'tuningDataStats',
|
|
20914
21183
|
]);
|
|
@@ -21051,6 +21320,62 @@ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
|
21051
21320
|
}
|
|
21052
21321
|
return toObject;
|
|
21053
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
|
+
}
|
|
21054
21379
|
|
|
21055
21380
|
/**
|
|
21056
21381
|
* @license
|
|
@@ -21397,6 +21722,46 @@ class Tunings extends BaseModule {
|
|
|
21397
21722
|
});
|
|
21398
21723
|
}
|
|
21399
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
|
+
}
|
|
21400
21765
|
}
|
|
21401
21766
|
|
|
21402
21767
|
/**
|
|
@@ -21598,6 +21963,8 @@ exports.Pager = Pager;
|
|
|
21598
21963
|
exports.RawReferenceImage = RawReferenceImage;
|
|
21599
21964
|
exports.RecontextImageResponse = RecontextImageResponse;
|
|
21600
21965
|
exports.RegisterFilesResponse = RegisterFilesResponse;
|
|
21966
|
+
exports.ReinforcementTuningAutoraterScorerParsedResponseConversionScorer = ReinforcementTuningAutoraterScorerParsedResponseConversionScorer;
|
|
21967
|
+
exports.ReinforcementTuningParseResponseConfig = ReinforcementTuningParseResponseConfig;
|
|
21601
21968
|
exports.ReplayResponse = ReplayResponse;
|
|
21602
21969
|
exports.SegmentImageResponse = SegmentImageResponse;
|
|
21603
21970
|
exports.Session = Session;
|
|
@@ -21610,6 +21977,7 @@ exports.UploadToFileSearchStoreOperation = UploadToFileSearchStoreOperation;
|
|
|
21610
21977
|
exports.UploadToFileSearchStoreResponse = UploadToFileSearchStoreResponse;
|
|
21611
21978
|
exports.UploadToFileSearchStoreResumableResponse = UploadToFileSearchStoreResumableResponse;
|
|
21612
21979
|
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
21980
|
+
exports.ValidateRewardResponse = ValidateRewardResponse;
|
|
21613
21981
|
exports.createFunctionResponsePartFromBase64 = createFunctionResponsePartFromBase64;
|
|
21614
21982
|
exports.createFunctionResponsePartFromUri = createFunctionResponsePartFromUri;
|
|
21615
21983
|
exports.createModelContent = createModelContent;
|