@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.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
|
/**
|
|
@@ -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) {
|
|
@@ -2177,24 +2229,13 @@ the API in a subsequent turn within a `Content` message, along with the
|
|
|
2177
2229
|
corresponding `ToolCall`. */
|
|
2178
2230
|
class ToolResponse {
|
|
2179
2231
|
}
|
|
2180
|
-
/** Raw media bytes for function response.
|
|
2181
|
-
|
|
2182
|
-
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
2183
|
-
field. */
|
|
2232
|
+
/** Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. */
|
|
2184
2233
|
class FunctionResponseBlob {
|
|
2185
2234
|
}
|
|
2186
|
-
/** URI based data for function response. */
|
|
2235
|
+
/** URI based data for function response. This data type is not supported in Gemini API. */
|
|
2187
2236
|
class FunctionResponseFileData {
|
|
2188
2237
|
}
|
|
2189
|
-
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
2190
|
-
|
|
2191
|
-
A `FunctionResponsePart` consists of data which has an associated datatype. A
|
|
2192
|
-
`FunctionResponsePart` can only contain one of the accepted types in
|
|
2193
|
-
`FunctionResponsePart.data`.
|
|
2194
|
-
|
|
2195
|
-
A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
|
|
2196
|
-
type and subtype of the media if the `inline_data` field is filled with raw
|
|
2197
|
-
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. */
|
|
2198
2239
|
class FunctionResponsePart {
|
|
2199
2240
|
}
|
|
2200
2241
|
/**
|
|
@@ -2219,7 +2260,7 @@ function createFunctionResponsePartFromUri(uri, mimeType) {
|
|
|
2219
2260
|
},
|
|
2220
2261
|
};
|
|
2221
2262
|
}
|
|
2222
|
-
/**
|
|
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. */
|
|
2223
2264
|
class FunctionResponse {
|
|
2224
2265
|
}
|
|
2225
2266
|
/**
|
|
@@ -2647,6 +2688,12 @@ class GenerateVideosOperation {
|
|
|
2647
2688
|
return operation;
|
|
2648
2689
|
}
|
|
2649
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
|
+
}
|
|
2650
2697
|
/** The results from an evaluation run performed by the EvaluationService. This data type is not supported in Gemini API. */
|
|
2651
2698
|
class EvaluateDatasetResponse {
|
|
2652
2699
|
}
|
|
@@ -2656,6 +2703,12 @@ class ListTuningJobsResponse {
|
|
|
2656
2703
|
/** Empty response for tunings.cancel method. */
|
|
2657
2704
|
class CancelTuningJobResponse {
|
|
2658
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
|
+
}
|
|
2659
2712
|
/** Empty response for caches.delete method. */
|
|
2660
2713
|
class DeleteCachedContentResponse {
|
|
2661
2714
|
}
|
|
@@ -5845,7 +5898,7 @@ function blobToMldev$3(fromObject) {
|
|
|
5845
5898
|
}
|
|
5846
5899
|
return toObject;
|
|
5847
5900
|
}
|
|
5848
|
-
function codeExecutionResultToVertex$
|
|
5901
|
+
function codeExecutionResultToVertex$3(fromObject) {
|
|
5849
5902
|
const toObject = {};
|
|
5850
5903
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
5851
5904
|
if (fromOutcome != null) {
|
|
@@ -5878,14 +5931,14 @@ function contentToMldev$3(fromObject) {
|
|
|
5878
5931
|
}
|
|
5879
5932
|
return toObject;
|
|
5880
5933
|
}
|
|
5881
|
-
function contentToVertex$
|
|
5934
|
+
function contentToVertex$3(fromObject) {
|
|
5882
5935
|
const toObject = {};
|
|
5883
5936
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5884
5937
|
if (fromParts != null) {
|
|
5885
5938
|
let transformedList = fromParts;
|
|
5886
5939
|
if (Array.isArray(transformedList)) {
|
|
5887
5940
|
transformedList = transformedList.map((item) => {
|
|
5888
|
-
return partToVertex$
|
|
5941
|
+
return partToVertex$3(item);
|
|
5889
5942
|
});
|
|
5890
5943
|
}
|
|
5891
5944
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5964,7 +6017,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5964
6017
|
let transformedList = tContents(fromContents);
|
|
5965
6018
|
if (Array.isArray(transformedList)) {
|
|
5966
6019
|
transformedList = transformedList.map((item) => {
|
|
5967
|
-
return contentToVertex$
|
|
6020
|
+
return contentToVertex$3(item);
|
|
5968
6021
|
});
|
|
5969
6022
|
}
|
|
5970
6023
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -5973,7 +6026,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5973
6026
|
'systemInstruction',
|
|
5974
6027
|
]);
|
|
5975
6028
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
5976
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$
|
|
6029
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$3(tContent(fromSystemInstruction)));
|
|
5977
6030
|
}
|
|
5978
6031
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5979
6032
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -6055,7 +6108,7 @@ function deleteCachedContentResponseFromVertex(fromObject) {
|
|
|
6055
6108
|
}
|
|
6056
6109
|
return toObject;
|
|
6057
6110
|
}
|
|
6058
|
-
function executableCodeToVertex$
|
|
6111
|
+
function executableCodeToVertex$3(fromObject) {
|
|
6059
6112
|
const toObject = {};
|
|
6060
6113
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
6061
6114
|
if (fromCode != null) {
|
|
@@ -6269,6 +6322,16 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
6269
6322
|
}
|
|
6270
6323
|
return toObject;
|
|
6271
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
|
+
}
|
|
6272
6335
|
function partToMldev$3(fromObject) {
|
|
6273
6336
|
const toObject = {};
|
|
6274
6337
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -6341,7 +6404,7 @@ function partToMldev$3(fromObject) {
|
|
|
6341
6404
|
}
|
|
6342
6405
|
return toObject;
|
|
6343
6406
|
}
|
|
6344
|
-
function partToVertex$
|
|
6407
|
+
function partToVertex$3(fromObject) {
|
|
6345
6408
|
const toObject = {};
|
|
6346
6409
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
6347
6410
|
'mediaResolution',
|
|
@@ -6353,13 +6416,13 @@ function partToVertex$2(fromObject) {
|
|
|
6353
6416
|
'codeExecutionResult',
|
|
6354
6417
|
]);
|
|
6355
6418
|
if (fromCodeExecutionResult != null) {
|
|
6356
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
6419
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$3(fromCodeExecutionResult));
|
|
6357
6420
|
}
|
|
6358
6421
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
6359
6422
|
'executableCode',
|
|
6360
6423
|
]);
|
|
6361
6424
|
if (fromExecutableCode != null) {
|
|
6362
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
6425
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$3(fromExecutableCode));
|
|
6363
6426
|
}
|
|
6364
6427
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
6365
6428
|
if (fromFileData != null) {
|
|
@@ -6578,8 +6641,15 @@ function toolToVertex$2(fromObject) {
|
|
|
6578
6641
|
if (fromUrlContext != null) {
|
|
6579
6642
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
6580
6643
|
}
|
|
6581
|
-
|
|
6582
|
-
|
|
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);
|
|
6583
6653
|
}
|
|
6584
6654
|
return toObject;
|
|
6585
6655
|
}
|
|
@@ -7669,7 +7739,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7669
7739
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7670
7740
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7671
7741
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7672
|
-
const SDK_VERSION = '2.
|
|
7742
|
+
const SDK_VERSION = '2.8.0'; // x-release-please-version
|
|
7673
7743
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7674
7744
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7675
7745
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11706,7 +11776,7 @@ function blobToMldev$2(fromObject) {
|
|
|
11706
11776
|
}
|
|
11707
11777
|
return toObject;
|
|
11708
11778
|
}
|
|
11709
|
-
function codeExecutionResultToVertex$
|
|
11779
|
+
function codeExecutionResultToVertex$2(fromObject) {
|
|
11710
11780
|
const toObject = {};
|
|
11711
11781
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
11712
11782
|
if (fromOutcome != null) {
|
|
@@ -11739,14 +11809,14 @@ function contentToMldev$2(fromObject) {
|
|
|
11739
11809
|
}
|
|
11740
11810
|
return toObject;
|
|
11741
11811
|
}
|
|
11742
|
-
function contentToVertex$
|
|
11812
|
+
function contentToVertex$2(fromObject) {
|
|
11743
11813
|
const toObject = {};
|
|
11744
11814
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
11745
11815
|
if (fromParts != null) {
|
|
11746
11816
|
let transformedList = fromParts;
|
|
11747
11817
|
if (Array.isArray(transformedList)) {
|
|
11748
11818
|
transformedList = transformedList.map((item) => {
|
|
11749
|
-
return partToVertex$
|
|
11819
|
+
return partToVertex$2(item);
|
|
11750
11820
|
});
|
|
11751
11821
|
}
|
|
11752
11822
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -11757,7 +11827,7 @@ function contentToVertex$1(fromObject) {
|
|
|
11757
11827
|
}
|
|
11758
11828
|
return toObject;
|
|
11759
11829
|
}
|
|
11760
|
-
function executableCodeToVertex$
|
|
11830
|
+
function executableCodeToVertex$2(fromObject) {
|
|
11761
11831
|
const toObject = {};
|
|
11762
11832
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
11763
11833
|
if (fromCode != null) {
|
|
@@ -12096,11 +12166,11 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
12096
12166
|
}
|
|
12097
12167
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
12098
12168
|
}
|
|
12099
|
-
const
|
|
12100
|
-
'
|
|
12169
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
12170
|
+
'translationConfig',
|
|
12101
12171
|
]);
|
|
12102
|
-
if (parentObject !== undefined &&
|
|
12103
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
12172
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
12173
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
12104
12174
|
}
|
|
12105
12175
|
return toObject;
|
|
12106
12176
|
}
|
|
@@ -12166,7 +12236,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
12166
12236
|
'systemInstruction',
|
|
12167
12237
|
]);
|
|
12168
12238
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
12169
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$
|
|
12239
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$2(tContent(fromSystemInstruction)));
|
|
12170
12240
|
}
|
|
12171
12241
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
12172
12242
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -12234,8 +12304,8 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
12234
12304
|
}
|
|
12235
12305
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
12236
12306
|
}
|
|
12237
|
-
if (getValueByPath(fromObject, ['
|
|
12238
|
-
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.');
|
|
12239
12309
|
}
|
|
12240
12310
|
return toObject;
|
|
12241
12311
|
}
|
|
@@ -12427,6 +12497,16 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
12427
12497
|
}
|
|
12428
12498
|
return toObject;
|
|
12429
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
|
+
}
|
|
12430
12510
|
function partToMldev$2(fromObject) {
|
|
12431
12511
|
const toObject = {};
|
|
12432
12512
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -12499,7 +12579,7 @@ function partToMldev$2(fromObject) {
|
|
|
12499
12579
|
}
|
|
12500
12580
|
return toObject;
|
|
12501
12581
|
}
|
|
12502
|
-
function partToVertex$
|
|
12582
|
+
function partToVertex$2(fromObject) {
|
|
12503
12583
|
const toObject = {};
|
|
12504
12584
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
12505
12585
|
'mediaResolution',
|
|
@@ -12511,13 +12591,13 @@ function partToVertex$1(fromObject) {
|
|
|
12511
12591
|
'codeExecutionResult',
|
|
12512
12592
|
]);
|
|
12513
12593
|
if (fromCodeExecutionResult != null) {
|
|
12514
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
12594
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$2(fromCodeExecutionResult));
|
|
12515
12595
|
}
|
|
12516
12596
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
12517
12597
|
'executableCode',
|
|
12518
12598
|
]);
|
|
12519
12599
|
if (fromExecutableCode != null) {
|
|
12520
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
12600
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$2(fromExecutableCode));
|
|
12521
12601
|
}
|
|
12522
12602
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
12523
12603
|
if (fromFileData != null) {
|
|
@@ -12722,8 +12802,15 @@ function toolToVertex$1(fromObject) {
|
|
|
12722
12802
|
if (fromUrlContext != null) {
|
|
12723
12803
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
12724
12804
|
}
|
|
12725
|
-
|
|
12726
|
-
|
|
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);
|
|
12727
12814
|
}
|
|
12728
12815
|
return toObject;
|
|
12729
12816
|
}
|
|
@@ -12949,7 +13036,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
12949
13036
|
}
|
|
12950
13037
|
return toObject;
|
|
12951
13038
|
}
|
|
12952
|
-
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
13039
|
+
function codeExecutionResultToVertex$1(fromObject, _rootObject) {
|
|
12953
13040
|
const toObject = {};
|
|
12954
13041
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
12955
13042
|
if (fromOutcome != null) {
|
|
@@ -12975,7 +13062,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
12975
13062
|
let transformedList = tContents(fromContents);
|
|
12976
13063
|
if (Array.isArray(transformedList)) {
|
|
12977
13064
|
transformedList = transformedList.map((item) => {
|
|
12978
|
-
return contentToVertex(item);
|
|
13065
|
+
return contentToVertex$1(item);
|
|
12979
13066
|
});
|
|
12980
13067
|
}
|
|
12981
13068
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -13044,14 +13131,14 @@ function contentToMldev$1(fromObject, rootObject) {
|
|
|
13044
13131
|
}
|
|
13045
13132
|
return toObject;
|
|
13046
13133
|
}
|
|
13047
|
-
function contentToVertex(fromObject, rootObject) {
|
|
13134
|
+
function contentToVertex$1(fromObject, rootObject) {
|
|
13048
13135
|
const toObject = {};
|
|
13049
13136
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13050
13137
|
if (fromParts != null) {
|
|
13051
13138
|
let transformedList = fromParts;
|
|
13052
13139
|
if (Array.isArray(transformedList)) {
|
|
13053
13140
|
transformedList = transformedList.map((item) => {
|
|
13054
|
-
return partToVertex(item);
|
|
13141
|
+
return partToVertex$1(item);
|
|
13055
13142
|
});
|
|
13056
13143
|
}
|
|
13057
13144
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -13095,7 +13182,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
13095
13182
|
'systemInstruction',
|
|
13096
13183
|
]);
|
|
13097
13184
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
13098
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
13185
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
13099
13186
|
}
|
|
13100
13187
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
13101
13188
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -13148,7 +13235,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
13148
13235
|
let transformedList = tContents(fromContents);
|
|
13149
13236
|
if (Array.isArray(transformedList)) {
|
|
13150
13237
|
transformedList = transformedList.map((item) => {
|
|
13151
|
-
return contentToVertex(item);
|
|
13238
|
+
return contentToVertex$1(item);
|
|
13152
13239
|
});
|
|
13153
13240
|
}
|
|
13154
13241
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -13584,7 +13671,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
|
|
|
13584
13671
|
if (discriminatorContent === 'EMBED_CONTENT') {
|
|
13585
13672
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
13586
13673
|
if (fromContent != null) {
|
|
13587
|
-
setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
|
|
13674
|
+
setValueByPath(toObject, ['content'], contentToVertex$1(tContent(fromContent)));
|
|
13588
13675
|
}
|
|
13589
13676
|
}
|
|
13590
13677
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -13676,7 +13763,7 @@ function endpointFromVertex(fromObject, _rootObject) {
|
|
|
13676
13763
|
}
|
|
13677
13764
|
return toObject;
|
|
13678
13765
|
}
|
|
13679
|
-
function executableCodeToVertex(fromObject, _rootObject) {
|
|
13766
|
+
function executableCodeToVertex$1(fromObject, _rootObject) {
|
|
13680
13767
|
const toObject = {};
|
|
13681
13768
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
13682
13769
|
if (fromCode != null) {
|
|
@@ -13919,7 +14006,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
13919
14006
|
'systemInstruction',
|
|
13920
14007
|
]);
|
|
13921
14008
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
13922
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
14009
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
13923
14010
|
}
|
|
13924
14011
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
13925
14012
|
if (fromTemperature != null) {
|
|
@@ -14124,7 +14211,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
14124
14211
|
let transformedList = tContents(fromContents);
|
|
14125
14212
|
if (Array.isArray(transformedList)) {
|
|
14126
14213
|
transformedList = transformedList.map((item) => {
|
|
14127
|
-
return contentToVertex(item);
|
|
14214
|
+
return contentToVertex$1(item);
|
|
14128
14215
|
});
|
|
14129
14216
|
}
|
|
14130
14217
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -15379,6 +15466,16 @@ function maskReferenceConfigToVertex(fromObject, _rootObject) {
|
|
|
15379
15466
|
}
|
|
15380
15467
|
return toObject;
|
|
15381
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
|
+
}
|
|
15382
15479
|
function modelFromMldev(fromObject, rootObject) {
|
|
15383
15480
|
const toObject = {};
|
|
15384
15481
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -15569,7 +15666,7 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
15569
15666
|
}
|
|
15570
15667
|
return toObject;
|
|
15571
15668
|
}
|
|
15572
|
-
function partToVertex(fromObject, rootObject) {
|
|
15669
|
+
function partToVertex$1(fromObject, rootObject) {
|
|
15573
15670
|
const toObject = {};
|
|
15574
15671
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
15575
15672
|
'mediaResolution',
|
|
@@ -15581,13 +15678,13 @@ function partToVertex(fromObject, rootObject) {
|
|
|
15581
15678
|
'codeExecutionResult',
|
|
15582
15679
|
]);
|
|
15583
15680
|
if (fromCodeExecutionResult != null) {
|
|
15584
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
15681
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$1(fromCodeExecutionResult));
|
|
15585
15682
|
}
|
|
15586
15683
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
15587
15684
|
'executableCode',
|
|
15588
15685
|
]);
|
|
15589
15686
|
if (fromExecutableCode != null) {
|
|
15590
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
15687
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$1(fromExecutableCode));
|
|
15591
15688
|
}
|
|
15592
15689
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
15593
15690
|
if (fromFileData != null) {
|
|
@@ -16062,7 +16159,7 @@ function toolToMldev$1(fromObject, rootObject) {
|
|
|
16062
16159
|
}
|
|
16063
16160
|
return toObject;
|
|
16064
16161
|
}
|
|
16065
|
-
function toolToVertex(fromObject,
|
|
16162
|
+
function toolToVertex(fromObject, rootObject) {
|
|
16066
16163
|
const toObject = {};
|
|
16067
16164
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
16068
16165
|
if (fromRetrieval != null) {
|
|
@@ -16123,8 +16220,15 @@ function toolToVertex(fromObject, _rootObject) {
|
|
|
16123
16220
|
if (fromUrlContext != null) {
|
|
16124
16221
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
16125
16222
|
}
|
|
16126
|
-
|
|
16127
|
-
|
|
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);
|
|
16128
16232
|
}
|
|
16129
16233
|
return toObject;
|
|
16130
16234
|
}
|
|
@@ -19395,11 +19499,11 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
19395
19499
|
}
|
|
19396
19500
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
19397
19501
|
}
|
|
19398
|
-
const
|
|
19399
|
-
'
|
|
19502
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
19503
|
+
'translationConfig',
|
|
19400
19504
|
]);
|
|
19401
|
-
if (parentObject !== undefined &&
|
|
19402
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
19505
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
19506
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
19403
19507
|
}
|
|
19404
19508
|
return toObject;
|
|
19405
19509
|
}
|
|
@@ -19893,6 +19997,39 @@ function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
|
|
|
19893
19997
|
}
|
|
19894
19998
|
return toObject;
|
|
19895
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
|
+
}
|
|
19896
20033
|
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
19897
20034
|
const toObject = {};
|
|
19898
20035
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
@@ -19981,6 +20118,12 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
19981
20118
|
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
19982
20119
|
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
19983
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
|
+
}
|
|
19984
20127
|
return toObject;
|
|
19985
20128
|
}
|
|
19986
20129
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -20314,6 +20457,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20314
20457
|
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20315
20458
|
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20316
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
|
+
}
|
|
20317
20472
|
return toObject;
|
|
20318
20473
|
}
|
|
20319
20474
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20484,6 +20639,21 @@ function distillationSpecFromVertex(fromObject, rootObject) {
|
|
|
20484
20639
|
}
|
|
20485
20640
|
return toObject;
|
|
20486
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
|
+
}
|
|
20487
20657
|
function generationConfigFromVertex(fromObject, _rootObject) {
|
|
20488
20658
|
const toObject = {};
|
|
20489
20659
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
@@ -20674,6 +20844,99 @@ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
|
20674
20844
|
}
|
|
20675
20845
|
return toObject;
|
|
20676
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
|
+
}
|
|
20677
20940
|
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
20678
20941
|
const toObject = {};
|
|
20679
20942
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
@@ -20907,6 +21170,12 @@ function tuningJobFromVertex(fromObject, rootObject) {
|
|
|
20907
21170
|
if (fromDistillationSpec != null) {
|
|
20908
21171
|
setValueByPath(toObject, ['distillationSpec'], distillationSpecFromVertex(fromDistillationSpec));
|
|
20909
21172
|
}
|
|
21173
|
+
const fromReinforcementTuningSpec = getValueByPath(fromObject, [
|
|
21174
|
+
'reinforcementTuningSpec',
|
|
21175
|
+
]);
|
|
21176
|
+
if (fromReinforcementTuningSpec != null) {
|
|
21177
|
+
setValueByPath(toObject, ['reinforcementTuningSpec'], fromReinforcementTuningSpec);
|
|
21178
|
+
}
|
|
20910
21179
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
20911
21180
|
'tuningDataStats',
|
|
20912
21181
|
]);
|
|
@@ -21049,6 +21318,62 @@ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
|
21049
21318
|
}
|
|
21050
21319
|
return toObject;
|
|
21051
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
|
+
}
|
|
21052
21377
|
|
|
21053
21378
|
/**
|
|
21054
21379
|
* @license
|
|
@@ -21395,6 +21720,46 @@ class Tunings extends BaseModule {
|
|
|
21395
21720
|
});
|
|
21396
21721
|
}
|
|
21397
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
|
+
}
|
|
21398
21763
|
}
|
|
21399
21764
|
|
|
21400
21765
|
/**
|
|
@@ -21543,5 +21908,5 @@ class GoogleGenAI {
|
|
|
21543
21908
|
}
|
|
21544
21909
|
}
|
|
21545
21910
|
|
|
21546
|
-
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 };
|
|
21547
21912
|
//# sourceMappingURL=index.mjs.map
|