@google/genai 1.37.0 → 1.39.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 +195 -50
- package/dist/index.cjs +443 -169
- package/dist/index.mjs +443 -170
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +489 -170
- package/dist/node/index.mjs +489 -171
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +195 -50
- package/dist/tokenizer/node.cjs +16 -0
- package/dist/tokenizer/node.d.ts +14 -0
- package/dist/tokenizer/node.mjs +16 -0
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/web/index.mjs +443 -170
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +195 -50
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -1333,6 +1333,18 @@ var PartMediaResolutionLevel;
|
|
|
1333
1333
|
*/
|
|
1334
1334
|
PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
|
|
1335
1335
|
})(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
|
|
1336
|
+
/** Resource scope. */
|
|
1337
|
+
var ResourceScope;
|
|
1338
|
+
(function (ResourceScope) {
|
|
1339
|
+
/**
|
|
1340
|
+
* When setting base_url, this value configures resource scope to be the collection.
|
|
1341
|
+
The resource name will not include api version, project, or location.
|
|
1342
|
+
For example, if base_url is set to "https://aiplatform.googleapis.com",
|
|
1343
|
+
then the resource name for a Model would be
|
|
1344
|
+
"https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview
|
|
1345
|
+
*/
|
|
1346
|
+
ResourceScope["COLLECTION"] = "COLLECTION";
|
|
1347
|
+
})(ResourceScope || (ResourceScope = {}));
|
|
1336
1348
|
/** Options for feature selection preference. */
|
|
1337
1349
|
var FeatureSelectionPreference;
|
|
1338
1350
|
(function (FeatureSelectionPreference) {
|
|
@@ -1526,6 +1538,10 @@ var TuningMethod;
|
|
|
1526
1538
|
* Preference optimization tuning.
|
|
1527
1539
|
*/
|
|
1528
1540
|
TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
|
|
1541
|
+
/**
|
|
1542
|
+
* Distillation tuning.
|
|
1543
|
+
*/
|
|
1544
|
+
TuningMethod["DISTILLATION"] = "DISTILLATION";
|
|
1529
1545
|
})(TuningMethod || (TuningMethod = {}));
|
|
1530
1546
|
/** State for the lifecycle of a Document. */
|
|
1531
1547
|
var DocumentState;
|
|
@@ -2317,6 +2333,9 @@ class CreateFileResponse {
|
|
|
2317
2333
|
/** Response for the delete file method. */
|
|
2318
2334
|
class DeleteFileResponse {
|
|
2319
2335
|
}
|
|
2336
|
+
/** Response for the _register file method. */
|
|
2337
|
+
class RegisterFilesResponse {
|
|
2338
|
+
}
|
|
2320
2339
|
/** Config for `inlined_responses` parameter. */
|
|
2321
2340
|
class InlinedResponse {
|
|
2322
2341
|
}
|
|
@@ -4169,6 +4188,9 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
|
4169
4188
|
if (fromEnableEnhancedCivicAnswers != null) {
|
|
4170
4189
|
setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
|
|
4171
4190
|
}
|
|
4191
|
+
if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
|
|
4192
|
+
throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
|
|
4193
|
+
}
|
|
4172
4194
|
return toObject;
|
|
4173
4195
|
}
|
|
4174
4196
|
function generateContentResponseFromMldev$1(fromObject) {
|
|
@@ -4308,6 +4330,10 @@ function inlinedResponseFromMldev(fromObject) {
|
|
|
4308
4330
|
if (fromResponse != null) {
|
|
4309
4331
|
setValueByPath(toObject, ['response'], generateContentResponseFromMldev$1(fromResponse));
|
|
4310
4332
|
}
|
|
4333
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
4334
|
+
if (fromMetadata != null) {
|
|
4335
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
4336
|
+
}
|
|
4311
4337
|
const fromError = getValueByPath(fromObject, ['error']);
|
|
4312
4338
|
if (fromError != null) {
|
|
4313
4339
|
setValueByPath(toObject, ['error'], fromError);
|
|
@@ -6748,6 +6774,14 @@ function getFileParametersToMldev(fromObject) {
|
|
|
6748
6774
|
}
|
|
6749
6775
|
return toObject;
|
|
6750
6776
|
}
|
|
6777
|
+
function internalRegisterFilesParametersToMldev(fromObject) {
|
|
6778
|
+
const toObject = {};
|
|
6779
|
+
const fromUris = getValueByPath(fromObject, ['uris']);
|
|
6780
|
+
if (fromUris != null) {
|
|
6781
|
+
setValueByPath(toObject, ['uris'], fromUris);
|
|
6782
|
+
}
|
|
6783
|
+
return toObject;
|
|
6784
|
+
}
|
|
6751
6785
|
function listFilesConfigToMldev(fromObject, parentObject) {
|
|
6752
6786
|
const toObject = {};
|
|
6753
6787
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
@@ -6794,6 +6828,26 @@ function listFilesResponseFromMldev(fromObject) {
|
|
|
6794
6828
|
}
|
|
6795
6829
|
return toObject;
|
|
6796
6830
|
}
|
|
6831
|
+
function registerFilesResponseFromMldev(fromObject) {
|
|
6832
|
+
const toObject = {};
|
|
6833
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
6834
|
+
'sdkHttpResponse',
|
|
6835
|
+
]);
|
|
6836
|
+
if (fromSdkHttpResponse != null) {
|
|
6837
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
6838
|
+
}
|
|
6839
|
+
const fromFiles = getValueByPath(fromObject, ['files']);
|
|
6840
|
+
if (fromFiles != null) {
|
|
6841
|
+
let transformedList = fromFiles;
|
|
6842
|
+
if (Array.isArray(transformedList)) {
|
|
6843
|
+
transformedList = transformedList.map((item) => {
|
|
6844
|
+
return item;
|
|
6845
|
+
});
|
|
6846
|
+
}
|
|
6847
|
+
setValueByPath(toObject, ['files'], transformedList);
|
|
6848
|
+
}
|
|
6849
|
+
return toObject;
|
|
6850
|
+
}
|
|
6797
6851
|
|
|
6798
6852
|
/**
|
|
6799
6853
|
* @license
|
|
@@ -6894,6 +6948,16 @@ class Files extends BaseModule {
|
|
|
6894
6948
|
async download(params) {
|
|
6895
6949
|
await this.apiClient.downloadFile(params);
|
|
6896
6950
|
}
|
|
6951
|
+
/**
|
|
6952
|
+
* Registers Google Cloud Storage files for use with the API.
|
|
6953
|
+
* This method is only available in Node.js environments.
|
|
6954
|
+
*/
|
|
6955
|
+
async registerFiles(params) {
|
|
6956
|
+
throw new Error('registerFiles is only supported in Node.js environments.');
|
|
6957
|
+
}
|
|
6958
|
+
async _registerFiles(params) {
|
|
6959
|
+
return this.registerFilesInternal(params);
|
|
6960
|
+
}
|
|
6897
6961
|
async listInternal(params) {
|
|
6898
6962
|
var _a, _b;
|
|
6899
6963
|
let response;
|
|
@@ -7067,6 +7131,40 @@ class Files extends BaseModule {
|
|
|
7067
7131
|
});
|
|
7068
7132
|
}
|
|
7069
7133
|
}
|
|
7134
|
+
async registerFilesInternal(params) {
|
|
7135
|
+
var _a, _b;
|
|
7136
|
+
let response;
|
|
7137
|
+
let path = '';
|
|
7138
|
+
let queryParams = {};
|
|
7139
|
+
if (this.apiClient.isVertexAI()) {
|
|
7140
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7141
|
+
}
|
|
7142
|
+
else {
|
|
7143
|
+
const body = internalRegisterFilesParametersToMldev(params);
|
|
7144
|
+
path = formatMap('files:register', body['_url']);
|
|
7145
|
+
queryParams = body['_query'];
|
|
7146
|
+
delete body['_url'];
|
|
7147
|
+
delete body['_query'];
|
|
7148
|
+
response = this.apiClient
|
|
7149
|
+
.request({
|
|
7150
|
+
path: path,
|
|
7151
|
+
queryParams: queryParams,
|
|
7152
|
+
body: JSON.stringify(body),
|
|
7153
|
+
httpMethod: 'POST',
|
|
7154
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7155
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7156
|
+
})
|
|
7157
|
+
.then((httpResponse) => {
|
|
7158
|
+
return httpResponse.json();
|
|
7159
|
+
});
|
|
7160
|
+
return response.then((apiResponse) => {
|
|
7161
|
+
const resp = registerFilesResponseFromMldev(apiResponse);
|
|
7162
|
+
const typedResp = new RegisterFilesResponse();
|
|
7163
|
+
Object.assign(typedResp, resp);
|
|
7164
|
+
return typedResp;
|
|
7165
|
+
});
|
|
7166
|
+
}
|
|
7167
|
+
}
|
|
7070
7168
|
}
|
|
7071
7169
|
|
|
7072
7170
|
/**
|
|
@@ -8039,7 +8137,7 @@ function voiceActivityFromVertex(fromObject) {
|
|
|
8039
8137
|
* Copyright 2025 Google LLC
|
|
8040
8138
|
* SPDX-License-Identifier: Apache-2.0
|
|
8041
8139
|
*/
|
|
8042
|
-
function blobToMldev$1(fromObject) {
|
|
8140
|
+
function blobToMldev$1(fromObject, _rootObject) {
|
|
8043
8141
|
const toObject = {};
|
|
8044
8142
|
const fromData = getValueByPath(fromObject, ['data']);
|
|
8045
8143
|
if (fromData != null) {
|
|
@@ -8054,7 +8152,7 @@ function blobToMldev$1(fromObject) {
|
|
|
8054
8152
|
}
|
|
8055
8153
|
return toObject;
|
|
8056
8154
|
}
|
|
8057
|
-
function candidateFromMldev(fromObject) {
|
|
8155
|
+
function candidateFromMldev(fromObject, rootObject) {
|
|
8058
8156
|
const toObject = {};
|
|
8059
8157
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
8060
8158
|
if (fromContent != null) {
|
|
@@ -8114,7 +8212,7 @@ function candidateFromMldev(fromObject) {
|
|
|
8114
8212
|
}
|
|
8115
8213
|
return toObject;
|
|
8116
8214
|
}
|
|
8117
|
-
function citationMetadataFromMldev(fromObject) {
|
|
8215
|
+
function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
8118
8216
|
const toObject = {};
|
|
8119
8217
|
const fromCitations = getValueByPath(fromObject, ['citationSources']);
|
|
8120
8218
|
if (fromCitations != null) {
|
|
@@ -8128,7 +8226,7 @@ function citationMetadataFromMldev(fromObject) {
|
|
|
8128
8226
|
}
|
|
8129
8227
|
return toObject;
|
|
8130
8228
|
}
|
|
8131
|
-
function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
8229
|
+
function computeTokensParametersToVertex(apiClient, fromObject, _rootObject) {
|
|
8132
8230
|
const toObject = {};
|
|
8133
8231
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
8134
8232
|
if (fromModel != null) {
|
|
@@ -8146,7 +8244,7 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
|
8146
8244
|
}
|
|
8147
8245
|
return toObject;
|
|
8148
8246
|
}
|
|
8149
|
-
function computeTokensResponseFromVertex(fromObject) {
|
|
8247
|
+
function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
8150
8248
|
const toObject = {};
|
|
8151
8249
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
8152
8250
|
'sdkHttpResponse',
|
|
@@ -8166,7 +8264,7 @@ function computeTokensResponseFromVertex(fromObject) {
|
|
|
8166
8264
|
}
|
|
8167
8265
|
return toObject;
|
|
8168
8266
|
}
|
|
8169
|
-
function contentEmbeddingFromVertex(fromObject) {
|
|
8267
|
+
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
8170
8268
|
const toObject = {};
|
|
8171
8269
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
8172
8270
|
if (fromValues != null) {
|
|
@@ -8178,7 +8276,7 @@ function contentEmbeddingFromVertex(fromObject) {
|
|
|
8178
8276
|
}
|
|
8179
8277
|
return toObject;
|
|
8180
8278
|
}
|
|
8181
|
-
function contentEmbeddingStatisticsFromVertex(fromObject) {
|
|
8279
|
+
function contentEmbeddingStatisticsFromVertex(fromObject, _rootObject) {
|
|
8182
8280
|
const toObject = {};
|
|
8183
8281
|
const fromTruncated = getValueByPath(fromObject, ['truncated']);
|
|
8184
8282
|
if (fromTruncated != null) {
|
|
@@ -8190,7 +8288,7 @@ function contentEmbeddingStatisticsFromVertex(fromObject) {
|
|
|
8190
8288
|
}
|
|
8191
8289
|
return toObject;
|
|
8192
8290
|
}
|
|
8193
|
-
function contentToMldev$1(fromObject) {
|
|
8291
|
+
function contentToMldev$1(fromObject, rootObject) {
|
|
8194
8292
|
const toObject = {};
|
|
8195
8293
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
8196
8294
|
if (fromParts != null) {
|
|
@@ -8208,7 +8306,7 @@ function contentToMldev$1(fromObject) {
|
|
|
8208
8306
|
}
|
|
8209
8307
|
return toObject;
|
|
8210
8308
|
}
|
|
8211
|
-
function controlReferenceConfigToVertex(fromObject) {
|
|
8309
|
+
function controlReferenceConfigToVertex(fromObject, _rootObject) {
|
|
8212
8310
|
const toObject = {};
|
|
8213
8311
|
const fromControlType = getValueByPath(fromObject, ['controlType']);
|
|
8214
8312
|
if (fromControlType != null) {
|
|
@@ -8222,7 +8320,7 @@ function controlReferenceConfigToVertex(fromObject) {
|
|
|
8222
8320
|
}
|
|
8223
8321
|
return toObject;
|
|
8224
8322
|
}
|
|
8225
|
-
function countTokensConfigToMldev(fromObject) {
|
|
8323
|
+
function countTokensConfigToMldev(fromObject, _rootObject) {
|
|
8226
8324
|
const toObject = {};
|
|
8227
8325
|
if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
|
|
8228
8326
|
throw new Error('systemInstruction parameter is not supported in Gemini API.');
|
|
@@ -8235,7 +8333,7 @@ function countTokensConfigToMldev(fromObject) {
|
|
|
8235
8333
|
}
|
|
8236
8334
|
return toObject;
|
|
8237
8335
|
}
|
|
8238
|
-
function countTokensConfigToVertex(fromObject, parentObject) {
|
|
8336
|
+
function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
8239
8337
|
const toObject = {};
|
|
8240
8338
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
8241
8339
|
'systemInstruction',
|
|
@@ -8261,7 +8359,7 @@ function countTokensConfigToVertex(fromObject, parentObject) {
|
|
|
8261
8359
|
}
|
|
8262
8360
|
return toObject;
|
|
8263
8361
|
}
|
|
8264
|
-
function countTokensParametersToMldev(apiClient, fromObject) {
|
|
8362
|
+
function countTokensParametersToMldev(apiClient, fromObject, rootObject) {
|
|
8265
8363
|
const toObject = {};
|
|
8266
8364
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
8267
8365
|
if (fromModel != null) {
|
|
@@ -8283,7 +8381,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
|
|
|
8283
8381
|
}
|
|
8284
8382
|
return toObject;
|
|
8285
8383
|
}
|
|
8286
|
-
function countTokensParametersToVertex(apiClient, fromObject) {
|
|
8384
|
+
function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
8287
8385
|
const toObject = {};
|
|
8288
8386
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
8289
8387
|
if (fromModel != null) {
|
|
@@ -8305,7 +8403,7 @@ function countTokensParametersToVertex(apiClient, fromObject) {
|
|
|
8305
8403
|
}
|
|
8306
8404
|
return toObject;
|
|
8307
8405
|
}
|
|
8308
|
-
function countTokensResponseFromMldev(fromObject) {
|
|
8406
|
+
function countTokensResponseFromMldev(fromObject, _rootObject) {
|
|
8309
8407
|
const toObject = {};
|
|
8310
8408
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
8311
8409
|
'sdkHttpResponse',
|
|
@@ -8325,7 +8423,7 @@ function countTokensResponseFromMldev(fromObject) {
|
|
|
8325
8423
|
}
|
|
8326
8424
|
return toObject;
|
|
8327
8425
|
}
|
|
8328
|
-
function countTokensResponseFromVertex(fromObject) {
|
|
8426
|
+
function countTokensResponseFromVertex(fromObject, _rootObject) {
|
|
8329
8427
|
const toObject = {};
|
|
8330
8428
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
8331
8429
|
'sdkHttpResponse',
|
|
@@ -8339,7 +8437,7 @@ function countTokensResponseFromVertex(fromObject) {
|
|
|
8339
8437
|
}
|
|
8340
8438
|
return toObject;
|
|
8341
8439
|
}
|
|
8342
|
-
function deleteModelParametersToMldev(apiClient, fromObject) {
|
|
8440
|
+
function deleteModelParametersToMldev(apiClient, fromObject, _rootObject) {
|
|
8343
8441
|
const toObject = {};
|
|
8344
8442
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
8345
8443
|
if (fromModel != null) {
|
|
@@ -8347,7 +8445,7 @@ function deleteModelParametersToMldev(apiClient, fromObject) {
|
|
|
8347
8445
|
}
|
|
8348
8446
|
return toObject;
|
|
8349
8447
|
}
|
|
8350
|
-
function deleteModelParametersToVertex(apiClient, fromObject) {
|
|
8448
|
+
function deleteModelParametersToVertex(apiClient, fromObject, _rootObject) {
|
|
8351
8449
|
const toObject = {};
|
|
8352
8450
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
8353
8451
|
if (fromModel != null) {
|
|
@@ -8355,7 +8453,7 @@ function deleteModelParametersToVertex(apiClient, fromObject) {
|
|
|
8355
8453
|
}
|
|
8356
8454
|
return toObject;
|
|
8357
8455
|
}
|
|
8358
|
-
function deleteModelResponseFromMldev(fromObject) {
|
|
8456
|
+
function deleteModelResponseFromMldev(fromObject, _rootObject) {
|
|
8359
8457
|
const toObject = {};
|
|
8360
8458
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
8361
8459
|
'sdkHttpResponse',
|
|
@@ -8365,7 +8463,7 @@ function deleteModelResponseFromMldev(fromObject) {
|
|
|
8365
8463
|
}
|
|
8366
8464
|
return toObject;
|
|
8367
8465
|
}
|
|
8368
|
-
function deleteModelResponseFromVertex(fromObject) {
|
|
8466
|
+
function deleteModelResponseFromVertex(fromObject, _rootObject) {
|
|
8369
8467
|
const toObject = {};
|
|
8370
8468
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
8371
8469
|
'sdkHttpResponse',
|
|
@@ -8375,7 +8473,7 @@ function deleteModelResponseFromVertex(fromObject) {
|
|
|
8375
8473
|
}
|
|
8376
8474
|
return toObject;
|
|
8377
8475
|
}
|
|
8378
|
-
function editImageConfigToVertex(fromObject, parentObject) {
|
|
8476
|
+
function editImageConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
8379
8477
|
const toObject = {};
|
|
8380
8478
|
const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
|
|
8381
8479
|
if (parentObject !== undefined && fromOutputGcsUri != null) {
|
|
@@ -8465,7 +8563,7 @@ function editImageConfigToVertex(fromObject, parentObject) {
|
|
|
8465
8563
|
}
|
|
8466
8564
|
return toObject;
|
|
8467
8565
|
}
|
|
8468
|
-
function editImageParametersInternalToVertex(apiClient, fromObject) {
|
|
8566
|
+
function editImageParametersInternalToVertex(apiClient, fromObject, rootObject) {
|
|
8469
8567
|
const toObject = {};
|
|
8470
8568
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
8471
8569
|
if (fromModel != null) {
|
|
@@ -8493,7 +8591,7 @@ function editImageParametersInternalToVertex(apiClient, fromObject) {
|
|
|
8493
8591
|
}
|
|
8494
8592
|
return toObject;
|
|
8495
8593
|
}
|
|
8496
|
-
function editImageResponseFromVertex(fromObject) {
|
|
8594
|
+
function editImageResponseFromVertex(fromObject, rootObject) {
|
|
8497
8595
|
const toObject = {};
|
|
8498
8596
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
8499
8597
|
'sdkHttpResponse',
|
|
@@ -8515,7 +8613,7 @@ function editImageResponseFromVertex(fromObject) {
|
|
|
8515
8613
|
}
|
|
8516
8614
|
return toObject;
|
|
8517
8615
|
}
|
|
8518
|
-
function embedContentConfigToMldev(fromObject, parentObject) {
|
|
8616
|
+
function embedContentConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
8519
8617
|
const toObject = {};
|
|
8520
8618
|
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
8521
8619
|
if (parentObject !== undefined && fromTaskType != null) {
|
|
@@ -8539,7 +8637,7 @@ function embedContentConfigToMldev(fromObject, parentObject) {
|
|
|
8539
8637
|
}
|
|
8540
8638
|
return toObject;
|
|
8541
8639
|
}
|
|
8542
|
-
function embedContentConfigToVertex(fromObject, parentObject) {
|
|
8640
|
+
function embedContentConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
8543
8641
|
const toObject = {};
|
|
8544
8642
|
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
8545
8643
|
if (parentObject !== undefined && fromTaskType != null) {
|
|
@@ -8565,7 +8663,7 @@ function embedContentConfigToVertex(fromObject, parentObject) {
|
|
|
8565
8663
|
}
|
|
8566
8664
|
return toObject;
|
|
8567
8665
|
}
|
|
8568
|
-
function embedContentParametersToMldev(apiClient, fromObject) {
|
|
8666
|
+
function embedContentParametersToMldev(apiClient, fromObject, rootObject) {
|
|
8569
8667
|
const toObject = {};
|
|
8570
8668
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
8571
8669
|
if (fromModel != null) {
|
|
@@ -8591,7 +8689,7 @@ function embedContentParametersToMldev(apiClient, fromObject) {
|
|
|
8591
8689
|
}
|
|
8592
8690
|
return toObject;
|
|
8593
8691
|
}
|
|
8594
|
-
function embedContentParametersToVertex(apiClient, fromObject) {
|
|
8692
|
+
function embedContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
8595
8693
|
const toObject = {};
|
|
8596
8694
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
8597
8695
|
if (fromModel != null) {
|
|
@@ -8613,7 +8711,7 @@ function embedContentParametersToVertex(apiClient, fromObject) {
|
|
|
8613
8711
|
}
|
|
8614
8712
|
return toObject;
|
|
8615
8713
|
}
|
|
8616
|
-
function embedContentResponseFromMldev(fromObject) {
|
|
8714
|
+
function embedContentResponseFromMldev(fromObject, _rootObject) {
|
|
8617
8715
|
const toObject = {};
|
|
8618
8716
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
8619
8717
|
'sdkHttpResponse',
|
|
@@ -8637,7 +8735,7 @@ function embedContentResponseFromMldev(fromObject) {
|
|
|
8637
8735
|
}
|
|
8638
8736
|
return toObject;
|
|
8639
8737
|
}
|
|
8640
|
-
function embedContentResponseFromVertex(fromObject) {
|
|
8738
|
+
function embedContentResponseFromVertex(fromObject, rootObject) {
|
|
8641
8739
|
const toObject = {};
|
|
8642
8740
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
8643
8741
|
'sdkHttpResponse',
|
|
@@ -8664,7 +8762,7 @@ function embedContentResponseFromVertex(fromObject) {
|
|
|
8664
8762
|
}
|
|
8665
8763
|
return toObject;
|
|
8666
8764
|
}
|
|
8667
|
-
function endpointFromVertex(fromObject) {
|
|
8765
|
+
function endpointFromVertex(fromObject, _rootObject) {
|
|
8668
8766
|
const toObject = {};
|
|
8669
8767
|
const fromName = getValueByPath(fromObject, ['endpoint']);
|
|
8670
8768
|
if (fromName != null) {
|
|
@@ -8678,7 +8776,7 @@ function endpointFromVertex(fromObject) {
|
|
|
8678
8776
|
}
|
|
8679
8777
|
return toObject;
|
|
8680
8778
|
}
|
|
8681
|
-
function fileDataToMldev$1(fromObject) {
|
|
8779
|
+
function fileDataToMldev$1(fromObject, _rootObject) {
|
|
8682
8780
|
const toObject = {};
|
|
8683
8781
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
8684
8782
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -8693,7 +8791,7 @@ function fileDataToMldev$1(fromObject) {
|
|
|
8693
8791
|
}
|
|
8694
8792
|
return toObject;
|
|
8695
8793
|
}
|
|
8696
|
-
function functionCallToMldev$1(fromObject) {
|
|
8794
|
+
function functionCallToMldev$1(fromObject, _rootObject) {
|
|
8697
8795
|
const toObject = {};
|
|
8698
8796
|
const fromId = getValueByPath(fromObject, ['id']);
|
|
8699
8797
|
if (fromId != null) {
|
|
@@ -8715,7 +8813,7 @@ function functionCallToMldev$1(fromObject) {
|
|
|
8715
8813
|
}
|
|
8716
8814
|
return toObject;
|
|
8717
8815
|
}
|
|
8718
|
-
function functionCallingConfigToMldev(fromObject) {
|
|
8816
|
+
function functionCallingConfigToMldev(fromObject, _rootObject) {
|
|
8719
8817
|
const toObject = {};
|
|
8720
8818
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
8721
8819
|
'allowedFunctionNames',
|
|
@@ -8733,7 +8831,7 @@ function functionCallingConfigToMldev(fromObject) {
|
|
|
8733
8831
|
}
|
|
8734
8832
|
return toObject;
|
|
8735
8833
|
}
|
|
8736
|
-
function functionDeclarationToVertex(fromObject) {
|
|
8834
|
+
function functionDeclarationToVertex(fromObject, _rootObject) {
|
|
8737
8835
|
const toObject = {};
|
|
8738
8836
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
8739
8837
|
if (fromDescription != null) {
|
|
@@ -8768,7 +8866,7 @@ function functionDeclarationToVertex(fromObject) {
|
|
|
8768
8866
|
}
|
|
8769
8867
|
return toObject;
|
|
8770
8868
|
}
|
|
8771
|
-
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
8869
|
+
function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootObject) {
|
|
8772
8870
|
const toObject = {};
|
|
8773
8871
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
8774
8872
|
'systemInstruction',
|
|
@@ -8926,9 +9024,12 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8926
9024
|
if (fromEnableEnhancedCivicAnswers != null) {
|
|
8927
9025
|
setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
|
|
8928
9026
|
}
|
|
9027
|
+
if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
|
|
9028
|
+
throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
|
|
9029
|
+
}
|
|
8929
9030
|
return toObject;
|
|
8930
9031
|
}
|
|
8931
|
-
function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
9032
|
+
function generateContentConfigToVertex(apiClient, fromObject, parentObject, rootObject) {
|
|
8932
9033
|
const toObject = {};
|
|
8933
9034
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
8934
9035
|
'systemInstruction',
|
|
@@ -9094,9 +9195,15 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
9094
9195
|
undefined) {
|
|
9095
9196
|
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
9096
9197
|
}
|
|
9198
|
+
const fromModelArmorConfig = getValueByPath(fromObject, [
|
|
9199
|
+
'modelArmorConfig',
|
|
9200
|
+
]);
|
|
9201
|
+
if (parentObject !== undefined && fromModelArmorConfig != null) {
|
|
9202
|
+
setValueByPath(parentObject, ['modelArmorConfig'], fromModelArmorConfig);
|
|
9203
|
+
}
|
|
9097
9204
|
return toObject;
|
|
9098
9205
|
}
|
|
9099
|
-
function generateContentParametersToMldev(apiClient, fromObject) {
|
|
9206
|
+
function generateContentParametersToMldev(apiClient, fromObject, rootObject) {
|
|
9100
9207
|
const toObject = {};
|
|
9101
9208
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
9102
9209
|
if (fromModel != null) {
|
|
@@ -9118,7 +9225,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
|
|
|
9118
9225
|
}
|
|
9119
9226
|
return toObject;
|
|
9120
9227
|
}
|
|
9121
|
-
function generateContentParametersToVertex(apiClient, fromObject) {
|
|
9228
|
+
function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
9122
9229
|
const toObject = {};
|
|
9123
9230
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
9124
9231
|
if (fromModel != null) {
|
|
@@ -9140,7 +9247,7 @@ function generateContentParametersToVertex(apiClient, fromObject) {
|
|
|
9140
9247
|
}
|
|
9141
9248
|
return toObject;
|
|
9142
9249
|
}
|
|
9143
|
-
function generateContentResponseFromMldev(fromObject) {
|
|
9250
|
+
function generateContentResponseFromMldev(fromObject, rootObject) {
|
|
9144
9251
|
const toObject = {};
|
|
9145
9252
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
9146
9253
|
'sdkHttpResponse',
|
|
@@ -9180,7 +9287,7 @@ function generateContentResponseFromMldev(fromObject) {
|
|
|
9180
9287
|
}
|
|
9181
9288
|
return toObject;
|
|
9182
9289
|
}
|
|
9183
|
-
function generateContentResponseFromVertex(fromObject) {
|
|
9290
|
+
function generateContentResponseFromVertex(fromObject, _rootObject) {
|
|
9184
9291
|
const toObject = {};
|
|
9185
9292
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
9186
9293
|
'sdkHttpResponse',
|
|
@@ -9224,7 +9331,7 @@ function generateContentResponseFromVertex(fromObject) {
|
|
|
9224
9331
|
}
|
|
9225
9332
|
return toObject;
|
|
9226
9333
|
}
|
|
9227
|
-
function generateImagesConfigToMldev(fromObject, parentObject) {
|
|
9334
|
+
function generateImagesConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
9228
9335
|
const toObject = {};
|
|
9229
9336
|
if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
|
|
9230
9337
|
throw new Error('outputGcsUri parameter is not supported in Gemini API.');
|
|
@@ -9306,7 +9413,7 @@ function generateImagesConfigToMldev(fromObject, parentObject) {
|
|
|
9306
9413
|
}
|
|
9307
9414
|
return toObject;
|
|
9308
9415
|
}
|
|
9309
|
-
function generateImagesConfigToVertex(fromObject, parentObject) {
|
|
9416
|
+
function generateImagesConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
9310
9417
|
const toObject = {};
|
|
9311
9418
|
const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
|
|
9312
9419
|
if (parentObject !== undefined && fromOutputGcsUri != null) {
|
|
@@ -9398,7 +9505,7 @@ function generateImagesConfigToVertex(fromObject, parentObject) {
|
|
|
9398
9505
|
}
|
|
9399
9506
|
return toObject;
|
|
9400
9507
|
}
|
|
9401
|
-
function generateImagesParametersToMldev(apiClient, fromObject) {
|
|
9508
|
+
function generateImagesParametersToMldev(apiClient, fromObject, rootObject) {
|
|
9402
9509
|
const toObject = {};
|
|
9403
9510
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
9404
9511
|
if (fromModel != null) {
|
|
@@ -9414,7 +9521,7 @@ function generateImagesParametersToMldev(apiClient, fromObject) {
|
|
|
9414
9521
|
}
|
|
9415
9522
|
return toObject;
|
|
9416
9523
|
}
|
|
9417
|
-
function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
9524
|
+
function generateImagesParametersToVertex(apiClient, fromObject, rootObject) {
|
|
9418
9525
|
const toObject = {};
|
|
9419
9526
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
9420
9527
|
if (fromModel != null) {
|
|
@@ -9430,7 +9537,7 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
|
9430
9537
|
}
|
|
9431
9538
|
return toObject;
|
|
9432
9539
|
}
|
|
9433
|
-
function generateImagesResponseFromMldev(fromObject) {
|
|
9540
|
+
function generateImagesResponseFromMldev(fromObject, rootObject) {
|
|
9434
9541
|
const toObject = {};
|
|
9435
9542
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
9436
9543
|
'sdkHttpResponse',
|
|
@@ -9458,7 +9565,7 @@ function generateImagesResponseFromMldev(fromObject) {
|
|
|
9458
9565
|
}
|
|
9459
9566
|
return toObject;
|
|
9460
9567
|
}
|
|
9461
|
-
function generateImagesResponseFromVertex(fromObject) {
|
|
9568
|
+
function generateImagesResponseFromVertex(fromObject, rootObject) {
|
|
9462
9569
|
const toObject = {};
|
|
9463
9570
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
9464
9571
|
'sdkHttpResponse',
|
|
@@ -9486,7 +9593,7 @@ function generateImagesResponseFromVertex(fromObject) {
|
|
|
9486
9593
|
}
|
|
9487
9594
|
return toObject;
|
|
9488
9595
|
}
|
|
9489
|
-
function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
9596
|
+
function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
|
|
9490
9597
|
const toObject = {};
|
|
9491
9598
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
9492
9599
|
'numberOfVideos',
|
|
@@ -9565,7 +9672,7 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
9565
9672
|
}
|
|
9566
9673
|
return toObject;
|
|
9567
9674
|
}
|
|
9568
|
-
function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
9675
|
+
function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
|
|
9569
9676
|
const toObject = {};
|
|
9570
9677
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
9571
9678
|
'numberOfVideos',
|
|
@@ -9655,7 +9762,7 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
|
9655
9762
|
}
|
|
9656
9763
|
return toObject;
|
|
9657
9764
|
}
|
|
9658
|
-
function generateVideosOperationFromMldev(fromObject) {
|
|
9765
|
+
function generateVideosOperationFromMldev(fromObject, rootObject) {
|
|
9659
9766
|
const toObject = {};
|
|
9660
9767
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
9661
9768
|
if (fromName != null) {
|
|
@@ -9682,7 +9789,7 @@ function generateVideosOperationFromMldev(fromObject) {
|
|
|
9682
9789
|
}
|
|
9683
9790
|
return toObject;
|
|
9684
9791
|
}
|
|
9685
|
-
function generateVideosOperationFromVertex(fromObject) {
|
|
9792
|
+
function generateVideosOperationFromVertex(fromObject, rootObject) {
|
|
9686
9793
|
const toObject = {};
|
|
9687
9794
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
9688
9795
|
if (fromName != null) {
|
|
@@ -9706,7 +9813,7 @@ function generateVideosOperationFromVertex(fromObject) {
|
|
|
9706
9813
|
}
|
|
9707
9814
|
return toObject;
|
|
9708
9815
|
}
|
|
9709
|
-
function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
9816
|
+
function generateVideosParametersToMldev(apiClient, fromObject, rootObject) {
|
|
9710
9817
|
const toObject = {};
|
|
9711
9818
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
9712
9819
|
if (fromModel != null) {
|
|
@@ -9734,7 +9841,7 @@ function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
|
9734
9841
|
}
|
|
9735
9842
|
return toObject;
|
|
9736
9843
|
}
|
|
9737
|
-
function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
9844
|
+
function generateVideosParametersToVertex(apiClient, fromObject, rootObject) {
|
|
9738
9845
|
const toObject = {};
|
|
9739
9846
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
9740
9847
|
if (fromModel != null) {
|
|
@@ -9762,7 +9869,7 @@ function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
|
9762
9869
|
}
|
|
9763
9870
|
return toObject;
|
|
9764
9871
|
}
|
|
9765
|
-
function generateVideosResponseFromMldev(fromObject) {
|
|
9872
|
+
function generateVideosResponseFromMldev(fromObject, rootObject) {
|
|
9766
9873
|
const toObject = {};
|
|
9767
9874
|
const fromGeneratedVideos = getValueByPath(fromObject, [
|
|
9768
9875
|
'generatedSamples',
|
|
@@ -9790,7 +9897,7 @@ function generateVideosResponseFromMldev(fromObject) {
|
|
|
9790
9897
|
}
|
|
9791
9898
|
return toObject;
|
|
9792
9899
|
}
|
|
9793
|
-
function generateVideosResponseFromVertex(fromObject) {
|
|
9900
|
+
function generateVideosResponseFromVertex(fromObject, rootObject) {
|
|
9794
9901
|
const toObject = {};
|
|
9795
9902
|
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
9796
9903
|
if (fromGeneratedVideos != null) {
|
|
@@ -9816,7 +9923,7 @@ function generateVideosResponseFromVertex(fromObject) {
|
|
|
9816
9923
|
}
|
|
9817
9924
|
return toObject;
|
|
9818
9925
|
}
|
|
9819
|
-
function generateVideosSourceToMldev(fromObject, parentObject) {
|
|
9926
|
+
function generateVideosSourceToMldev(fromObject, parentObject, rootObject) {
|
|
9820
9927
|
const toObject = {};
|
|
9821
9928
|
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
9822
9929
|
if (parentObject !== undefined && fromPrompt != null) {
|
|
@@ -9832,7 +9939,7 @@ function generateVideosSourceToMldev(fromObject, parentObject) {
|
|
|
9832
9939
|
}
|
|
9833
9940
|
return toObject;
|
|
9834
9941
|
}
|
|
9835
|
-
function generateVideosSourceToVertex(fromObject, parentObject) {
|
|
9942
|
+
function generateVideosSourceToVertex(fromObject, parentObject, rootObject) {
|
|
9836
9943
|
const toObject = {};
|
|
9837
9944
|
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
9838
9945
|
if (parentObject !== undefined && fromPrompt != null) {
|
|
@@ -9848,7 +9955,7 @@ function generateVideosSourceToVertex(fromObject, parentObject) {
|
|
|
9848
9955
|
}
|
|
9849
9956
|
return toObject;
|
|
9850
9957
|
}
|
|
9851
|
-
function generatedImageFromMldev(fromObject) {
|
|
9958
|
+
function generatedImageFromMldev(fromObject, rootObject) {
|
|
9852
9959
|
const toObject = {};
|
|
9853
9960
|
const fromImage = getValueByPath(fromObject, ['_self']);
|
|
9854
9961
|
if (fromImage != null) {
|
|
@@ -9866,7 +9973,7 @@ function generatedImageFromMldev(fromObject) {
|
|
|
9866
9973
|
}
|
|
9867
9974
|
return toObject;
|
|
9868
9975
|
}
|
|
9869
|
-
function generatedImageFromVertex(fromObject) {
|
|
9976
|
+
function generatedImageFromVertex(fromObject, rootObject) {
|
|
9870
9977
|
const toObject = {};
|
|
9871
9978
|
const fromImage = getValueByPath(fromObject, ['_self']);
|
|
9872
9979
|
if (fromImage != null) {
|
|
@@ -9888,7 +9995,7 @@ function generatedImageFromVertex(fromObject) {
|
|
|
9888
9995
|
}
|
|
9889
9996
|
return toObject;
|
|
9890
9997
|
}
|
|
9891
|
-
function generatedImageMaskFromVertex(fromObject) {
|
|
9998
|
+
function generatedImageMaskFromVertex(fromObject, rootObject) {
|
|
9892
9999
|
const toObject = {};
|
|
9893
10000
|
const fromMask = getValueByPath(fromObject, ['_self']);
|
|
9894
10001
|
if (fromMask != null) {
|
|
@@ -9906,7 +10013,7 @@ function generatedImageMaskFromVertex(fromObject) {
|
|
|
9906
10013
|
}
|
|
9907
10014
|
return toObject;
|
|
9908
10015
|
}
|
|
9909
|
-
function generatedVideoFromMldev(fromObject) {
|
|
10016
|
+
function generatedVideoFromMldev(fromObject, rootObject) {
|
|
9910
10017
|
const toObject = {};
|
|
9911
10018
|
const fromVideo = getValueByPath(fromObject, ['video']);
|
|
9912
10019
|
if (fromVideo != null) {
|
|
@@ -9914,7 +10021,7 @@ function generatedVideoFromMldev(fromObject) {
|
|
|
9914
10021
|
}
|
|
9915
10022
|
return toObject;
|
|
9916
10023
|
}
|
|
9917
|
-
function generatedVideoFromVertex(fromObject) {
|
|
10024
|
+
function generatedVideoFromVertex(fromObject, rootObject) {
|
|
9918
10025
|
const toObject = {};
|
|
9919
10026
|
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
9920
10027
|
if (fromVideo != null) {
|
|
@@ -9922,7 +10029,7 @@ function generatedVideoFromVertex(fromObject) {
|
|
|
9922
10029
|
}
|
|
9923
10030
|
return toObject;
|
|
9924
10031
|
}
|
|
9925
|
-
function generationConfigToVertex(fromObject) {
|
|
10032
|
+
function generationConfigToVertex(fromObject, _rootObject) {
|
|
9926
10033
|
const toObject = {};
|
|
9927
10034
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
9928
10035
|
'modelSelectionConfig',
|
|
@@ -10050,7 +10157,7 @@ function generationConfigToVertex(fromObject) {
|
|
|
10050
10157
|
}
|
|
10051
10158
|
return toObject;
|
|
10052
10159
|
}
|
|
10053
|
-
function getModelParametersToMldev(apiClient, fromObject) {
|
|
10160
|
+
function getModelParametersToMldev(apiClient, fromObject, _rootObject) {
|
|
10054
10161
|
const toObject = {};
|
|
10055
10162
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
10056
10163
|
if (fromModel != null) {
|
|
@@ -10058,7 +10165,7 @@ function getModelParametersToMldev(apiClient, fromObject) {
|
|
|
10058
10165
|
}
|
|
10059
10166
|
return toObject;
|
|
10060
10167
|
}
|
|
10061
|
-
function getModelParametersToVertex(apiClient, fromObject) {
|
|
10168
|
+
function getModelParametersToVertex(apiClient, fromObject, _rootObject) {
|
|
10062
10169
|
const toObject = {};
|
|
10063
10170
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
10064
10171
|
if (fromModel != null) {
|
|
@@ -10066,7 +10173,7 @@ function getModelParametersToVertex(apiClient, fromObject) {
|
|
|
10066
10173
|
}
|
|
10067
10174
|
return toObject;
|
|
10068
10175
|
}
|
|
10069
|
-
function googleMapsToMldev$1(fromObject) {
|
|
10176
|
+
function googleMapsToMldev$1(fromObject, _rootObject) {
|
|
10070
10177
|
const toObject = {};
|
|
10071
10178
|
if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
|
|
10072
10179
|
throw new Error('authConfig parameter is not supported in Gemini API.');
|
|
@@ -10077,7 +10184,7 @@ function googleMapsToMldev$1(fromObject) {
|
|
|
10077
10184
|
}
|
|
10078
10185
|
return toObject;
|
|
10079
10186
|
}
|
|
10080
|
-
function googleSearchToMldev$1(fromObject) {
|
|
10187
|
+
function googleSearchToMldev$1(fromObject, _rootObject) {
|
|
10081
10188
|
const toObject = {};
|
|
10082
10189
|
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
10083
10190
|
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
@@ -10093,7 +10200,7 @@ function googleSearchToMldev$1(fromObject) {
|
|
|
10093
10200
|
}
|
|
10094
10201
|
return toObject;
|
|
10095
10202
|
}
|
|
10096
|
-
function imageConfigToMldev(fromObject) {
|
|
10203
|
+
function imageConfigToMldev(fromObject, _rootObject) {
|
|
10097
10204
|
const toObject = {};
|
|
10098
10205
|
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
10099
10206
|
if (fromAspectRatio != null) {
|
|
@@ -10115,7 +10222,7 @@ function imageConfigToMldev(fromObject) {
|
|
|
10115
10222
|
}
|
|
10116
10223
|
return toObject;
|
|
10117
10224
|
}
|
|
10118
|
-
function imageConfigToVertex(fromObject) {
|
|
10225
|
+
function imageConfigToVertex(fromObject, _rootObject) {
|
|
10119
10226
|
const toObject = {};
|
|
10120
10227
|
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
10121
10228
|
if (fromAspectRatio != null) {
|
|
@@ -10145,7 +10252,7 @@ function imageConfigToVertex(fromObject) {
|
|
|
10145
10252
|
}
|
|
10146
10253
|
return toObject;
|
|
10147
10254
|
}
|
|
10148
|
-
function imageFromMldev(fromObject) {
|
|
10255
|
+
function imageFromMldev(fromObject, _rootObject) {
|
|
10149
10256
|
const toObject = {};
|
|
10150
10257
|
const fromImageBytes = getValueByPath(fromObject, [
|
|
10151
10258
|
'bytesBase64Encoded',
|
|
@@ -10159,7 +10266,7 @@ function imageFromMldev(fromObject) {
|
|
|
10159
10266
|
}
|
|
10160
10267
|
return toObject;
|
|
10161
10268
|
}
|
|
10162
|
-
function imageFromVertex(fromObject) {
|
|
10269
|
+
function imageFromVertex(fromObject, _rootObject) {
|
|
10163
10270
|
const toObject = {};
|
|
10164
10271
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
10165
10272
|
if (fromGcsUri != null) {
|
|
@@ -10177,7 +10284,7 @@ function imageFromVertex(fromObject) {
|
|
|
10177
10284
|
}
|
|
10178
10285
|
return toObject;
|
|
10179
10286
|
}
|
|
10180
|
-
function imageToMldev(fromObject) {
|
|
10287
|
+
function imageToMldev(fromObject, _rootObject) {
|
|
10181
10288
|
const toObject = {};
|
|
10182
10289
|
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
10183
10290
|
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
@@ -10192,7 +10299,7 @@ function imageToMldev(fromObject) {
|
|
|
10192
10299
|
}
|
|
10193
10300
|
return toObject;
|
|
10194
10301
|
}
|
|
10195
|
-
function imageToVertex(fromObject) {
|
|
10302
|
+
function imageToVertex(fromObject, _rootObject) {
|
|
10196
10303
|
const toObject = {};
|
|
10197
10304
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
10198
10305
|
if (fromGcsUri != null) {
|
|
@@ -10208,7 +10315,7 @@ function imageToVertex(fromObject) {
|
|
|
10208
10315
|
}
|
|
10209
10316
|
return toObject;
|
|
10210
10317
|
}
|
|
10211
|
-
function listModelsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
10318
|
+
function listModelsConfigToMldev(apiClient, fromObject, parentObject, _rootObject) {
|
|
10212
10319
|
const toObject = {};
|
|
10213
10320
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
10214
10321
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -10228,7 +10335,7 @@ function listModelsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
10228
10335
|
}
|
|
10229
10336
|
return toObject;
|
|
10230
10337
|
}
|
|
10231
|
-
function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
10338
|
+
function listModelsConfigToVertex(apiClient, fromObject, parentObject, _rootObject) {
|
|
10232
10339
|
const toObject = {};
|
|
10233
10340
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
10234
10341
|
if (parentObject !== undefined && fromPageSize != null) {
|
|
@@ -10248,7 +10355,7 @@ function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
10248
10355
|
}
|
|
10249
10356
|
return toObject;
|
|
10250
10357
|
}
|
|
10251
|
-
function listModelsParametersToMldev(apiClient, fromObject) {
|
|
10358
|
+
function listModelsParametersToMldev(apiClient, fromObject, rootObject) {
|
|
10252
10359
|
const toObject = {};
|
|
10253
10360
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
10254
10361
|
if (fromConfig != null) {
|
|
@@ -10256,7 +10363,7 @@ function listModelsParametersToMldev(apiClient, fromObject) {
|
|
|
10256
10363
|
}
|
|
10257
10364
|
return toObject;
|
|
10258
10365
|
}
|
|
10259
|
-
function listModelsParametersToVertex(apiClient, fromObject) {
|
|
10366
|
+
function listModelsParametersToVertex(apiClient, fromObject, rootObject) {
|
|
10260
10367
|
const toObject = {};
|
|
10261
10368
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
10262
10369
|
if (fromConfig != null) {
|
|
@@ -10264,7 +10371,7 @@ function listModelsParametersToVertex(apiClient, fromObject) {
|
|
|
10264
10371
|
}
|
|
10265
10372
|
return toObject;
|
|
10266
10373
|
}
|
|
10267
|
-
function listModelsResponseFromMldev(fromObject) {
|
|
10374
|
+
function listModelsResponseFromMldev(fromObject, rootObject) {
|
|
10268
10375
|
const toObject = {};
|
|
10269
10376
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
10270
10377
|
'sdkHttpResponse',
|
|
@@ -10290,7 +10397,7 @@ function listModelsResponseFromMldev(fromObject) {
|
|
|
10290
10397
|
}
|
|
10291
10398
|
return toObject;
|
|
10292
10399
|
}
|
|
10293
|
-
function listModelsResponseFromVertex(fromObject) {
|
|
10400
|
+
function listModelsResponseFromVertex(fromObject, rootObject) {
|
|
10294
10401
|
const toObject = {};
|
|
10295
10402
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
10296
10403
|
'sdkHttpResponse',
|
|
@@ -10316,7 +10423,7 @@ function listModelsResponseFromVertex(fromObject) {
|
|
|
10316
10423
|
}
|
|
10317
10424
|
return toObject;
|
|
10318
10425
|
}
|
|
10319
|
-
function maskReferenceConfigToVertex(fromObject) {
|
|
10426
|
+
function maskReferenceConfigToVertex(fromObject, _rootObject) {
|
|
10320
10427
|
const toObject = {};
|
|
10321
10428
|
const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
|
|
10322
10429
|
if (fromMaskMode != null) {
|
|
@@ -10334,7 +10441,7 @@ function maskReferenceConfigToVertex(fromObject) {
|
|
|
10334
10441
|
}
|
|
10335
10442
|
return toObject;
|
|
10336
10443
|
}
|
|
10337
|
-
function modelFromMldev(fromObject) {
|
|
10444
|
+
function modelFromMldev(fromObject, rootObject) {
|
|
10338
10445
|
const toObject = {};
|
|
10339
10446
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
10340
10447
|
if (fromName != null) {
|
|
@@ -10398,7 +10505,7 @@ function modelFromMldev(fromObject) {
|
|
|
10398
10505
|
}
|
|
10399
10506
|
return toObject;
|
|
10400
10507
|
}
|
|
10401
|
-
function modelFromVertex(fromObject) {
|
|
10508
|
+
function modelFromVertex(fromObject, rootObject) {
|
|
10402
10509
|
const toObject = {};
|
|
10403
10510
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
10404
10511
|
if (fromName != null) {
|
|
@@ -10452,7 +10559,7 @@ function modelFromVertex(fromObject) {
|
|
|
10452
10559
|
}
|
|
10453
10560
|
return toObject;
|
|
10454
10561
|
}
|
|
10455
|
-
function partToMldev$1(fromObject) {
|
|
10562
|
+
function partToMldev$1(fromObject, rootObject) {
|
|
10456
10563
|
const toObject = {};
|
|
10457
10564
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
10458
10565
|
'mediaResolution',
|
|
@@ -10512,7 +10619,7 @@ function partToMldev$1(fromObject) {
|
|
|
10512
10619
|
}
|
|
10513
10620
|
return toObject;
|
|
10514
10621
|
}
|
|
10515
|
-
function productImageToVertex(fromObject) {
|
|
10622
|
+
function productImageToVertex(fromObject, rootObject) {
|
|
10516
10623
|
const toObject = {};
|
|
10517
10624
|
const fromProductImage = getValueByPath(fromObject, ['productImage']);
|
|
10518
10625
|
if (fromProductImage != null) {
|
|
@@ -10520,7 +10627,7 @@ function productImageToVertex(fromObject) {
|
|
|
10520
10627
|
}
|
|
10521
10628
|
return toObject;
|
|
10522
10629
|
}
|
|
10523
|
-
function recontextImageConfigToVertex(fromObject, parentObject) {
|
|
10630
|
+
function recontextImageConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
10524
10631
|
const toObject = {};
|
|
10525
10632
|
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
10526
10633
|
'numberOfImages',
|
|
@@ -10580,7 +10687,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
|
|
|
10580
10687
|
}
|
|
10581
10688
|
return toObject;
|
|
10582
10689
|
}
|
|
10583
|
-
function recontextImageParametersToVertex(apiClient, fromObject) {
|
|
10690
|
+
function recontextImageParametersToVertex(apiClient, fromObject, rootObject) {
|
|
10584
10691
|
const toObject = {};
|
|
10585
10692
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
10586
10693
|
if (fromModel != null) {
|
|
@@ -10596,7 +10703,7 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
|
|
|
10596
10703
|
}
|
|
10597
10704
|
return toObject;
|
|
10598
10705
|
}
|
|
10599
|
-
function recontextImageResponseFromVertex(fromObject) {
|
|
10706
|
+
function recontextImageResponseFromVertex(fromObject, rootObject) {
|
|
10600
10707
|
const toObject = {};
|
|
10601
10708
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
10602
10709
|
'predictions',
|
|
@@ -10612,7 +10719,7 @@ function recontextImageResponseFromVertex(fromObject) {
|
|
|
10612
10719
|
}
|
|
10613
10720
|
return toObject;
|
|
10614
10721
|
}
|
|
10615
|
-
function recontextImageSourceToVertex(fromObject, parentObject) {
|
|
10722
|
+
function recontextImageSourceToVertex(fromObject, parentObject, rootObject) {
|
|
10616
10723
|
const toObject = {};
|
|
10617
10724
|
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
10618
10725
|
if (parentObject !== undefined && fromPrompt != null) {
|
|
@@ -10636,7 +10743,7 @@ function recontextImageSourceToVertex(fromObject, parentObject) {
|
|
|
10636
10743
|
}
|
|
10637
10744
|
return toObject;
|
|
10638
10745
|
}
|
|
10639
|
-
function referenceImageAPIInternalToVertex(fromObject) {
|
|
10746
|
+
function referenceImageAPIInternalToVertex(fromObject, rootObject) {
|
|
10640
10747
|
const toObject = {};
|
|
10641
10748
|
const fromReferenceImage = getValueByPath(fromObject, [
|
|
10642
10749
|
'referenceImage',
|
|
@@ -10680,7 +10787,7 @@ function referenceImageAPIInternalToVertex(fromObject) {
|
|
|
10680
10787
|
}
|
|
10681
10788
|
return toObject;
|
|
10682
10789
|
}
|
|
10683
|
-
function safetyAttributesFromMldev(fromObject) {
|
|
10790
|
+
function safetyAttributesFromMldev(fromObject, _rootObject) {
|
|
10684
10791
|
const toObject = {};
|
|
10685
10792
|
const fromCategories = getValueByPath(fromObject, [
|
|
10686
10793
|
'safetyAttributes',
|
|
@@ -10702,7 +10809,7 @@ function safetyAttributesFromMldev(fromObject) {
|
|
|
10702
10809
|
}
|
|
10703
10810
|
return toObject;
|
|
10704
10811
|
}
|
|
10705
|
-
function safetyAttributesFromVertex(fromObject) {
|
|
10812
|
+
function safetyAttributesFromVertex(fromObject, _rootObject) {
|
|
10706
10813
|
const toObject = {};
|
|
10707
10814
|
const fromCategories = getValueByPath(fromObject, [
|
|
10708
10815
|
'safetyAttributes',
|
|
@@ -10724,7 +10831,7 @@ function safetyAttributesFromVertex(fromObject) {
|
|
|
10724
10831
|
}
|
|
10725
10832
|
return toObject;
|
|
10726
10833
|
}
|
|
10727
|
-
function safetySettingToMldev(fromObject) {
|
|
10834
|
+
function safetySettingToMldev(fromObject, _rootObject) {
|
|
10728
10835
|
const toObject = {};
|
|
10729
10836
|
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
10730
10837
|
if (fromCategory != null) {
|
|
@@ -10739,7 +10846,7 @@ function safetySettingToMldev(fromObject) {
|
|
|
10739
10846
|
}
|
|
10740
10847
|
return toObject;
|
|
10741
10848
|
}
|
|
10742
|
-
function scribbleImageToVertex(fromObject) {
|
|
10849
|
+
function scribbleImageToVertex(fromObject, rootObject) {
|
|
10743
10850
|
const toObject = {};
|
|
10744
10851
|
const fromImage = getValueByPath(fromObject, ['image']);
|
|
10745
10852
|
if (fromImage != null) {
|
|
@@ -10747,7 +10854,7 @@ function scribbleImageToVertex(fromObject) {
|
|
|
10747
10854
|
}
|
|
10748
10855
|
return toObject;
|
|
10749
10856
|
}
|
|
10750
|
-
function segmentImageConfigToVertex(fromObject, parentObject) {
|
|
10857
|
+
function segmentImageConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
10751
10858
|
const toObject = {};
|
|
10752
10859
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
10753
10860
|
if (parentObject !== undefined && fromMode != null) {
|
|
@@ -10781,7 +10888,7 @@ function segmentImageConfigToVertex(fromObject, parentObject) {
|
|
|
10781
10888
|
}
|
|
10782
10889
|
return toObject;
|
|
10783
10890
|
}
|
|
10784
|
-
function segmentImageParametersToVertex(apiClient, fromObject) {
|
|
10891
|
+
function segmentImageParametersToVertex(apiClient, fromObject, rootObject) {
|
|
10785
10892
|
const toObject = {};
|
|
10786
10893
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
10787
10894
|
if (fromModel != null) {
|
|
@@ -10797,7 +10904,7 @@ function segmentImageParametersToVertex(apiClient, fromObject) {
|
|
|
10797
10904
|
}
|
|
10798
10905
|
return toObject;
|
|
10799
10906
|
}
|
|
10800
|
-
function segmentImageResponseFromVertex(fromObject) {
|
|
10907
|
+
function segmentImageResponseFromVertex(fromObject, rootObject) {
|
|
10801
10908
|
const toObject = {};
|
|
10802
10909
|
const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
|
|
10803
10910
|
if (fromGeneratedMasks != null) {
|
|
@@ -10811,7 +10918,7 @@ function segmentImageResponseFromVertex(fromObject) {
|
|
|
10811
10918
|
}
|
|
10812
10919
|
return toObject;
|
|
10813
10920
|
}
|
|
10814
|
-
function segmentImageSourceToVertex(fromObject, parentObject) {
|
|
10921
|
+
function segmentImageSourceToVertex(fromObject, parentObject, rootObject) {
|
|
10815
10922
|
const toObject = {};
|
|
10816
10923
|
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
10817
10924
|
if (parentObject !== undefined && fromPrompt != null) {
|
|
@@ -10829,7 +10936,7 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
|
|
|
10829
10936
|
}
|
|
10830
10937
|
return toObject;
|
|
10831
10938
|
}
|
|
10832
|
-
function toolConfigToMldev(fromObject) {
|
|
10939
|
+
function toolConfigToMldev(fromObject, rootObject) {
|
|
10833
10940
|
const toObject = {};
|
|
10834
10941
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
10835
10942
|
'retrievalConfig',
|
|
@@ -10845,7 +10952,7 @@ function toolConfigToMldev(fromObject) {
|
|
|
10845
10952
|
}
|
|
10846
10953
|
return toObject;
|
|
10847
10954
|
}
|
|
10848
|
-
function toolToMldev$1(fromObject) {
|
|
10955
|
+
function toolToMldev$1(fromObject, rootObject) {
|
|
10849
10956
|
const toObject = {};
|
|
10850
10957
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
10851
10958
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
@@ -10899,7 +11006,7 @@ function toolToMldev$1(fromObject) {
|
|
|
10899
11006
|
}
|
|
10900
11007
|
return toObject;
|
|
10901
11008
|
}
|
|
10902
|
-
function toolToVertex(fromObject) {
|
|
11009
|
+
function toolToVertex(fromObject, rootObject) {
|
|
10903
11010
|
const toObject = {};
|
|
10904
11011
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
10905
11012
|
if (fromRetrieval != null) {
|
|
@@ -10956,7 +11063,7 @@ function toolToVertex(fromObject) {
|
|
|
10956
11063
|
}
|
|
10957
11064
|
return toObject;
|
|
10958
11065
|
}
|
|
10959
|
-
function tunedModelInfoFromMldev(fromObject) {
|
|
11066
|
+
function tunedModelInfoFromMldev(fromObject, _rootObject) {
|
|
10960
11067
|
const toObject = {};
|
|
10961
11068
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
10962
11069
|
if (fromBaseModel != null) {
|
|
@@ -10972,7 +11079,7 @@ function tunedModelInfoFromMldev(fromObject) {
|
|
|
10972
11079
|
}
|
|
10973
11080
|
return toObject;
|
|
10974
11081
|
}
|
|
10975
|
-
function tunedModelInfoFromVertex(fromObject) {
|
|
11082
|
+
function tunedModelInfoFromVertex(fromObject, _rootObject) {
|
|
10976
11083
|
const toObject = {};
|
|
10977
11084
|
const fromBaseModel = getValueByPath(fromObject, [
|
|
10978
11085
|
'labels',
|
|
@@ -10991,7 +11098,7 @@ function tunedModelInfoFromVertex(fromObject) {
|
|
|
10991
11098
|
}
|
|
10992
11099
|
return toObject;
|
|
10993
11100
|
}
|
|
10994
|
-
function updateModelConfigToMldev(fromObject, parentObject) {
|
|
11101
|
+
function updateModelConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
10995
11102
|
const toObject = {};
|
|
10996
11103
|
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
10997
11104
|
if (parentObject !== undefined && fromDisplayName != null) {
|
|
@@ -11009,7 +11116,7 @@ function updateModelConfigToMldev(fromObject, parentObject) {
|
|
|
11009
11116
|
}
|
|
11010
11117
|
return toObject;
|
|
11011
11118
|
}
|
|
11012
|
-
function updateModelConfigToVertex(fromObject, parentObject) {
|
|
11119
|
+
function updateModelConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
11013
11120
|
const toObject = {};
|
|
11014
11121
|
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
11015
11122
|
if (parentObject !== undefined && fromDisplayName != null) {
|
|
@@ -11027,7 +11134,7 @@ function updateModelConfigToVertex(fromObject, parentObject) {
|
|
|
11027
11134
|
}
|
|
11028
11135
|
return toObject;
|
|
11029
11136
|
}
|
|
11030
|
-
function updateModelParametersToMldev(apiClient, fromObject) {
|
|
11137
|
+
function updateModelParametersToMldev(apiClient, fromObject, rootObject) {
|
|
11031
11138
|
const toObject = {};
|
|
11032
11139
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
11033
11140
|
if (fromModel != null) {
|
|
@@ -11039,7 +11146,7 @@ function updateModelParametersToMldev(apiClient, fromObject) {
|
|
|
11039
11146
|
}
|
|
11040
11147
|
return toObject;
|
|
11041
11148
|
}
|
|
11042
|
-
function updateModelParametersToVertex(apiClient, fromObject) {
|
|
11149
|
+
function updateModelParametersToVertex(apiClient, fromObject, rootObject) {
|
|
11043
11150
|
const toObject = {};
|
|
11044
11151
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
11045
11152
|
if (fromModel != null) {
|
|
@@ -11051,7 +11158,7 @@ function updateModelParametersToVertex(apiClient, fromObject) {
|
|
|
11051
11158
|
}
|
|
11052
11159
|
return toObject;
|
|
11053
11160
|
}
|
|
11054
|
-
function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
|
|
11161
|
+
function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject, _rootObject) {
|
|
11055
11162
|
const toObject = {};
|
|
11056
11163
|
const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
|
|
11057
11164
|
if (parentObject !== undefined && fromOutputGcsUri != null) {
|
|
@@ -11115,7 +11222,7 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
|
|
|
11115
11222
|
}
|
|
11116
11223
|
return toObject;
|
|
11117
11224
|
}
|
|
11118
|
-
function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
|
|
11225
|
+
function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject, rootObject) {
|
|
11119
11226
|
const toObject = {};
|
|
11120
11227
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
11121
11228
|
if (fromModel != null) {
|
|
@@ -11137,7 +11244,7 @@ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
|
|
|
11137
11244
|
}
|
|
11138
11245
|
return toObject;
|
|
11139
11246
|
}
|
|
11140
|
-
function upscaleImageResponseFromVertex(fromObject) {
|
|
11247
|
+
function upscaleImageResponseFromVertex(fromObject, rootObject) {
|
|
11141
11248
|
const toObject = {};
|
|
11142
11249
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
11143
11250
|
'sdkHttpResponse',
|
|
@@ -11159,7 +11266,7 @@ function upscaleImageResponseFromVertex(fromObject) {
|
|
|
11159
11266
|
}
|
|
11160
11267
|
return toObject;
|
|
11161
11268
|
}
|
|
11162
|
-
function videoFromMldev(fromObject) {
|
|
11269
|
+
function videoFromMldev(fromObject, _rootObject) {
|
|
11163
11270
|
const toObject = {};
|
|
11164
11271
|
const fromUri = getValueByPath(fromObject, ['uri']);
|
|
11165
11272
|
if (fromUri != null) {
|
|
@@ -11175,7 +11282,7 @@ function videoFromMldev(fromObject) {
|
|
|
11175
11282
|
}
|
|
11176
11283
|
return toObject;
|
|
11177
11284
|
}
|
|
11178
|
-
function videoFromVertex(fromObject) {
|
|
11285
|
+
function videoFromVertex(fromObject, _rootObject) {
|
|
11179
11286
|
const toObject = {};
|
|
11180
11287
|
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
11181
11288
|
if (fromUri != null) {
|
|
@@ -11193,7 +11300,7 @@ function videoFromVertex(fromObject) {
|
|
|
11193
11300
|
}
|
|
11194
11301
|
return toObject;
|
|
11195
11302
|
}
|
|
11196
|
-
function videoGenerationMaskToVertex(fromObject) {
|
|
11303
|
+
function videoGenerationMaskToVertex(fromObject, rootObject) {
|
|
11197
11304
|
const toObject = {};
|
|
11198
11305
|
const fromImage = getValueByPath(fromObject, ['image']);
|
|
11199
11306
|
if (fromImage != null) {
|
|
@@ -11205,7 +11312,7 @@ function videoGenerationMaskToVertex(fromObject) {
|
|
|
11205
11312
|
}
|
|
11206
11313
|
return toObject;
|
|
11207
11314
|
}
|
|
11208
|
-
function videoGenerationReferenceImageToMldev(fromObject) {
|
|
11315
|
+
function videoGenerationReferenceImageToMldev(fromObject, rootObject) {
|
|
11209
11316
|
const toObject = {};
|
|
11210
11317
|
const fromImage = getValueByPath(fromObject, ['image']);
|
|
11211
11318
|
if (fromImage != null) {
|
|
@@ -11219,7 +11326,7 @@ function videoGenerationReferenceImageToMldev(fromObject) {
|
|
|
11219
11326
|
}
|
|
11220
11327
|
return toObject;
|
|
11221
11328
|
}
|
|
11222
|
-
function videoGenerationReferenceImageToVertex(fromObject) {
|
|
11329
|
+
function videoGenerationReferenceImageToVertex(fromObject, rootObject) {
|
|
11223
11330
|
const toObject = {};
|
|
11224
11331
|
const fromImage = getValueByPath(fromObject, ['image']);
|
|
11225
11332
|
if (fromImage != null) {
|
|
@@ -11233,7 +11340,7 @@ function videoGenerationReferenceImageToVertex(fromObject) {
|
|
|
11233
11340
|
}
|
|
11234
11341
|
return toObject;
|
|
11235
11342
|
}
|
|
11236
|
-
function videoToMldev(fromObject) {
|
|
11343
|
+
function videoToMldev(fromObject, _rootObject) {
|
|
11237
11344
|
const toObject = {};
|
|
11238
11345
|
const fromUri = getValueByPath(fromObject, ['uri']);
|
|
11239
11346
|
if (fromUri != null) {
|
|
@@ -11249,7 +11356,7 @@ function videoToMldev(fromObject) {
|
|
|
11249
11356
|
}
|
|
11250
11357
|
return toObject;
|
|
11251
11358
|
}
|
|
11252
|
-
function videoToVertex(fromObject) {
|
|
11359
|
+
function videoToVertex(fromObject, _rootObject) {
|
|
11253
11360
|
const toObject = {};
|
|
11254
11361
|
const fromUri = getValueByPath(fromObject, ['uri']);
|
|
11255
11362
|
if (fromUri != null) {
|
|
@@ -11510,7 +11617,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
11510
11617
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
11511
11618
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
11512
11619
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
11513
|
-
const SDK_VERSION = '1.
|
|
11620
|
+
const SDK_VERSION = '1.39.0'; // x-release-please-version
|
|
11514
11621
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
11515
11622
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
11516
11623
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11520,19 +11627,57 @@ const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
|
11520
11627
|
*/
|
|
11521
11628
|
class ApiClient {
|
|
11522
11629
|
constructor(opts) {
|
|
11523
|
-
var _a, _b;
|
|
11524
|
-
this.clientOptions = Object.assign(
|
|
11630
|
+
var _a, _b, _c;
|
|
11631
|
+
this.clientOptions = Object.assign({}, opts);
|
|
11632
|
+
this.customBaseUrl = (_a = opts.httpOptions) === null || _a === void 0 ? void 0 : _a.baseUrl;
|
|
11633
|
+
if (this.clientOptions.vertexai) {
|
|
11634
|
+
if (this.clientOptions.project && this.clientOptions.location) {
|
|
11635
|
+
this.clientOptions.apiKey = undefined;
|
|
11636
|
+
}
|
|
11637
|
+
else if (this.clientOptions.apiKey) {
|
|
11638
|
+
this.clientOptions.project = undefined;
|
|
11639
|
+
this.clientOptions.location = undefined;
|
|
11640
|
+
}
|
|
11641
|
+
}
|
|
11525
11642
|
const initHttpOptions = {};
|
|
11526
11643
|
if (this.clientOptions.vertexai) {
|
|
11644
|
+
if (!this.clientOptions.location &&
|
|
11645
|
+
!this.clientOptions.apiKey &&
|
|
11646
|
+
!this.customBaseUrl) {
|
|
11647
|
+
this.clientOptions.location = 'global';
|
|
11648
|
+
}
|
|
11649
|
+
const hasSufficientAuth = (this.clientOptions.project && this.clientOptions.location) ||
|
|
11650
|
+
this.clientOptions.apiKey;
|
|
11651
|
+
if (!hasSufficientAuth && !this.customBaseUrl) {
|
|
11652
|
+
throw new Error('Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.');
|
|
11653
|
+
}
|
|
11654
|
+
const hasConstructorAuth = (opts.project && opts.location) || !!opts.apiKey;
|
|
11655
|
+
if (this.customBaseUrl && !hasConstructorAuth) {
|
|
11656
|
+
initHttpOptions.baseUrl = this.customBaseUrl;
|
|
11657
|
+
this.clientOptions.project = undefined;
|
|
11658
|
+
this.clientOptions.location = undefined;
|
|
11659
|
+
}
|
|
11660
|
+
else if (this.clientOptions.apiKey ||
|
|
11661
|
+
this.clientOptions.location === 'global') {
|
|
11662
|
+
// Vertex Express or global endpoint case.
|
|
11663
|
+
initHttpOptions.baseUrl = 'https://aiplatform.googleapis.com/';
|
|
11664
|
+
}
|
|
11665
|
+
else if (this.clientOptions.project && this.clientOptions.location) {
|
|
11666
|
+
initHttpOptions.baseUrl = `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
|
|
11667
|
+
}
|
|
11527
11668
|
initHttpOptions.apiVersion =
|
|
11528
|
-
(
|
|
11529
|
-
initHttpOptions.baseUrl = this.baseUrlFromProjectLocation();
|
|
11530
|
-
this.normalizeAuthParameters();
|
|
11669
|
+
(_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : VERTEX_AI_API_DEFAULT_VERSION;
|
|
11531
11670
|
}
|
|
11532
11671
|
else {
|
|
11533
11672
|
// Gemini API
|
|
11673
|
+
if (!this.clientOptions.apiKey) {
|
|
11674
|
+
throw new ApiError({
|
|
11675
|
+
message: 'API key must be set when using the Gemini API.',
|
|
11676
|
+
status: 403,
|
|
11677
|
+
});
|
|
11678
|
+
}
|
|
11534
11679
|
initHttpOptions.apiVersion =
|
|
11535
|
-
(
|
|
11680
|
+
(_c = this.clientOptions.apiVersion) !== null && _c !== void 0 ? _c : GOOGLE_AI_API_DEFAULT_VERSION;
|
|
11536
11681
|
initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;
|
|
11537
11682
|
}
|
|
11538
11683
|
initHttpOptions.headers = this.getDefaultHeaders();
|
|
@@ -11541,39 +11686,6 @@ class ApiClient {
|
|
|
11541
11686
|
this.clientOptions.httpOptions = this.patchHttpOptions(initHttpOptions, opts.httpOptions);
|
|
11542
11687
|
}
|
|
11543
11688
|
}
|
|
11544
|
-
/**
|
|
11545
|
-
* Determines the base URL for Vertex AI based on project and location.
|
|
11546
|
-
* Uses the global endpoint if location is 'global' or if project/location
|
|
11547
|
-
* are not specified (implying API key usage).
|
|
11548
|
-
* @private
|
|
11549
|
-
*/
|
|
11550
|
-
baseUrlFromProjectLocation() {
|
|
11551
|
-
if (this.clientOptions.project &&
|
|
11552
|
-
this.clientOptions.location &&
|
|
11553
|
-
this.clientOptions.location !== 'global') {
|
|
11554
|
-
// Regional endpoint
|
|
11555
|
-
return `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
|
|
11556
|
-
}
|
|
11557
|
-
// Global endpoint (covers 'global' location and API key usage)
|
|
11558
|
-
return `https://aiplatform.googleapis.com/`;
|
|
11559
|
-
}
|
|
11560
|
-
/**
|
|
11561
|
-
* Normalizes authentication parameters for Vertex AI.
|
|
11562
|
-
* If project and location are provided, API key is cleared.
|
|
11563
|
-
* If project and location are not provided (implying API key usage),
|
|
11564
|
-
* project and location are cleared.
|
|
11565
|
-
* @private
|
|
11566
|
-
*/
|
|
11567
|
-
normalizeAuthParameters() {
|
|
11568
|
-
if (this.clientOptions.project && this.clientOptions.location) {
|
|
11569
|
-
// Using project/location for auth, clear potential API key
|
|
11570
|
-
this.clientOptions.apiKey = undefined;
|
|
11571
|
-
return;
|
|
11572
|
-
}
|
|
11573
|
-
// Using API key for auth (or no auth provided yet), clear project/location
|
|
11574
|
-
this.clientOptions.project = undefined;
|
|
11575
|
-
this.clientOptions.location = undefined;
|
|
11576
|
-
}
|
|
11577
11689
|
isVertexAI() {
|
|
11578
11690
|
var _a;
|
|
11579
11691
|
return (_a = this.clientOptions.vertexai) !== null && _a !== void 0 ? _a : false;
|
|
@@ -11584,6 +11696,9 @@ class ApiClient {
|
|
|
11584
11696
|
getLocation() {
|
|
11585
11697
|
return this.clientOptions.location;
|
|
11586
11698
|
}
|
|
11699
|
+
getCustomBaseUrl() {
|
|
11700
|
+
return this.customBaseUrl;
|
|
11701
|
+
}
|
|
11587
11702
|
async getAuthHeaders() {
|
|
11588
11703
|
const headers = new Headers();
|
|
11589
11704
|
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
@@ -11661,7 +11776,11 @@ class ApiClient {
|
|
|
11661
11776
|
const url = new URL(`${urlElement.join('/')}`);
|
|
11662
11777
|
return url;
|
|
11663
11778
|
}
|
|
11664
|
-
shouldPrependVertexProjectPath(request) {
|
|
11779
|
+
shouldPrependVertexProjectPath(request, httpOptions) {
|
|
11780
|
+
if (httpOptions.baseUrl &&
|
|
11781
|
+
httpOptions.baseUrlResourceScope === ResourceScope.COLLECTION) {
|
|
11782
|
+
return false;
|
|
11783
|
+
}
|
|
11665
11784
|
if (this.clientOptions.apiKey) {
|
|
11666
11785
|
return false;
|
|
11667
11786
|
}
|
|
@@ -11687,7 +11806,7 @@ class ApiClient {
|
|
|
11687
11806
|
if (request.httpOptions) {
|
|
11688
11807
|
patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
|
|
11689
11808
|
}
|
|
11690
|
-
const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
|
|
11809
|
+
const prependProjectLocation = this.shouldPrependVertexProjectPath(request, patchedHttpOptions);
|
|
11691
11810
|
const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
|
|
11692
11811
|
if (request.queryParams) {
|
|
11693
11812
|
for (const [key, value] of Object.entries(request.queryParams)) {
|
|
@@ -11730,7 +11849,7 @@ class ApiClient {
|
|
|
11730
11849
|
if (request.httpOptions) {
|
|
11731
11850
|
patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
|
|
11732
11851
|
}
|
|
11733
|
-
const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
|
|
11852
|
+
const prependProjectLocation = this.shouldPrependVertexProjectPath(request, patchedHttpOptions);
|
|
11734
11853
|
const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
|
|
11735
11854
|
if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
|
|
11736
11855
|
url.searchParams.set('alt', 'sse');
|
|
@@ -12657,8 +12776,19 @@ class Live {
|
|
|
12657
12776
|
}
|
|
12658
12777
|
const headers = mapToHeaders(clientHeaders);
|
|
12659
12778
|
if (this.apiClient.isVertexAI()) {
|
|
12660
|
-
|
|
12661
|
-
|
|
12779
|
+
const project = this.apiClient.getProject();
|
|
12780
|
+
const location = this.apiClient.getLocation();
|
|
12781
|
+
const apiKey = this.apiClient.getApiKey();
|
|
12782
|
+
const hasStandardAuth = (!!project && !!location) || !!apiKey;
|
|
12783
|
+
if (this.apiClient.getCustomBaseUrl() && !hasStandardAuth) {
|
|
12784
|
+
// Custom base URL without standard auth (e.g., proxy).
|
|
12785
|
+
url = websocketBaseUrl;
|
|
12786
|
+
// Auth headers are assumed to be in `clientHeaders` from httpOptions.
|
|
12787
|
+
}
|
|
12788
|
+
else {
|
|
12789
|
+
url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
|
|
12790
|
+
await this.auth.addAuthHeaders(headers, url);
|
|
12791
|
+
}
|
|
12662
12792
|
}
|
|
12663
12793
|
else {
|
|
12664
12794
|
const apiKey = this.apiClient.getApiKey();
|
|
@@ -12704,8 +12834,10 @@ class Live {
|
|
|
12704
12834
|
transformedModel.startsWith('publishers/')) {
|
|
12705
12835
|
const project = this.apiClient.getProject();
|
|
12706
12836
|
const location = this.apiClient.getLocation();
|
|
12707
|
-
|
|
12708
|
-
|
|
12837
|
+
if (project && location) {
|
|
12838
|
+
transformedModel =
|
|
12839
|
+
`projects/${project}/locations/${location}/` + transformedModel;
|
|
12840
|
+
}
|
|
12709
12841
|
}
|
|
12710
12842
|
let clientMessage = {};
|
|
12711
12843
|
if (this.apiClient.isVertexAI() &&
|
|
@@ -13661,7 +13793,7 @@ class Models extends BaseModule {
|
|
|
13661
13793
|
_c = apiResponse_1_1.value;
|
|
13662
13794
|
_d = false;
|
|
13663
13795
|
const chunk = _c;
|
|
13664
|
-
const resp = generateContentResponseFromVertex((yield __await(chunk.json())));
|
|
13796
|
+
const resp = generateContentResponseFromVertex((yield __await(chunk.json())), params);
|
|
13665
13797
|
resp['sdkHttpResponse'] = {
|
|
13666
13798
|
headers: chunk.headers,
|
|
13667
13799
|
};
|
|
@@ -13703,7 +13835,7 @@ class Models extends BaseModule {
|
|
|
13703
13835
|
_c = apiResponse_2_1.value;
|
|
13704
13836
|
_d = false;
|
|
13705
13837
|
const chunk = _c;
|
|
13706
|
-
const resp = generateContentResponseFromMldev((yield __await(chunk.json())));
|
|
13838
|
+
const resp = generateContentResponseFromMldev((yield __await(chunk.json())), params);
|
|
13707
13839
|
resp['sdkHttpResponse'] = {
|
|
13708
13840
|
headers: chunk.headers,
|
|
13709
13841
|
};
|
|
@@ -16636,7 +16768,9 @@ class BaseInteractions extends APIResource {
|
|
|
16636
16768
|
*
|
|
16637
16769
|
* @example
|
|
16638
16770
|
* ```ts
|
|
16639
|
-
* const interaction = await client.interactions.delete('id'
|
|
16771
|
+
* const interaction = await client.interactions.delete('id', {
|
|
16772
|
+
* api_version: 'api_version',
|
|
16773
|
+
* });
|
|
16640
16774
|
* ```
|
|
16641
16775
|
*/
|
|
16642
16776
|
delete(id, params = {}, options) {
|
|
@@ -16648,7 +16782,9 @@ class BaseInteractions extends APIResource {
|
|
|
16648
16782
|
*
|
|
16649
16783
|
* @example
|
|
16650
16784
|
* ```ts
|
|
16651
|
-
* const interaction = await client.interactions.cancel('id'
|
|
16785
|
+
* const interaction = await client.interactions.cancel('id', {
|
|
16786
|
+
* api_version: 'api_version',
|
|
16787
|
+
* });
|
|
16652
16788
|
* ```
|
|
16653
16789
|
*/
|
|
16654
16790
|
cancel(id, params = {}, options) {
|
|
@@ -18145,6 +18281,12 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
18145
18281
|
if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
|
|
18146
18282
|
throw new Error('adapterSize parameter is not supported in Gemini API.');
|
|
18147
18283
|
}
|
|
18284
|
+
if (getValueByPath(fromObject, ['tuningMode']) !== undefined) {
|
|
18285
|
+
throw new Error('tuningMode parameter is not supported in Gemini API.');
|
|
18286
|
+
}
|
|
18287
|
+
if (getValueByPath(fromObject, ['customBaseModel']) !== undefined) {
|
|
18288
|
+
throw new Error('customBaseModel parameter is not supported in Gemini API.');
|
|
18289
|
+
}
|
|
18148
18290
|
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
18149
18291
|
if (parentObject !== undefined && fromBatchSize != null) {
|
|
18150
18292
|
setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
|
|
@@ -18159,6 +18301,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
18159
18301
|
if (getValueByPath(fromObject, ['beta']) !== undefined) {
|
|
18160
18302
|
throw new Error('beta parameter is not supported in Gemini API.');
|
|
18161
18303
|
}
|
|
18304
|
+
if (getValueByPath(fromObject, ['baseTeacherModel']) !== undefined) {
|
|
18305
|
+
throw new Error('baseTeacherModel parameter is not supported in Gemini API.');
|
|
18306
|
+
}
|
|
18307
|
+
if (getValueByPath(fromObject, ['tunedTeacherModelSource']) !== undefined) {
|
|
18308
|
+
throw new Error('tunedTeacherModelSource parameter is not supported in Gemini API.');
|
|
18309
|
+
}
|
|
18310
|
+
if (getValueByPath(fromObject, ['sftLossWeightMultiplier']) !== undefined) {
|
|
18311
|
+
throw new Error('sftLossWeightMultiplier parameter is not supported in Gemini API.');
|
|
18312
|
+
}
|
|
18313
|
+
if (getValueByPath(fromObject, ['outputUri']) !== undefined) {
|
|
18314
|
+
throw new Error('outputUri parameter is not supported in Gemini API.');
|
|
18315
|
+
}
|
|
18162
18316
|
return toObject;
|
|
18163
18317
|
}
|
|
18164
18318
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -18186,6 +18340,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
18186
18340
|
setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
18187
18341
|
}
|
|
18188
18342
|
}
|
|
18343
|
+
else if (discriminatorValidationDataset === 'DISTILLATION') {
|
|
18344
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
18345
|
+
'validationDataset',
|
|
18346
|
+
]);
|
|
18347
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
18348
|
+
setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
18349
|
+
}
|
|
18350
|
+
}
|
|
18189
18351
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
18190
18352
|
'tunedModelDisplayName',
|
|
18191
18353
|
]);
|
|
@@ -18215,6 +18377,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
18215
18377
|
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
18216
18378
|
}
|
|
18217
18379
|
}
|
|
18380
|
+
else if (discriminatorEpochCount === 'DISTILLATION') {
|
|
18381
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
18382
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
18383
|
+
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
18384
|
+
}
|
|
18385
|
+
}
|
|
18218
18386
|
let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
|
|
18219
18387
|
'config',
|
|
18220
18388
|
'method',
|
|
@@ -18242,6 +18410,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
18242
18410
|
], fromLearningRateMultiplier);
|
|
18243
18411
|
}
|
|
18244
18412
|
}
|
|
18413
|
+
else if (discriminatorLearningRateMultiplier === 'DISTILLATION') {
|
|
18414
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
18415
|
+
'learningRateMultiplier',
|
|
18416
|
+
]);
|
|
18417
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
18418
|
+
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
18419
|
+
}
|
|
18420
|
+
}
|
|
18245
18421
|
let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
|
|
18246
18422
|
if (discriminatorExportLastCheckpointOnly === undefined) {
|
|
18247
18423
|
discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
|
|
@@ -18262,6 +18438,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
18262
18438
|
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
18263
18439
|
}
|
|
18264
18440
|
}
|
|
18441
|
+
else if (discriminatorExportLastCheckpointOnly === 'DISTILLATION') {
|
|
18442
|
+
const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
|
|
18443
|
+
'exportLastCheckpointOnly',
|
|
18444
|
+
]);
|
|
18445
|
+
if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
|
|
18446
|
+
setValueByPath(parentObject, ['distillationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
18447
|
+
}
|
|
18448
|
+
}
|
|
18265
18449
|
let discriminatorAdapterSize = getValueByPath(rootObject, [
|
|
18266
18450
|
'config',
|
|
18267
18451
|
'method',
|
|
@@ -18281,11 +18465,58 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
18281
18465
|
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
18282
18466
|
}
|
|
18283
18467
|
}
|
|
18284
|
-
if (
|
|
18285
|
-
|
|
18468
|
+
else if (discriminatorAdapterSize === 'DISTILLATION') {
|
|
18469
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
18470
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
18471
|
+
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
18472
|
+
}
|
|
18473
|
+
}
|
|
18474
|
+
let discriminatorTuningMode = getValueByPath(rootObject, [
|
|
18475
|
+
'config',
|
|
18476
|
+
'method',
|
|
18477
|
+
]);
|
|
18478
|
+
if (discriminatorTuningMode === undefined) {
|
|
18479
|
+
discriminatorTuningMode = 'SUPERVISED_FINE_TUNING';
|
|
18480
|
+
}
|
|
18481
|
+
if (discriminatorTuningMode === 'SUPERVISED_FINE_TUNING') {
|
|
18482
|
+
const fromTuningMode = getValueByPath(fromObject, ['tuningMode']);
|
|
18483
|
+
if (parentObject !== undefined && fromTuningMode != null) {
|
|
18484
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'tuningMode'], fromTuningMode);
|
|
18485
|
+
}
|
|
18286
18486
|
}
|
|
18287
|
-
|
|
18288
|
-
|
|
18487
|
+
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
18488
|
+
'customBaseModel',
|
|
18489
|
+
]);
|
|
18490
|
+
if (parentObject !== undefined && fromCustomBaseModel != null) {
|
|
18491
|
+
setValueByPath(parentObject, ['customBaseModel'], fromCustomBaseModel);
|
|
18492
|
+
}
|
|
18493
|
+
let discriminatorBatchSize = getValueByPath(rootObject, [
|
|
18494
|
+
'config',
|
|
18495
|
+
'method',
|
|
18496
|
+
]);
|
|
18497
|
+
if (discriminatorBatchSize === undefined) {
|
|
18498
|
+
discriminatorBatchSize = 'SUPERVISED_FINE_TUNING';
|
|
18499
|
+
}
|
|
18500
|
+
if (discriminatorBatchSize === 'SUPERVISED_FINE_TUNING') {
|
|
18501
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
18502
|
+
if (parentObject !== undefined && fromBatchSize != null) {
|
|
18503
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
|
|
18504
|
+
}
|
|
18505
|
+
}
|
|
18506
|
+
let discriminatorLearningRate = getValueByPath(rootObject, [
|
|
18507
|
+
'config',
|
|
18508
|
+
'method',
|
|
18509
|
+
]);
|
|
18510
|
+
if (discriminatorLearningRate === undefined) {
|
|
18511
|
+
discriminatorLearningRate = 'SUPERVISED_FINE_TUNING';
|
|
18512
|
+
}
|
|
18513
|
+
if (discriminatorLearningRate === 'SUPERVISED_FINE_TUNING') {
|
|
18514
|
+
const fromLearningRate = getValueByPath(fromObject, [
|
|
18515
|
+
'learningRate',
|
|
18516
|
+
]);
|
|
18517
|
+
if (parentObject !== undefined && fromLearningRate != null) {
|
|
18518
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRate'], fromLearningRate);
|
|
18519
|
+
}
|
|
18289
18520
|
}
|
|
18290
18521
|
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
18291
18522
|
if (parentObject !== undefined && fromLabels != null) {
|
|
@@ -18295,6 +18526,28 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
18295
18526
|
if (parentObject !== undefined && fromBeta != null) {
|
|
18296
18527
|
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'beta'], fromBeta);
|
|
18297
18528
|
}
|
|
18529
|
+
const fromBaseTeacherModel = getValueByPath(fromObject, [
|
|
18530
|
+
'baseTeacherModel',
|
|
18531
|
+
]);
|
|
18532
|
+
if (parentObject !== undefined && fromBaseTeacherModel != null) {
|
|
18533
|
+
setValueByPath(parentObject, ['distillationSpec', 'baseTeacherModel'], fromBaseTeacherModel);
|
|
18534
|
+
}
|
|
18535
|
+
const fromTunedTeacherModelSource = getValueByPath(fromObject, [
|
|
18536
|
+
'tunedTeacherModelSource',
|
|
18537
|
+
]);
|
|
18538
|
+
if (parentObject !== undefined && fromTunedTeacherModelSource != null) {
|
|
18539
|
+
setValueByPath(parentObject, ['distillationSpec', 'tunedTeacherModelSource'], fromTunedTeacherModelSource);
|
|
18540
|
+
}
|
|
18541
|
+
const fromSftLossWeightMultiplier = getValueByPath(fromObject, [
|
|
18542
|
+
'sftLossWeightMultiplier',
|
|
18543
|
+
]);
|
|
18544
|
+
if (parentObject !== undefined && fromSftLossWeightMultiplier != null) {
|
|
18545
|
+
setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'sftLossWeightMultiplier'], fromSftLossWeightMultiplier);
|
|
18546
|
+
}
|
|
18547
|
+
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
18548
|
+
if (parentObject !== undefined && fromOutputUri != null) {
|
|
18549
|
+
setValueByPath(parentObject, ['outputUri'], fromOutputUri);
|
|
18550
|
+
}
|
|
18298
18551
|
return toObject;
|
|
18299
18552
|
}
|
|
18300
18553
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -18514,6 +18767,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
18514
18767
|
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
18515
18768
|
}
|
|
18516
18769
|
}
|
|
18770
|
+
else if (discriminatorGcsUri === 'DISTILLATION') {
|
|
18771
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
18772
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
18773
|
+
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
|
|
18774
|
+
}
|
|
18775
|
+
}
|
|
18517
18776
|
let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
|
|
18518
18777
|
'config',
|
|
18519
18778
|
'method',
|
|
@@ -18537,6 +18796,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
18537
18796
|
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
18538
18797
|
}
|
|
18539
18798
|
}
|
|
18799
|
+
else if (discriminatorVertexDatasetResource === 'DISTILLATION') {
|
|
18800
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
18801
|
+
'vertexDatasetResource',
|
|
18802
|
+
]);
|
|
18803
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
18804
|
+
setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
|
|
18805
|
+
}
|
|
18806
|
+
}
|
|
18540
18807
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
18541
18808
|
throw new Error('examples parameter is not supported in Vertex AI.');
|
|
18542
18809
|
}
|
|
@@ -18660,6 +18927,12 @@ function tuningJobFromVertex(fromObject, _rootObject) {
|
|
|
18660
18927
|
if (fromPreferenceOptimizationSpec != null) {
|
|
18661
18928
|
setValueByPath(toObject, ['preferenceOptimizationSpec'], fromPreferenceOptimizationSpec);
|
|
18662
18929
|
}
|
|
18930
|
+
const fromDistillationSpec = getValueByPath(fromObject, [
|
|
18931
|
+
'distillationSpec',
|
|
18932
|
+
]);
|
|
18933
|
+
if (fromDistillationSpec != null) {
|
|
18934
|
+
setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
|
|
18935
|
+
}
|
|
18663
18936
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
18664
18937
|
'tuningDataStats',
|
|
18665
18938
|
]);
|
|
@@ -19437,6 +19710,48 @@ class NodeUploader {
|
|
|
19437
19710
|
}
|
|
19438
19711
|
}
|
|
19439
19712
|
|
|
19713
|
+
/**
|
|
19714
|
+
* @license
|
|
19715
|
+
* Copyright 2025 Google LLC
|
|
19716
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
19717
|
+
*/
|
|
19718
|
+
class NodeFiles extends Files {
|
|
19719
|
+
/**
|
|
19720
|
+
* Registers Google Cloud Storage files for use with the API.
|
|
19721
|
+
* This method is only available in Node.js environments.
|
|
19722
|
+
*/
|
|
19723
|
+
async registerFiles(params) {
|
|
19724
|
+
if (typeof process === 'undefined' ||
|
|
19725
|
+
!process.versions ||
|
|
19726
|
+
!process.versions.node) {
|
|
19727
|
+
throw new Error('registerFiles is only supported in Node.js environments.');
|
|
19728
|
+
}
|
|
19729
|
+
const googleAuth = params.auth;
|
|
19730
|
+
const authHeaders = await googleAuth.getRequestHeaders();
|
|
19731
|
+
const config = params.config || {};
|
|
19732
|
+
const httpOptions = config.httpOptions || {};
|
|
19733
|
+
const headers = Object.assign({}, (httpOptions.headers || {}));
|
|
19734
|
+
if (authHeaders) {
|
|
19735
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19736
|
+
if (typeof authHeaders[Symbol.iterator] === 'function') {
|
|
19737
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19738
|
+
for (const [key, value] of authHeaders) {
|
|
19739
|
+
headers[key] = value;
|
|
19740
|
+
}
|
|
19741
|
+
}
|
|
19742
|
+
else {
|
|
19743
|
+
for (const [key, value] of Object.entries(authHeaders)) {
|
|
19744
|
+
headers[key] = value;
|
|
19745
|
+
}
|
|
19746
|
+
}
|
|
19747
|
+
}
|
|
19748
|
+
return this._registerFiles({
|
|
19749
|
+
uris: params.uris,
|
|
19750
|
+
config: Object.assign(Object.assign({}, config), { httpOptions: Object.assign(Object.assign({}, httpOptions), { headers }) }),
|
|
19751
|
+
});
|
|
19752
|
+
}
|
|
19753
|
+
}
|
|
19754
|
+
|
|
19440
19755
|
/**
|
|
19441
19756
|
* @license
|
|
19442
19757
|
* Copyright 2025 Google LLC
|
|
@@ -19519,6 +19834,9 @@ class GoogleGenAI {
|
|
|
19519
19834
|
this.apiKey = (_c = options.apiKey) !== null && _c !== void 0 ? _c : envApiKey;
|
|
19520
19835
|
this.project = (_d = options.project) !== null && _d !== void 0 ? _d : envProject;
|
|
19521
19836
|
this.location = (_e = options.location) !== null && _e !== void 0 ? _e : envLocation;
|
|
19837
|
+
if (!this.vertexai && !this.apiKey) {
|
|
19838
|
+
throw new Error('API key must be set when using the Gemini API.');
|
|
19839
|
+
}
|
|
19522
19840
|
// Handle when to use Vertex AI in express mode (api key)
|
|
19523
19841
|
if (options.vertexai) {
|
|
19524
19842
|
if ((_f = options.googleAuthOptions) === null || _f === void 0 ? void 0 : _f.credentials) {
|
|
@@ -19583,7 +19901,7 @@ class GoogleGenAI {
|
|
|
19583
19901
|
this.batches = new Batches(this.apiClient);
|
|
19584
19902
|
this.chats = new Chats(this.models, this.apiClient);
|
|
19585
19903
|
this.caches = new Caches(this.apiClient);
|
|
19586
|
-
this.files = new
|
|
19904
|
+
this.files = new NodeFiles(this.apiClient);
|
|
19587
19905
|
this.operations = new Operations(this.apiClient);
|
|
19588
19906
|
this.authTokens = new Tokens(this.apiClient);
|
|
19589
19907
|
this.tunings = new Tunings(this.apiClient);
|
|
@@ -19612,5 +19930,5 @@ function getApiKeyFromEnv() {
|
|
|
19612
19930
|
return envGoogleApiKey || envGeminiApiKey || undefined;
|
|
19613
19931
|
}
|
|
19614
19932
|
|
|
19615
|
-
export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, 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, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
19933
|
+
export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, 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, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReplayResponse, ResourceScope, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
19616
19934
|
//# sourceMappingURL=index.mjs.map
|