@google/genai 1.30.0 → 1.31.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 +66 -65
- package/dist/index.cjs +906 -864
- package/dist/index.mjs +906 -865
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +1302 -1260
- package/dist/node/index.mjs +1302 -1261
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +66 -65
- package/dist/web/index.mjs +1302 -1261
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +66 -65
- package/package.json +2 -2
package/dist/web/index.mjs
CHANGED
|
@@ -2224,6 +2224,9 @@ class GenerateVideosOperation {
|
|
|
2224
2224
|
/** Response for the list tuning jobs method. */
|
|
2225
2225
|
class ListTuningJobsResponse {
|
|
2226
2226
|
}
|
|
2227
|
+
/** Empty response for tunings.cancel method. */
|
|
2228
|
+
class CancelTuningJobResponse {
|
|
2229
|
+
}
|
|
2227
2230
|
/** Empty response for caches.delete method. */
|
|
2228
2231
|
class DeleteCachedContentResponse {
|
|
2229
2232
|
}
|
|
@@ -4691,6 +4694,23 @@ class Batches extends BaseModule {
|
|
|
4691
4694
|
constructor(apiClient) {
|
|
4692
4695
|
super();
|
|
4693
4696
|
this.apiClient = apiClient;
|
|
4697
|
+
/**
|
|
4698
|
+
* Lists batch jobs.
|
|
4699
|
+
*
|
|
4700
|
+
* @param params - The parameters for the list request.
|
|
4701
|
+
* @return - A pager of batch jobs.
|
|
4702
|
+
*
|
|
4703
|
+
* @example
|
|
4704
|
+
* ```ts
|
|
4705
|
+
* const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
|
|
4706
|
+
* for await (const batchJob of batchJobs) {
|
|
4707
|
+
* console.log(batchJob);
|
|
4708
|
+
* }
|
|
4709
|
+
* ```
|
|
4710
|
+
*/
|
|
4711
|
+
this.list = async (params = {}) => {
|
|
4712
|
+
return new Pager(PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4713
|
+
};
|
|
4694
4714
|
/**
|
|
4695
4715
|
* Create batch job.
|
|
4696
4716
|
*
|
|
@@ -4739,23 +4759,6 @@ class Batches extends BaseModule {
|
|
|
4739
4759
|
}
|
|
4740
4760
|
return this.createEmbeddingsInternal(params);
|
|
4741
4761
|
};
|
|
4742
|
-
/**
|
|
4743
|
-
* Lists batch job configurations.
|
|
4744
|
-
*
|
|
4745
|
-
* @param params - The parameters for the list request.
|
|
4746
|
-
* @return The paginated results of the list of batch jobs.
|
|
4747
|
-
*
|
|
4748
|
-
* @example
|
|
4749
|
-
* ```ts
|
|
4750
|
-
* const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
|
|
4751
|
-
* for await (const batchJob of batchJobs) {
|
|
4752
|
-
* console.log(batchJob);
|
|
4753
|
-
* }
|
|
4754
|
-
* ```
|
|
4755
|
-
*/
|
|
4756
|
-
this.list = async (params = {}) => {
|
|
4757
|
-
return new Pager(PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4758
|
-
};
|
|
4759
4762
|
}
|
|
4760
4763
|
// Helper function to handle inlined generate content requests
|
|
4761
4764
|
createInlinedGenerateContentRequest(params) {
|
|
@@ -5858,10 +5861,10 @@ class Caches extends BaseModule {
|
|
|
5858
5861
|
super();
|
|
5859
5862
|
this.apiClient = apiClient;
|
|
5860
5863
|
/**
|
|
5861
|
-
* Lists cached
|
|
5864
|
+
* Lists cached contents.
|
|
5862
5865
|
*
|
|
5863
5866
|
* @param params - The parameters for the list request.
|
|
5864
|
-
* @return
|
|
5867
|
+
* @return - A pager of cached contents.
|
|
5865
5868
|
*
|
|
5866
5869
|
* @example
|
|
5867
5870
|
* ```ts
|
|
@@ -6731,19 +6734,16 @@ class Files extends BaseModule {
|
|
|
6731
6734
|
super();
|
|
6732
6735
|
this.apiClient = apiClient;
|
|
6733
6736
|
/**
|
|
6734
|
-
* Lists
|
|
6737
|
+
* Lists files.
|
|
6735
6738
|
*
|
|
6736
|
-
* @param params - The parameters for the list request
|
|
6737
|
-
* @return
|
|
6739
|
+
* @param params - The parameters for the list request.
|
|
6740
|
+
* @return - A pager of files.
|
|
6738
6741
|
*
|
|
6739
6742
|
* @example
|
|
6740
|
-
* The following code prints the names of all files from the service, the
|
|
6741
|
-
* size of each page is 10.
|
|
6742
|
-
*
|
|
6743
6743
|
* ```ts
|
|
6744
|
-
* const
|
|
6745
|
-
* for await (const file of
|
|
6746
|
-
* console.log(file
|
|
6744
|
+
* const files = await ai.files.list({config: {'pageSize': 2}});
|
|
6745
|
+
* for await (const file of files) {
|
|
6746
|
+
* console.log(file);
|
|
6747
6747
|
* }
|
|
6748
6748
|
* ```
|
|
6749
6749
|
*/
|
|
@@ -11182,239 +11182,474 @@ function videoToVertex(fromObject) {
|
|
|
11182
11182
|
* Copyright 2025 Google LLC
|
|
11183
11183
|
* SPDX-License-Identifier: Apache-2.0
|
|
11184
11184
|
*/
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
const
|
|
11188
|
-
const
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
11192
|
-
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
11193
|
-
const responseLineRE = /^\s*data: (.*)(?:\n\n|\r\r|\r\n\r\n)/;
|
|
11194
|
-
/**
|
|
11195
|
-
* The ApiClient class is used to send requests to the Gemini API or Vertex AI
|
|
11196
|
-
* endpoints.
|
|
11197
|
-
*/
|
|
11198
|
-
class ApiClient {
|
|
11199
|
-
constructor(opts) {
|
|
11200
|
-
var _a, _b;
|
|
11201
|
-
this.clientOptions = Object.assign(Object.assign({}, opts), { project: opts.project, location: opts.location, apiKey: opts.apiKey, vertexai: opts.vertexai });
|
|
11202
|
-
const initHttpOptions = {};
|
|
11203
|
-
if (this.clientOptions.vertexai) {
|
|
11204
|
-
initHttpOptions.apiVersion =
|
|
11205
|
-
(_a = this.clientOptions.apiVersion) !== null && _a !== void 0 ? _a : VERTEX_AI_API_DEFAULT_VERSION;
|
|
11206
|
-
initHttpOptions.baseUrl = this.baseUrlFromProjectLocation();
|
|
11207
|
-
this.normalizeAuthParameters();
|
|
11208
|
-
}
|
|
11209
|
-
else {
|
|
11210
|
-
// Gemini API
|
|
11211
|
-
initHttpOptions.apiVersion =
|
|
11212
|
-
(_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : GOOGLE_AI_API_DEFAULT_VERSION;
|
|
11213
|
-
initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;
|
|
11214
|
-
}
|
|
11215
|
-
initHttpOptions.headers = this.getDefaultHeaders();
|
|
11216
|
-
this.clientOptions.httpOptions = initHttpOptions;
|
|
11217
|
-
if (opts.httpOptions) {
|
|
11218
|
-
this.clientOptions.httpOptions = this.patchHttpOptions(initHttpOptions, opts.httpOptions);
|
|
11219
|
-
}
|
|
11185
|
+
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
11186
|
+
function createFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
11187
|
+
const toObject = {};
|
|
11188
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
11189
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
11190
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
11220
11191
|
}
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
if (this.clientOptions.project &&
|
|
11229
|
-
this.clientOptions.location &&
|
|
11230
|
-
this.clientOptions.location !== 'global') {
|
|
11231
|
-
// Regional endpoint
|
|
11232
|
-
return `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
|
|
11233
|
-
}
|
|
11234
|
-
// Global endpoint (covers 'global' location and API key usage)
|
|
11235
|
-
return `https://aiplatform.googleapis.com/`;
|
|
11192
|
+
return toObject;
|
|
11193
|
+
}
|
|
11194
|
+
function createFileSearchStoreParametersToMldev(fromObject) {
|
|
11195
|
+
const toObject = {};
|
|
11196
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
11197
|
+
if (fromConfig != null) {
|
|
11198
|
+
createFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
11236
11199
|
}
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
normalizeAuthParameters() {
|
|
11245
|
-
if (this.clientOptions.project && this.clientOptions.location) {
|
|
11246
|
-
// Using project/location for auth, clear potential API key
|
|
11247
|
-
this.clientOptions.apiKey = undefined;
|
|
11248
|
-
return;
|
|
11249
|
-
}
|
|
11250
|
-
// Using API key for auth (or no auth provided yet), clear project/location
|
|
11251
|
-
this.clientOptions.project = undefined;
|
|
11252
|
-
this.clientOptions.location = undefined;
|
|
11200
|
+
return toObject;
|
|
11201
|
+
}
|
|
11202
|
+
function deleteFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
11203
|
+
const toObject = {};
|
|
11204
|
+
const fromForce = getValueByPath(fromObject, ['force']);
|
|
11205
|
+
if (parentObject !== undefined && fromForce != null) {
|
|
11206
|
+
setValueByPath(parentObject, ['_query', 'force'], fromForce);
|
|
11253
11207
|
}
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
|
|
11208
|
+
return toObject;
|
|
11209
|
+
}
|
|
11210
|
+
function deleteFileSearchStoreParametersToMldev(fromObject) {
|
|
11211
|
+
const toObject = {};
|
|
11212
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
11213
|
+
if (fromName != null) {
|
|
11214
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
11257
11215
|
}
|
|
11258
|
-
|
|
11259
|
-
|
|
11216
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
11217
|
+
if (fromConfig != null) {
|
|
11218
|
+
deleteFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
11260
11219
|
}
|
|
11261
|
-
|
|
11262
|
-
|
|
11220
|
+
return toObject;
|
|
11221
|
+
}
|
|
11222
|
+
function getFileSearchStoreParametersToMldev(fromObject) {
|
|
11223
|
+
const toObject = {};
|
|
11224
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
11225
|
+
if (fromName != null) {
|
|
11226
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
11263
11227
|
}
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
|
|
11228
|
+
return toObject;
|
|
11229
|
+
}
|
|
11230
|
+
function importFileConfigToMldev(fromObject, parentObject) {
|
|
11231
|
+
const toObject = {};
|
|
11232
|
+
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
11233
|
+
'customMetadata',
|
|
11234
|
+
]);
|
|
11235
|
+
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
11236
|
+
let transformedList = fromCustomMetadata;
|
|
11237
|
+
if (Array.isArray(transformedList)) {
|
|
11238
|
+
transformedList = transformedList.map((item) => {
|
|
11239
|
+
return item;
|
|
11240
|
+
});
|
|
11268
11241
|
}
|
|
11269
|
-
|
|
11242
|
+
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
11270
11243
|
}
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
throw new Error('Base URL is not set.');
|
|
11244
|
+
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
11245
|
+
'chunkingConfig',
|
|
11246
|
+
]);
|
|
11247
|
+
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
11248
|
+
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
11277
11249
|
}
|
|
11278
|
-
|
|
11279
|
-
|
|
11250
|
+
return toObject;
|
|
11251
|
+
}
|
|
11252
|
+
function importFileOperationFromMldev(fromObject) {
|
|
11253
|
+
const toObject = {};
|
|
11254
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
11255
|
+
if (fromName != null) {
|
|
11256
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
11280
11257
|
}
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
|
|
11284
|
-
return this.clientOptions.httpOptions.headers;
|
|
11285
|
-
}
|
|
11286
|
-
else {
|
|
11287
|
-
throw new Error('Headers are not set.');
|
|
11288
|
-
}
|
|
11258
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
11259
|
+
if (fromMetadata != null) {
|
|
11260
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
11289
11261
|
}
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
httpOptions.apiVersion === undefined) {
|
|
11294
|
-
throw new Error('HTTP options are not correctly set.');
|
|
11295
|
-
}
|
|
11296
|
-
const baseUrl = httpOptions.baseUrl.endsWith('/')
|
|
11297
|
-
? httpOptions.baseUrl.slice(0, -1)
|
|
11298
|
-
: httpOptions.baseUrl;
|
|
11299
|
-
const urlElement = [baseUrl];
|
|
11300
|
-
if (httpOptions.apiVersion && httpOptions.apiVersion !== '') {
|
|
11301
|
-
urlElement.push(httpOptions.apiVersion);
|
|
11302
|
-
}
|
|
11303
|
-
return urlElement.join('/');
|
|
11262
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
11263
|
+
if (fromDone != null) {
|
|
11264
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
11304
11265
|
}
|
|
11305
|
-
|
|
11306
|
-
|
|
11266
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
11267
|
+
if (fromError != null) {
|
|
11268
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
11307
11269
|
}
|
|
11308
|
-
|
|
11309
|
-
|
|
11270
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
11271
|
+
if (fromResponse != null) {
|
|
11272
|
+
setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
|
|
11310
11273
|
}
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11274
|
+
return toObject;
|
|
11275
|
+
}
|
|
11276
|
+
function importFileParametersToMldev(fromObject) {
|
|
11277
|
+
const toObject = {};
|
|
11278
|
+
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
11279
|
+
'fileSearchStoreName',
|
|
11280
|
+
]);
|
|
11281
|
+
if (fromFileSearchStoreName != null) {
|
|
11282
|
+
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
11316
11283
|
}
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
}
|
|
11321
|
-
else {
|
|
11322
|
-
throw new Error('HTTP options are not correctly set.');
|
|
11323
|
-
}
|
|
11284
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
11285
|
+
if (fromFileName != null) {
|
|
11286
|
+
setValueByPath(toObject, ['fileName'], fromFileName);
|
|
11324
11287
|
}
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
urlElement.push(this.getBaseResourcePath());
|
|
11329
|
-
}
|
|
11330
|
-
if (path !== '') {
|
|
11331
|
-
urlElement.push(path);
|
|
11332
|
-
}
|
|
11333
|
-
const url = new URL(`${urlElement.join('/')}`);
|
|
11334
|
-
return url;
|
|
11288
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
11289
|
+
if (fromConfig != null) {
|
|
11290
|
+
importFileConfigToMldev(fromConfig, toObject);
|
|
11335
11291
|
}
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
// `projects/<project>/location/<location>`.
|
|
11346
|
-
return false;
|
|
11347
|
-
}
|
|
11348
|
-
if (request.httpMethod === 'GET' &&
|
|
11349
|
-
request.path.startsWith('publishers/google/models')) {
|
|
11350
|
-
// These paths are used by Vertex's models.get and models.list
|
|
11351
|
-
// calls. For base models Vertex does not accept a project/location
|
|
11352
|
-
// prefix (for tuned model the prefix is required).
|
|
11353
|
-
return false;
|
|
11354
|
-
}
|
|
11355
|
-
return true;
|
|
11292
|
+
return toObject;
|
|
11293
|
+
}
|
|
11294
|
+
function importFileResponseFromMldev(fromObject) {
|
|
11295
|
+
const toObject = {};
|
|
11296
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
11297
|
+
'sdkHttpResponse',
|
|
11298
|
+
]);
|
|
11299
|
+
if (fromSdkHttpResponse != null) {
|
|
11300
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
11356
11301
|
}
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11302
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
11303
|
+
if (fromParent != null) {
|
|
11304
|
+
setValueByPath(toObject, ['parent'], fromParent);
|
|
11305
|
+
}
|
|
11306
|
+
const fromDocumentName = getValueByPath(fromObject, ['documentName']);
|
|
11307
|
+
if (fromDocumentName != null) {
|
|
11308
|
+
setValueByPath(toObject, ['documentName'], fromDocumentName);
|
|
11309
|
+
}
|
|
11310
|
+
return toObject;
|
|
11311
|
+
}
|
|
11312
|
+
function listFileSearchStoresConfigToMldev(fromObject, parentObject) {
|
|
11313
|
+
const toObject = {};
|
|
11314
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
11315
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
11316
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
11317
|
+
}
|
|
11318
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
11319
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
11320
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
11321
|
+
}
|
|
11322
|
+
return toObject;
|
|
11323
|
+
}
|
|
11324
|
+
function listFileSearchStoresParametersToMldev(fromObject) {
|
|
11325
|
+
const toObject = {};
|
|
11326
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
11327
|
+
if (fromConfig != null) {
|
|
11328
|
+
listFileSearchStoresConfigToMldev(fromConfig, toObject);
|
|
11329
|
+
}
|
|
11330
|
+
return toObject;
|
|
11331
|
+
}
|
|
11332
|
+
function listFileSearchStoresResponseFromMldev(fromObject) {
|
|
11333
|
+
const toObject = {};
|
|
11334
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
11335
|
+
'sdkHttpResponse',
|
|
11336
|
+
]);
|
|
11337
|
+
if (fromSdkHttpResponse != null) {
|
|
11338
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
11339
|
+
}
|
|
11340
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
11341
|
+
'nextPageToken',
|
|
11342
|
+
]);
|
|
11343
|
+
if (fromNextPageToken != null) {
|
|
11344
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
11345
|
+
}
|
|
11346
|
+
const fromFileSearchStores = getValueByPath(fromObject, [
|
|
11347
|
+
'fileSearchStores',
|
|
11348
|
+
]);
|
|
11349
|
+
if (fromFileSearchStores != null) {
|
|
11350
|
+
let transformedList = fromFileSearchStores;
|
|
11351
|
+
if (Array.isArray(transformedList)) {
|
|
11352
|
+
transformedList = transformedList.map((item) => {
|
|
11353
|
+
return item;
|
|
11354
|
+
});
|
|
11361
11355
|
}
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11356
|
+
setValueByPath(toObject, ['fileSearchStores'], transformedList);
|
|
11357
|
+
}
|
|
11358
|
+
return toObject;
|
|
11359
|
+
}
|
|
11360
|
+
function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
11361
|
+
const toObject = {};
|
|
11362
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
11363
|
+
if (parentObject !== undefined && fromMimeType != null) {
|
|
11364
|
+
setValueByPath(parentObject, ['mimeType'], fromMimeType);
|
|
11365
|
+
}
|
|
11366
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
11367
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
11368
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
11369
|
+
}
|
|
11370
|
+
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
11371
|
+
'customMetadata',
|
|
11372
|
+
]);
|
|
11373
|
+
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
11374
|
+
let transformedList = fromCustomMetadata;
|
|
11375
|
+
if (Array.isArray(transformedList)) {
|
|
11376
|
+
transformedList = transformedList.map((item) => {
|
|
11377
|
+
return item;
|
|
11378
|
+
});
|
|
11368
11379
|
}
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11380
|
+
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
11381
|
+
}
|
|
11382
|
+
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
11383
|
+
'chunkingConfig',
|
|
11384
|
+
]);
|
|
11385
|
+
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
11386
|
+
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
11387
|
+
}
|
|
11388
|
+
return toObject;
|
|
11389
|
+
}
|
|
11390
|
+
function uploadToFileSearchStoreParametersToMldev(fromObject) {
|
|
11391
|
+
const toObject = {};
|
|
11392
|
+
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
11393
|
+
'fileSearchStoreName',
|
|
11394
|
+
]);
|
|
11395
|
+
if (fromFileSearchStoreName != null) {
|
|
11396
|
+
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
11397
|
+
}
|
|
11398
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
11399
|
+
if (fromConfig != null) {
|
|
11400
|
+
uploadToFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
11401
|
+
}
|
|
11402
|
+
return toObject;
|
|
11403
|
+
}
|
|
11404
|
+
function uploadToFileSearchStoreResumableResponseFromMldev(fromObject) {
|
|
11405
|
+
const toObject = {};
|
|
11406
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
11407
|
+
'sdkHttpResponse',
|
|
11408
|
+
]);
|
|
11409
|
+
if (fromSdkHttpResponse != null) {
|
|
11410
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
11411
|
+
}
|
|
11412
|
+
return toObject;
|
|
11413
|
+
}
|
|
11414
|
+
|
|
11415
|
+
/**
|
|
11416
|
+
* @license
|
|
11417
|
+
* Copyright 2025 Google LLC
|
|
11418
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
11419
|
+
*/
|
|
11420
|
+
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
11421
|
+
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
11422
|
+
const USER_AGENT_HEADER = 'User-Agent';
|
|
11423
|
+
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
11424
|
+
const SDK_VERSION = '1.31.0'; // x-release-please-version
|
|
11425
|
+
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
11426
|
+
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
11427
|
+
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
11428
|
+
const responseLineRE = /^\s*data: (.*)(?:\n\n|\r\r|\r\n\r\n)/;
|
|
11429
|
+
/**
|
|
11430
|
+
* The ApiClient class is used to send requests to the Gemini API or Vertex AI
|
|
11431
|
+
* endpoints.
|
|
11432
|
+
*/
|
|
11433
|
+
class ApiClient {
|
|
11434
|
+
constructor(opts) {
|
|
11435
|
+
var _a, _b;
|
|
11436
|
+
this.clientOptions = Object.assign(Object.assign({}, opts), { project: opts.project, location: opts.location, apiKey: opts.apiKey, vertexai: opts.vertexai });
|
|
11437
|
+
const initHttpOptions = {};
|
|
11438
|
+
if (this.clientOptions.vertexai) {
|
|
11439
|
+
initHttpOptions.apiVersion =
|
|
11440
|
+
(_a = this.clientOptions.apiVersion) !== null && _a !== void 0 ? _a : VERTEX_AI_API_DEFAULT_VERSION;
|
|
11441
|
+
initHttpOptions.baseUrl = this.baseUrlFromProjectLocation();
|
|
11442
|
+
this.normalizeAuthParameters();
|
|
11374
11443
|
}
|
|
11375
11444
|
else {
|
|
11376
|
-
|
|
11445
|
+
// Gemini API
|
|
11446
|
+
initHttpOptions.apiVersion =
|
|
11447
|
+
(_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : GOOGLE_AI_API_DEFAULT_VERSION;
|
|
11448
|
+
initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;
|
|
11377
11449
|
}
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
const patchedHttpOptions = JSON.parse(JSON.stringify(baseHttpOptions));
|
|
11383
|
-
for (const [key, value] of Object.entries(requestHttpOptions)) {
|
|
11384
|
-
// Records compile to objects.
|
|
11385
|
-
if (typeof value === 'object') {
|
|
11386
|
-
// @ts-expect-error TS2345TS7053: Element implicitly has an 'any' type
|
|
11387
|
-
// because expression of type 'string' can't be used to index type
|
|
11388
|
-
// 'HttpOptions'.
|
|
11389
|
-
patchedHttpOptions[key] = Object.assign(Object.assign({}, patchedHttpOptions[key]), value);
|
|
11390
|
-
}
|
|
11391
|
-
else if (value !== undefined) {
|
|
11392
|
-
// @ts-expect-error TS2345TS7053: Element implicitly has an 'any' type
|
|
11393
|
-
// because expression of type 'string' can't be used to index type
|
|
11394
|
-
// 'HttpOptions'.
|
|
11395
|
-
patchedHttpOptions[key] = value;
|
|
11396
|
-
}
|
|
11450
|
+
initHttpOptions.headers = this.getDefaultHeaders();
|
|
11451
|
+
this.clientOptions.httpOptions = initHttpOptions;
|
|
11452
|
+
if (opts.httpOptions) {
|
|
11453
|
+
this.clientOptions.httpOptions = this.patchHttpOptions(initHttpOptions, opts.httpOptions);
|
|
11397
11454
|
}
|
|
11398
|
-
return patchedHttpOptions;
|
|
11399
11455
|
}
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11456
|
+
/**
|
|
11457
|
+
* Determines the base URL for Vertex AI based on project and location.
|
|
11458
|
+
* Uses the global endpoint if location is 'global' or if project/location
|
|
11459
|
+
* are not specified (implying API key usage).
|
|
11460
|
+
* @private
|
|
11461
|
+
*/
|
|
11462
|
+
baseUrlFromProjectLocation() {
|
|
11463
|
+
if (this.clientOptions.project &&
|
|
11464
|
+
this.clientOptions.location &&
|
|
11465
|
+
this.clientOptions.location !== 'global') {
|
|
11466
|
+
// Regional endpoint
|
|
11467
|
+
return `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
|
|
11404
11468
|
}
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11469
|
+
// Global endpoint (covers 'global' location and API key usage)
|
|
11470
|
+
return `https://aiplatform.googleapis.com/`;
|
|
11471
|
+
}
|
|
11472
|
+
/**
|
|
11473
|
+
* Normalizes authentication parameters for Vertex AI.
|
|
11474
|
+
* If project and location are provided, API key is cleared.
|
|
11475
|
+
* If project and location are not provided (implying API key usage),
|
|
11476
|
+
* project and location are cleared.
|
|
11477
|
+
* @private
|
|
11478
|
+
*/
|
|
11479
|
+
normalizeAuthParameters() {
|
|
11480
|
+
if (this.clientOptions.project && this.clientOptions.location) {
|
|
11481
|
+
// Using project/location for auth, clear potential API key
|
|
11482
|
+
this.clientOptions.apiKey = undefined;
|
|
11483
|
+
return;
|
|
11409
11484
|
}
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
return this.streamApiCall(url, requestInit, request.httpMethod);
|
|
11485
|
+
// Using API key for auth (or no auth provided yet), clear project/location
|
|
11486
|
+
this.clientOptions.project = undefined;
|
|
11487
|
+
this.clientOptions.location = undefined;
|
|
11414
11488
|
}
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11489
|
+
isVertexAI() {
|
|
11490
|
+
var _a;
|
|
11491
|
+
return (_a = this.clientOptions.vertexai) !== null && _a !== void 0 ? _a : false;
|
|
11492
|
+
}
|
|
11493
|
+
getProject() {
|
|
11494
|
+
return this.clientOptions.project;
|
|
11495
|
+
}
|
|
11496
|
+
getLocation() {
|
|
11497
|
+
return this.clientOptions.location;
|
|
11498
|
+
}
|
|
11499
|
+
getApiVersion() {
|
|
11500
|
+
if (this.clientOptions.httpOptions &&
|
|
11501
|
+
this.clientOptions.httpOptions.apiVersion !== undefined) {
|
|
11502
|
+
return this.clientOptions.httpOptions.apiVersion;
|
|
11503
|
+
}
|
|
11504
|
+
throw new Error('API version is not set.');
|
|
11505
|
+
}
|
|
11506
|
+
getBaseUrl() {
|
|
11507
|
+
if (this.clientOptions.httpOptions &&
|
|
11508
|
+
this.clientOptions.httpOptions.baseUrl !== undefined) {
|
|
11509
|
+
return this.clientOptions.httpOptions.baseUrl;
|
|
11510
|
+
}
|
|
11511
|
+
throw new Error('Base URL is not set.');
|
|
11512
|
+
}
|
|
11513
|
+
getRequestUrl() {
|
|
11514
|
+
return this.getRequestUrlInternal(this.clientOptions.httpOptions);
|
|
11515
|
+
}
|
|
11516
|
+
getHeaders() {
|
|
11517
|
+
if (this.clientOptions.httpOptions &&
|
|
11518
|
+
this.clientOptions.httpOptions.headers !== undefined) {
|
|
11519
|
+
return this.clientOptions.httpOptions.headers;
|
|
11520
|
+
}
|
|
11521
|
+
else {
|
|
11522
|
+
throw new Error('Headers are not set.');
|
|
11523
|
+
}
|
|
11524
|
+
}
|
|
11525
|
+
getRequestUrlInternal(httpOptions) {
|
|
11526
|
+
if (!httpOptions ||
|
|
11527
|
+
httpOptions.baseUrl === undefined ||
|
|
11528
|
+
httpOptions.apiVersion === undefined) {
|
|
11529
|
+
throw new Error('HTTP options are not correctly set.');
|
|
11530
|
+
}
|
|
11531
|
+
const baseUrl = httpOptions.baseUrl.endsWith('/')
|
|
11532
|
+
? httpOptions.baseUrl.slice(0, -1)
|
|
11533
|
+
: httpOptions.baseUrl;
|
|
11534
|
+
const urlElement = [baseUrl];
|
|
11535
|
+
if (httpOptions.apiVersion && httpOptions.apiVersion !== '') {
|
|
11536
|
+
urlElement.push(httpOptions.apiVersion);
|
|
11537
|
+
}
|
|
11538
|
+
return urlElement.join('/');
|
|
11539
|
+
}
|
|
11540
|
+
getBaseResourcePath() {
|
|
11541
|
+
return `projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`;
|
|
11542
|
+
}
|
|
11543
|
+
getApiKey() {
|
|
11544
|
+
return this.clientOptions.apiKey;
|
|
11545
|
+
}
|
|
11546
|
+
getWebsocketBaseUrl() {
|
|
11547
|
+
const baseUrl = this.getBaseUrl();
|
|
11548
|
+
const urlParts = new URL(baseUrl);
|
|
11549
|
+
urlParts.protocol = urlParts.protocol == 'http:' ? 'ws' : 'wss';
|
|
11550
|
+
return urlParts.toString();
|
|
11551
|
+
}
|
|
11552
|
+
setBaseUrl(url) {
|
|
11553
|
+
if (this.clientOptions.httpOptions) {
|
|
11554
|
+
this.clientOptions.httpOptions.baseUrl = url;
|
|
11555
|
+
}
|
|
11556
|
+
else {
|
|
11557
|
+
throw new Error('HTTP options are not correctly set.');
|
|
11558
|
+
}
|
|
11559
|
+
}
|
|
11560
|
+
constructUrl(path, httpOptions, prependProjectLocation) {
|
|
11561
|
+
const urlElement = [this.getRequestUrlInternal(httpOptions)];
|
|
11562
|
+
if (prependProjectLocation) {
|
|
11563
|
+
urlElement.push(this.getBaseResourcePath());
|
|
11564
|
+
}
|
|
11565
|
+
if (path !== '') {
|
|
11566
|
+
urlElement.push(path);
|
|
11567
|
+
}
|
|
11568
|
+
const url = new URL(`${urlElement.join('/')}`);
|
|
11569
|
+
return url;
|
|
11570
|
+
}
|
|
11571
|
+
shouldPrependVertexProjectPath(request) {
|
|
11572
|
+
if (this.clientOptions.apiKey) {
|
|
11573
|
+
return false;
|
|
11574
|
+
}
|
|
11575
|
+
if (!this.clientOptions.vertexai) {
|
|
11576
|
+
return false;
|
|
11577
|
+
}
|
|
11578
|
+
if (request.path.startsWith('projects/')) {
|
|
11579
|
+
// Assume the path already starts with
|
|
11580
|
+
// `projects/<project>/location/<location>`.
|
|
11581
|
+
return false;
|
|
11582
|
+
}
|
|
11583
|
+
if (request.httpMethod === 'GET' &&
|
|
11584
|
+
request.path.startsWith('publishers/google/models')) {
|
|
11585
|
+
// These paths are used by Vertex's models.get and models.list
|
|
11586
|
+
// calls. For base models Vertex does not accept a project/location
|
|
11587
|
+
// prefix (for tuned model the prefix is required).
|
|
11588
|
+
return false;
|
|
11589
|
+
}
|
|
11590
|
+
return true;
|
|
11591
|
+
}
|
|
11592
|
+
async request(request) {
|
|
11593
|
+
let patchedHttpOptions = this.clientOptions.httpOptions;
|
|
11594
|
+
if (request.httpOptions) {
|
|
11595
|
+
patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
|
|
11596
|
+
}
|
|
11597
|
+
const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
|
|
11598
|
+
const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
|
|
11599
|
+
if (request.queryParams) {
|
|
11600
|
+
for (const [key, value] of Object.entries(request.queryParams)) {
|
|
11601
|
+
url.searchParams.append(key, String(value));
|
|
11602
|
+
}
|
|
11603
|
+
}
|
|
11604
|
+
let requestInit = {};
|
|
11605
|
+
if (request.httpMethod === 'GET') {
|
|
11606
|
+
if (request.body && request.body !== '{}') {
|
|
11607
|
+
throw new Error('Request body should be empty for GET request, but got non empty request body');
|
|
11608
|
+
}
|
|
11609
|
+
}
|
|
11610
|
+
else {
|
|
11611
|
+
requestInit.body = request.body;
|
|
11612
|
+
}
|
|
11613
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
11614
|
+
return this.unaryApiCall(url, requestInit, request.httpMethod);
|
|
11615
|
+
}
|
|
11616
|
+
patchHttpOptions(baseHttpOptions, requestHttpOptions) {
|
|
11617
|
+
const patchedHttpOptions = JSON.parse(JSON.stringify(baseHttpOptions));
|
|
11618
|
+
for (const [key, value] of Object.entries(requestHttpOptions)) {
|
|
11619
|
+
// Records compile to objects.
|
|
11620
|
+
if (typeof value === 'object') {
|
|
11621
|
+
// @ts-expect-error TS2345TS7053: Element implicitly has an 'any' type
|
|
11622
|
+
// because expression of type 'string' can't be used to index type
|
|
11623
|
+
// 'HttpOptions'.
|
|
11624
|
+
patchedHttpOptions[key] = Object.assign(Object.assign({}, patchedHttpOptions[key]), value);
|
|
11625
|
+
}
|
|
11626
|
+
else if (value !== undefined) {
|
|
11627
|
+
// @ts-expect-error TS2345TS7053: Element implicitly has an 'any' type
|
|
11628
|
+
// because expression of type 'string' can't be used to index type
|
|
11629
|
+
// 'HttpOptions'.
|
|
11630
|
+
patchedHttpOptions[key] = value;
|
|
11631
|
+
}
|
|
11632
|
+
}
|
|
11633
|
+
return patchedHttpOptions;
|
|
11634
|
+
}
|
|
11635
|
+
async requestStream(request) {
|
|
11636
|
+
let patchedHttpOptions = this.clientOptions.httpOptions;
|
|
11637
|
+
if (request.httpOptions) {
|
|
11638
|
+
patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
|
|
11639
|
+
}
|
|
11640
|
+
const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
|
|
11641
|
+
const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
|
|
11642
|
+
if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
|
|
11643
|
+
url.searchParams.set('alt', 'sse');
|
|
11644
|
+
}
|
|
11645
|
+
let requestInit = {};
|
|
11646
|
+
requestInit.body = request.body;
|
|
11647
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
|
|
11648
|
+
return this.streamApiCall(url, requestInit, request.httpMethod);
|
|
11649
|
+
}
|
|
11650
|
+
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, url, abortSignal) {
|
|
11651
|
+
if ((httpOptions && httpOptions.timeout) || abortSignal) {
|
|
11652
|
+
const abortController = new AbortController();
|
|
11418
11653
|
const signal = abortController.signal;
|
|
11419
11654
|
if (httpOptions.timeout && (httpOptions === null || httpOptions === void 0 ? void 0 : httpOptions.timeout) > 0) {
|
|
11420
11655
|
const timeoutHandle = setTimeout(() => abortController.abort(), httpOptions.timeout);
|
|
@@ -11635,11 +11870,8 @@ class ApiClient {
|
|
|
11635
11870
|
const path = `upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`;
|
|
11636
11871
|
const fileName = this.getFileName(file);
|
|
11637
11872
|
const body = {};
|
|
11638
|
-
if (config
|
|
11639
|
-
body
|
|
11640
|
-
}
|
|
11641
|
-
if (config === null || config === void 0 ? void 0 : config.chunkingConfig) {
|
|
11642
|
-
body['chunkingConfig'] = config.chunkingConfig;
|
|
11873
|
+
if (config != null) {
|
|
11874
|
+
uploadToFileSearchStoreConfigToMldev(config, body);
|
|
11643
11875
|
}
|
|
11644
11876
|
const uploadUrl = await this.fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
|
|
11645
11877
|
return uploader.uploadToFileSearchStore(file, uploadUrl, this);
|
|
@@ -14191,594 +14423,41 @@ class Models extends BaseModule {
|
|
|
14191
14423
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14192
14424
|
})
|
|
14193
14425
|
.then((httpResponse) => {
|
|
14194
|
-
return httpResponse.json();
|
|
14195
|
-
});
|
|
14196
|
-
return response.then((apiResponse) => {
|
|
14197
|
-
const resp = generateVideosOperationFromVertex(apiResponse);
|
|
14198
|
-
const typedResp = new GenerateVideosOperation();
|
|
14199
|
-
Object.assign(typedResp, resp);
|
|
14200
|
-
return typedResp;
|
|
14201
|
-
});
|
|
14202
|
-
}
|
|
14203
|
-
else {
|
|
14204
|
-
const body = generateVideosParametersToMldev(this.apiClient, params);
|
|
14205
|
-
path = formatMap('{model}:predictLongRunning', body['_url']);
|
|
14206
|
-
queryParams = body['_query'];
|
|
14207
|
-
delete body['_url'];
|
|
14208
|
-
delete body['_query'];
|
|
14209
|
-
response = this.apiClient
|
|
14210
|
-
.request({
|
|
14211
|
-
path: path,
|
|
14212
|
-
queryParams: queryParams,
|
|
14213
|
-
body: JSON.stringify(body),
|
|
14214
|
-
httpMethod: 'POST',
|
|
14215
|
-
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
14216
|
-
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
14217
|
-
})
|
|
14218
|
-
.then((httpResponse) => {
|
|
14219
|
-
return httpResponse.json();
|
|
14220
|
-
});
|
|
14221
|
-
return response.then((apiResponse) => {
|
|
14222
|
-
const resp = generateVideosOperationFromMldev(apiResponse);
|
|
14223
|
-
const typedResp = new GenerateVideosOperation();
|
|
14224
|
-
Object.assign(typedResp, resp);
|
|
14225
|
-
return typedResp;
|
|
14226
|
-
});
|
|
14227
|
-
}
|
|
14228
|
-
}
|
|
14229
|
-
}
|
|
14230
|
-
|
|
14231
|
-
/**
|
|
14232
|
-
* @license
|
|
14233
|
-
* Copyright 2025 Google LLC
|
|
14234
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
14235
|
-
*/
|
|
14236
|
-
class Operations extends BaseModule {
|
|
14237
|
-
constructor(apiClient) {
|
|
14238
|
-
super();
|
|
14239
|
-
this.apiClient = apiClient;
|
|
14240
|
-
}
|
|
14241
|
-
/**
|
|
14242
|
-
* Gets the status of a long-running operation.
|
|
14243
|
-
*
|
|
14244
|
-
* @param parameters The parameters for the get operation request.
|
|
14245
|
-
* @return The updated Operation object, with the latest status or result.
|
|
14246
|
-
*/
|
|
14247
|
-
async getVideosOperation(parameters) {
|
|
14248
|
-
const operation = parameters.operation;
|
|
14249
|
-
const config = parameters.config;
|
|
14250
|
-
if (operation.name === undefined || operation.name === '') {
|
|
14251
|
-
throw new Error('Operation name is required.');
|
|
14252
|
-
}
|
|
14253
|
-
if (this.apiClient.isVertexAI()) {
|
|
14254
|
-
const resourceName = operation.name.split('/operations/')[0];
|
|
14255
|
-
let httpOptions = undefined;
|
|
14256
|
-
if (config && 'httpOptions' in config) {
|
|
14257
|
-
httpOptions = config.httpOptions;
|
|
14258
|
-
}
|
|
14259
|
-
const rawOperation = await this.fetchPredictVideosOperationInternal({
|
|
14260
|
-
operationName: operation.name,
|
|
14261
|
-
resourceName: resourceName,
|
|
14262
|
-
config: { httpOptions: httpOptions },
|
|
14263
|
-
});
|
|
14264
|
-
return operation._fromAPIResponse({
|
|
14265
|
-
apiResponse: rawOperation,
|
|
14266
|
-
_isVertexAI: true,
|
|
14267
|
-
});
|
|
14268
|
-
}
|
|
14269
|
-
else {
|
|
14270
|
-
const rawOperation = await this.getVideosOperationInternal({
|
|
14271
|
-
operationName: operation.name,
|
|
14272
|
-
config: config,
|
|
14273
|
-
});
|
|
14274
|
-
return operation._fromAPIResponse({
|
|
14275
|
-
apiResponse: rawOperation,
|
|
14276
|
-
_isVertexAI: false,
|
|
14277
|
-
});
|
|
14278
|
-
}
|
|
14279
|
-
}
|
|
14280
|
-
/**
|
|
14281
|
-
* Gets the status of a long-running operation.
|
|
14282
|
-
*
|
|
14283
|
-
* @param parameters The parameters for the get operation request.
|
|
14284
|
-
* @return The updated Operation object, with the latest status or result.
|
|
14285
|
-
*/
|
|
14286
|
-
async get(parameters) {
|
|
14287
|
-
const operation = parameters.operation;
|
|
14288
|
-
const config = parameters.config;
|
|
14289
|
-
if (operation.name === undefined || operation.name === '') {
|
|
14290
|
-
throw new Error('Operation name is required.');
|
|
14291
|
-
}
|
|
14292
|
-
if (this.apiClient.isVertexAI()) {
|
|
14293
|
-
const resourceName = operation.name.split('/operations/')[0];
|
|
14294
|
-
let httpOptions = undefined;
|
|
14295
|
-
if (config && 'httpOptions' in config) {
|
|
14296
|
-
httpOptions = config.httpOptions;
|
|
14297
|
-
}
|
|
14298
|
-
const rawOperation = await this.fetchPredictVideosOperationInternal({
|
|
14299
|
-
operationName: operation.name,
|
|
14300
|
-
resourceName: resourceName,
|
|
14301
|
-
config: { httpOptions: httpOptions },
|
|
14302
|
-
});
|
|
14303
|
-
return operation._fromAPIResponse({
|
|
14304
|
-
apiResponse: rawOperation,
|
|
14305
|
-
_isVertexAI: true,
|
|
14306
|
-
});
|
|
14307
|
-
}
|
|
14308
|
-
else {
|
|
14309
|
-
const rawOperation = await this.getVideosOperationInternal({
|
|
14310
|
-
operationName: operation.name,
|
|
14311
|
-
config: config,
|
|
14312
|
-
});
|
|
14313
|
-
return operation._fromAPIResponse({
|
|
14314
|
-
apiResponse: rawOperation,
|
|
14315
|
-
_isVertexAI: false,
|
|
14316
|
-
});
|
|
14317
|
-
}
|
|
14318
|
-
}
|
|
14319
|
-
async getVideosOperationInternal(params) {
|
|
14320
|
-
var _a, _b, _c, _d;
|
|
14321
|
-
let response;
|
|
14322
|
-
let path = '';
|
|
14323
|
-
let queryParams = {};
|
|
14324
|
-
if (this.apiClient.isVertexAI()) {
|
|
14325
|
-
const body = getOperationParametersToVertex(params);
|
|
14326
|
-
path = formatMap('{operationName}', body['_url']);
|
|
14327
|
-
queryParams = body['_query'];
|
|
14328
|
-
delete body['_url'];
|
|
14329
|
-
delete body['_query'];
|
|
14330
|
-
response = this.apiClient
|
|
14331
|
-
.request({
|
|
14332
|
-
path: path,
|
|
14333
|
-
queryParams: queryParams,
|
|
14334
|
-
body: JSON.stringify(body),
|
|
14335
|
-
httpMethod: 'GET',
|
|
14336
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
14337
|
-
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14338
|
-
})
|
|
14339
|
-
.then((httpResponse) => {
|
|
14340
|
-
return httpResponse.json();
|
|
14341
|
-
});
|
|
14342
|
-
return response;
|
|
14343
|
-
}
|
|
14344
|
-
else {
|
|
14345
|
-
const body = getOperationParametersToMldev(params);
|
|
14346
|
-
path = formatMap('{operationName}', body['_url']);
|
|
14347
|
-
queryParams = body['_query'];
|
|
14348
|
-
delete body['_url'];
|
|
14349
|
-
delete body['_query'];
|
|
14350
|
-
response = this.apiClient
|
|
14351
|
-
.request({
|
|
14352
|
-
path: path,
|
|
14353
|
-
queryParams: queryParams,
|
|
14354
|
-
body: JSON.stringify(body),
|
|
14355
|
-
httpMethod: 'GET',
|
|
14356
|
-
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
14357
|
-
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
14358
|
-
})
|
|
14359
|
-
.then((httpResponse) => {
|
|
14360
|
-
return httpResponse.json();
|
|
14361
|
-
});
|
|
14362
|
-
return response;
|
|
14363
|
-
}
|
|
14364
|
-
}
|
|
14365
|
-
async fetchPredictVideosOperationInternal(params) {
|
|
14366
|
-
var _a, _b;
|
|
14367
|
-
let response;
|
|
14368
|
-
let path = '';
|
|
14369
|
-
let queryParams = {};
|
|
14370
|
-
if (this.apiClient.isVertexAI()) {
|
|
14371
|
-
const body = fetchPredictOperationParametersToVertex(params);
|
|
14372
|
-
path = formatMap('{resourceName}:fetchPredictOperation', body['_url']);
|
|
14373
|
-
queryParams = body['_query'];
|
|
14374
|
-
delete body['_url'];
|
|
14375
|
-
delete body['_query'];
|
|
14376
|
-
response = this.apiClient
|
|
14377
|
-
.request({
|
|
14378
|
-
path: path,
|
|
14379
|
-
queryParams: queryParams,
|
|
14380
|
-
body: JSON.stringify(body),
|
|
14381
|
-
httpMethod: 'POST',
|
|
14382
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
14383
|
-
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14384
|
-
})
|
|
14385
|
-
.then((httpResponse) => {
|
|
14386
|
-
return httpResponse.json();
|
|
14387
|
-
});
|
|
14388
|
-
return response;
|
|
14389
|
-
}
|
|
14390
|
-
else {
|
|
14391
|
-
throw new Error('This method is only supported by the Vertex AI.');
|
|
14392
|
-
}
|
|
14393
|
-
}
|
|
14394
|
-
}
|
|
14395
|
-
|
|
14396
|
-
/**
|
|
14397
|
-
* @license
|
|
14398
|
-
* Copyright 2025 Google LLC
|
|
14399
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
14400
|
-
*/
|
|
14401
|
-
function blobToMldev(fromObject) {
|
|
14402
|
-
const toObject = {};
|
|
14403
|
-
const fromData = getValueByPath(fromObject, ['data']);
|
|
14404
|
-
if (fromData != null) {
|
|
14405
|
-
setValueByPath(toObject, ['data'], fromData);
|
|
14406
|
-
}
|
|
14407
|
-
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
14408
|
-
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
14409
|
-
}
|
|
14410
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
14411
|
-
if (fromMimeType != null) {
|
|
14412
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
14413
|
-
}
|
|
14414
|
-
return toObject;
|
|
14415
|
-
}
|
|
14416
|
-
function contentToMldev(fromObject) {
|
|
14417
|
-
const toObject = {};
|
|
14418
|
-
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
14419
|
-
if (fromParts != null) {
|
|
14420
|
-
let transformedList = fromParts;
|
|
14421
|
-
if (Array.isArray(transformedList)) {
|
|
14422
|
-
transformedList = transformedList.map((item) => {
|
|
14423
|
-
return partToMldev(item);
|
|
14424
|
-
});
|
|
14425
|
-
}
|
|
14426
|
-
setValueByPath(toObject, ['parts'], transformedList);
|
|
14427
|
-
}
|
|
14428
|
-
const fromRole = getValueByPath(fromObject, ['role']);
|
|
14429
|
-
if (fromRole != null) {
|
|
14430
|
-
setValueByPath(toObject, ['role'], fromRole);
|
|
14431
|
-
}
|
|
14432
|
-
return toObject;
|
|
14433
|
-
}
|
|
14434
|
-
function createAuthTokenConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14435
|
-
const toObject = {};
|
|
14436
|
-
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
14437
|
-
if (parentObject !== undefined && fromExpireTime != null) {
|
|
14438
|
-
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
14439
|
-
}
|
|
14440
|
-
const fromNewSessionExpireTime = getValueByPath(fromObject, [
|
|
14441
|
-
'newSessionExpireTime',
|
|
14442
|
-
]);
|
|
14443
|
-
if (parentObject !== undefined && fromNewSessionExpireTime != null) {
|
|
14444
|
-
setValueByPath(parentObject, ['newSessionExpireTime'], fromNewSessionExpireTime);
|
|
14445
|
-
}
|
|
14446
|
-
const fromUses = getValueByPath(fromObject, ['uses']);
|
|
14447
|
-
if (parentObject !== undefined && fromUses != null) {
|
|
14448
|
-
setValueByPath(parentObject, ['uses'], fromUses);
|
|
14449
|
-
}
|
|
14450
|
-
const fromLiveConnectConstraints = getValueByPath(fromObject, [
|
|
14451
|
-
'liveConnectConstraints',
|
|
14452
|
-
]);
|
|
14453
|
-
if (parentObject !== undefined && fromLiveConnectConstraints != null) {
|
|
14454
|
-
setValueByPath(parentObject, ['bidiGenerateContentSetup'], liveConnectConstraintsToMldev(apiClient, fromLiveConnectConstraints));
|
|
14455
|
-
}
|
|
14456
|
-
const fromLockAdditionalFields = getValueByPath(fromObject, [
|
|
14457
|
-
'lockAdditionalFields',
|
|
14458
|
-
]);
|
|
14459
|
-
if (parentObject !== undefined && fromLockAdditionalFields != null) {
|
|
14460
|
-
setValueByPath(parentObject, ['fieldMask'], fromLockAdditionalFields);
|
|
14461
|
-
}
|
|
14462
|
-
return toObject;
|
|
14463
|
-
}
|
|
14464
|
-
function createAuthTokenParametersToMldev(apiClient, fromObject) {
|
|
14465
|
-
const toObject = {};
|
|
14466
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14467
|
-
if (fromConfig != null) {
|
|
14468
|
-
setValueByPath(toObject, ['config'], createAuthTokenConfigToMldev(apiClient, fromConfig, toObject));
|
|
14469
|
-
}
|
|
14470
|
-
return toObject;
|
|
14471
|
-
}
|
|
14472
|
-
function fileDataToMldev(fromObject) {
|
|
14473
|
-
const toObject = {};
|
|
14474
|
-
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
14475
|
-
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
14476
|
-
}
|
|
14477
|
-
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
14478
|
-
if (fromFileUri != null) {
|
|
14479
|
-
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
14480
|
-
}
|
|
14481
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
14482
|
-
if (fromMimeType != null) {
|
|
14483
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
14484
|
-
}
|
|
14485
|
-
return toObject;
|
|
14486
|
-
}
|
|
14487
|
-
function functionCallToMldev(fromObject) {
|
|
14488
|
-
const toObject = {};
|
|
14489
|
-
const fromId = getValueByPath(fromObject, ['id']);
|
|
14490
|
-
if (fromId != null) {
|
|
14491
|
-
setValueByPath(toObject, ['id'], fromId);
|
|
14492
|
-
}
|
|
14493
|
-
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
14494
|
-
if (fromArgs != null) {
|
|
14495
|
-
setValueByPath(toObject, ['args'], fromArgs);
|
|
14496
|
-
}
|
|
14497
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
14498
|
-
if (fromName != null) {
|
|
14499
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
14500
|
-
}
|
|
14501
|
-
if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
|
|
14502
|
-
throw new Error('partialArgs parameter is not supported in Gemini API.');
|
|
14503
|
-
}
|
|
14504
|
-
if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
|
|
14505
|
-
throw new Error('willContinue parameter is not supported in Gemini API.');
|
|
14506
|
-
}
|
|
14507
|
-
return toObject;
|
|
14508
|
-
}
|
|
14509
|
-
function googleMapsToMldev(fromObject) {
|
|
14510
|
-
const toObject = {};
|
|
14511
|
-
if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
|
|
14512
|
-
throw new Error('authConfig parameter is not supported in Gemini API.');
|
|
14513
|
-
}
|
|
14514
|
-
const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
|
|
14515
|
-
if (fromEnableWidget != null) {
|
|
14516
|
-
setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
|
|
14517
|
-
}
|
|
14518
|
-
return toObject;
|
|
14519
|
-
}
|
|
14520
|
-
function googleSearchToMldev(fromObject) {
|
|
14521
|
-
const toObject = {};
|
|
14522
|
-
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
14523
|
-
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
14524
|
-
}
|
|
14525
|
-
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
14526
|
-
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
14527
|
-
}
|
|
14528
|
-
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
14529
|
-
'timeRangeFilter',
|
|
14530
|
-
]);
|
|
14531
|
-
if (fromTimeRangeFilter != null) {
|
|
14532
|
-
setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
|
|
14533
|
-
}
|
|
14534
|
-
return toObject;
|
|
14535
|
-
}
|
|
14536
|
-
function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
14537
|
-
const toObject = {};
|
|
14538
|
-
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
14539
|
-
'generationConfig',
|
|
14540
|
-
]);
|
|
14541
|
-
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
14542
|
-
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
14543
|
-
}
|
|
14544
|
-
const fromResponseModalities = getValueByPath(fromObject, [
|
|
14545
|
-
'responseModalities',
|
|
14546
|
-
]);
|
|
14547
|
-
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
14548
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
14549
|
-
}
|
|
14550
|
-
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
14551
|
-
if (parentObject !== undefined && fromTemperature != null) {
|
|
14552
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
14553
|
-
}
|
|
14554
|
-
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
14555
|
-
if (parentObject !== undefined && fromTopP != null) {
|
|
14556
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
14557
|
-
}
|
|
14558
|
-
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
14559
|
-
if (parentObject !== undefined && fromTopK != null) {
|
|
14560
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
14561
|
-
}
|
|
14562
|
-
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
14563
|
-
'maxOutputTokens',
|
|
14564
|
-
]);
|
|
14565
|
-
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
14566
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
14567
|
-
}
|
|
14568
|
-
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14569
|
-
'mediaResolution',
|
|
14570
|
-
]);
|
|
14571
|
-
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
14572
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
14573
|
-
}
|
|
14574
|
-
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
14575
|
-
if (parentObject !== undefined && fromSeed != null) {
|
|
14576
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
14577
|
-
}
|
|
14578
|
-
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
14579
|
-
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
14580
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
|
|
14581
|
-
}
|
|
14582
|
-
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
14583
|
-
'thinkingConfig',
|
|
14584
|
-
]);
|
|
14585
|
-
if (parentObject !== undefined && fromThinkingConfig != null) {
|
|
14586
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'thinkingConfig'], fromThinkingConfig);
|
|
14587
|
-
}
|
|
14588
|
-
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
14589
|
-
'enableAffectiveDialog',
|
|
14590
|
-
]);
|
|
14591
|
-
if (parentObject !== undefined && fromEnableAffectiveDialog != null) {
|
|
14592
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'enableAffectiveDialog'], fromEnableAffectiveDialog);
|
|
14593
|
-
}
|
|
14594
|
-
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
14595
|
-
'systemInstruction',
|
|
14596
|
-
]);
|
|
14597
|
-
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
14598
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev(tContent(fromSystemInstruction)));
|
|
14599
|
-
}
|
|
14600
|
-
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
14601
|
-
if (parentObject !== undefined && fromTools != null) {
|
|
14602
|
-
let transformedList = tTools(fromTools);
|
|
14603
|
-
if (Array.isArray(transformedList)) {
|
|
14604
|
-
transformedList = transformedList.map((item) => {
|
|
14605
|
-
return toolToMldev(tTool(item));
|
|
14606
|
-
});
|
|
14607
|
-
}
|
|
14608
|
-
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
14609
|
-
}
|
|
14610
|
-
const fromSessionResumption = getValueByPath(fromObject, [
|
|
14611
|
-
'sessionResumption',
|
|
14612
|
-
]);
|
|
14613
|
-
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
14614
|
-
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(fromSessionResumption));
|
|
14615
|
-
}
|
|
14616
|
-
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
14617
|
-
'inputAudioTranscription',
|
|
14618
|
-
]);
|
|
14619
|
-
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
14620
|
-
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], fromInputAudioTranscription);
|
|
14621
|
-
}
|
|
14622
|
-
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
14623
|
-
'outputAudioTranscription',
|
|
14624
|
-
]);
|
|
14625
|
-
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
14626
|
-
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], fromOutputAudioTranscription);
|
|
14627
|
-
}
|
|
14628
|
-
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
14629
|
-
'realtimeInputConfig',
|
|
14630
|
-
]);
|
|
14631
|
-
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
14632
|
-
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], fromRealtimeInputConfig);
|
|
14633
|
-
}
|
|
14634
|
-
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
14635
|
-
'contextWindowCompression',
|
|
14636
|
-
]);
|
|
14637
|
-
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
14638
|
-
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], fromContextWindowCompression);
|
|
14639
|
-
}
|
|
14640
|
-
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
14641
|
-
if (parentObject !== undefined && fromProactivity != null) {
|
|
14642
|
-
setValueByPath(parentObject, ['setup', 'proactivity'], fromProactivity);
|
|
14643
|
-
}
|
|
14644
|
-
return toObject;
|
|
14645
|
-
}
|
|
14646
|
-
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
14647
|
-
const toObject = {};
|
|
14648
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
14649
|
-
if (fromModel != null) {
|
|
14650
|
-
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
14651
|
-
}
|
|
14652
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14653
|
-
if (fromConfig != null) {
|
|
14654
|
-
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(fromConfig, toObject));
|
|
14655
|
-
}
|
|
14656
|
-
return toObject;
|
|
14657
|
-
}
|
|
14658
|
-
function partToMldev(fromObject) {
|
|
14659
|
-
const toObject = {};
|
|
14660
|
-
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14661
|
-
'mediaResolution',
|
|
14662
|
-
]);
|
|
14663
|
-
if (fromMediaResolution != null) {
|
|
14664
|
-
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
14665
|
-
}
|
|
14666
|
-
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
14667
|
-
'codeExecutionResult',
|
|
14668
|
-
]);
|
|
14669
|
-
if (fromCodeExecutionResult != null) {
|
|
14670
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
14671
|
-
}
|
|
14672
|
-
const fromExecutableCode = getValueByPath(fromObject, [
|
|
14673
|
-
'executableCode',
|
|
14674
|
-
]);
|
|
14675
|
-
if (fromExecutableCode != null) {
|
|
14676
|
-
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
14677
|
-
}
|
|
14678
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
14679
|
-
if (fromFileData != null) {
|
|
14680
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
|
|
14681
|
-
}
|
|
14682
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
14683
|
-
if (fromFunctionCall != null) {
|
|
14684
|
-
setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
|
|
14685
|
-
}
|
|
14686
|
-
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
14687
|
-
'functionResponse',
|
|
14688
|
-
]);
|
|
14689
|
-
if (fromFunctionResponse != null) {
|
|
14690
|
-
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
14691
|
-
}
|
|
14692
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
14693
|
-
if (fromInlineData != null) {
|
|
14694
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
|
|
14695
|
-
}
|
|
14696
|
-
const fromText = getValueByPath(fromObject, ['text']);
|
|
14697
|
-
if (fromText != null) {
|
|
14698
|
-
setValueByPath(toObject, ['text'], fromText);
|
|
14699
|
-
}
|
|
14700
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
14701
|
-
if (fromThought != null) {
|
|
14702
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
14703
|
-
}
|
|
14704
|
-
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
14705
|
-
'thoughtSignature',
|
|
14706
|
-
]);
|
|
14707
|
-
if (fromThoughtSignature != null) {
|
|
14708
|
-
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
14709
|
-
}
|
|
14710
|
-
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
14711
|
-
'videoMetadata',
|
|
14712
|
-
]);
|
|
14713
|
-
if (fromVideoMetadata != null) {
|
|
14714
|
-
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
14715
|
-
}
|
|
14716
|
-
return toObject;
|
|
14717
|
-
}
|
|
14718
|
-
function sessionResumptionConfigToMldev(fromObject) {
|
|
14719
|
-
const toObject = {};
|
|
14720
|
-
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
14721
|
-
if (fromHandle != null) {
|
|
14722
|
-
setValueByPath(toObject, ['handle'], fromHandle);
|
|
14723
|
-
}
|
|
14724
|
-
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
14725
|
-
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
14726
|
-
}
|
|
14727
|
-
return toObject;
|
|
14728
|
-
}
|
|
14729
|
-
function toolToMldev(fromObject) {
|
|
14730
|
-
const toObject = {};
|
|
14731
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14732
|
-
'functionDeclarations',
|
|
14733
|
-
]);
|
|
14734
|
-
if (fromFunctionDeclarations != null) {
|
|
14735
|
-
let transformedList = fromFunctionDeclarations;
|
|
14736
|
-
if (Array.isArray(transformedList)) {
|
|
14737
|
-
transformedList = transformedList.map((item) => {
|
|
14738
|
-
return item;
|
|
14426
|
+
return httpResponse.json();
|
|
14427
|
+
});
|
|
14428
|
+
return response.then((apiResponse) => {
|
|
14429
|
+
const resp = generateVideosOperationFromVertex(apiResponse);
|
|
14430
|
+
const typedResp = new GenerateVideosOperation();
|
|
14431
|
+
Object.assign(typedResp, resp);
|
|
14432
|
+
return typedResp;
|
|
14433
|
+
});
|
|
14434
|
+
}
|
|
14435
|
+
else {
|
|
14436
|
+
const body = generateVideosParametersToMldev(this.apiClient, params);
|
|
14437
|
+
path = formatMap('{model}:predictLongRunning', body['_url']);
|
|
14438
|
+
queryParams = body['_query'];
|
|
14439
|
+
delete body['_url'];
|
|
14440
|
+
delete body['_query'];
|
|
14441
|
+
response = this.apiClient
|
|
14442
|
+
.request({
|
|
14443
|
+
path: path,
|
|
14444
|
+
queryParams: queryParams,
|
|
14445
|
+
body: JSON.stringify(body),
|
|
14446
|
+
httpMethod: 'POST',
|
|
14447
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
14448
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
14449
|
+
})
|
|
14450
|
+
.then((httpResponse) => {
|
|
14451
|
+
return httpResponse.json();
|
|
14452
|
+
});
|
|
14453
|
+
return response.then((apiResponse) => {
|
|
14454
|
+
const resp = generateVideosOperationFromMldev(apiResponse);
|
|
14455
|
+
const typedResp = new GenerateVideosOperation();
|
|
14456
|
+
Object.assign(typedResp, resp);
|
|
14457
|
+
return typedResp;
|
|
14739
14458
|
});
|
|
14740
14459
|
}
|
|
14741
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14742
|
-
}
|
|
14743
|
-
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
14744
|
-
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
14745
|
-
}
|
|
14746
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14747
|
-
'googleSearchRetrieval',
|
|
14748
|
-
]);
|
|
14749
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
14750
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14751
|
-
}
|
|
14752
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14753
|
-
if (fromComputerUse != null) {
|
|
14754
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
14755
|
-
}
|
|
14756
|
-
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
14757
|
-
if (fromFileSearch != null) {
|
|
14758
|
-
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
14759
|
-
}
|
|
14760
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
14761
|
-
'codeExecution',
|
|
14762
|
-
]);
|
|
14763
|
-
if (fromCodeExecution != null) {
|
|
14764
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
14765
|
-
}
|
|
14766
|
-
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
14767
|
-
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
14768
|
-
}
|
|
14769
|
-
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
14770
|
-
if (fromGoogleMaps != null) {
|
|
14771
|
-
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
14772
|
-
}
|
|
14773
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
14774
|
-
if (fromGoogleSearch != null) {
|
|
14775
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
|
|
14776
|
-
}
|
|
14777
|
-
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
14778
|
-
if (fromUrlContext != null) {
|
|
14779
|
-
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
14780
14460
|
}
|
|
14781
|
-
return toObject;
|
|
14782
14461
|
}
|
|
14783
14462
|
|
|
14784
14463
|
/**
|
|
@@ -14786,257 +14465,151 @@ function toolToMldev(fromObject) {
|
|
|
14786
14465
|
* Copyright 2025 Google LLC
|
|
14787
14466
|
* SPDX-License-Identifier: Apache-2.0
|
|
14788
14467
|
*/
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
* @return A comma-separated list of field masks.
|
|
14794
|
-
*/
|
|
14795
|
-
function getFieldMasks(setup) {
|
|
14796
|
-
const fields = [];
|
|
14797
|
-
for (const key in setup) {
|
|
14798
|
-
if (Object.prototype.hasOwnProperty.call(setup, key)) {
|
|
14799
|
-
const value = setup[key];
|
|
14800
|
-
// 2nd layer, recursively get field masks see TODO(b/418290100)
|
|
14801
|
-
if (typeof value === 'object' &&
|
|
14802
|
-
value != null &&
|
|
14803
|
-
Object.keys(value).length > 0) {
|
|
14804
|
-
const field = Object.keys(value).map((kk) => `${key}.${kk}`);
|
|
14805
|
-
fields.push(...field);
|
|
14806
|
-
}
|
|
14807
|
-
else {
|
|
14808
|
-
fields.push(key); // 1st layer
|
|
14809
|
-
}
|
|
14810
|
-
}
|
|
14468
|
+
class Operations extends BaseModule {
|
|
14469
|
+
constructor(apiClient) {
|
|
14470
|
+
super();
|
|
14471
|
+
this.apiClient = apiClient;
|
|
14811
14472
|
}
|
|
14812
|
-
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
.
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14473
|
+
/**
|
|
14474
|
+
* Gets the status of a long-running operation.
|
|
14475
|
+
*
|
|
14476
|
+
* @param parameters The parameters for the get operation request.
|
|
14477
|
+
* @return The updated Operation object, with the latest status or result.
|
|
14478
|
+
*/
|
|
14479
|
+
async getVideosOperation(parameters) {
|
|
14480
|
+
const operation = parameters.operation;
|
|
14481
|
+
const config = parameters.config;
|
|
14482
|
+
if (operation.name === undefined || operation.name === '') {
|
|
14483
|
+
throw new Error('Operation name is required.');
|
|
14484
|
+
}
|
|
14485
|
+
if (this.apiClient.isVertexAI()) {
|
|
14486
|
+
const resourceName = operation.name.split('/operations/')[0];
|
|
14487
|
+
let httpOptions = undefined;
|
|
14488
|
+
if (config && 'httpOptions' in config) {
|
|
14489
|
+
httpOptions = config.httpOptions;
|
|
14490
|
+
}
|
|
14491
|
+
const rawOperation = await this.fetchPredictVideosOperationInternal({
|
|
14492
|
+
operationName: operation.name,
|
|
14493
|
+
resourceName: resourceName,
|
|
14494
|
+
config: { httpOptions: httpOptions },
|
|
14495
|
+
});
|
|
14496
|
+
return operation._fromAPIResponse({
|
|
14497
|
+
apiResponse: rawOperation,
|
|
14498
|
+
_isVertexAI: true,
|
|
14499
|
+
});
|
|
14835
14500
|
}
|
|
14836
14501
|
else {
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14502
|
+
const rawOperation = await this.getVideosOperationInternal({
|
|
14503
|
+
operationName: operation.name,
|
|
14504
|
+
config: config,
|
|
14505
|
+
});
|
|
14506
|
+
return operation._fromAPIResponse({
|
|
14507
|
+
apiResponse: rawOperation,
|
|
14508
|
+
_isVertexAI: false,
|
|
14509
|
+
});
|
|
14840
14510
|
}
|
|
14841
14511
|
}
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
14850
|
-
const
|
|
14851
|
-
if (
|
|
14852
|
-
|
|
14853
|
-
// Case 1: lockAdditionalFields is an empty array. Lock only fields from
|
|
14854
|
-
// bidi setup.
|
|
14855
|
-
if (generatedMaskFromBidi) {
|
|
14856
|
-
// Only assign if mask is not empty
|
|
14857
|
-
requestDict['fieldMask'] = generatedMaskFromBidi;
|
|
14858
|
-
}
|
|
14859
|
-
else {
|
|
14860
|
-
delete requestDict['fieldMask']; // If mask is empty, effectively no
|
|
14861
|
-
// specific fields locked by bidi
|
|
14862
|
-
}
|
|
14512
|
+
/**
|
|
14513
|
+
* Gets the status of a long-running operation.
|
|
14514
|
+
*
|
|
14515
|
+
* @param parameters The parameters for the get operation request.
|
|
14516
|
+
* @return The updated Operation object, with the latest status or result.
|
|
14517
|
+
*/
|
|
14518
|
+
async get(parameters) {
|
|
14519
|
+
const operation = parameters.operation;
|
|
14520
|
+
const config = parameters.config;
|
|
14521
|
+
if (operation.name === undefined || operation.name === '') {
|
|
14522
|
+
throw new Error('Operation name is required.');
|
|
14863
14523
|
}
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
// Case 2: Lock fields from bidi setup + additional fields
|
|
14870
|
-
// (preExistingFieldMask).
|
|
14871
|
-
const generationConfigFields = [
|
|
14872
|
-
'temperature',
|
|
14873
|
-
'topK',
|
|
14874
|
-
'topP',
|
|
14875
|
-
'maxOutputTokens',
|
|
14876
|
-
'responseModalities',
|
|
14877
|
-
'seed',
|
|
14878
|
-
'speechConfig',
|
|
14879
|
-
];
|
|
14880
|
-
let mappedFieldsFromPreExisting = [];
|
|
14881
|
-
if (preExistingFieldMask.length > 0) {
|
|
14882
|
-
mappedFieldsFromPreExisting = preExistingFieldMask.map((field) => {
|
|
14883
|
-
if (generationConfigFields.includes(field)) {
|
|
14884
|
-
return `generationConfig.${field}`;
|
|
14885
|
-
}
|
|
14886
|
-
return field; // Keep original field name if not in
|
|
14887
|
-
// generationConfigFields
|
|
14888
|
-
});
|
|
14889
|
-
}
|
|
14890
|
-
const finalMaskParts = [];
|
|
14891
|
-
if (generatedMaskFromBidi) {
|
|
14892
|
-
finalMaskParts.push(generatedMaskFromBidi);
|
|
14893
|
-
}
|
|
14894
|
-
if (mappedFieldsFromPreExisting.length > 0) {
|
|
14895
|
-
finalMaskParts.push(...mappedFieldsFromPreExisting);
|
|
14896
|
-
}
|
|
14897
|
-
if (finalMaskParts.length > 0) {
|
|
14898
|
-
requestDict['fieldMask'] = finalMaskParts.join(',');
|
|
14899
|
-
}
|
|
14900
|
-
else {
|
|
14901
|
-
// If no fields from bidi and no valid additional fields from
|
|
14902
|
-
// pre-existing mask.
|
|
14903
|
-
delete requestDict['fieldMask'];
|
|
14524
|
+
if (this.apiClient.isVertexAI()) {
|
|
14525
|
+
const resourceName = operation.name.split('/operations/')[0];
|
|
14526
|
+
let httpOptions = undefined;
|
|
14527
|
+
if (config && 'httpOptions' in config) {
|
|
14528
|
+
httpOptions = config.httpOptions;
|
|
14904
14529
|
}
|
|
14530
|
+
const rawOperation = await this.fetchPredictVideosOperationInternal({
|
|
14531
|
+
operationName: operation.name,
|
|
14532
|
+
resourceName: resourceName,
|
|
14533
|
+
config: { httpOptions: httpOptions },
|
|
14534
|
+
});
|
|
14535
|
+
return operation._fromAPIResponse({
|
|
14536
|
+
apiResponse: rawOperation,
|
|
14537
|
+
_isVertexAI: true,
|
|
14538
|
+
});
|
|
14905
14539
|
}
|
|
14906
14540
|
else {
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
|
|
14541
|
+
const rawOperation = await this.getVideosOperationInternal({
|
|
14542
|
+
operationName: operation.name,
|
|
14543
|
+
config: config,
|
|
14544
|
+
});
|
|
14545
|
+
return operation._fromAPIResponse({
|
|
14546
|
+
apiResponse: rawOperation,
|
|
14547
|
+
_isVertexAI: false,
|
|
14548
|
+
});
|
|
14913
14549
|
}
|
|
14914
14550
|
}
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14551
|
+
async getVideosOperationInternal(params) {
|
|
14552
|
+
var _a, _b, _c, _d;
|
|
14553
|
+
let response;
|
|
14554
|
+
let path = '';
|
|
14555
|
+
let queryParams = {};
|
|
14556
|
+
if (this.apiClient.isVertexAI()) {
|
|
14557
|
+
const body = getOperationParametersToVertex(params);
|
|
14558
|
+
path = formatMap('{operationName}', body['_url']);
|
|
14559
|
+
queryParams = body['_query'];
|
|
14560
|
+
delete body['_url'];
|
|
14561
|
+
delete body['_query'];
|
|
14562
|
+
response = this.apiClient
|
|
14563
|
+
.request({
|
|
14564
|
+
path: path,
|
|
14565
|
+
queryParams: queryParams,
|
|
14566
|
+
body: JSON.stringify(body),
|
|
14567
|
+
httpMethod: 'GET',
|
|
14568
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
14569
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14570
|
+
})
|
|
14571
|
+
.then((httpResponse) => {
|
|
14572
|
+
return httpResponse.json();
|
|
14573
|
+
});
|
|
14574
|
+
return response;
|
|
14924
14575
|
}
|
|
14925
14576
|
else {
|
|
14926
|
-
|
|
14577
|
+
const body = getOperationParametersToMldev(params);
|
|
14578
|
+
path = formatMap('{operationName}', body['_url']);
|
|
14579
|
+
queryParams = body['_query'];
|
|
14580
|
+
delete body['_url'];
|
|
14581
|
+
delete body['_query'];
|
|
14582
|
+
response = this.apiClient
|
|
14583
|
+
.request({
|
|
14584
|
+
path: path,
|
|
14585
|
+
queryParams: queryParams,
|
|
14586
|
+
body: JSON.stringify(body),
|
|
14587
|
+
httpMethod: 'GET',
|
|
14588
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
14589
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
14590
|
+
})
|
|
14591
|
+
.then((httpResponse) => {
|
|
14592
|
+
return httpResponse.json();
|
|
14593
|
+
});
|
|
14594
|
+
return response;
|
|
14927
14595
|
}
|
|
14928
14596
|
}
|
|
14929
|
-
|
|
14930
|
-
}
|
|
14931
|
-
class Tokens extends BaseModule {
|
|
14932
|
-
constructor(apiClient) {
|
|
14933
|
-
super();
|
|
14934
|
-
this.apiClient = apiClient;
|
|
14935
|
-
}
|
|
14936
|
-
/**
|
|
14937
|
-
* Creates an ephemeral auth token resource.
|
|
14938
|
-
*
|
|
14939
|
-
* @experimental
|
|
14940
|
-
*
|
|
14941
|
-
* @remarks
|
|
14942
|
-
* Ephemeral auth tokens is only supported in the Gemini Developer API.
|
|
14943
|
-
* It can be used for the session connection to the Live constrained API.
|
|
14944
|
-
* Support in v1alpha only.
|
|
14945
|
-
*
|
|
14946
|
-
* @param params - The parameters for the create request.
|
|
14947
|
-
* @return The created auth token.
|
|
14948
|
-
*
|
|
14949
|
-
* @example
|
|
14950
|
-
* ```ts
|
|
14951
|
-
* const ai = new GoogleGenAI({
|
|
14952
|
-
* apiKey: token.name,
|
|
14953
|
-
* httpOptions: { apiVersion: 'v1alpha' } // Support in v1alpha only.
|
|
14954
|
-
* });
|
|
14955
|
-
*
|
|
14956
|
-
* // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
|
|
14957
|
-
* // when using the token in Live API sessions. Each session connection can
|
|
14958
|
-
* // use a different configuration.
|
|
14959
|
-
* const config: CreateAuthTokenConfig = {
|
|
14960
|
-
* uses: 3,
|
|
14961
|
-
* expireTime: '2025-05-01T00:00:00Z',
|
|
14962
|
-
* }
|
|
14963
|
-
* const token = await ai.tokens.create(config);
|
|
14964
|
-
*
|
|
14965
|
-
* // Case 2: If LiveEphemeralParameters is set, lock all fields in
|
|
14966
|
-
* // LiveConnectConfig when using the token in Live API sessions. For
|
|
14967
|
-
* // example, changing `outputAudioTranscription` in the Live API
|
|
14968
|
-
* // connection will be ignored by the API.
|
|
14969
|
-
* const config: CreateAuthTokenConfig =
|
|
14970
|
-
* uses: 3,
|
|
14971
|
-
* expireTime: '2025-05-01T00:00:00Z',
|
|
14972
|
-
* LiveEphemeralParameters: {
|
|
14973
|
-
* model: 'gemini-2.0-flash-001',
|
|
14974
|
-
* config: {
|
|
14975
|
-
* 'responseModalities': ['AUDIO'],
|
|
14976
|
-
* 'systemInstruction': 'Always answer in English.',
|
|
14977
|
-
* }
|
|
14978
|
-
* }
|
|
14979
|
-
* }
|
|
14980
|
-
* const token = await ai.tokens.create(config);
|
|
14981
|
-
*
|
|
14982
|
-
* // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14983
|
-
* // set, lock LiveConnectConfig with set and additional fields (e.g.
|
|
14984
|
-
* // responseModalities, systemInstruction, temperature in this example) when
|
|
14985
|
-
* // using the token in Live API sessions.
|
|
14986
|
-
* const config: CreateAuthTokenConfig =
|
|
14987
|
-
* uses: 3,
|
|
14988
|
-
* expireTime: '2025-05-01T00:00:00Z',
|
|
14989
|
-
* LiveEphemeralParameters: {
|
|
14990
|
-
* model: 'gemini-2.0-flash-001',
|
|
14991
|
-
* config: {
|
|
14992
|
-
* 'responseModalities': ['AUDIO'],
|
|
14993
|
-
* 'systemInstruction': 'Always answer in English.',
|
|
14994
|
-
* }
|
|
14995
|
-
* },
|
|
14996
|
-
* lockAdditionalFields: ['temperature'],
|
|
14997
|
-
* }
|
|
14998
|
-
* const token = await ai.tokens.create(config);
|
|
14999
|
-
*
|
|
15000
|
-
* // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
15001
|
-
* // empty array, lock LiveConnectConfig with set fields (e.g.
|
|
15002
|
-
* // responseModalities, systemInstruction in this example) when using the
|
|
15003
|
-
* // token in Live API sessions.
|
|
15004
|
-
* const config: CreateAuthTokenConfig =
|
|
15005
|
-
* uses: 3,
|
|
15006
|
-
* expireTime: '2025-05-01T00:00:00Z',
|
|
15007
|
-
* LiveEphemeralParameters: {
|
|
15008
|
-
* model: 'gemini-2.0-flash-001',
|
|
15009
|
-
* config: {
|
|
15010
|
-
* 'responseModalities': ['AUDIO'],
|
|
15011
|
-
* 'systemInstruction': 'Always answer in English.',
|
|
15012
|
-
* }
|
|
15013
|
-
* },
|
|
15014
|
-
* lockAdditionalFields: [],
|
|
15015
|
-
* }
|
|
15016
|
-
* const token = await ai.tokens.create(config);
|
|
15017
|
-
* ```
|
|
15018
|
-
*/
|
|
15019
|
-
async create(params) {
|
|
14597
|
+
async fetchPredictVideosOperationInternal(params) {
|
|
15020
14598
|
var _a, _b;
|
|
15021
14599
|
let response;
|
|
15022
14600
|
let path = '';
|
|
15023
14601
|
let queryParams = {};
|
|
15024
14602
|
if (this.apiClient.isVertexAI()) {
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
else {
|
|
15028
|
-
const body = createAuthTokenParametersToMldev(this.apiClient, params);
|
|
15029
|
-
path = formatMap('auth_tokens', body['_url']);
|
|
14603
|
+
const body = fetchPredictOperationParametersToVertex(params);
|
|
14604
|
+
path = formatMap('{resourceName}:fetchPredictOperation', body['_url']);
|
|
15030
14605
|
queryParams = body['_query'];
|
|
15031
|
-
delete body['config'];
|
|
15032
14606
|
delete body['_url'];
|
|
15033
14607
|
delete body['_query'];
|
|
15034
|
-
const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
|
|
15035
14608
|
response = this.apiClient
|
|
15036
14609
|
.request({
|
|
15037
14610
|
path: path,
|
|
15038
14611
|
queryParams: queryParams,
|
|
15039
|
-
body: JSON.stringify(
|
|
14612
|
+
body: JSON.stringify(body),
|
|
15040
14613
|
httpMethod: 'POST',
|
|
15041
14614
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
15042
14615
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
@@ -15044,246 +14617,670 @@ class Tokens extends BaseModule {
|
|
|
15044
14617
|
.then((httpResponse) => {
|
|
15045
14618
|
return httpResponse.json();
|
|
15046
14619
|
});
|
|
15047
|
-
return response
|
|
15048
|
-
|
|
14620
|
+
return response;
|
|
14621
|
+
}
|
|
14622
|
+
else {
|
|
14623
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
14624
|
+
}
|
|
14625
|
+
}
|
|
14626
|
+
}
|
|
14627
|
+
|
|
14628
|
+
/**
|
|
14629
|
+
* @license
|
|
14630
|
+
* Copyright 2025 Google LLC
|
|
14631
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14632
|
+
*/
|
|
14633
|
+
function blobToMldev(fromObject) {
|
|
14634
|
+
const toObject = {};
|
|
14635
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
14636
|
+
if (fromData != null) {
|
|
14637
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
14638
|
+
}
|
|
14639
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
14640
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
14641
|
+
}
|
|
14642
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
14643
|
+
if (fromMimeType != null) {
|
|
14644
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
14645
|
+
}
|
|
14646
|
+
return toObject;
|
|
14647
|
+
}
|
|
14648
|
+
function contentToMldev(fromObject) {
|
|
14649
|
+
const toObject = {};
|
|
14650
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
14651
|
+
if (fromParts != null) {
|
|
14652
|
+
let transformedList = fromParts;
|
|
14653
|
+
if (Array.isArray(transformedList)) {
|
|
14654
|
+
transformedList = transformedList.map((item) => {
|
|
14655
|
+
return partToMldev(item);
|
|
15049
14656
|
});
|
|
15050
14657
|
}
|
|
14658
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
14659
|
+
}
|
|
14660
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
14661
|
+
if (fromRole != null) {
|
|
14662
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
14663
|
+
}
|
|
14664
|
+
return toObject;
|
|
14665
|
+
}
|
|
14666
|
+
function createAuthTokenConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14667
|
+
const toObject = {};
|
|
14668
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
14669
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
14670
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
14671
|
+
}
|
|
14672
|
+
const fromNewSessionExpireTime = getValueByPath(fromObject, [
|
|
14673
|
+
'newSessionExpireTime',
|
|
14674
|
+
]);
|
|
14675
|
+
if (parentObject !== undefined && fromNewSessionExpireTime != null) {
|
|
14676
|
+
setValueByPath(parentObject, ['newSessionExpireTime'], fromNewSessionExpireTime);
|
|
14677
|
+
}
|
|
14678
|
+
const fromUses = getValueByPath(fromObject, ['uses']);
|
|
14679
|
+
if (parentObject !== undefined && fromUses != null) {
|
|
14680
|
+
setValueByPath(parentObject, ['uses'], fromUses);
|
|
14681
|
+
}
|
|
14682
|
+
const fromLiveConnectConstraints = getValueByPath(fromObject, [
|
|
14683
|
+
'liveConnectConstraints',
|
|
14684
|
+
]);
|
|
14685
|
+
if (parentObject !== undefined && fromLiveConnectConstraints != null) {
|
|
14686
|
+
setValueByPath(parentObject, ['bidiGenerateContentSetup'], liveConnectConstraintsToMldev(apiClient, fromLiveConnectConstraints));
|
|
14687
|
+
}
|
|
14688
|
+
const fromLockAdditionalFields = getValueByPath(fromObject, [
|
|
14689
|
+
'lockAdditionalFields',
|
|
14690
|
+
]);
|
|
14691
|
+
if (parentObject !== undefined && fromLockAdditionalFields != null) {
|
|
14692
|
+
setValueByPath(parentObject, ['fieldMask'], fromLockAdditionalFields);
|
|
14693
|
+
}
|
|
14694
|
+
return toObject;
|
|
14695
|
+
}
|
|
14696
|
+
function createAuthTokenParametersToMldev(apiClient, fromObject) {
|
|
14697
|
+
const toObject = {};
|
|
14698
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14699
|
+
if (fromConfig != null) {
|
|
14700
|
+
setValueByPath(toObject, ['config'], createAuthTokenConfigToMldev(apiClient, fromConfig, toObject));
|
|
14701
|
+
}
|
|
14702
|
+
return toObject;
|
|
14703
|
+
}
|
|
14704
|
+
function fileDataToMldev(fromObject) {
|
|
14705
|
+
const toObject = {};
|
|
14706
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
14707
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
14708
|
+
}
|
|
14709
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
14710
|
+
if (fromFileUri != null) {
|
|
14711
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
14712
|
+
}
|
|
14713
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
14714
|
+
if (fromMimeType != null) {
|
|
14715
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
14716
|
+
}
|
|
14717
|
+
return toObject;
|
|
14718
|
+
}
|
|
14719
|
+
function functionCallToMldev(fromObject) {
|
|
14720
|
+
const toObject = {};
|
|
14721
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
14722
|
+
if (fromId != null) {
|
|
14723
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
14724
|
+
}
|
|
14725
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
14726
|
+
if (fromArgs != null) {
|
|
14727
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
14728
|
+
}
|
|
14729
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14730
|
+
if (fromName != null) {
|
|
14731
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14732
|
+
}
|
|
14733
|
+
if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
|
|
14734
|
+
throw new Error('partialArgs parameter is not supported in Gemini API.');
|
|
14735
|
+
}
|
|
14736
|
+
if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
|
|
14737
|
+
throw new Error('willContinue parameter is not supported in Gemini API.');
|
|
15051
14738
|
}
|
|
14739
|
+
return toObject;
|
|
15052
14740
|
}
|
|
15053
|
-
|
|
15054
|
-
/**
|
|
15055
|
-
* @license
|
|
15056
|
-
* Copyright 2025 Google LLC
|
|
15057
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
15058
|
-
*/
|
|
15059
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
15060
|
-
function createFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
14741
|
+
function googleMapsToMldev(fromObject) {
|
|
15061
14742
|
const toObject = {};
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
14743
|
+
if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
|
|
14744
|
+
throw new Error('authConfig parameter is not supported in Gemini API.');
|
|
14745
|
+
}
|
|
14746
|
+
const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
|
|
14747
|
+
if (fromEnableWidget != null) {
|
|
14748
|
+
setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
|
|
15065
14749
|
}
|
|
15066
14750
|
return toObject;
|
|
15067
14751
|
}
|
|
15068
|
-
function
|
|
14752
|
+
function googleSearchToMldev(fromObject) {
|
|
15069
14753
|
const toObject = {};
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
14754
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
14755
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
14756
|
+
}
|
|
14757
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
14758
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
14759
|
+
}
|
|
14760
|
+
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
14761
|
+
'timeRangeFilter',
|
|
14762
|
+
]);
|
|
14763
|
+
if (fromTimeRangeFilter != null) {
|
|
14764
|
+
setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
|
|
15073
14765
|
}
|
|
15074
14766
|
return toObject;
|
|
15075
14767
|
}
|
|
15076
|
-
function
|
|
14768
|
+
function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
15077
14769
|
const toObject = {};
|
|
15078
|
-
const
|
|
15079
|
-
|
|
15080
|
-
|
|
14770
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
14771
|
+
'generationConfig',
|
|
14772
|
+
]);
|
|
14773
|
+
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
14774
|
+
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
14775
|
+
}
|
|
14776
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
14777
|
+
'responseModalities',
|
|
14778
|
+
]);
|
|
14779
|
+
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
14780
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
14781
|
+
}
|
|
14782
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
14783
|
+
if (parentObject !== undefined && fromTemperature != null) {
|
|
14784
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
14785
|
+
}
|
|
14786
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
14787
|
+
if (parentObject !== undefined && fromTopP != null) {
|
|
14788
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
14789
|
+
}
|
|
14790
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
14791
|
+
if (parentObject !== undefined && fromTopK != null) {
|
|
14792
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
14793
|
+
}
|
|
14794
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
14795
|
+
'maxOutputTokens',
|
|
14796
|
+
]);
|
|
14797
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
14798
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
14799
|
+
}
|
|
14800
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14801
|
+
'mediaResolution',
|
|
14802
|
+
]);
|
|
14803
|
+
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
14804
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
14805
|
+
}
|
|
14806
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
14807
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
14808
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
14809
|
+
}
|
|
14810
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
14811
|
+
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
14812
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
|
|
14813
|
+
}
|
|
14814
|
+
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
14815
|
+
'thinkingConfig',
|
|
14816
|
+
]);
|
|
14817
|
+
if (parentObject !== undefined && fromThinkingConfig != null) {
|
|
14818
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'thinkingConfig'], fromThinkingConfig);
|
|
14819
|
+
}
|
|
14820
|
+
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
14821
|
+
'enableAffectiveDialog',
|
|
14822
|
+
]);
|
|
14823
|
+
if (parentObject !== undefined && fromEnableAffectiveDialog != null) {
|
|
14824
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'enableAffectiveDialog'], fromEnableAffectiveDialog);
|
|
14825
|
+
}
|
|
14826
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
14827
|
+
'systemInstruction',
|
|
14828
|
+
]);
|
|
14829
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
14830
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev(tContent(fromSystemInstruction)));
|
|
14831
|
+
}
|
|
14832
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
14833
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
14834
|
+
let transformedList = tTools(fromTools);
|
|
14835
|
+
if (Array.isArray(transformedList)) {
|
|
14836
|
+
transformedList = transformedList.map((item) => {
|
|
14837
|
+
return toolToMldev(tTool(item));
|
|
14838
|
+
});
|
|
14839
|
+
}
|
|
14840
|
+
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
14841
|
+
}
|
|
14842
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
14843
|
+
'sessionResumption',
|
|
14844
|
+
]);
|
|
14845
|
+
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
14846
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(fromSessionResumption));
|
|
14847
|
+
}
|
|
14848
|
+
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
14849
|
+
'inputAudioTranscription',
|
|
14850
|
+
]);
|
|
14851
|
+
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
14852
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], fromInputAudioTranscription);
|
|
14853
|
+
}
|
|
14854
|
+
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
14855
|
+
'outputAudioTranscription',
|
|
14856
|
+
]);
|
|
14857
|
+
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
14858
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], fromOutputAudioTranscription);
|
|
14859
|
+
}
|
|
14860
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
14861
|
+
'realtimeInputConfig',
|
|
14862
|
+
]);
|
|
14863
|
+
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
14864
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], fromRealtimeInputConfig);
|
|
14865
|
+
}
|
|
14866
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
14867
|
+
'contextWindowCompression',
|
|
14868
|
+
]);
|
|
14869
|
+
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
14870
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], fromContextWindowCompression);
|
|
14871
|
+
}
|
|
14872
|
+
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
14873
|
+
if (parentObject !== undefined && fromProactivity != null) {
|
|
14874
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], fromProactivity);
|
|
15081
14875
|
}
|
|
15082
14876
|
return toObject;
|
|
15083
14877
|
}
|
|
15084
|
-
function
|
|
14878
|
+
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
15085
14879
|
const toObject = {};
|
|
15086
|
-
const
|
|
15087
|
-
if (
|
|
15088
|
-
setValueByPath(toObject, ['
|
|
14880
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
14881
|
+
if (fromModel != null) {
|
|
14882
|
+
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
15089
14883
|
}
|
|
15090
14884
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
15091
14885
|
if (fromConfig != null) {
|
|
15092
|
-
|
|
14886
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(fromConfig, toObject));
|
|
15093
14887
|
}
|
|
15094
14888
|
return toObject;
|
|
15095
14889
|
}
|
|
15096
|
-
function
|
|
14890
|
+
function partToMldev(fromObject) {
|
|
15097
14891
|
const toObject = {};
|
|
15098
|
-
const
|
|
15099
|
-
|
|
15100
|
-
|
|
14892
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14893
|
+
'mediaResolution',
|
|
14894
|
+
]);
|
|
14895
|
+
if (fromMediaResolution != null) {
|
|
14896
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
14897
|
+
}
|
|
14898
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
14899
|
+
'codeExecutionResult',
|
|
14900
|
+
]);
|
|
14901
|
+
if (fromCodeExecutionResult != null) {
|
|
14902
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
14903
|
+
}
|
|
14904
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
14905
|
+
'executableCode',
|
|
14906
|
+
]);
|
|
14907
|
+
if (fromExecutableCode != null) {
|
|
14908
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
14909
|
+
}
|
|
14910
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
14911
|
+
if (fromFileData != null) {
|
|
14912
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
|
|
14913
|
+
}
|
|
14914
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
14915
|
+
if (fromFunctionCall != null) {
|
|
14916
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
|
|
14917
|
+
}
|
|
14918
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
14919
|
+
'functionResponse',
|
|
14920
|
+
]);
|
|
14921
|
+
if (fromFunctionResponse != null) {
|
|
14922
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
14923
|
+
}
|
|
14924
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
14925
|
+
if (fromInlineData != null) {
|
|
14926
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
|
|
14927
|
+
}
|
|
14928
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
14929
|
+
if (fromText != null) {
|
|
14930
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
14931
|
+
}
|
|
14932
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
14933
|
+
if (fromThought != null) {
|
|
14934
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
14935
|
+
}
|
|
14936
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
14937
|
+
'thoughtSignature',
|
|
14938
|
+
]);
|
|
14939
|
+
if (fromThoughtSignature != null) {
|
|
14940
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
14941
|
+
}
|
|
14942
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
14943
|
+
'videoMetadata',
|
|
14944
|
+
]);
|
|
14945
|
+
if (fromVideoMetadata != null) {
|
|
14946
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
15101
14947
|
}
|
|
15102
14948
|
return toObject;
|
|
15103
14949
|
}
|
|
15104
|
-
function
|
|
14950
|
+
function sessionResumptionConfigToMldev(fromObject) {
|
|
15105
14951
|
const toObject = {};
|
|
15106
|
-
const
|
|
15107
|
-
|
|
14952
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
14953
|
+
if (fromHandle != null) {
|
|
14954
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
14955
|
+
}
|
|
14956
|
+
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
14957
|
+
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
14958
|
+
}
|
|
14959
|
+
return toObject;
|
|
14960
|
+
}
|
|
14961
|
+
function toolToMldev(fromObject) {
|
|
14962
|
+
const toObject = {};
|
|
14963
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14964
|
+
'functionDeclarations',
|
|
15108
14965
|
]);
|
|
15109
|
-
if (
|
|
15110
|
-
let transformedList =
|
|
14966
|
+
if (fromFunctionDeclarations != null) {
|
|
14967
|
+
let transformedList = fromFunctionDeclarations;
|
|
15111
14968
|
if (Array.isArray(transformedList)) {
|
|
15112
14969
|
transformedList = transformedList.map((item) => {
|
|
15113
14970
|
return item;
|
|
15114
14971
|
});
|
|
15115
14972
|
}
|
|
15116
|
-
setValueByPath(
|
|
15117
|
-
}
|
|
15118
|
-
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
15119
|
-
'chunkingConfig',
|
|
15120
|
-
]);
|
|
15121
|
-
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
15122
|
-
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
15123
|
-
}
|
|
15124
|
-
return toObject;
|
|
15125
|
-
}
|
|
15126
|
-
function importFileOperationFromMldev(fromObject) {
|
|
15127
|
-
const toObject = {};
|
|
15128
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
15129
|
-
if (fromName != null) {
|
|
15130
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
15131
|
-
}
|
|
15132
|
-
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
15133
|
-
if (fromMetadata != null) {
|
|
15134
|
-
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
15135
|
-
}
|
|
15136
|
-
const fromDone = getValueByPath(fromObject, ['done']);
|
|
15137
|
-
if (fromDone != null) {
|
|
15138
|
-
setValueByPath(toObject, ['done'], fromDone);
|
|
15139
|
-
}
|
|
15140
|
-
const fromError = getValueByPath(fromObject, ['error']);
|
|
15141
|
-
if (fromError != null) {
|
|
15142
|
-
setValueByPath(toObject, ['error'], fromError);
|
|
14973
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
15143
14974
|
}
|
|
15144
|
-
|
|
15145
|
-
|
|
15146
|
-
setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
|
|
14975
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
14976
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
15147
14977
|
}
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
function importFileParametersToMldev(fromObject) {
|
|
15151
|
-
const toObject = {};
|
|
15152
|
-
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
15153
|
-
'fileSearchStoreName',
|
|
14978
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14979
|
+
'googleSearchRetrieval',
|
|
15154
14980
|
]);
|
|
15155
|
-
if (
|
|
15156
|
-
setValueByPath(toObject, ['
|
|
14981
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
14982
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
15157
14983
|
}
|
|
15158
|
-
const
|
|
15159
|
-
if (
|
|
15160
|
-
setValueByPath(toObject, ['
|
|
14984
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14985
|
+
if (fromComputerUse != null) {
|
|
14986
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
15161
14987
|
}
|
|
15162
|
-
const
|
|
15163
|
-
if (
|
|
15164
|
-
|
|
14988
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
14989
|
+
if (fromFileSearch != null) {
|
|
14990
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
15165
14991
|
}
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
function importFileResponseFromMldev(fromObject) {
|
|
15169
|
-
const toObject = {};
|
|
15170
|
-
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
15171
|
-
'sdkHttpResponse',
|
|
14992
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
14993
|
+
'codeExecution',
|
|
15172
14994
|
]);
|
|
15173
|
-
if (
|
|
15174
|
-
setValueByPath(toObject, ['
|
|
14995
|
+
if (fromCodeExecution != null) {
|
|
14996
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
15175
14997
|
}
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
setValueByPath(toObject, ['parent'], fromParent);
|
|
14998
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
14999
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
15179
15000
|
}
|
|
15180
|
-
const
|
|
15181
|
-
if (
|
|
15182
|
-
setValueByPath(toObject, ['
|
|
15001
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
15002
|
+
if (fromGoogleMaps != null) {
|
|
15003
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
15183
15004
|
}
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
const toObject = {};
|
|
15188
|
-
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
15189
|
-
if (parentObject !== undefined && fromPageSize != null) {
|
|
15190
|
-
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
15005
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
15006
|
+
if (fromGoogleSearch != null) {
|
|
15007
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
|
|
15191
15008
|
}
|
|
15192
|
-
const
|
|
15193
|
-
if (
|
|
15194
|
-
setValueByPath(
|
|
15009
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
15010
|
+
if (fromUrlContext != null) {
|
|
15011
|
+
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
15195
15012
|
}
|
|
15196
15013
|
return toObject;
|
|
15197
15014
|
}
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
|
|
15015
|
+
|
|
15016
|
+
/**
|
|
15017
|
+
* @license
|
|
15018
|
+
* Copyright 2025 Google LLC
|
|
15019
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15020
|
+
*/
|
|
15021
|
+
/**
|
|
15022
|
+
* Returns a comma-separated list of field masks from a given object.
|
|
15023
|
+
*
|
|
15024
|
+
* @param setup The object to extract field masks from.
|
|
15025
|
+
* @return A comma-separated list of field masks.
|
|
15026
|
+
*/
|
|
15027
|
+
function getFieldMasks(setup) {
|
|
15028
|
+
const fields = [];
|
|
15029
|
+
for (const key in setup) {
|
|
15030
|
+
if (Object.prototype.hasOwnProperty.call(setup, key)) {
|
|
15031
|
+
const value = setup[key];
|
|
15032
|
+
// 2nd layer, recursively get field masks see TODO(b/418290100)
|
|
15033
|
+
if (typeof value === 'object' &&
|
|
15034
|
+
value != null &&
|
|
15035
|
+
Object.keys(value).length > 0) {
|
|
15036
|
+
const field = Object.keys(value).map((kk) => `${key}.${kk}`);
|
|
15037
|
+
fields.push(...field);
|
|
15038
|
+
}
|
|
15039
|
+
else {
|
|
15040
|
+
fields.push(key); // 1st layer
|
|
15041
|
+
}
|
|
15042
|
+
}
|
|
15203
15043
|
}
|
|
15204
|
-
return
|
|
15044
|
+
return fields.join(',');
|
|
15205
15045
|
}
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
|
|
15046
|
+
/**
|
|
15047
|
+
* Converts bidiGenerateContentSetup.
|
|
15048
|
+
* @param requestDict - The request dictionary.
|
|
15049
|
+
* @param config - The configuration object.
|
|
15050
|
+
* @return - The modified request dictionary.
|
|
15051
|
+
*/
|
|
15052
|
+
function convertBidiSetupToTokenSetup(requestDict, config) {
|
|
15053
|
+
// Convert bidiGenerateContentSetup from bidiGenerateContentSetup.setup.
|
|
15054
|
+
let setupForMaskGeneration = null;
|
|
15055
|
+
const bidiGenerateContentSetupValue = requestDict['bidiGenerateContentSetup'];
|
|
15056
|
+
if (typeof bidiGenerateContentSetupValue === 'object' &&
|
|
15057
|
+
bidiGenerateContentSetupValue !== null &&
|
|
15058
|
+
'setup' in bidiGenerateContentSetupValue) {
|
|
15059
|
+
// Now we know bidiGenerateContentSetupValue is an object and has a 'setup'
|
|
15060
|
+
// property.
|
|
15061
|
+
const innerSetup = bidiGenerateContentSetupValue
|
|
15062
|
+
.setup;
|
|
15063
|
+
if (typeof innerSetup === 'object' && innerSetup !== null) {
|
|
15064
|
+
// Valid inner setup found.
|
|
15065
|
+
requestDict['bidiGenerateContentSetup'] = innerSetup;
|
|
15066
|
+
setupForMaskGeneration = innerSetup;
|
|
15067
|
+
}
|
|
15068
|
+
else {
|
|
15069
|
+
// `bidiGenerateContentSetupValue.setup` is not a valid object; treat as
|
|
15070
|
+
// if bidiGenerateContentSetup is invalid.
|
|
15071
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
15072
|
+
}
|
|
15213
15073
|
}
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15218
|
-
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
15074
|
+
else if (bidiGenerateContentSetupValue !== undefined) {
|
|
15075
|
+
// `bidiGenerateContentSetup` exists but not in the expected
|
|
15076
|
+
// shape {setup: {...}}; treat as invalid.
|
|
15077
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
15219
15078
|
}
|
|
15220
|
-
const
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
|
|
15228
|
-
|
|
15079
|
+
const preExistingFieldMask = requestDict['fieldMask'];
|
|
15080
|
+
// Handle mask generation setup.
|
|
15081
|
+
if (setupForMaskGeneration) {
|
|
15082
|
+
const generatedMaskFromBidi = getFieldMasks(setupForMaskGeneration);
|
|
15083
|
+
if (Array.isArray(config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
15084
|
+
(config === null || config === void 0 ? void 0 : config.lockAdditionalFields.length) === 0) {
|
|
15085
|
+
// Case 1: lockAdditionalFields is an empty array. Lock only fields from
|
|
15086
|
+
// bidi setup.
|
|
15087
|
+
if (generatedMaskFromBidi) {
|
|
15088
|
+
// Only assign if mask is not empty
|
|
15089
|
+
requestDict['fieldMask'] = generatedMaskFromBidi;
|
|
15090
|
+
}
|
|
15091
|
+
else {
|
|
15092
|
+
delete requestDict['fieldMask']; // If mask is empty, effectively no
|
|
15093
|
+
// specific fields locked by bidi
|
|
15094
|
+
}
|
|
15095
|
+
}
|
|
15096
|
+
else if ((config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
15097
|
+
config.lockAdditionalFields.length > 0 &&
|
|
15098
|
+
preExistingFieldMask !== null &&
|
|
15099
|
+
Array.isArray(preExistingFieldMask) &&
|
|
15100
|
+
preExistingFieldMask.length > 0) {
|
|
15101
|
+
// Case 2: Lock fields from bidi setup + additional fields
|
|
15102
|
+
// (preExistingFieldMask).
|
|
15103
|
+
const generationConfigFields = [
|
|
15104
|
+
'temperature',
|
|
15105
|
+
'topK',
|
|
15106
|
+
'topP',
|
|
15107
|
+
'maxOutputTokens',
|
|
15108
|
+
'responseModalities',
|
|
15109
|
+
'seed',
|
|
15110
|
+
'speechConfig',
|
|
15111
|
+
];
|
|
15112
|
+
let mappedFieldsFromPreExisting = [];
|
|
15113
|
+
if (preExistingFieldMask.length > 0) {
|
|
15114
|
+
mappedFieldsFromPreExisting = preExistingFieldMask.map((field) => {
|
|
15115
|
+
if (generationConfigFields.includes(field)) {
|
|
15116
|
+
return `generationConfig.${field}`;
|
|
15117
|
+
}
|
|
15118
|
+
return field; // Keep original field name if not in
|
|
15119
|
+
// generationConfigFields
|
|
15120
|
+
});
|
|
15121
|
+
}
|
|
15122
|
+
const finalMaskParts = [];
|
|
15123
|
+
if (generatedMaskFromBidi) {
|
|
15124
|
+
finalMaskParts.push(generatedMaskFromBidi);
|
|
15125
|
+
}
|
|
15126
|
+
if (mappedFieldsFromPreExisting.length > 0) {
|
|
15127
|
+
finalMaskParts.push(...mappedFieldsFromPreExisting);
|
|
15128
|
+
}
|
|
15129
|
+
if (finalMaskParts.length > 0) {
|
|
15130
|
+
requestDict['fieldMask'] = finalMaskParts.join(',');
|
|
15131
|
+
}
|
|
15132
|
+
else {
|
|
15133
|
+
// If no fields from bidi and no valid additional fields from
|
|
15134
|
+
// pre-existing mask.
|
|
15135
|
+
delete requestDict['fieldMask'];
|
|
15136
|
+
}
|
|
15137
|
+
}
|
|
15138
|
+
else {
|
|
15139
|
+
// Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
|
|
15140
|
+
// defaults apply or all are mutable). This is hit if:
|
|
15141
|
+
// - `config.lockAdditionalFields` is undefined.
|
|
15142
|
+
// - `config.lockAdditionalFields` is non-empty, BUT
|
|
15143
|
+
// `preExistingFieldMask` is null, not a string, or an empty string.
|
|
15144
|
+
delete requestDict['fieldMask'];
|
|
15145
|
+
}
|
|
15146
|
+
}
|
|
15147
|
+
else {
|
|
15148
|
+
// No valid `bidiGenerateContentSetup` was found or extracted.
|
|
15149
|
+
// "Lock additional null fields if any".
|
|
15150
|
+
if (preExistingFieldMask !== null &&
|
|
15151
|
+
Array.isArray(preExistingFieldMask) &&
|
|
15152
|
+
preExistingFieldMask.length > 0) {
|
|
15153
|
+
// If there's a pre-existing field mask, it's a string, and it's not
|
|
15154
|
+
// empty, then we should lock all fields.
|
|
15155
|
+
requestDict['fieldMask'] = preExistingFieldMask.join(',');
|
|
15156
|
+
}
|
|
15157
|
+
else {
|
|
15158
|
+
delete requestDict['fieldMask'];
|
|
15229
15159
|
}
|
|
15230
|
-
setValueByPath(toObject, ['fileSearchStores'], transformedList);
|
|
15231
15160
|
}
|
|
15232
|
-
return
|
|
15161
|
+
return requestDict;
|
|
15233
15162
|
}
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
setValueByPath(parentObject, ['mimeType'], fromMimeType);
|
|
15239
|
-
}
|
|
15240
|
-
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
15241
|
-
if (parentObject !== undefined && fromDisplayName != null) {
|
|
15242
|
-
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
15163
|
+
class Tokens extends BaseModule {
|
|
15164
|
+
constructor(apiClient) {
|
|
15165
|
+
super();
|
|
15166
|
+
this.apiClient = apiClient;
|
|
15243
15167
|
}
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15168
|
+
/**
|
|
15169
|
+
* Creates an ephemeral auth token resource.
|
|
15170
|
+
*
|
|
15171
|
+
* @experimental
|
|
15172
|
+
*
|
|
15173
|
+
* @remarks
|
|
15174
|
+
* Ephemeral auth tokens is only supported in the Gemini Developer API.
|
|
15175
|
+
* It can be used for the session connection to the Live constrained API.
|
|
15176
|
+
* Support in v1alpha only.
|
|
15177
|
+
*
|
|
15178
|
+
* @param params - The parameters for the create request.
|
|
15179
|
+
* @return The created auth token.
|
|
15180
|
+
*
|
|
15181
|
+
* @example
|
|
15182
|
+
* ```ts
|
|
15183
|
+
* const ai = new GoogleGenAI({
|
|
15184
|
+
* apiKey: token.name,
|
|
15185
|
+
* httpOptions: { apiVersion: 'v1alpha' } // Support in v1alpha only.
|
|
15186
|
+
* });
|
|
15187
|
+
*
|
|
15188
|
+
* // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
|
|
15189
|
+
* // when using the token in Live API sessions. Each session connection can
|
|
15190
|
+
* // use a different configuration.
|
|
15191
|
+
* const config: CreateAuthTokenConfig = {
|
|
15192
|
+
* uses: 3,
|
|
15193
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
15194
|
+
* }
|
|
15195
|
+
* const token = await ai.tokens.create(config);
|
|
15196
|
+
*
|
|
15197
|
+
* // Case 2: If LiveEphemeralParameters is set, lock all fields in
|
|
15198
|
+
* // LiveConnectConfig when using the token in Live API sessions. For
|
|
15199
|
+
* // example, changing `outputAudioTranscription` in the Live API
|
|
15200
|
+
* // connection will be ignored by the API.
|
|
15201
|
+
* const config: CreateAuthTokenConfig =
|
|
15202
|
+
* uses: 3,
|
|
15203
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
15204
|
+
* LiveEphemeralParameters: {
|
|
15205
|
+
* model: 'gemini-2.0-flash-001',
|
|
15206
|
+
* config: {
|
|
15207
|
+
* 'responseModalities': ['AUDIO'],
|
|
15208
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
15209
|
+
* }
|
|
15210
|
+
* }
|
|
15211
|
+
* }
|
|
15212
|
+
* const token = await ai.tokens.create(config);
|
|
15213
|
+
*
|
|
15214
|
+
* // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
15215
|
+
* // set, lock LiveConnectConfig with set and additional fields (e.g.
|
|
15216
|
+
* // responseModalities, systemInstruction, temperature in this example) when
|
|
15217
|
+
* // using the token in Live API sessions.
|
|
15218
|
+
* const config: CreateAuthTokenConfig =
|
|
15219
|
+
* uses: 3,
|
|
15220
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
15221
|
+
* LiveEphemeralParameters: {
|
|
15222
|
+
* model: 'gemini-2.0-flash-001',
|
|
15223
|
+
* config: {
|
|
15224
|
+
* 'responseModalities': ['AUDIO'],
|
|
15225
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
15226
|
+
* }
|
|
15227
|
+
* },
|
|
15228
|
+
* lockAdditionalFields: ['temperature'],
|
|
15229
|
+
* }
|
|
15230
|
+
* const token = await ai.tokens.create(config);
|
|
15231
|
+
*
|
|
15232
|
+
* // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
15233
|
+
* // empty array, lock LiveConnectConfig with set fields (e.g.
|
|
15234
|
+
* // responseModalities, systemInstruction in this example) when using the
|
|
15235
|
+
* // token in Live API sessions.
|
|
15236
|
+
* const config: CreateAuthTokenConfig =
|
|
15237
|
+
* uses: 3,
|
|
15238
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
15239
|
+
* LiveEphemeralParameters: {
|
|
15240
|
+
* model: 'gemini-2.0-flash-001',
|
|
15241
|
+
* config: {
|
|
15242
|
+
* 'responseModalities': ['AUDIO'],
|
|
15243
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
15244
|
+
* }
|
|
15245
|
+
* },
|
|
15246
|
+
* lockAdditionalFields: [],
|
|
15247
|
+
* }
|
|
15248
|
+
* const token = await ai.tokens.create(config);
|
|
15249
|
+
* ```
|
|
15250
|
+
*/
|
|
15251
|
+
async create(params) {
|
|
15252
|
+
var _a, _b;
|
|
15253
|
+
let response;
|
|
15254
|
+
let path = '';
|
|
15255
|
+
let queryParams = {};
|
|
15256
|
+
if (this.apiClient.isVertexAI()) {
|
|
15257
|
+
throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
|
|
15258
|
+
}
|
|
15259
|
+
else {
|
|
15260
|
+
const body = createAuthTokenParametersToMldev(this.apiClient, params);
|
|
15261
|
+
path = formatMap('auth_tokens', body['_url']);
|
|
15262
|
+
queryParams = body['_query'];
|
|
15263
|
+
delete body['config'];
|
|
15264
|
+
delete body['_url'];
|
|
15265
|
+
delete body['_query'];
|
|
15266
|
+
const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
|
|
15267
|
+
response = this.apiClient
|
|
15268
|
+
.request({
|
|
15269
|
+
path: path,
|
|
15270
|
+
queryParams: queryParams,
|
|
15271
|
+
body: JSON.stringify(transformedBody),
|
|
15272
|
+
httpMethod: 'POST',
|
|
15273
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
15274
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15275
|
+
})
|
|
15276
|
+
.then((httpResponse) => {
|
|
15277
|
+
return httpResponse.json();
|
|
15278
|
+
});
|
|
15279
|
+
return response.then((resp) => {
|
|
15280
|
+
return resp;
|
|
15252
15281
|
});
|
|
15253
15282
|
}
|
|
15254
|
-
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
15255
|
-
}
|
|
15256
|
-
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
15257
|
-
'chunkingConfig',
|
|
15258
|
-
]);
|
|
15259
|
-
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
15260
|
-
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
15261
|
-
}
|
|
15262
|
-
return toObject;
|
|
15263
|
-
}
|
|
15264
|
-
function uploadToFileSearchStoreParametersToMldev(fromObject) {
|
|
15265
|
-
const toObject = {};
|
|
15266
|
-
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
15267
|
-
'fileSearchStoreName',
|
|
15268
|
-
]);
|
|
15269
|
-
if (fromFileSearchStoreName != null) {
|
|
15270
|
-
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
15271
|
-
}
|
|
15272
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
15273
|
-
if (fromConfig != null) {
|
|
15274
|
-
uploadToFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
15275
|
-
}
|
|
15276
|
-
return toObject;
|
|
15277
|
-
}
|
|
15278
|
-
function uploadToFileSearchStoreResumableResponseFromMldev(fromObject) {
|
|
15279
|
-
const toObject = {};
|
|
15280
|
-
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
15281
|
-
'sdkHttpResponse',
|
|
15282
|
-
]);
|
|
15283
|
-
if (fromSdkHttpResponse != null) {
|
|
15284
|
-
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
15285
15283
|
}
|
|
15286
|
-
return toObject;
|
|
15287
15284
|
}
|
|
15288
15285
|
|
|
15289
15286
|
/**
|
|
@@ -15388,17 +15385,14 @@ class Documents extends BaseModule {
|
|
|
15388
15385
|
*
|
|
15389
15386
|
* @example
|
|
15390
15387
|
* ```ts
|
|
15391
|
-
* const documents = await ai.documents.list({config: {'pageSize': 2}});
|
|
15388
|
+
* const documents = await ai.documents.list({parent:'rag_store_name', config: {'pageSize': 2}});
|
|
15392
15389
|
* for await (const document of documents) {
|
|
15393
15390
|
* console.log(document);
|
|
15394
15391
|
* }
|
|
15395
15392
|
* ```
|
|
15396
15393
|
*/
|
|
15397
15394
|
this.list = async (params) => {
|
|
15398
|
-
return new Pager(PagedItem.PAGED_ITEM_DOCUMENTS, (x) => this.listInternal({
|
|
15399
|
-
parent: params.parent,
|
|
15400
|
-
config: x.config,
|
|
15401
|
-
}), await this.listInternal(params), params);
|
|
15395
|
+
return new Pager(PagedItem.PAGED_ITEM_DOCUMENTS, (x) => this.listInternal({ parent: params.parent, config: x.config }), await this.listInternal(params), params);
|
|
15402
15396
|
};
|
|
15403
15397
|
}
|
|
15404
15398
|
/**
|
|
@@ -15466,12 +15460,6 @@ class Documents extends BaseModule {
|
|
|
15466
15460
|
});
|
|
15467
15461
|
}
|
|
15468
15462
|
}
|
|
15469
|
-
/**
|
|
15470
|
-
* Lists all Documents in a FileSearchStore.
|
|
15471
|
-
*
|
|
15472
|
-
* @param params - The parameters for listing documents.
|
|
15473
|
-
* @return ListDocumentsResponse.
|
|
15474
|
-
*/
|
|
15475
15463
|
async listInternal(params) {
|
|
15476
15464
|
var _a, _b;
|
|
15477
15465
|
let response;
|
|
@@ -15680,12 +15668,6 @@ class FileSearchStores extends BaseModule {
|
|
|
15680
15668
|
});
|
|
15681
15669
|
}
|
|
15682
15670
|
}
|
|
15683
|
-
/**
|
|
15684
|
-
* Lists all FileSearchStore owned by the user.
|
|
15685
|
-
*
|
|
15686
|
-
* @param params - The parameters for listing file search stores.
|
|
15687
|
-
* @return ListFileSearchStoresResponse.
|
|
15688
|
-
*/
|
|
15689
15671
|
async listInternal(params) {
|
|
15690
15672
|
var _a, _b;
|
|
15691
15673
|
let response;
|
|
@@ -15820,6 +15802,26 @@ function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
|
15820
15802
|
}
|
|
15821
15803
|
return toObject;
|
|
15822
15804
|
}
|
|
15805
|
+
function cancelTuningJobResponseFromMldev(fromObject, _rootObject) {
|
|
15806
|
+
const toObject = {};
|
|
15807
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
15808
|
+
'sdkHttpResponse',
|
|
15809
|
+
]);
|
|
15810
|
+
if (fromSdkHttpResponse != null) {
|
|
15811
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
15812
|
+
}
|
|
15813
|
+
return toObject;
|
|
15814
|
+
}
|
|
15815
|
+
function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
|
|
15816
|
+
const toObject = {};
|
|
15817
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
15818
|
+
'sdkHttpResponse',
|
|
15819
|
+
]);
|
|
15820
|
+
if (fromSdkHttpResponse != null) {
|
|
15821
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
15822
|
+
}
|
|
15823
|
+
return toObject;
|
|
15824
|
+
}
|
|
15823
15825
|
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
15824
15826
|
const toObject = {};
|
|
15825
15827
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
@@ -16481,28 +16483,33 @@ class Tunings extends BaseModule {
|
|
|
16481
16483
|
super();
|
|
16482
16484
|
this.apiClient = apiClient;
|
|
16483
16485
|
/**
|
|
16484
|
-
*
|
|
16486
|
+
* Lists tuning jobs.
|
|
16485
16487
|
*
|
|
16486
|
-
* @param
|
|
16487
|
-
* @return - A
|
|
16488
|
+
* @param params - The parameters for the list request.
|
|
16489
|
+
* @return - A pager of tuning jobs.
|
|
16488
16490
|
*
|
|
16489
|
-
* @
|
|
16490
|
-
*
|
|
16491
|
+
* @example
|
|
16492
|
+
* ```ts
|
|
16493
|
+
* const tuningJobs = await ai.tunings.list({config: {'pageSize': 2}});
|
|
16494
|
+
* for await (const tuningJob of tuningJobs) {
|
|
16495
|
+
* console.log(tuningJob);
|
|
16496
|
+
* }
|
|
16497
|
+
* ```
|
|
16491
16498
|
*/
|
|
16492
|
-
this.
|
|
16493
|
-
return await this.
|
|
16499
|
+
this.list = async (params = {}) => {
|
|
16500
|
+
return new Pager(PagedItem.PAGED_ITEM_TUNING_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
16494
16501
|
};
|
|
16495
16502
|
/**
|
|
16496
|
-
*
|
|
16503
|
+
* Gets a TuningJob.
|
|
16497
16504
|
*
|
|
16498
|
-
* @param
|
|
16499
|
-
* @return - A
|
|
16505
|
+
* @param name - The resource name of the tuning job.
|
|
16506
|
+
* @return - A TuningJob object.
|
|
16500
16507
|
*
|
|
16501
16508
|
* @experimental - The SDK's tuning implementation is experimental, and may
|
|
16502
16509
|
* change in future versions.
|
|
16503
16510
|
*/
|
|
16504
|
-
this.
|
|
16505
|
-
return
|
|
16511
|
+
this.get = async (params) => {
|
|
16512
|
+
return await this.getInternal(params);
|
|
16506
16513
|
};
|
|
16507
16514
|
/**
|
|
16508
16515
|
* Creates a supervised fine-tuning job.
|
|
@@ -16697,6 +16704,7 @@ class Tunings extends BaseModule {
|
|
|
16697
16704
|
*/
|
|
16698
16705
|
async cancel(params) {
|
|
16699
16706
|
var _a, _b, _c, _d;
|
|
16707
|
+
let response;
|
|
16700
16708
|
let path = '';
|
|
16701
16709
|
let queryParams = {};
|
|
16702
16710
|
if (this.apiClient.isVertexAI()) {
|
|
@@ -16705,13 +16713,29 @@ class Tunings extends BaseModule {
|
|
|
16705
16713
|
queryParams = body['_query'];
|
|
16706
16714
|
delete body['_url'];
|
|
16707
16715
|
delete body['_query'];
|
|
16708
|
-
|
|
16716
|
+
response = this.apiClient
|
|
16717
|
+
.request({
|
|
16709
16718
|
path: path,
|
|
16710
16719
|
queryParams: queryParams,
|
|
16711
16720
|
body: JSON.stringify(body),
|
|
16712
16721
|
httpMethod: 'POST',
|
|
16713
16722
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
16714
16723
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
16724
|
+
})
|
|
16725
|
+
.then((httpResponse) => {
|
|
16726
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
16727
|
+
const response = jsonResponse;
|
|
16728
|
+
response.sdkHttpResponse = {
|
|
16729
|
+
headers: httpResponse.headers,
|
|
16730
|
+
};
|
|
16731
|
+
return response;
|
|
16732
|
+
});
|
|
16733
|
+
});
|
|
16734
|
+
return response.then((apiResponse) => {
|
|
16735
|
+
const resp = cancelTuningJobResponseFromVertex(apiResponse);
|
|
16736
|
+
const typedResp = new CancelTuningJobResponse();
|
|
16737
|
+
Object.assign(typedResp, resp);
|
|
16738
|
+
return typedResp;
|
|
16715
16739
|
});
|
|
16716
16740
|
}
|
|
16717
16741
|
else {
|
|
@@ -16720,13 +16744,29 @@ class Tunings extends BaseModule {
|
|
|
16720
16744
|
queryParams = body['_query'];
|
|
16721
16745
|
delete body['_url'];
|
|
16722
16746
|
delete body['_query'];
|
|
16723
|
-
|
|
16747
|
+
response = this.apiClient
|
|
16748
|
+
.request({
|
|
16724
16749
|
path: path,
|
|
16725
16750
|
queryParams: queryParams,
|
|
16726
16751
|
body: JSON.stringify(body),
|
|
16727
16752
|
httpMethod: 'POST',
|
|
16728
16753
|
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
16729
16754
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
16755
|
+
})
|
|
16756
|
+
.then((httpResponse) => {
|
|
16757
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
16758
|
+
const response = jsonResponse;
|
|
16759
|
+
response.sdkHttpResponse = {
|
|
16760
|
+
headers: httpResponse.headers,
|
|
16761
|
+
};
|
|
16762
|
+
return response;
|
|
16763
|
+
});
|
|
16764
|
+
});
|
|
16765
|
+
return response.then((apiResponse) => {
|
|
16766
|
+
const resp = cancelTuningJobResponseFromMldev(apiResponse);
|
|
16767
|
+
const typedResp = new CancelTuningJobResponse();
|
|
16768
|
+
Object.assign(typedResp, resp);
|
|
16769
|
+
return typedResp;
|
|
16730
16770
|
});
|
|
16731
16771
|
}
|
|
16732
16772
|
}
|
|
@@ -17057,13 +17097,14 @@ class GoogleGenAI {
|
|
|
17057
17097
|
}
|
|
17058
17098
|
}
|
|
17059
17099
|
this.apiVersion = options.apiVersion;
|
|
17100
|
+
this.httpOptions = options.httpOptions;
|
|
17060
17101
|
const auth = new WebAuth(this.apiKey);
|
|
17061
17102
|
this.apiClient = new ApiClient({
|
|
17062
17103
|
auth: auth,
|
|
17063
17104
|
apiVersion: this.apiVersion,
|
|
17064
17105
|
apiKey: this.apiKey,
|
|
17065
17106
|
vertexai: this.vertexai,
|
|
17066
|
-
httpOptions:
|
|
17107
|
+
httpOptions: this.httpOptions,
|
|
17067
17108
|
userAgentExtra: LANGUAGE_LABEL_PREFIX + 'web',
|
|
17068
17109
|
uploader: new BrowserUploader(),
|
|
17069
17110
|
downloader: new BrowserDownloader(),
|
|
@@ -17081,5 +17122,5 @@ class GoogleGenAI {
|
|
|
17081
17122
|
}
|
|
17082
17123
|
}
|
|
17083
17124
|
|
|
17084
|
-
export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, 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, Mode, 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, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
17125
|
+
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, Mode, 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, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
17085
17126
|
//# sourceMappingURL=index.mjs.map
|