@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/node/index.cjs
CHANGED
|
@@ -648,7 +648,7 @@ exports.Language = void 0;
|
|
|
648
648
|
*/
|
|
649
649
|
Language["PYTHON"] = "PYTHON";
|
|
650
650
|
})(exports.Language || (exports.Language = {}));
|
|
651
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
651
|
+
/** Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */
|
|
652
652
|
exports.FunctionResponseScheduling = void 0;
|
|
653
653
|
(function (FunctionResponseScheduling) {
|
|
654
654
|
/**
|
|
@@ -1844,6 +1844,58 @@ exports.ImageResizeMode = void 0;
|
|
|
1844
1844
|
*/
|
|
1845
1845
|
ImageResizeMode["PAD"] = "PAD";
|
|
1846
1846
|
})(exports.ImageResizeMode || (exports.ImageResizeMode = {}));
|
|
1847
|
+
/** Defines how to parse sample response. */
|
|
1848
|
+
exports.ResponseParseType = void 0;
|
|
1849
|
+
(function (ResponseParseType) {
|
|
1850
|
+
/**
|
|
1851
|
+
* Default value. This value is unused.
|
|
1852
|
+
*/
|
|
1853
|
+
ResponseParseType["RESPONSE_PARSE_TYPE_UNSPECIFIED"] = "RESPONSE_PARSE_TYPE_UNSPECIFIED";
|
|
1854
|
+
/**
|
|
1855
|
+
* Use the sample response as is.
|
|
1856
|
+
*/
|
|
1857
|
+
ResponseParseType["IDENTITY"] = "IDENTITY";
|
|
1858
|
+
/**
|
|
1859
|
+
* Use regex to extract the important part of sample response.
|
|
1860
|
+
*/
|
|
1861
|
+
ResponseParseType["REGEX_EXTRACT"] = "REGEX_EXTRACT";
|
|
1862
|
+
})(exports.ResponseParseType || (exports.ResponseParseType = {}));
|
|
1863
|
+
/** Match operation to use for evaluation. */
|
|
1864
|
+
exports.MatchOperation = void 0;
|
|
1865
|
+
(function (MatchOperation) {
|
|
1866
|
+
/**
|
|
1867
|
+
* Default value. This value is unused.
|
|
1868
|
+
*/
|
|
1869
|
+
MatchOperation["MATCH_OPERATION_UNSPECIFIED"] = "MATCH_OPERATION_UNSPECIFIED";
|
|
1870
|
+
/**
|
|
1871
|
+
* Equivalent to GoogleSQL `REGEX_CONTAINS(target, expression)`.
|
|
1872
|
+
*/
|
|
1873
|
+
MatchOperation["REGEX_CONTAINS"] = "REGEX_CONTAINS";
|
|
1874
|
+
/**
|
|
1875
|
+
* `expression` is a substring of target.
|
|
1876
|
+
*/
|
|
1877
|
+
MatchOperation["PARTIAL_MATCH"] = "PARTIAL_MATCH";
|
|
1878
|
+
/**
|
|
1879
|
+
* `expression` is an exact match of target.
|
|
1880
|
+
*/
|
|
1881
|
+
MatchOperation["EXACT_MATCH"] = "EXACT_MATCH";
|
|
1882
|
+
})(exports.MatchOperation || (exports.MatchOperation = {}));
|
|
1883
|
+
/** Represents how much to think for the tuning job. */
|
|
1884
|
+
exports.ReinforcementTuningThinkingLevel = void 0;
|
|
1885
|
+
(function (ReinforcementTuningThinkingLevel) {
|
|
1886
|
+
/**
|
|
1887
|
+
* Unspecified thinking level.
|
|
1888
|
+
*/
|
|
1889
|
+
ReinforcementTuningThinkingLevel["REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED"] = "REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED";
|
|
1890
|
+
/**
|
|
1891
|
+
* Little to no thinking.
|
|
1892
|
+
*/
|
|
1893
|
+
ReinforcementTuningThinkingLevel["MINIMAL"] = "MINIMAL";
|
|
1894
|
+
/**
|
|
1895
|
+
* High thinking level.
|
|
1896
|
+
*/
|
|
1897
|
+
ReinforcementTuningThinkingLevel["HIGH"] = "HIGH";
|
|
1898
|
+
})(exports.ReinforcementTuningThinkingLevel || (exports.ReinforcementTuningThinkingLevel = {}));
|
|
1847
1899
|
/** Enum representing the tuning method. */
|
|
1848
1900
|
exports.TuningMethod = void 0;
|
|
1849
1901
|
(function (TuningMethod) {
|
|
@@ -2237,24 +2289,13 @@ the API in a subsequent turn within a `Content` message, along with the
|
|
|
2237
2289
|
corresponding `ToolCall`. */
|
|
2238
2290
|
class ToolResponse {
|
|
2239
2291
|
}
|
|
2240
|
-
/** Raw media bytes for function response.
|
|
2241
|
-
|
|
2242
|
-
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
2243
|
-
field. */
|
|
2292
|
+
/** Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. */
|
|
2244
2293
|
class FunctionResponseBlob {
|
|
2245
2294
|
}
|
|
2246
|
-
/** URI based data for function response. */
|
|
2295
|
+
/** URI based data for function response. This data type is not supported in Gemini API. */
|
|
2247
2296
|
class FunctionResponseFileData {
|
|
2248
2297
|
}
|
|
2249
|
-
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
2250
|
-
|
|
2251
|
-
A `FunctionResponsePart` consists of data which has an associated datatype. A
|
|
2252
|
-
`FunctionResponsePart` can only contain one of the accepted types in
|
|
2253
|
-
`FunctionResponsePart.data`.
|
|
2254
|
-
|
|
2255
|
-
A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
|
|
2256
|
-
type and subtype of the media if the `inline_data` field is filled with raw
|
|
2257
|
-
bytes. */
|
|
2298
|
+
/** A datatype containing media that is part of a `FunctionResponse` message. A `FunctionResponsePart` consists of data which has an associated datatype. A `FunctionResponsePart` can only contain one of the accepted types in `FunctionResponsePart.data`. A `FunctionResponsePart` must have a fixed IANA MIME type identifying the type and subtype of the media if the `inline_data` field is filled with raw bytes. */
|
|
2258
2299
|
class FunctionResponsePart {
|
|
2259
2300
|
}
|
|
2260
2301
|
/**
|
|
@@ -2279,7 +2320,7 @@ function createFunctionResponsePartFromUri(uri, mimeType) {
|
|
|
2279
2320
|
},
|
|
2280
2321
|
};
|
|
2281
2322
|
}
|
|
2282
|
-
/**
|
|
2323
|
+
/** The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a `FunctionCall` made based on model prediction. */
|
|
2283
2324
|
class FunctionResponse {
|
|
2284
2325
|
}
|
|
2285
2326
|
/**
|
|
@@ -2707,6 +2748,12 @@ class GenerateVideosOperation {
|
|
|
2707
2748
|
return operation;
|
|
2708
2749
|
}
|
|
2709
2750
|
}
|
|
2751
|
+
/** Defines how to parse sample response for reinforcement tuning. */
|
|
2752
|
+
class ReinforcementTuningParseResponseConfig {
|
|
2753
|
+
}
|
|
2754
|
+
/** Scores responses by directly converting parsed autorater response to float reward (reward is clipped to be within [-1, 1]). */
|
|
2755
|
+
class ReinforcementTuningAutoraterScorerParsedResponseConversionScorer {
|
|
2756
|
+
}
|
|
2710
2757
|
/** The results from an evaluation run performed by the EvaluationService. This data type is not supported in Gemini API. */
|
|
2711
2758
|
class EvaluateDatasetResponse {
|
|
2712
2759
|
}
|
|
@@ -2716,6 +2763,12 @@ class ListTuningJobsResponse {
|
|
|
2716
2763
|
/** Empty response for tunings.cancel method. */
|
|
2717
2764
|
class CancelTuningJobResponse {
|
|
2718
2765
|
}
|
|
2766
|
+
/** Response for the validate_reward method.
|
|
2767
|
+
|
|
2768
|
+
Contains the computed reward for a reinforcement tuning reward
|
|
2769
|
+
configuration. */
|
|
2770
|
+
class ValidateRewardResponse {
|
|
2771
|
+
}
|
|
2719
2772
|
/** Empty response for caches.delete method. */
|
|
2720
2773
|
class DeleteCachedContentResponse {
|
|
2721
2774
|
}
|
|
@@ -5905,7 +5958,7 @@ function blobToMldev$3(fromObject) {
|
|
|
5905
5958
|
}
|
|
5906
5959
|
return toObject;
|
|
5907
5960
|
}
|
|
5908
|
-
function codeExecutionResultToVertex$
|
|
5961
|
+
function codeExecutionResultToVertex$3(fromObject) {
|
|
5909
5962
|
const toObject = {};
|
|
5910
5963
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
5911
5964
|
if (fromOutcome != null) {
|
|
@@ -5938,14 +5991,14 @@ function contentToMldev$3(fromObject) {
|
|
|
5938
5991
|
}
|
|
5939
5992
|
return toObject;
|
|
5940
5993
|
}
|
|
5941
|
-
function contentToVertex$
|
|
5994
|
+
function contentToVertex$3(fromObject) {
|
|
5942
5995
|
const toObject = {};
|
|
5943
5996
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5944
5997
|
if (fromParts != null) {
|
|
5945
5998
|
let transformedList = fromParts;
|
|
5946
5999
|
if (Array.isArray(transformedList)) {
|
|
5947
6000
|
transformedList = transformedList.map((item) => {
|
|
5948
|
-
return partToVertex$
|
|
6001
|
+
return partToVertex$3(item);
|
|
5949
6002
|
});
|
|
5950
6003
|
}
|
|
5951
6004
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -6024,7 +6077,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
6024
6077
|
let transformedList = tContents(fromContents);
|
|
6025
6078
|
if (Array.isArray(transformedList)) {
|
|
6026
6079
|
transformedList = transformedList.map((item) => {
|
|
6027
|
-
return contentToVertex$
|
|
6080
|
+
return contentToVertex$3(item);
|
|
6028
6081
|
});
|
|
6029
6082
|
}
|
|
6030
6083
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -6033,7 +6086,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
6033
6086
|
'systemInstruction',
|
|
6034
6087
|
]);
|
|
6035
6088
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
6036
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$
|
|
6089
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$3(tContent(fromSystemInstruction)));
|
|
6037
6090
|
}
|
|
6038
6091
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
6039
6092
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -6115,7 +6168,7 @@ function deleteCachedContentResponseFromVertex(fromObject) {
|
|
|
6115
6168
|
}
|
|
6116
6169
|
return toObject;
|
|
6117
6170
|
}
|
|
6118
|
-
function executableCodeToVertex$
|
|
6171
|
+
function executableCodeToVertex$3(fromObject) {
|
|
6119
6172
|
const toObject = {};
|
|
6120
6173
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
6121
6174
|
if (fromCode != null) {
|
|
@@ -6329,6 +6382,16 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
6329
6382
|
}
|
|
6330
6383
|
return toObject;
|
|
6331
6384
|
}
|
|
6385
|
+
function mcpServerToVertex$2(fromObject) {
|
|
6386
|
+
const toObject = {};
|
|
6387
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
6388
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6389
|
+
}
|
|
6390
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
6391
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6392
|
+
}
|
|
6393
|
+
return toObject;
|
|
6394
|
+
}
|
|
6332
6395
|
function partToMldev$3(fromObject) {
|
|
6333
6396
|
const toObject = {};
|
|
6334
6397
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -6401,7 +6464,7 @@ function partToMldev$3(fromObject) {
|
|
|
6401
6464
|
}
|
|
6402
6465
|
return toObject;
|
|
6403
6466
|
}
|
|
6404
|
-
function partToVertex$
|
|
6467
|
+
function partToVertex$3(fromObject) {
|
|
6405
6468
|
const toObject = {};
|
|
6406
6469
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
6407
6470
|
'mediaResolution',
|
|
@@ -6413,13 +6476,13 @@ function partToVertex$2(fromObject) {
|
|
|
6413
6476
|
'codeExecutionResult',
|
|
6414
6477
|
]);
|
|
6415
6478
|
if (fromCodeExecutionResult != null) {
|
|
6416
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
6479
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$3(fromCodeExecutionResult));
|
|
6417
6480
|
}
|
|
6418
6481
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
6419
6482
|
'executableCode',
|
|
6420
6483
|
]);
|
|
6421
6484
|
if (fromExecutableCode != null) {
|
|
6422
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
6485
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$3(fromExecutableCode));
|
|
6423
6486
|
}
|
|
6424
6487
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
6425
6488
|
if (fromFileData != null) {
|
|
@@ -6638,8 +6701,15 @@ function toolToVertex$2(fromObject) {
|
|
|
6638
6701
|
if (fromUrlContext != null) {
|
|
6639
6702
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
6640
6703
|
}
|
|
6641
|
-
|
|
6642
|
-
|
|
6704
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
6705
|
+
if (fromMcpServers != null) {
|
|
6706
|
+
let transformedList = fromMcpServers;
|
|
6707
|
+
if (Array.isArray(transformedList)) {
|
|
6708
|
+
transformedList = transformedList.map((item) => {
|
|
6709
|
+
return mcpServerToVertex$2(item);
|
|
6710
|
+
});
|
|
6711
|
+
}
|
|
6712
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
6643
6713
|
}
|
|
6644
6714
|
return toObject;
|
|
6645
6715
|
}
|
|
@@ -7977,7 +8047,7 @@ function blobToMldev$2(fromObject) {
|
|
|
7977
8047
|
}
|
|
7978
8048
|
return toObject;
|
|
7979
8049
|
}
|
|
7980
|
-
function codeExecutionResultToVertex$
|
|
8050
|
+
function codeExecutionResultToVertex$2(fromObject) {
|
|
7981
8051
|
const toObject = {};
|
|
7982
8052
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
7983
8053
|
if (fromOutcome != null) {
|
|
@@ -8010,14 +8080,14 @@ function contentToMldev$2(fromObject) {
|
|
|
8010
8080
|
}
|
|
8011
8081
|
return toObject;
|
|
8012
8082
|
}
|
|
8013
|
-
function contentToVertex$
|
|
8083
|
+
function contentToVertex$2(fromObject) {
|
|
8014
8084
|
const toObject = {};
|
|
8015
8085
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
8016
8086
|
if (fromParts != null) {
|
|
8017
8087
|
let transformedList = fromParts;
|
|
8018
8088
|
if (Array.isArray(transformedList)) {
|
|
8019
8089
|
transformedList = transformedList.map((item) => {
|
|
8020
|
-
return partToVertex$
|
|
8090
|
+
return partToVertex$2(item);
|
|
8021
8091
|
});
|
|
8022
8092
|
}
|
|
8023
8093
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -8028,7 +8098,7 @@ function contentToVertex$1(fromObject) {
|
|
|
8028
8098
|
}
|
|
8029
8099
|
return toObject;
|
|
8030
8100
|
}
|
|
8031
|
-
function executableCodeToVertex$
|
|
8101
|
+
function executableCodeToVertex$2(fromObject) {
|
|
8032
8102
|
const toObject = {};
|
|
8033
8103
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
8034
8104
|
if (fromCode != null) {
|
|
@@ -8367,11 +8437,11 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
8367
8437
|
}
|
|
8368
8438
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8369
8439
|
}
|
|
8370
|
-
const
|
|
8371
|
-
'
|
|
8440
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
8441
|
+
'translationConfig',
|
|
8372
8442
|
]);
|
|
8373
|
-
if (parentObject !== undefined &&
|
|
8374
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
8443
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
8444
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
8375
8445
|
}
|
|
8376
8446
|
return toObject;
|
|
8377
8447
|
}
|
|
@@ -8437,7 +8507,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8437
8507
|
'systemInstruction',
|
|
8438
8508
|
]);
|
|
8439
8509
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
8440
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$
|
|
8510
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$2(tContent(fromSystemInstruction)));
|
|
8441
8511
|
}
|
|
8442
8512
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
8443
8513
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -8505,8 +8575,8 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8505
8575
|
}
|
|
8506
8576
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8507
8577
|
}
|
|
8508
|
-
if (getValueByPath(fromObject, ['
|
|
8509
|
-
throw new Error('
|
|
8578
|
+
if (getValueByPath(fromObject, ['translationConfig']) !== undefined) {
|
|
8579
|
+
throw new Error('translationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8510
8580
|
}
|
|
8511
8581
|
return toObject;
|
|
8512
8582
|
}
|
|
@@ -8698,6 +8768,16 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
8698
8768
|
}
|
|
8699
8769
|
return toObject;
|
|
8700
8770
|
}
|
|
8771
|
+
function mcpServerToVertex$1(fromObject) {
|
|
8772
|
+
const toObject = {};
|
|
8773
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
8774
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8775
|
+
}
|
|
8776
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
8777
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8778
|
+
}
|
|
8779
|
+
return toObject;
|
|
8780
|
+
}
|
|
8701
8781
|
function partToMldev$2(fromObject) {
|
|
8702
8782
|
const toObject = {};
|
|
8703
8783
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -8770,7 +8850,7 @@ function partToMldev$2(fromObject) {
|
|
|
8770
8850
|
}
|
|
8771
8851
|
return toObject;
|
|
8772
8852
|
}
|
|
8773
|
-
function partToVertex$
|
|
8853
|
+
function partToVertex$2(fromObject) {
|
|
8774
8854
|
const toObject = {};
|
|
8775
8855
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
8776
8856
|
'mediaResolution',
|
|
@@ -8782,13 +8862,13 @@ function partToVertex$1(fromObject) {
|
|
|
8782
8862
|
'codeExecutionResult',
|
|
8783
8863
|
]);
|
|
8784
8864
|
if (fromCodeExecutionResult != null) {
|
|
8785
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
8865
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$2(fromCodeExecutionResult));
|
|
8786
8866
|
}
|
|
8787
8867
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
8788
8868
|
'executableCode',
|
|
8789
8869
|
]);
|
|
8790
8870
|
if (fromExecutableCode != null) {
|
|
8791
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
8871
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$2(fromExecutableCode));
|
|
8792
8872
|
}
|
|
8793
8873
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
8794
8874
|
if (fromFileData != null) {
|
|
@@ -8993,8 +9073,15 @@ function toolToVertex$1(fromObject) {
|
|
|
8993
9073
|
if (fromUrlContext != null) {
|
|
8994
9074
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
8995
9075
|
}
|
|
8996
|
-
|
|
8997
|
-
|
|
9076
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
9077
|
+
if (fromMcpServers != null) {
|
|
9078
|
+
let transformedList = fromMcpServers;
|
|
9079
|
+
if (Array.isArray(transformedList)) {
|
|
9080
|
+
transformedList = transformedList.map((item) => {
|
|
9081
|
+
return mcpServerToVertex$1(item);
|
|
9082
|
+
});
|
|
9083
|
+
}
|
|
9084
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
8998
9085
|
}
|
|
8999
9086
|
return toObject;
|
|
9000
9087
|
}
|
|
@@ -9220,7 +9307,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
9220
9307
|
}
|
|
9221
9308
|
return toObject;
|
|
9222
9309
|
}
|
|
9223
|
-
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
9310
|
+
function codeExecutionResultToVertex$1(fromObject, _rootObject) {
|
|
9224
9311
|
const toObject = {};
|
|
9225
9312
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
9226
9313
|
if (fromOutcome != null) {
|
|
@@ -9246,7 +9333,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
9246
9333
|
let transformedList = tContents(fromContents);
|
|
9247
9334
|
if (Array.isArray(transformedList)) {
|
|
9248
9335
|
transformedList = transformedList.map((item) => {
|
|
9249
|
-
return contentToVertex(item);
|
|
9336
|
+
return contentToVertex$1(item);
|
|
9250
9337
|
});
|
|
9251
9338
|
}
|
|
9252
9339
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -9315,14 +9402,14 @@ function contentToMldev$1(fromObject, rootObject) {
|
|
|
9315
9402
|
}
|
|
9316
9403
|
return toObject;
|
|
9317
9404
|
}
|
|
9318
|
-
function contentToVertex(fromObject, rootObject) {
|
|
9405
|
+
function contentToVertex$1(fromObject, rootObject) {
|
|
9319
9406
|
const toObject = {};
|
|
9320
9407
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
9321
9408
|
if (fromParts != null) {
|
|
9322
9409
|
let transformedList = fromParts;
|
|
9323
9410
|
if (Array.isArray(transformedList)) {
|
|
9324
9411
|
transformedList = transformedList.map((item) => {
|
|
9325
|
-
return partToVertex(item);
|
|
9412
|
+
return partToVertex$1(item);
|
|
9326
9413
|
});
|
|
9327
9414
|
}
|
|
9328
9415
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -9366,7 +9453,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
9366
9453
|
'systemInstruction',
|
|
9367
9454
|
]);
|
|
9368
9455
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
9369
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
9456
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
9370
9457
|
}
|
|
9371
9458
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
9372
9459
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -9419,7 +9506,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
9419
9506
|
let transformedList = tContents(fromContents);
|
|
9420
9507
|
if (Array.isArray(transformedList)) {
|
|
9421
9508
|
transformedList = transformedList.map((item) => {
|
|
9422
|
-
return contentToVertex(item);
|
|
9509
|
+
return contentToVertex$1(item);
|
|
9423
9510
|
});
|
|
9424
9511
|
}
|
|
9425
9512
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -9855,7 +9942,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
|
|
|
9855
9942
|
if (discriminatorContent === 'EMBED_CONTENT') {
|
|
9856
9943
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
9857
9944
|
if (fromContent != null) {
|
|
9858
|
-
setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
|
|
9945
|
+
setValueByPath(toObject, ['content'], contentToVertex$1(tContent(fromContent)));
|
|
9859
9946
|
}
|
|
9860
9947
|
}
|
|
9861
9948
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -9947,7 +10034,7 @@ function endpointFromVertex(fromObject, _rootObject) {
|
|
|
9947
10034
|
}
|
|
9948
10035
|
return toObject;
|
|
9949
10036
|
}
|
|
9950
|
-
function executableCodeToVertex(fromObject, _rootObject) {
|
|
10037
|
+
function executableCodeToVertex$1(fromObject, _rootObject) {
|
|
9951
10038
|
const toObject = {};
|
|
9952
10039
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
9953
10040
|
if (fromCode != null) {
|
|
@@ -10190,7 +10277,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
10190
10277
|
'systemInstruction',
|
|
10191
10278
|
]);
|
|
10192
10279
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
10193
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
10280
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
10194
10281
|
}
|
|
10195
10282
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
10196
10283
|
if (fromTemperature != null) {
|
|
@@ -10395,7 +10482,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
10395
10482
|
let transformedList = tContents(fromContents);
|
|
10396
10483
|
if (Array.isArray(transformedList)) {
|
|
10397
10484
|
transformedList = transformedList.map((item) => {
|
|
10398
|
-
return contentToVertex(item);
|
|
10485
|
+
return contentToVertex$1(item);
|
|
10399
10486
|
});
|
|
10400
10487
|
}
|
|
10401
10488
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -11650,6 +11737,16 @@ function maskReferenceConfigToVertex(fromObject, _rootObject) {
|
|
|
11650
11737
|
}
|
|
11651
11738
|
return toObject;
|
|
11652
11739
|
}
|
|
11740
|
+
function mcpServerToVertex(fromObject, _rootObject) {
|
|
11741
|
+
const toObject = {};
|
|
11742
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
11743
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11744
|
+
}
|
|
11745
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
11746
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11747
|
+
}
|
|
11748
|
+
return toObject;
|
|
11749
|
+
}
|
|
11653
11750
|
function modelFromMldev(fromObject, rootObject) {
|
|
11654
11751
|
const toObject = {};
|
|
11655
11752
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -11840,7 +11937,7 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
11840
11937
|
}
|
|
11841
11938
|
return toObject;
|
|
11842
11939
|
}
|
|
11843
|
-
function partToVertex(fromObject, rootObject) {
|
|
11940
|
+
function partToVertex$1(fromObject, rootObject) {
|
|
11844
11941
|
const toObject = {};
|
|
11845
11942
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
11846
11943
|
'mediaResolution',
|
|
@@ -11852,13 +11949,13 @@ function partToVertex(fromObject, rootObject) {
|
|
|
11852
11949
|
'codeExecutionResult',
|
|
11853
11950
|
]);
|
|
11854
11951
|
if (fromCodeExecutionResult != null) {
|
|
11855
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
11952
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$1(fromCodeExecutionResult));
|
|
11856
11953
|
}
|
|
11857
11954
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
11858
11955
|
'executableCode',
|
|
11859
11956
|
]);
|
|
11860
11957
|
if (fromExecutableCode != null) {
|
|
11861
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
11958
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$1(fromExecutableCode));
|
|
11862
11959
|
}
|
|
11863
11960
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
11864
11961
|
if (fromFileData != null) {
|
|
@@ -12333,7 +12430,7 @@ function toolToMldev$1(fromObject, rootObject) {
|
|
|
12333
12430
|
}
|
|
12334
12431
|
return toObject;
|
|
12335
12432
|
}
|
|
12336
|
-
function toolToVertex(fromObject,
|
|
12433
|
+
function toolToVertex(fromObject, rootObject) {
|
|
12337
12434
|
const toObject = {};
|
|
12338
12435
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
12339
12436
|
if (fromRetrieval != null) {
|
|
@@ -12394,8 +12491,15 @@ function toolToVertex(fromObject, _rootObject) {
|
|
|
12394
12491
|
if (fromUrlContext != null) {
|
|
12395
12492
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
12396
12493
|
}
|
|
12397
|
-
|
|
12398
|
-
|
|
12494
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
12495
|
+
if (fromMcpServers != null) {
|
|
12496
|
+
let transformedList = fromMcpServers;
|
|
12497
|
+
if (Array.isArray(transformedList)) {
|
|
12498
|
+
transformedList = transformedList.map((item) => {
|
|
12499
|
+
return mcpServerToVertex(item);
|
|
12500
|
+
});
|
|
12501
|
+
}
|
|
12502
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
12399
12503
|
}
|
|
12400
12504
|
return toObject;
|
|
12401
12505
|
}
|
|
@@ -12958,7 +13062,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12958
13062
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12959
13063
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12960
13064
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12961
|
-
const SDK_VERSION = '2.
|
|
13065
|
+
const SDK_VERSION = '2.8.0'; // x-release-please-version
|
|
12962
13066
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12963
13067
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12964
13068
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -16608,11 +16712,11 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
16608
16712
|
}
|
|
16609
16713
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
16610
16714
|
}
|
|
16611
|
-
const
|
|
16612
|
-
'
|
|
16715
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
16716
|
+
'translationConfig',
|
|
16613
16717
|
]);
|
|
16614
|
-
if (parentObject !== undefined &&
|
|
16615
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
16718
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
16719
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
16616
16720
|
}
|
|
16617
16721
|
return toObject;
|
|
16618
16722
|
}
|
|
@@ -19981,6 +20085,39 @@ function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
|
|
|
19981
20085
|
}
|
|
19982
20086
|
return toObject;
|
|
19983
20087
|
}
|
|
20088
|
+
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
20089
|
+
const toObject = {};
|
|
20090
|
+
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
20091
|
+
if (fromOutcome != null) {
|
|
20092
|
+
setValueByPath(toObject, ['outcome'], fromOutcome);
|
|
20093
|
+
}
|
|
20094
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
20095
|
+
if (fromOutput != null) {
|
|
20096
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
20097
|
+
}
|
|
20098
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20099
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20100
|
+
}
|
|
20101
|
+
return toObject;
|
|
20102
|
+
}
|
|
20103
|
+
function contentToVertex(fromObject, rootObject) {
|
|
20104
|
+
const toObject = {};
|
|
20105
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
20106
|
+
if (fromParts != null) {
|
|
20107
|
+
let transformedList = fromParts;
|
|
20108
|
+
if (Array.isArray(transformedList)) {
|
|
20109
|
+
transformedList = transformedList.map((item) => {
|
|
20110
|
+
return partToVertex(item);
|
|
20111
|
+
});
|
|
20112
|
+
}
|
|
20113
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
20114
|
+
}
|
|
20115
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
20116
|
+
if (fromRole != null) {
|
|
20117
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
20118
|
+
}
|
|
20119
|
+
return toObject;
|
|
20120
|
+
}
|
|
19984
20121
|
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
19985
20122
|
const toObject = {};
|
|
19986
20123
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
@@ -20069,6 +20206,12 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
20069
20206
|
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
20070
20207
|
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20071
20208
|
}
|
|
20209
|
+
if (getValueByPath(fromObject, ['thinkingLevel']) !== undefined) {
|
|
20210
|
+
throw new Error('thinkingLevel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20211
|
+
}
|
|
20212
|
+
if (getValueByPath(fromObject, ['validationDatasetUri']) !== undefined) {
|
|
20213
|
+
throw new Error('validationDatasetUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20214
|
+
}
|
|
20072
20215
|
return toObject;
|
|
20073
20216
|
}
|
|
20074
20217
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -20402,6 +20545,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20402
20545
|
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20403
20546
|
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20404
20547
|
}
|
|
20548
|
+
const fromThinkingLevel = getValueByPath(fromObject, [
|
|
20549
|
+
'thinkingLevel',
|
|
20550
|
+
]);
|
|
20551
|
+
if (parentObject !== undefined && fromThinkingLevel != null) {
|
|
20552
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'thinkingLevel'], fromThinkingLevel);
|
|
20553
|
+
}
|
|
20554
|
+
const fromValidationDatasetUri = getValueByPath(fromObject, [
|
|
20555
|
+
'validationDatasetUri',
|
|
20556
|
+
]);
|
|
20557
|
+
if (parentObject !== undefined && fromValidationDatasetUri != null) {
|
|
20558
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'validationDatasetUri'], fromValidationDatasetUri);
|
|
20559
|
+
}
|
|
20405
20560
|
return toObject;
|
|
20406
20561
|
}
|
|
20407
20562
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20572,6 +20727,21 @@ function distillationSpecFromVertex(fromObject, rootObject) {
|
|
|
20572
20727
|
}
|
|
20573
20728
|
return toObject;
|
|
20574
20729
|
}
|
|
20730
|
+
function executableCodeToVertex(fromObject, _rootObject) {
|
|
20731
|
+
const toObject = {};
|
|
20732
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
20733
|
+
if (fromCode != null) {
|
|
20734
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
20735
|
+
}
|
|
20736
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
20737
|
+
if (fromLanguage != null) {
|
|
20738
|
+
setValueByPath(toObject, ['language'], fromLanguage);
|
|
20739
|
+
}
|
|
20740
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20741
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20742
|
+
}
|
|
20743
|
+
return toObject;
|
|
20744
|
+
}
|
|
20575
20745
|
function generationConfigFromVertex(fromObject, _rootObject) {
|
|
20576
20746
|
const toObject = {};
|
|
20577
20747
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
@@ -20762,6 +20932,99 @@ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
|
20762
20932
|
}
|
|
20763
20933
|
return toObject;
|
|
20764
20934
|
}
|
|
20935
|
+
function partToVertex(fromObject, rootObject) {
|
|
20936
|
+
const toObject = {};
|
|
20937
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
20938
|
+
'mediaResolution',
|
|
20939
|
+
]);
|
|
20940
|
+
if (fromMediaResolution != null) {
|
|
20941
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
20942
|
+
}
|
|
20943
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
20944
|
+
'codeExecutionResult',
|
|
20945
|
+
]);
|
|
20946
|
+
if (fromCodeExecutionResult != null) {
|
|
20947
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
20948
|
+
}
|
|
20949
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
20950
|
+
'executableCode',
|
|
20951
|
+
]);
|
|
20952
|
+
if (fromExecutableCode != null) {
|
|
20953
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
20954
|
+
}
|
|
20955
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
20956
|
+
if (fromFileData != null) {
|
|
20957
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
20958
|
+
}
|
|
20959
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
20960
|
+
if (fromFunctionCall != null) {
|
|
20961
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
20962
|
+
}
|
|
20963
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
20964
|
+
'functionResponse',
|
|
20965
|
+
]);
|
|
20966
|
+
if (fromFunctionResponse != null) {
|
|
20967
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
20968
|
+
}
|
|
20969
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
20970
|
+
if (fromInlineData != null) {
|
|
20971
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
20972
|
+
}
|
|
20973
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
20974
|
+
if (fromText != null) {
|
|
20975
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
20976
|
+
}
|
|
20977
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
20978
|
+
if (fromThought != null) {
|
|
20979
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
20980
|
+
}
|
|
20981
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
20982
|
+
'thoughtSignature',
|
|
20983
|
+
]);
|
|
20984
|
+
if (fromThoughtSignature != null) {
|
|
20985
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
20986
|
+
}
|
|
20987
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
20988
|
+
'videoMetadata',
|
|
20989
|
+
]);
|
|
20990
|
+
if (fromVideoMetadata != null) {
|
|
20991
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
20992
|
+
}
|
|
20993
|
+
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
20994
|
+
throw new Error('toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20995
|
+
}
|
|
20996
|
+
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
20997
|
+
throw new Error('toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20998
|
+
}
|
|
20999
|
+
if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
|
|
21000
|
+
throw new Error('partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
21001
|
+
}
|
|
21002
|
+
return toObject;
|
|
21003
|
+
}
|
|
21004
|
+
function reinforcementTuningExampleToVertex(fromObject, rootObject) {
|
|
21005
|
+
const toObject = {};
|
|
21006
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
21007
|
+
if (fromContents != null) {
|
|
21008
|
+
let transformedList = fromContents;
|
|
21009
|
+
if (Array.isArray(transformedList)) {
|
|
21010
|
+
transformedList = transformedList.map((item) => {
|
|
21011
|
+
return contentToVertex(item);
|
|
21012
|
+
});
|
|
21013
|
+
}
|
|
21014
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
21015
|
+
}
|
|
21016
|
+
const fromReferences = getValueByPath(fromObject, ['references']);
|
|
21017
|
+
if (fromReferences != null) {
|
|
21018
|
+
setValueByPath(toObject, ['references'], fromReferences);
|
|
21019
|
+
}
|
|
21020
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
21021
|
+
'systemInstruction',
|
|
21022
|
+
]);
|
|
21023
|
+
if (fromSystemInstruction != null) {
|
|
21024
|
+
setValueByPath(toObject, ['systemInstruction'], contentToVertex(fromSystemInstruction));
|
|
21025
|
+
}
|
|
21026
|
+
return toObject;
|
|
21027
|
+
}
|
|
20765
21028
|
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
20766
21029
|
const toObject = {};
|
|
20767
21030
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
@@ -20995,6 +21258,12 @@ function tuningJobFromVertex(fromObject, rootObject) {
|
|
|
20995
21258
|
if (fromDistillationSpec != null) {
|
|
20996
21259
|
setValueByPath(toObject, ['distillationSpec'], distillationSpecFromVertex(fromDistillationSpec));
|
|
20997
21260
|
}
|
|
21261
|
+
const fromReinforcementTuningSpec = getValueByPath(fromObject, [
|
|
21262
|
+
'reinforcementTuningSpec',
|
|
21263
|
+
]);
|
|
21264
|
+
if (fromReinforcementTuningSpec != null) {
|
|
21265
|
+
setValueByPath(toObject, ['reinforcementTuningSpec'], fromReinforcementTuningSpec);
|
|
21266
|
+
}
|
|
20998
21267
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
20999
21268
|
'tuningDataStats',
|
|
21000
21269
|
]);
|
|
@@ -21137,6 +21406,62 @@ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
|
21137
21406
|
}
|
|
21138
21407
|
return toObject;
|
|
21139
21408
|
}
|
|
21409
|
+
function validateRewardParametersToVertex(fromObject, rootObject) {
|
|
21410
|
+
const toObject = {};
|
|
21411
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
21412
|
+
if (fromParent != null) {
|
|
21413
|
+
setValueByPath(toObject, ['_url', 'parent'], fromParent);
|
|
21414
|
+
}
|
|
21415
|
+
const fromSampleResponse = getValueByPath(fromObject, [
|
|
21416
|
+
'sampleResponse',
|
|
21417
|
+
]);
|
|
21418
|
+
if (fromSampleResponse != null) {
|
|
21419
|
+
setValueByPath(toObject, ['sampleResponse'], contentToVertex(fromSampleResponse));
|
|
21420
|
+
}
|
|
21421
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
21422
|
+
if (fromExample != null) {
|
|
21423
|
+
setValueByPath(toObject, ['example'], reinforcementTuningExampleToVertex(fromExample));
|
|
21424
|
+
}
|
|
21425
|
+
const fromSingleRewardConfig = getValueByPath(fromObject, [
|
|
21426
|
+
'singleRewardConfig',
|
|
21427
|
+
]);
|
|
21428
|
+
if (fromSingleRewardConfig != null) {
|
|
21429
|
+
setValueByPath(toObject, ['singleRewardConfig'], fromSingleRewardConfig);
|
|
21430
|
+
}
|
|
21431
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
21432
|
+
'compositeRewardConfig',
|
|
21433
|
+
]);
|
|
21434
|
+
if (fromCompositeRewardConfig != null) {
|
|
21435
|
+
setValueByPath(toObject, ['compositeRewardConfig'], fromCompositeRewardConfig);
|
|
21436
|
+
}
|
|
21437
|
+
return toObject;
|
|
21438
|
+
}
|
|
21439
|
+
function validateRewardResponseFromVertex(fromObject, _rootObject) {
|
|
21440
|
+
const toObject = {};
|
|
21441
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
21442
|
+
'sdkHttpResponse',
|
|
21443
|
+
]);
|
|
21444
|
+
if (fromSdkHttpResponse != null) {
|
|
21445
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
21446
|
+
}
|
|
21447
|
+
const fromOverallReward = getValueByPath(fromObject, [
|
|
21448
|
+
'overallReward',
|
|
21449
|
+
]);
|
|
21450
|
+
if (fromOverallReward != null) {
|
|
21451
|
+
setValueByPath(toObject, ['overallReward'], fromOverallReward);
|
|
21452
|
+
}
|
|
21453
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
21454
|
+
if (fromError != null) {
|
|
21455
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
21456
|
+
}
|
|
21457
|
+
const fromRewardInfoDetails = getValueByPath(fromObject, [
|
|
21458
|
+
'rewardInfoDetails',
|
|
21459
|
+
]);
|
|
21460
|
+
if (fromRewardInfoDetails != null) {
|
|
21461
|
+
setValueByPath(toObject, ['rewardInfoDetails'], fromRewardInfoDetails);
|
|
21462
|
+
}
|
|
21463
|
+
return toObject;
|
|
21464
|
+
}
|
|
21140
21465
|
|
|
21141
21466
|
/**
|
|
21142
21467
|
* @license
|
|
@@ -21483,6 +21808,46 @@ class Tunings extends BaseModule {
|
|
|
21483
21808
|
});
|
|
21484
21809
|
}
|
|
21485
21810
|
}
|
|
21811
|
+
async validateReward(params) {
|
|
21812
|
+
var _a, _b;
|
|
21813
|
+
let response;
|
|
21814
|
+
let path = '';
|
|
21815
|
+
let queryParams = {};
|
|
21816
|
+
if (this.apiClient.isVertexAI()) {
|
|
21817
|
+
const body = validateRewardParametersToVertex(params);
|
|
21818
|
+
path = formatMap('{parent}/tuningJobs:validateReinforcementTuningReward', body['_url']);
|
|
21819
|
+
queryParams = body['_query'];
|
|
21820
|
+
delete body['_url'];
|
|
21821
|
+
delete body['_query'];
|
|
21822
|
+
response = this.apiClient
|
|
21823
|
+
.request({
|
|
21824
|
+
path: path,
|
|
21825
|
+
queryParams: queryParams,
|
|
21826
|
+
body: JSON.stringify(body),
|
|
21827
|
+
httpMethod: 'POST',
|
|
21828
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
21829
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
21830
|
+
})
|
|
21831
|
+
.then((httpResponse) => {
|
|
21832
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
21833
|
+
const response = jsonResponse;
|
|
21834
|
+
response.sdkHttpResponse = {
|
|
21835
|
+
headers: httpResponse.headers,
|
|
21836
|
+
};
|
|
21837
|
+
return response;
|
|
21838
|
+
});
|
|
21839
|
+
});
|
|
21840
|
+
return response.then((apiResponse) => {
|
|
21841
|
+
const resp = validateRewardResponseFromVertex(apiResponse);
|
|
21842
|
+
const typedResp = new ValidateRewardResponse();
|
|
21843
|
+
Object.assign(typedResp, resp);
|
|
21844
|
+
return typedResp;
|
|
21845
|
+
});
|
|
21846
|
+
}
|
|
21847
|
+
else {
|
|
21848
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
21849
|
+
}
|
|
21850
|
+
}
|
|
21486
21851
|
}
|
|
21487
21852
|
|
|
21488
21853
|
const MAX_CHUNK_SIZE = 1024 * 1024 * 8; // bytes
|
|
@@ -22109,6 +22474,8 @@ exports.Pager = Pager;
|
|
|
22109
22474
|
exports.RawReferenceImage = RawReferenceImage;
|
|
22110
22475
|
exports.RecontextImageResponse = RecontextImageResponse;
|
|
22111
22476
|
exports.RegisterFilesResponse = RegisterFilesResponse;
|
|
22477
|
+
exports.ReinforcementTuningAutoraterScorerParsedResponseConversionScorer = ReinforcementTuningAutoraterScorerParsedResponseConversionScorer;
|
|
22478
|
+
exports.ReinforcementTuningParseResponseConfig = ReinforcementTuningParseResponseConfig;
|
|
22112
22479
|
exports.ReplayResponse = ReplayResponse;
|
|
22113
22480
|
exports.SegmentImageResponse = SegmentImageResponse;
|
|
22114
22481
|
exports.Session = Session;
|
|
@@ -22121,6 +22488,7 @@ exports.UploadToFileSearchStoreOperation = UploadToFileSearchStoreOperation;
|
|
|
22121
22488
|
exports.UploadToFileSearchStoreResponse = UploadToFileSearchStoreResponse;
|
|
22122
22489
|
exports.UploadToFileSearchStoreResumableResponse = UploadToFileSearchStoreResumableResponse;
|
|
22123
22490
|
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
22491
|
+
exports.ValidateRewardResponse = ValidateRewardResponse;
|
|
22124
22492
|
exports.createFunctionResponsePartFromBase64 = createFunctionResponsePartFromBase64;
|
|
22125
22493
|
exports.createFunctionResponsePartFromUri = createFunctionResponsePartFromUri;
|
|
22126
22494
|
exports.createModelContent = createModelContent;
|