@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.mjs
CHANGED
|
@@ -626,7 +626,7 @@ var Language;
|
|
|
626
626
|
*/
|
|
627
627
|
Language["PYTHON"] = "PYTHON";
|
|
628
628
|
})(Language || (Language = {}));
|
|
629
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
629
|
+
/** Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */
|
|
630
630
|
var FunctionResponseScheduling;
|
|
631
631
|
(function (FunctionResponseScheduling) {
|
|
632
632
|
/**
|
|
@@ -1822,6 +1822,58 @@ var ImageResizeMode;
|
|
|
1822
1822
|
*/
|
|
1823
1823
|
ImageResizeMode["PAD"] = "PAD";
|
|
1824
1824
|
})(ImageResizeMode || (ImageResizeMode = {}));
|
|
1825
|
+
/** Defines how to parse sample response. */
|
|
1826
|
+
var ResponseParseType;
|
|
1827
|
+
(function (ResponseParseType) {
|
|
1828
|
+
/**
|
|
1829
|
+
* Default value. This value is unused.
|
|
1830
|
+
*/
|
|
1831
|
+
ResponseParseType["RESPONSE_PARSE_TYPE_UNSPECIFIED"] = "RESPONSE_PARSE_TYPE_UNSPECIFIED";
|
|
1832
|
+
/**
|
|
1833
|
+
* Use the sample response as is.
|
|
1834
|
+
*/
|
|
1835
|
+
ResponseParseType["IDENTITY"] = "IDENTITY";
|
|
1836
|
+
/**
|
|
1837
|
+
* Use regex to extract the important part of sample response.
|
|
1838
|
+
*/
|
|
1839
|
+
ResponseParseType["REGEX_EXTRACT"] = "REGEX_EXTRACT";
|
|
1840
|
+
})(ResponseParseType || (ResponseParseType = {}));
|
|
1841
|
+
/** Match operation to use for evaluation. */
|
|
1842
|
+
var MatchOperation;
|
|
1843
|
+
(function (MatchOperation) {
|
|
1844
|
+
/**
|
|
1845
|
+
* Default value. This value is unused.
|
|
1846
|
+
*/
|
|
1847
|
+
MatchOperation["MATCH_OPERATION_UNSPECIFIED"] = "MATCH_OPERATION_UNSPECIFIED";
|
|
1848
|
+
/**
|
|
1849
|
+
* Equivalent to GoogleSQL `REGEX_CONTAINS(target, expression)`.
|
|
1850
|
+
*/
|
|
1851
|
+
MatchOperation["REGEX_CONTAINS"] = "REGEX_CONTAINS";
|
|
1852
|
+
/**
|
|
1853
|
+
* `expression` is a substring of target.
|
|
1854
|
+
*/
|
|
1855
|
+
MatchOperation["PARTIAL_MATCH"] = "PARTIAL_MATCH";
|
|
1856
|
+
/**
|
|
1857
|
+
* `expression` is an exact match of target.
|
|
1858
|
+
*/
|
|
1859
|
+
MatchOperation["EXACT_MATCH"] = "EXACT_MATCH";
|
|
1860
|
+
})(MatchOperation || (MatchOperation = {}));
|
|
1861
|
+
/** Represents how much to think for the tuning job. */
|
|
1862
|
+
var ReinforcementTuningThinkingLevel;
|
|
1863
|
+
(function (ReinforcementTuningThinkingLevel) {
|
|
1864
|
+
/**
|
|
1865
|
+
* Unspecified thinking level.
|
|
1866
|
+
*/
|
|
1867
|
+
ReinforcementTuningThinkingLevel["REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED"] = "REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED";
|
|
1868
|
+
/**
|
|
1869
|
+
* Little to no thinking.
|
|
1870
|
+
*/
|
|
1871
|
+
ReinforcementTuningThinkingLevel["MINIMAL"] = "MINIMAL";
|
|
1872
|
+
/**
|
|
1873
|
+
* High thinking level.
|
|
1874
|
+
*/
|
|
1875
|
+
ReinforcementTuningThinkingLevel["HIGH"] = "HIGH";
|
|
1876
|
+
})(ReinforcementTuningThinkingLevel || (ReinforcementTuningThinkingLevel = {}));
|
|
1825
1877
|
/** Enum representing the tuning method. */
|
|
1826
1878
|
var TuningMethod;
|
|
1827
1879
|
(function (TuningMethod) {
|
|
@@ -2215,24 +2267,13 @@ the API in a subsequent turn within a `Content` message, along with the
|
|
|
2215
2267
|
corresponding `ToolCall`. */
|
|
2216
2268
|
class ToolResponse {
|
|
2217
2269
|
}
|
|
2218
|
-
/** Raw media bytes for function response.
|
|
2219
|
-
|
|
2220
|
-
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
2221
|
-
field. */
|
|
2270
|
+
/** Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. */
|
|
2222
2271
|
class FunctionResponseBlob {
|
|
2223
2272
|
}
|
|
2224
|
-
/** URI based data for function response. */
|
|
2273
|
+
/** URI based data for function response. This data type is not supported in Gemini API. */
|
|
2225
2274
|
class FunctionResponseFileData {
|
|
2226
2275
|
}
|
|
2227
|
-
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
2228
|
-
|
|
2229
|
-
A `FunctionResponsePart` consists of data which has an associated datatype. A
|
|
2230
|
-
`FunctionResponsePart` can only contain one of the accepted types in
|
|
2231
|
-
`FunctionResponsePart.data`.
|
|
2232
|
-
|
|
2233
|
-
A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
|
|
2234
|
-
type and subtype of the media if the `inline_data` field is filled with raw
|
|
2235
|
-
bytes. */
|
|
2276
|
+
/** 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. */
|
|
2236
2277
|
class FunctionResponsePart {
|
|
2237
2278
|
}
|
|
2238
2279
|
/**
|
|
@@ -2257,7 +2298,7 @@ function createFunctionResponsePartFromUri(uri, mimeType) {
|
|
|
2257
2298
|
},
|
|
2258
2299
|
};
|
|
2259
2300
|
}
|
|
2260
|
-
/**
|
|
2301
|
+
/** 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. */
|
|
2261
2302
|
class FunctionResponse {
|
|
2262
2303
|
}
|
|
2263
2304
|
/**
|
|
@@ -2685,6 +2726,12 @@ class GenerateVideosOperation {
|
|
|
2685
2726
|
return operation;
|
|
2686
2727
|
}
|
|
2687
2728
|
}
|
|
2729
|
+
/** Defines how to parse sample response for reinforcement tuning. */
|
|
2730
|
+
class ReinforcementTuningParseResponseConfig {
|
|
2731
|
+
}
|
|
2732
|
+
/** Scores responses by directly converting parsed autorater response to float reward (reward is clipped to be within [-1, 1]). */
|
|
2733
|
+
class ReinforcementTuningAutoraterScorerParsedResponseConversionScorer {
|
|
2734
|
+
}
|
|
2688
2735
|
/** The results from an evaluation run performed by the EvaluationService. This data type is not supported in Gemini API. */
|
|
2689
2736
|
class EvaluateDatasetResponse {
|
|
2690
2737
|
}
|
|
@@ -2694,6 +2741,12 @@ class ListTuningJobsResponse {
|
|
|
2694
2741
|
/** Empty response for tunings.cancel method. */
|
|
2695
2742
|
class CancelTuningJobResponse {
|
|
2696
2743
|
}
|
|
2744
|
+
/** Response for the validate_reward method.
|
|
2745
|
+
|
|
2746
|
+
Contains the computed reward for a reinforcement tuning reward
|
|
2747
|
+
configuration. */
|
|
2748
|
+
class ValidateRewardResponse {
|
|
2749
|
+
}
|
|
2697
2750
|
/** Empty response for caches.delete method. */
|
|
2698
2751
|
class DeleteCachedContentResponse {
|
|
2699
2752
|
}
|
|
@@ -5883,7 +5936,7 @@ function blobToMldev$3(fromObject) {
|
|
|
5883
5936
|
}
|
|
5884
5937
|
return toObject;
|
|
5885
5938
|
}
|
|
5886
|
-
function codeExecutionResultToVertex$
|
|
5939
|
+
function codeExecutionResultToVertex$3(fromObject) {
|
|
5887
5940
|
const toObject = {};
|
|
5888
5941
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
5889
5942
|
if (fromOutcome != null) {
|
|
@@ -5916,14 +5969,14 @@ function contentToMldev$3(fromObject) {
|
|
|
5916
5969
|
}
|
|
5917
5970
|
return toObject;
|
|
5918
5971
|
}
|
|
5919
|
-
function contentToVertex$
|
|
5972
|
+
function contentToVertex$3(fromObject) {
|
|
5920
5973
|
const toObject = {};
|
|
5921
5974
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5922
5975
|
if (fromParts != null) {
|
|
5923
5976
|
let transformedList = fromParts;
|
|
5924
5977
|
if (Array.isArray(transformedList)) {
|
|
5925
5978
|
transformedList = transformedList.map((item) => {
|
|
5926
|
-
return partToVertex$
|
|
5979
|
+
return partToVertex$3(item);
|
|
5927
5980
|
});
|
|
5928
5981
|
}
|
|
5929
5982
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -6002,7 +6055,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
6002
6055
|
let transformedList = tContents(fromContents);
|
|
6003
6056
|
if (Array.isArray(transformedList)) {
|
|
6004
6057
|
transformedList = transformedList.map((item) => {
|
|
6005
|
-
return contentToVertex$
|
|
6058
|
+
return contentToVertex$3(item);
|
|
6006
6059
|
});
|
|
6007
6060
|
}
|
|
6008
6061
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -6011,7 +6064,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
6011
6064
|
'systemInstruction',
|
|
6012
6065
|
]);
|
|
6013
6066
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
6014
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$
|
|
6067
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$3(tContent(fromSystemInstruction)));
|
|
6015
6068
|
}
|
|
6016
6069
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
6017
6070
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -6093,7 +6146,7 @@ function deleteCachedContentResponseFromVertex(fromObject) {
|
|
|
6093
6146
|
}
|
|
6094
6147
|
return toObject;
|
|
6095
6148
|
}
|
|
6096
|
-
function executableCodeToVertex$
|
|
6149
|
+
function executableCodeToVertex$3(fromObject) {
|
|
6097
6150
|
const toObject = {};
|
|
6098
6151
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
6099
6152
|
if (fromCode != null) {
|
|
@@ -6307,6 +6360,16 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
6307
6360
|
}
|
|
6308
6361
|
return toObject;
|
|
6309
6362
|
}
|
|
6363
|
+
function mcpServerToVertex$2(fromObject) {
|
|
6364
|
+
const toObject = {};
|
|
6365
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
6366
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6367
|
+
}
|
|
6368
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
6369
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6370
|
+
}
|
|
6371
|
+
return toObject;
|
|
6372
|
+
}
|
|
6310
6373
|
function partToMldev$3(fromObject) {
|
|
6311
6374
|
const toObject = {};
|
|
6312
6375
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -6379,7 +6442,7 @@ function partToMldev$3(fromObject) {
|
|
|
6379
6442
|
}
|
|
6380
6443
|
return toObject;
|
|
6381
6444
|
}
|
|
6382
|
-
function partToVertex$
|
|
6445
|
+
function partToVertex$3(fromObject) {
|
|
6383
6446
|
const toObject = {};
|
|
6384
6447
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
6385
6448
|
'mediaResolution',
|
|
@@ -6391,13 +6454,13 @@ function partToVertex$2(fromObject) {
|
|
|
6391
6454
|
'codeExecutionResult',
|
|
6392
6455
|
]);
|
|
6393
6456
|
if (fromCodeExecutionResult != null) {
|
|
6394
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
6457
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$3(fromCodeExecutionResult));
|
|
6395
6458
|
}
|
|
6396
6459
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
6397
6460
|
'executableCode',
|
|
6398
6461
|
]);
|
|
6399
6462
|
if (fromExecutableCode != null) {
|
|
6400
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
6463
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$3(fromExecutableCode));
|
|
6401
6464
|
}
|
|
6402
6465
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
6403
6466
|
if (fromFileData != null) {
|
|
@@ -6616,8 +6679,15 @@ function toolToVertex$2(fromObject) {
|
|
|
6616
6679
|
if (fromUrlContext != null) {
|
|
6617
6680
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
6618
6681
|
}
|
|
6619
|
-
|
|
6620
|
-
|
|
6682
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
6683
|
+
if (fromMcpServers != null) {
|
|
6684
|
+
let transformedList = fromMcpServers;
|
|
6685
|
+
if (Array.isArray(transformedList)) {
|
|
6686
|
+
transformedList = transformedList.map((item) => {
|
|
6687
|
+
return mcpServerToVertex$2(item);
|
|
6688
|
+
});
|
|
6689
|
+
}
|
|
6690
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
6621
6691
|
}
|
|
6622
6692
|
return toObject;
|
|
6623
6693
|
}
|
|
@@ -7955,7 +8025,7 @@ function blobToMldev$2(fromObject) {
|
|
|
7955
8025
|
}
|
|
7956
8026
|
return toObject;
|
|
7957
8027
|
}
|
|
7958
|
-
function codeExecutionResultToVertex$
|
|
8028
|
+
function codeExecutionResultToVertex$2(fromObject) {
|
|
7959
8029
|
const toObject = {};
|
|
7960
8030
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
7961
8031
|
if (fromOutcome != null) {
|
|
@@ -7988,14 +8058,14 @@ function contentToMldev$2(fromObject) {
|
|
|
7988
8058
|
}
|
|
7989
8059
|
return toObject;
|
|
7990
8060
|
}
|
|
7991
|
-
function contentToVertex$
|
|
8061
|
+
function contentToVertex$2(fromObject) {
|
|
7992
8062
|
const toObject = {};
|
|
7993
8063
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7994
8064
|
if (fromParts != null) {
|
|
7995
8065
|
let transformedList = fromParts;
|
|
7996
8066
|
if (Array.isArray(transformedList)) {
|
|
7997
8067
|
transformedList = transformedList.map((item) => {
|
|
7998
|
-
return partToVertex$
|
|
8068
|
+
return partToVertex$2(item);
|
|
7999
8069
|
});
|
|
8000
8070
|
}
|
|
8001
8071
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -8006,7 +8076,7 @@ function contentToVertex$1(fromObject) {
|
|
|
8006
8076
|
}
|
|
8007
8077
|
return toObject;
|
|
8008
8078
|
}
|
|
8009
|
-
function executableCodeToVertex$
|
|
8079
|
+
function executableCodeToVertex$2(fromObject) {
|
|
8010
8080
|
const toObject = {};
|
|
8011
8081
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
8012
8082
|
if (fromCode != null) {
|
|
@@ -8345,11 +8415,11 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
8345
8415
|
}
|
|
8346
8416
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8347
8417
|
}
|
|
8348
|
-
const
|
|
8349
|
-
'
|
|
8418
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
8419
|
+
'translationConfig',
|
|
8350
8420
|
]);
|
|
8351
|
-
if (parentObject !== undefined &&
|
|
8352
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
8421
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
8422
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
8353
8423
|
}
|
|
8354
8424
|
return toObject;
|
|
8355
8425
|
}
|
|
@@ -8415,7 +8485,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8415
8485
|
'systemInstruction',
|
|
8416
8486
|
]);
|
|
8417
8487
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
8418
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$
|
|
8488
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$2(tContent(fromSystemInstruction)));
|
|
8419
8489
|
}
|
|
8420
8490
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
8421
8491
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -8483,8 +8553,8 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8483
8553
|
}
|
|
8484
8554
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8485
8555
|
}
|
|
8486
|
-
if (getValueByPath(fromObject, ['
|
|
8487
|
-
throw new Error('
|
|
8556
|
+
if (getValueByPath(fromObject, ['translationConfig']) !== undefined) {
|
|
8557
|
+
throw new Error('translationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8488
8558
|
}
|
|
8489
8559
|
return toObject;
|
|
8490
8560
|
}
|
|
@@ -8676,6 +8746,16 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
8676
8746
|
}
|
|
8677
8747
|
return toObject;
|
|
8678
8748
|
}
|
|
8749
|
+
function mcpServerToVertex$1(fromObject) {
|
|
8750
|
+
const toObject = {};
|
|
8751
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
8752
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8753
|
+
}
|
|
8754
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
8755
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8756
|
+
}
|
|
8757
|
+
return toObject;
|
|
8758
|
+
}
|
|
8679
8759
|
function partToMldev$2(fromObject) {
|
|
8680
8760
|
const toObject = {};
|
|
8681
8761
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -8748,7 +8828,7 @@ function partToMldev$2(fromObject) {
|
|
|
8748
8828
|
}
|
|
8749
8829
|
return toObject;
|
|
8750
8830
|
}
|
|
8751
|
-
function partToVertex$
|
|
8831
|
+
function partToVertex$2(fromObject) {
|
|
8752
8832
|
const toObject = {};
|
|
8753
8833
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
8754
8834
|
'mediaResolution',
|
|
@@ -8760,13 +8840,13 @@ function partToVertex$1(fromObject) {
|
|
|
8760
8840
|
'codeExecutionResult',
|
|
8761
8841
|
]);
|
|
8762
8842
|
if (fromCodeExecutionResult != null) {
|
|
8763
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$
|
|
8843
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$2(fromCodeExecutionResult));
|
|
8764
8844
|
}
|
|
8765
8845
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
8766
8846
|
'executableCode',
|
|
8767
8847
|
]);
|
|
8768
8848
|
if (fromExecutableCode != null) {
|
|
8769
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$
|
|
8849
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$2(fromExecutableCode));
|
|
8770
8850
|
}
|
|
8771
8851
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
8772
8852
|
if (fromFileData != null) {
|
|
@@ -8971,8 +9051,15 @@ function toolToVertex$1(fromObject) {
|
|
|
8971
9051
|
if (fromUrlContext != null) {
|
|
8972
9052
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
8973
9053
|
}
|
|
8974
|
-
|
|
8975
|
-
|
|
9054
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
9055
|
+
if (fromMcpServers != null) {
|
|
9056
|
+
let transformedList = fromMcpServers;
|
|
9057
|
+
if (Array.isArray(transformedList)) {
|
|
9058
|
+
transformedList = transformedList.map((item) => {
|
|
9059
|
+
return mcpServerToVertex$1(item);
|
|
9060
|
+
});
|
|
9061
|
+
}
|
|
9062
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
8976
9063
|
}
|
|
8977
9064
|
return toObject;
|
|
8978
9065
|
}
|
|
@@ -9198,7 +9285,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
9198
9285
|
}
|
|
9199
9286
|
return toObject;
|
|
9200
9287
|
}
|
|
9201
|
-
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
9288
|
+
function codeExecutionResultToVertex$1(fromObject, _rootObject) {
|
|
9202
9289
|
const toObject = {};
|
|
9203
9290
|
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
9204
9291
|
if (fromOutcome != null) {
|
|
@@ -9224,7 +9311,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
9224
9311
|
let transformedList = tContents(fromContents);
|
|
9225
9312
|
if (Array.isArray(transformedList)) {
|
|
9226
9313
|
transformedList = transformedList.map((item) => {
|
|
9227
|
-
return contentToVertex(item);
|
|
9314
|
+
return contentToVertex$1(item);
|
|
9228
9315
|
});
|
|
9229
9316
|
}
|
|
9230
9317
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -9293,14 +9380,14 @@ function contentToMldev$1(fromObject, rootObject) {
|
|
|
9293
9380
|
}
|
|
9294
9381
|
return toObject;
|
|
9295
9382
|
}
|
|
9296
|
-
function contentToVertex(fromObject, rootObject) {
|
|
9383
|
+
function contentToVertex$1(fromObject, rootObject) {
|
|
9297
9384
|
const toObject = {};
|
|
9298
9385
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
9299
9386
|
if (fromParts != null) {
|
|
9300
9387
|
let transformedList = fromParts;
|
|
9301
9388
|
if (Array.isArray(transformedList)) {
|
|
9302
9389
|
transformedList = transformedList.map((item) => {
|
|
9303
|
-
return partToVertex(item);
|
|
9390
|
+
return partToVertex$1(item);
|
|
9304
9391
|
});
|
|
9305
9392
|
}
|
|
9306
9393
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -9344,7 +9431,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
9344
9431
|
'systemInstruction',
|
|
9345
9432
|
]);
|
|
9346
9433
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
9347
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
9434
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
9348
9435
|
}
|
|
9349
9436
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
9350
9437
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -9397,7 +9484,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
9397
9484
|
let transformedList = tContents(fromContents);
|
|
9398
9485
|
if (Array.isArray(transformedList)) {
|
|
9399
9486
|
transformedList = transformedList.map((item) => {
|
|
9400
|
-
return contentToVertex(item);
|
|
9487
|
+
return contentToVertex$1(item);
|
|
9401
9488
|
});
|
|
9402
9489
|
}
|
|
9403
9490
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -9833,7 +9920,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
|
|
|
9833
9920
|
if (discriminatorContent === 'EMBED_CONTENT') {
|
|
9834
9921
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
9835
9922
|
if (fromContent != null) {
|
|
9836
|
-
setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
|
|
9923
|
+
setValueByPath(toObject, ['content'], contentToVertex$1(tContent(fromContent)));
|
|
9837
9924
|
}
|
|
9838
9925
|
}
|
|
9839
9926
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -9925,7 +10012,7 @@ function endpointFromVertex(fromObject, _rootObject) {
|
|
|
9925
10012
|
}
|
|
9926
10013
|
return toObject;
|
|
9927
10014
|
}
|
|
9928
|
-
function executableCodeToVertex(fromObject, _rootObject) {
|
|
10015
|
+
function executableCodeToVertex$1(fromObject, _rootObject) {
|
|
9929
10016
|
const toObject = {};
|
|
9930
10017
|
const fromCode = getValueByPath(fromObject, ['code']);
|
|
9931
10018
|
if (fromCode != null) {
|
|
@@ -10168,7 +10255,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
10168
10255
|
'systemInstruction',
|
|
10169
10256
|
]);
|
|
10170
10257
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
10171
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
10258
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
10172
10259
|
}
|
|
10173
10260
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
10174
10261
|
if (fromTemperature != null) {
|
|
@@ -10373,7 +10460,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
10373
10460
|
let transformedList = tContents(fromContents);
|
|
10374
10461
|
if (Array.isArray(transformedList)) {
|
|
10375
10462
|
transformedList = transformedList.map((item) => {
|
|
10376
|
-
return contentToVertex(item);
|
|
10463
|
+
return contentToVertex$1(item);
|
|
10377
10464
|
});
|
|
10378
10465
|
}
|
|
10379
10466
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -11628,6 +11715,16 @@ function maskReferenceConfigToVertex(fromObject, _rootObject) {
|
|
|
11628
11715
|
}
|
|
11629
11716
|
return toObject;
|
|
11630
11717
|
}
|
|
11718
|
+
function mcpServerToVertex(fromObject, _rootObject) {
|
|
11719
|
+
const toObject = {};
|
|
11720
|
+
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
11721
|
+
throw new Error('name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11722
|
+
}
|
|
11723
|
+
if (getValueByPath(fromObject, ['streamableHttpTransport']) !== undefined) {
|
|
11724
|
+
throw new Error('streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
11725
|
+
}
|
|
11726
|
+
return toObject;
|
|
11727
|
+
}
|
|
11631
11728
|
function modelFromMldev(fromObject, rootObject) {
|
|
11632
11729
|
const toObject = {};
|
|
11633
11730
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -11818,7 +11915,7 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
11818
11915
|
}
|
|
11819
11916
|
return toObject;
|
|
11820
11917
|
}
|
|
11821
|
-
function partToVertex(fromObject, rootObject) {
|
|
11918
|
+
function partToVertex$1(fromObject, rootObject) {
|
|
11822
11919
|
const toObject = {};
|
|
11823
11920
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
11824
11921
|
'mediaResolution',
|
|
@@ -11830,13 +11927,13 @@ function partToVertex(fromObject, rootObject) {
|
|
|
11830
11927
|
'codeExecutionResult',
|
|
11831
11928
|
]);
|
|
11832
11929
|
if (fromCodeExecutionResult != null) {
|
|
11833
|
-
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
11930
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex$1(fromCodeExecutionResult));
|
|
11834
11931
|
}
|
|
11835
11932
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
11836
11933
|
'executableCode',
|
|
11837
11934
|
]);
|
|
11838
11935
|
if (fromExecutableCode != null) {
|
|
11839
|
-
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
11936
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex$1(fromExecutableCode));
|
|
11840
11937
|
}
|
|
11841
11938
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
11842
11939
|
if (fromFileData != null) {
|
|
@@ -12311,7 +12408,7 @@ function toolToMldev$1(fromObject, rootObject) {
|
|
|
12311
12408
|
}
|
|
12312
12409
|
return toObject;
|
|
12313
12410
|
}
|
|
12314
|
-
function toolToVertex(fromObject,
|
|
12411
|
+
function toolToVertex(fromObject, rootObject) {
|
|
12315
12412
|
const toObject = {};
|
|
12316
12413
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
12317
12414
|
if (fromRetrieval != null) {
|
|
@@ -12372,8 +12469,15 @@ function toolToVertex(fromObject, _rootObject) {
|
|
|
12372
12469
|
if (fromUrlContext != null) {
|
|
12373
12470
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
12374
12471
|
}
|
|
12375
|
-
|
|
12376
|
-
|
|
12472
|
+
const fromMcpServers = getValueByPath(fromObject, ['mcpServers']);
|
|
12473
|
+
if (fromMcpServers != null) {
|
|
12474
|
+
let transformedList = fromMcpServers;
|
|
12475
|
+
if (Array.isArray(transformedList)) {
|
|
12476
|
+
transformedList = transformedList.map((item) => {
|
|
12477
|
+
return mcpServerToVertex(item);
|
|
12478
|
+
});
|
|
12479
|
+
}
|
|
12480
|
+
setValueByPath(toObject, ['mcpServers'], transformedList);
|
|
12377
12481
|
}
|
|
12378
12482
|
return toObject;
|
|
12379
12483
|
}
|
|
@@ -12936,7 +13040,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12936
13040
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12937
13041
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12938
13042
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12939
|
-
const SDK_VERSION = '2.
|
|
13043
|
+
const SDK_VERSION = '2.8.0'; // x-release-please-version
|
|
12940
13044
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12941
13045
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12942
13046
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -16586,11 +16690,11 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
16586
16690
|
}
|
|
16587
16691
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
16588
16692
|
}
|
|
16589
|
-
const
|
|
16590
|
-
'
|
|
16693
|
+
const fromTranslationConfig = getValueByPath(fromObject, [
|
|
16694
|
+
'translationConfig',
|
|
16591
16695
|
]);
|
|
16592
|
-
if (parentObject !== undefined &&
|
|
16593
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', '
|
|
16696
|
+
if (parentObject !== undefined && fromTranslationConfig != null) {
|
|
16697
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'translationConfig'], fromTranslationConfig);
|
|
16594
16698
|
}
|
|
16595
16699
|
return toObject;
|
|
16596
16700
|
}
|
|
@@ -19959,6 +20063,39 @@ function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
|
|
|
19959
20063
|
}
|
|
19960
20064
|
return toObject;
|
|
19961
20065
|
}
|
|
20066
|
+
function codeExecutionResultToVertex(fromObject, _rootObject) {
|
|
20067
|
+
const toObject = {};
|
|
20068
|
+
const fromOutcome = getValueByPath(fromObject, ['outcome']);
|
|
20069
|
+
if (fromOutcome != null) {
|
|
20070
|
+
setValueByPath(toObject, ['outcome'], fromOutcome);
|
|
20071
|
+
}
|
|
20072
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
20073
|
+
if (fromOutput != null) {
|
|
20074
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
20075
|
+
}
|
|
20076
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20077
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20078
|
+
}
|
|
20079
|
+
return toObject;
|
|
20080
|
+
}
|
|
20081
|
+
function contentToVertex(fromObject, rootObject) {
|
|
20082
|
+
const toObject = {};
|
|
20083
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
20084
|
+
if (fromParts != null) {
|
|
20085
|
+
let transformedList = fromParts;
|
|
20086
|
+
if (Array.isArray(transformedList)) {
|
|
20087
|
+
transformedList = transformedList.map((item) => {
|
|
20088
|
+
return partToVertex(item);
|
|
20089
|
+
});
|
|
20090
|
+
}
|
|
20091
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
20092
|
+
}
|
|
20093
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
20094
|
+
if (fromRole != null) {
|
|
20095
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
20096
|
+
}
|
|
20097
|
+
return toObject;
|
|
20098
|
+
}
|
|
19962
20099
|
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
19963
20100
|
const toObject = {};
|
|
19964
20101
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
@@ -20047,6 +20184,12 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
20047
20184
|
if (getValueByPath(fromObject, ['maxOutputTokens']) !== undefined) {
|
|
20048
20185
|
throw new Error('maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20049
20186
|
}
|
|
20187
|
+
if (getValueByPath(fromObject, ['thinkingLevel']) !== undefined) {
|
|
20188
|
+
throw new Error('thinkingLevel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20189
|
+
}
|
|
20190
|
+
if (getValueByPath(fromObject, ['validationDatasetUri']) !== undefined) {
|
|
20191
|
+
throw new Error('validationDatasetUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
20192
|
+
}
|
|
20050
20193
|
return toObject;
|
|
20051
20194
|
}
|
|
20052
20195
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -20380,6 +20523,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
20380
20523
|
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
20381
20524
|
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
20382
20525
|
}
|
|
20526
|
+
const fromThinkingLevel = getValueByPath(fromObject, [
|
|
20527
|
+
'thinkingLevel',
|
|
20528
|
+
]);
|
|
20529
|
+
if (parentObject !== undefined && fromThinkingLevel != null) {
|
|
20530
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'hyperParameters', 'thinkingLevel'], fromThinkingLevel);
|
|
20531
|
+
}
|
|
20532
|
+
const fromValidationDatasetUri = getValueByPath(fromObject, [
|
|
20533
|
+
'validationDatasetUri',
|
|
20534
|
+
]);
|
|
20535
|
+
if (parentObject !== undefined && fromValidationDatasetUri != null) {
|
|
20536
|
+
setValueByPath(parentObject, ['reinforcementTuningSpec', 'validationDatasetUri'], fromValidationDatasetUri);
|
|
20537
|
+
}
|
|
20383
20538
|
return toObject;
|
|
20384
20539
|
}
|
|
20385
20540
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -20550,6 +20705,21 @@ function distillationSpecFromVertex(fromObject, rootObject) {
|
|
|
20550
20705
|
}
|
|
20551
20706
|
return toObject;
|
|
20552
20707
|
}
|
|
20708
|
+
function executableCodeToVertex(fromObject, _rootObject) {
|
|
20709
|
+
const toObject = {};
|
|
20710
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
20711
|
+
if (fromCode != null) {
|
|
20712
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
20713
|
+
}
|
|
20714
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
20715
|
+
if (fromLanguage != null) {
|
|
20716
|
+
setValueByPath(toObject, ['language'], fromLanguage);
|
|
20717
|
+
}
|
|
20718
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
20719
|
+
throw new Error('id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20720
|
+
}
|
|
20721
|
+
return toObject;
|
|
20722
|
+
}
|
|
20553
20723
|
function generationConfigFromVertex(fromObject, _rootObject) {
|
|
20554
20724
|
const toObject = {};
|
|
20555
20725
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
@@ -20740,6 +20910,99 @@ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
|
20740
20910
|
}
|
|
20741
20911
|
return toObject;
|
|
20742
20912
|
}
|
|
20913
|
+
function partToVertex(fromObject, rootObject) {
|
|
20914
|
+
const toObject = {};
|
|
20915
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
20916
|
+
'mediaResolution',
|
|
20917
|
+
]);
|
|
20918
|
+
if (fromMediaResolution != null) {
|
|
20919
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
20920
|
+
}
|
|
20921
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
20922
|
+
'codeExecutionResult',
|
|
20923
|
+
]);
|
|
20924
|
+
if (fromCodeExecutionResult != null) {
|
|
20925
|
+
setValueByPath(toObject, ['codeExecutionResult'], codeExecutionResultToVertex(fromCodeExecutionResult));
|
|
20926
|
+
}
|
|
20927
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
20928
|
+
'executableCode',
|
|
20929
|
+
]);
|
|
20930
|
+
if (fromExecutableCode != null) {
|
|
20931
|
+
setValueByPath(toObject, ['executableCode'], executableCodeToVertex(fromExecutableCode));
|
|
20932
|
+
}
|
|
20933
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
20934
|
+
if (fromFileData != null) {
|
|
20935
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
20936
|
+
}
|
|
20937
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
20938
|
+
if (fromFunctionCall != null) {
|
|
20939
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
20940
|
+
}
|
|
20941
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
20942
|
+
'functionResponse',
|
|
20943
|
+
]);
|
|
20944
|
+
if (fromFunctionResponse != null) {
|
|
20945
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
20946
|
+
}
|
|
20947
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
20948
|
+
if (fromInlineData != null) {
|
|
20949
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
20950
|
+
}
|
|
20951
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
20952
|
+
if (fromText != null) {
|
|
20953
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
20954
|
+
}
|
|
20955
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
20956
|
+
if (fromThought != null) {
|
|
20957
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
20958
|
+
}
|
|
20959
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
20960
|
+
'thoughtSignature',
|
|
20961
|
+
]);
|
|
20962
|
+
if (fromThoughtSignature != null) {
|
|
20963
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
20964
|
+
}
|
|
20965
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
20966
|
+
'videoMetadata',
|
|
20967
|
+
]);
|
|
20968
|
+
if (fromVideoMetadata != null) {
|
|
20969
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
20970
|
+
}
|
|
20971
|
+
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
20972
|
+
throw new Error('toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20973
|
+
}
|
|
20974
|
+
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
20975
|
+
throw new Error('toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20976
|
+
}
|
|
20977
|
+
if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
|
|
20978
|
+
throw new Error('partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
20979
|
+
}
|
|
20980
|
+
return toObject;
|
|
20981
|
+
}
|
|
20982
|
+
function reinforcementTuningExampleToVertex(fromObject, rootObject) {
|
|
20983
|
+
const toObject = {};
|
|
20984
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
20985
|
+
if (fromContents != null) {
|
|
20986
|
+
let transformedList = fromContents;
|
|
20987
|
+
if (Array.isArray(transformedList)) {
|
|
20988
|
+
transformedList = transformedList.map((item) => {
|
|
20989
|
+
return contentToVertex(item);
|
|
20990
|
+
});
|
|
20991
|
+
}
|
|
20992
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
20993
|
+
}
|
|
20994
|
+
const fromReferences = getValueByPath(fromObject, ['references']);
|
|
20995
|
+
if (fromReferences != null) {
|
|
20996
|
+
setValueByPath(toObject, ['references'], fromReferences);
|
|
20997
|
+
}
|
|
20998
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
20999
|
+
'systemInstruction',
|
|
21000
|
+
]);
|
|
21001
|
+
if (fromSystemInstruction != null) {
|
|
21002
|
+
setValueByPath(toObject, ['systemInstruction'], contentToVertex(fromSystemInstruction));
|
|
21003
|
+
}
|
|
21004
|
+
return toObject;
|
|
21005
|
+
}
|
|
20743
21006
|
function tunedModelFromMldev(fromObject, _rootObject) {
|
|
20744
21007
|
const toObject = {};
|
|
20745
21008
|
const fromModel = getValueByPath(fromObject, ['name']);
|
|
@@ -20973,6 +21236,12 @@ function tuningJobFromVertex(fromObject, rootObject) {
|
|
|
20973
21236
|
if (fromDistillationSpec != null) {
|
|
20974
21237
|
setValueByPath(toObject, ['distillationSpec'], distillationSpecFromVertex(fromDistillationSpec));
|
|
20975
21238
|
}
|
|
21239
|
+
const fromReinforcementTuningSpec = getValueByPath(fromObject, [
|
|
21240
|
+
'reinforcementTuningSpec',
|
|
21241
|
+
]);
|
|
21242
|
+
if (fromReinforcementTuningSpec != null) {
|
|
21243
|
+
setValueByPath(toObject, ['reinforcementTuningSpec'], fromReinforcementTuningSpec);
|
|
21244
|
+
}
|
|
20976
21245
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
20977
21246
|
'tuningDataStats',
|
|
20978
21247
|
]);
|
|
@@ -21115,6 +21384,62 @@ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
|
|
|
21115
21384
|
}
|
|
21116
21385
|
return toObject;
|
|
21117
21386
|
}
|
|
21387
|
+
function validateRewardParametersToVertex(fromObject, rootObject) {
|
|
21388
|
+
const toObject = {};
|
|
21389
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
21390
|
+
if (fromParent != null) {
|
|
21391
|
+
setValueByPath(toObject, ['_url', 'parent'], fromParent);
|
|
21392
|
+
}
|
|
21393
|
+
const fromSampleResponse = getValueByPath(fromObject, [
|
|
21394
|
+
'sampleResponse',
|
|
21395
|
+
]);
|
|
21396
|
+
if (fromSampleResponse != null) {
|
|
21397
|
+
setValueByPath(toObject, ['sampleResponse'], contentToVertex(fromSampleResponse));
|
|
21398
|
+
}
|
|
21399
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
21400
|
+
if (fromExample != null) {
|
|
21401
|
+
setValueByPath(toObject, ['example'], reinforcementTuningExampleToVertex(fromExample));
|
|
21402
|
+
}
|
|
21403
|
+
const fromSingleRewardConfig = getValueByPath(fromObject, [
|
|
21404
|
+
'singleRewardConfig',
|
|
21405
|
+
]);
|
|
21406
|
+
if (fromSingleRewardConfig != null) {
|
|
21407
|
+
setValueByPath(toObject, ['singleRewardConfig'], fromSingleRewardConfig);
|
|
21408
|
+
}
|
|
21409
|
+
const fromCompositeRewardConfig = getValueByPath(fromObject, [
|
|
21410
|
+
'compositeRewardConfig',
|
|
21411
|
+
]);
|
|
21412
|
+
if (fromCompositeRewardConfig != null) {
|
|
21413
|
+
setValueByPath(toObject, ['compositeRewardConfig'], fromCompositeRewardConfig);
|
|
21414
|
+
}
|
|
21415
|
+
return toObject;
|
|
21416
|
+
}
|
|
21417
|
+
function validateRewardResponseFromVertex(fromObject, _rootObject) {
|
|
21418
|
+
const toObject = {};
|
|
21419
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
21420
|
+
'sdkHttpResponse',
|
|
21421
|
+
]);
|
|
21422
|
+
if (fromSdkHttpResponse != null) {
|
|
21423
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
21424
|
+
}
|
|
21425
|
+
const fromOverallReward = getValueByPath(fromObject, [
|
|
21426
|
+
'overallReward',
|
|
21427
|
+
]);
|
|
21428
|
+
if (fromOverallReward != null) {
|
|
21429
|
+
setValueByPath(toObject, ['overallReward'], fromOverallReward);
|
|
21430
|
+
}
|
|
21431
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
21432
|
+
if (fromError != null) {
|
|
21433
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
21434
|
+
}
|
|
21435
|
+
const fromRewardInfoDetails = getValueByPath(fromObject, [
|
|
21436
|
+
'rewardInfoDetails',
|
|
21437
|
+
]);
|
|
21438
|
+
if (fromRewardInfoDetails != null) {
|
|
21439
|
+
setValueByPath(toObject, ['rewardInfoDetails'], fromRewardInfoDetails);
|
|
21440
|
+
}
|
|
21441
|
+
return toObject;
|
|
21442
|
+
}
|
|
21118
21443
|
|
|
21119
21444
|
/**
|
|
21120
21445
|
* @license
|
|
@@ -21461,6 +21786,46 @@ class Tunings extends BaseModule {
|
|
|
21461
21786
|
});
|
|
21462
21787
|
}
|
|
21463
21788
|
}
|
|
21789
|
+
async validateReward(params) {
|
|
21790
|
+
var _a, _b;
|
|
21791
|
+
let response;
|
|
21792
|
+
let path = '';
|
|
21793
|
+
let queryParams = {};
|
|
21794
|
+
if (this.apiClient.isVertexAI()) {
|
|
21795
|
+
const body = validateRewardParametersToVertex(params);
|
|
21796
|
+
path = formatMap('{parent}/tuningJobs:validateReinforcementTuningReward', body['_url']);
|
|
21797
|
+
queryParams = body['_query'];
|
|
21798
|
+
delete body['_url'];
|
|
21799
|
+
delete body['_query'];
|
|
21800
|
+
response = this.apiClient
|
|
21801
|
+
.request({
|
|
21802
|
+
path: path,
|
|
21803
|
+
queryParams: queryParams,
|
|
21804
|
+
body: JSON.stringify(body),
|
|
21805
|
+
httpMethod: 'POST',
|
|
21806
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
21807
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
21808
|
+
})
|
|
21809
|
+
.then((httpResponse) => {
|
|
21810
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
21811
|
+
const response = jsonResponse;
|
|
21812
|
+
response.sdkHttpResponse = {
|
|
21813
|
+
headers: httpResponse.headers,
|
|
21814
|
+
};
|
|
21815
|
+
return response;
|
|
21816
|
+
});
|
|
21817
|
+
});
|
|
21818
|
+
return response.then((apiResponse) => {
|
|
21819
|
+
const resp = validateRewardResponseFromVertex(apiResponse);
|
|
21820
|
+
const typedResp = new ValidateRewardResponse();
|
|
21821
|
+
Object.assign(typedResp, resp);
|
|
21822
|
+
return typedResp;
|
|
21823
|
+
});
|
|
21824
|
+
}
|
|
21825
|
+
else {
|
|
21826
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
21827
|
+
}
|
|
21828
|
+
}
|
|
21464
21829
|
}
|
|
21465
21830
|
|
|
21466
21831
|
const MAX_CHUNK_SIZE = 1024 * 1024 * 8; // bytes
|
|
@@ -22034,5 +22399,5 @@ function getApiKeyFromEnv() {
|
|
|
22034
22399
|
return envGoogleApiKey || envGeminiApiKey || undefined;
|
|
22035
22400
|
}
|
|
22036
22401
|
|
|
22037
|
-
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 };
|
|
22402
|
+
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 };
|
|
22038
22403
|
//# sourceMappingURL=index.mjs.map
|