@google/genai 1.10.0 → 1.12.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 +113 -18
- package/dist/index.cjs +497 -246
- package/dist/index.mjs +497 -247
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +509 -258
- package/dist/node/index.mjs +509 -259
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +113 -18
- package/dist/web/index.mjs +504 -254
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +113 -18
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -162,6 +162,20 @@ function getValueByPath(data, keys) {
|
|
|
162
162
|
* Copyright 2025 Google LLC
|
|
163
163
|
* SPDX-License-Identifier: Apache-2.0
|
|
164
164
|
*/
|
|
165
|
+
function tBytes$1(fromBytes) {
|
|
166
|
+
if (typeof fromBytes !== 'string') {
|
|
167
|
+
throw new Error('fromImageBytes must be a string');
|
|
168
|
+
}
|
|
169
|
+
// TODO(b/389133914): Remove dummy bytes converter.
|
|
170
|
+
return fromBytes;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @license
|
|
175
|
+
* Copyright 2025 Google LLC
|
|
176
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
177
|
+
*/
|
|
178
|
+
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
165
179
|
/** Required. Outcome of the code execution. */
|
|
166
180
|
exports.Outcome = void 0;
|
|
167
181
|
(function (Outcome) {
|
|
@@ -1655,6 +1669,65 @@ class LiveServerMessage {
|
|
|
1655
1669
|
return data.length > 0 ? btoa(data) : undefined;
|
|
1656
1670
|
}
|
|
1657
1671
|
}
|
|
1672
|
+
/** A video generation long-running operation. */
|
|
1673
|
+
class GenerateVideosOperation {
|
|
1674
|
+
/**
|
|
1675
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
1676
|
+
* @internal
|
|
1677
|
+
*/
|
|
1678
|
+
_fromAPIResponse({ apiResponse, isVertexAI, }) {
|
|
1679
|
+
const operation = new GenerateVideosOperation();
|
|
1680
|
+
operation.name = apiResponse['name'];
|
|
1681
|
+
operation.metadata = apiResponse['metadata'];
|
|
1682
|
+
operation.done = apiResponse['done'];
|
|
1683
|
+
operation.error = apiResponse['error'];
|
|
1684
|
+
if (isVertexAI) {
|
|
1685
|
+
const response = apiResponse['response'];
|
|
1686
|
+
if (response) {
|
|
1687
|
+
const operationResponse = new GenerateVideosResponse();
|
|
1688
|
+
const responseVideos = response['videos'];
|
|
1689
|
+
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1690
|
+
return {
|
|
1691
|
+
video: {
|
|
1692
|
+
uri: generatedVideo['gcsUri'],
|
|
1693
|
+
videoBytes: generatedVideo['bytesBase64Encoded']
|
|
1694
|
+
? tBytes$1(generatedVideo['bytesBase64Encoded'])
|
|
1695
|
+
: undefined,
|
|
1696
|
+
mimeType: generatedVideo['mimeType'],
|
|
1697
|
+
},
|
|
1698
|
+
};
|
|
1699
|
+
});
|
|
1700
|
+
operationResponse.raiMediaFilteredCount = response['raiMediaFilteredCount'];
|
|
1701
|
+
operationResponse.raiMediaFilteredReasons = response['raiMediaFilteredReasons'];
|
|
1702
|
+
operation.response = operationResponse;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
else {
|
|
1706
|
+
const response = apiResponse['response'];
|
|
1707
|
+
if (response) {
|
|
1708
|
+
const operationResponse = new GenerateVideosResponse();
|
|
1709
|
+
const generatedVideoResponse = response['generateVideoResponse'];
|
|
1710
|
+
const responseVideos = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['generatedSamples'];
|
|
1711
|
+
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1712
|
+
const video = generatedVideo['video'];
|
|
1713
|
+
return {
|
|
1714
|
+
video: {
|
|
1715
|
+
uri: video === null || video === void 0 ? void 0 : video['uri'],
|
|
1716
|
+
videoBytes: (video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1717
|
+
? tBytes$1(video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1718
|
+
: undefined,
|
|
1719
|
+
mimeType: generatedVideo['encoding'],
|
|
1720
|
+
},
|
|
1721
|
+
};
|
|
1722
|
+
});
|
|
1723
|
+
operationResponse.raiMediaFilteredCount = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredCount'];
|
|
1724
|
+
operationResponse.raiMediaFilteredReasons = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredReasons'];
|
|
1725
|
+
operation.response = operationResponse;
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
return operation;
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1658
1731
|
/** Client generated response to a `ToolCall` received from the server.
|
|
1659
1732
|
|
|
1660
1733
|
Individual `FunctionResponse` objects are matched to the respective
|
|
@@ -2216,11 +2289,7 @@ function tTuningJobStatus(status) {
|
|
|
2216
2289
|
}
|
|
2217
2290
|
}
|
|
2218
2291
|
function tBytes(fromImageBytes) {
|
|
2219
|
-
|
|
2220
|
-
throw new Error('fromImageBytes must be a string');
|
|
2221
|
-
}
|
|
2222
|
-
// TODO(b/389133914): Remove dummy bytes converter.
|
|
2223
|
-
return fromImageBytes;
|
|
2292
|
+
return tBytes$1(fromImageBytes);
|
|
2224
2293
|
}
|
|
2225
2294
|
function _isFile(origin) {
|
|
2226
2295
|
return (origin !== null &&
|
|
@@ -3708,6 +3777,12 @@ function batchJobFromMldev(fromObject) {
|
|
|
3708
3777
|
}
|
|
3709
3778
|
function listBatchJobsResponseFromMldev(fromObject) {
|
|
3710
3779
|
const toObject = {};
|
|
3780
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
3781
|
+
'sdkHttpResponse',
|
|
3782
|
+
]);
|
|
3783
|
+
if (fromSdkHttpResponse != null) {
|
|
3784
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
3785
|
+
}
|
|
3711
3786
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
3712
3787
|
'nextPageToken',
|
|
3713
3788
|
]);
|
|
@@ -3849,6 +3924,12 @@ function batchJobFromVertex(fromObject) {
|
|
|
3849
3924
|
}
|
|
3850
3925
|
function listBatchJobsResponseFromVertex(fromObject) {
|
|
3851
3926
|
const toObject = {};
|
|
3927
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
3928
|
+
'sdkHttpResponse',
|
|
3929
|
+
]);
|
|
3930
|
+
if (fromSdkHttpResponse != null) {
|
|
3931
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
3932
|
+
}
|
|
3852
3933
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
3853
3934
|
'nextPageToken',
|
|
3854
3935
|
]);
|
|
@@ -3891,9 +3972,6 @@ function deleteResourceJobFromVertex(fromObject) {
|
|
|
3891
3972
|
* Copyright 2025 Google LLC
|
|
3892
3973
|
* SPDX-License-Identifier: Apache-2.0
|
|
3893
3974
|
*/
|
|
3894
|
-
/**
|
|
3895
|
-
* Pagers for the GenAI List APIs.
|
|
3896
|
-
*/
|
|
3897
3975
|
exports.PagedItem = void 0;
|
|
3898
3976
|
(function (PagedItem) {
|
|
3899
3977
|
PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
|
|
@@ -3916,9 +3994,10 @@ class Pager {
|
|
|
3916
3994
|
var _a, _b;
|
|
3917
3995
|
this.nameInternal = name;
|
|
3918
3996
|
this.pageInternal = response[this.nameInternal] || [];
|
|
3997
|
+
this.sdkHttpResponseInternal = response === null || response === void 0 ? void 0 : response.sdkHttpResponse;
|
|
3919
3998
|
this.idxInternal = 0;
|
|
3920
3999
|
let requestParams = { config: {} };
|
|
3921
|
-
if (!params) {
|
|
4000
|
+
if (!params || Object.keys(params).length === 0) {
|
|
3922
4001
|
requestParams = { config: {} };
|
|
3923
4002
|
}
|
|
3924
4003
|
else if (typeof params === 'object') {
|
|
@@ -3962,6 +4041,12 @@ class Pager {
|
|
|
3962
4041
|
get pageSize() {
|
|
3963
4042
|
return this.pageInternalSize;
|
|
3964
4043
|
}
|
|
4044
|
+
/**
|
|
4045
|
+
* Returns the headers of the API response.
|
|
4046
|
+
*/
|
|
4047
|
+
get sdkHttpResponse() {
|
|
4048
|
+
return this.sdkHttpResponseInternal;
|
|
4049
|
+
}
|
|
3965
4050
|
/**
|
|
3966
4051
|
* Returns the parameters when making the API request for the next page.
|
|
3967
4052
|
*
|
|
@@ -4331,7 +4416,13 @@ class Batches extends BaseModule {
|
|
|
4331
4416
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4332
4417
|
})
|
|
4333
4418
|
.then((httpResponse) => {
|
|
4334
|
-
return httpResponse.json()
|
|
4419
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
4420
|
+
const response = jsonResponse;
|
|
4421
|
+
response.sdkHttpResponse = {
|
|
4422
|
+
headers: httpResponse.headers,
|
|
4423
|
+
};
|
|
4424
|
+
return response;
|
|
4425
|
+
});
|
|
4335
4426
|
});
|
|
4336
4427
|
return response.then((apiResponse) => {
|
|
4337
4428
|
const resp = listBatchJobsResponseFromVertex(apiResponse);
|
|
@@ -4357,7 +4448,13 @@ class Batches extends BaseModule {
|
|
|
4357
4448
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4358
4449
|
})
|
|
4359
4450
|
.then((httpResponse) => {
|
|
4360
|
-
return httpResponse.json()
|
|
4451
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
4452
|
+
const response = jsonResponse;
|
|
4453
|
+
response.sdkHttpResponse = {
|
|
4454
|
+
headers: httpResponse.headers,
|
|
4455
|
+
};
|
|
4456
|
+
return response;
|
|
4457
|
+
});
|
|
4361
4458
|
});
|
|
4362
4459
|
return response.then((apiResponse) => {
|
|
4363
4460
|
const resp = listBatchJobsResponseFromMldev(apiResponse);
|
|
@@ -5410,6 +5507,12 @@ function deleteCachedContentResponseFromMldev() {
|
|
|
5410
5507
|
}
|
|
5411
5508
|
function listCachedContentsResponseFromMldev(fromObject) {
|
|
5412
5509
|
const toObject = {};
|
|
5510
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
5511
|
+
'sdkHttpResponse',
|
|
5512
|
+
]);
|
|
5513
|
+
if (fromSdkHttpResponse != null) {
|
|
5514
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
5515
|
+
}
|
|
5413
5516
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
5414
5517
|
'nextPageToken',
|
|
5415
5518
|
]);
|
|
@@ -5470,6 +5573,12 @@ function deleteCachedContentResponseFromVertex() {
|
|
|
5470
5573
|
}
|
|
5471
5574
|
function listCachedContentsResponseFromVertex(fromObject) {
|
|
5472
5575
|
const toObject = {};
|
|
5576
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
5577
|
+
'sdkHttpResponse',
|
|
5578
|
+
]);
|
|
5579
|
+
if (fromSdkHttpResponse != null) {
|
|
5580
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
5581
|
+
}
|
|
5473
5582
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
5474
5583
|
'nextPageToken',
|
|
5475
5584
|
]);
|
|
@@ -5822,7 +5931,13 @@ class Caches extends BaseModule {
|
|
|
5822
5931
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
5823
5932
|
})
|
|
5824
5933
|
.then((httpResponse) => {
|
|
5825
|
-
return httpResponse.json()
|
|
5934
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
5935
|
+
const response = jsonResponse;
|
|
5936
|
+
response.sdkHttpResponse = {
|
|
5937
|
+
headers: httpResponse.headers,
|
|
5938
|
+
};
|
|
5939
|
+
return response;
|
|
5940
|
+
});
|
|
5826
5941
|
});
|
|
5827
5942
|
return response.then((apiResponse) => {
|
|
5828
5943
|
const resp = listCachedContentsResponseFromVertex(apiResponse);
|
|
@@ -5848,7 +5963,13 @@ class Caches extends BaseModule {
|
|
|
5848
5963
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
5849
5964
|
})
|
|
5850
5965
|
.then((httpResponse) => {
|
|
5851
|
-
return httpResponse.json()
|
|
5966
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
5967
|
+
const response = jsonResponse;
|
|
5968
|
+
response.sdkHttpResponse = {
|
|
5969
|
+
headers: httpResponse.headers,
|
|
5970
|
+
};
|
|
5971
|
+
return response;
|
|
5972
|
+
});
|
|
5852
5973
|
});
|
|
5853
5974
|
return response.then((apiResponse) => {
|
|
5854
5975
|
const resp = listCachedContentsResponseFromMldev(apiResponse);
|
|
@@ -6271,7 +6392,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6271
6392
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6272
6393
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6273
6394
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6274
|
-
const SDK_VERSION = '1.
|
|
6395
|
+
const SDK_VERSION = '1.12.0'; // x-release-please-version
|
|
6275
6396
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6276
6397
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6277
6398
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -7183,6 +7304,12 @@ function fileFromMldev(fromObject) {
|
|
|
7183
7304
|
}
|
|
7184
7305
|
function listFilesResponseFromMldev(fromObject) {
|
|
7185
7306
|
const toObject = {};
|
|
7307
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7308
|
+
'sdkHttpResponse',
|
|
7309
|
+
]);
|
|
7310
|
+
if (fromSdkHttpResponse != null) {
|
|
7311
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7312
|
+
}
|
|
7186
7313
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
7187
7314
|
'nextPageToken',
|
|
7188
7315
|
]);
|
|
@@ -7344,7 +7471,13 @@ class Files extends BaseModule {
|
|
|
7344
7471
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7345
7472
|
})
|
|
7346
7473
|
.then((httpResponse) => {
|
|
7347
|
-
return httpResponse.json()
|
|
7474
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
7475
|
+
const response = jsonResponse;
|
|
7476
|
+
response.sdkHttpResponse = {
|
|
7477
|
+
headers: httpResponse.headers,
|
|
7478
|
+
};
|
|
7479
|
+
return response;
|
|
7480
|
+
});
|
|
7348
7481
|
});
|
|
7349
7482
|
return response.then((apiResponse) => {
|
|
7350
7483
|
const resp = listFilesResponseFromMldev(apiResponse);
|
|
@@ -10570,6 +10703,9 @@ function generateImagesConfigToMldev(fromObject, parentObject) {
|
|
|
10570
10703
|
if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
|
|
10571
10704
|
throw new Error('addWatermark parameter is not supported in Gemini API.');
|
|
10572
10705
|
}
|
|
10706
|
+
if (getValueByPath(fromObject, ['imageSize']) !== undefined) {
|
|
10707
|
+
throw new Error('imageSize parameter is not supported in Gemini API.');
|
|
10708
|
+
}
|
|
10573
10709
|
if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
|
|
10574
10710
|
throw new Error('enhancePrompt parameter is not supported in Gemini API.');
|
|
10575
10711
|
}
|
|
@@ -11646,6 +11782,10 @@ function generateImagesConfigToVertex(fromObject, parentObject) {
|
|
|
11646
11782
|
if (parentObject !== undefined && fromAddWatermark != null) {
|
|
11647
11783
|
setValueByPath(parentObject, ['parameters', 'addWatermark'], fromAddWatermark);
|
|
11648
11784
|
}
|
|
11785
|
+
const fromImageSize = getValueByPath(fromObject, ['imageSize']);
|
|
11786
|
+
if (parentObject !== undefined && fromImageSize != null) {
|
|
11787
|
+
setValueByPath(parentObject, ['parameters', 'sampleImageSize'], fromImageSize);
|
|
11788
|
+
}
|
|
11649
11789
|
const fromEnhancePrompt = getValueByPath(fromObject, [
|
|
11650
11790
|
'enhancePrompt',
|
|
11651
11791
|
]);
|
|
@@ -12484,6 +12624,12 @@ function embedContentMetadataFromMldev() {
|
|
|
12484
12624
|
}
|
|
12485
12625
|
function embedContentResponseFromMldev(fromObject) {
|
|
12486
12626
|
const toObject = {};
|
|
12627
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12628
|
+
'sdkHttpResponse',
|
|
12629
|
+
]);
|
|
12630
|
+
if (fromSdkHttpResponse != null) {
|
|
12631
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12632
|
+
}
|
|
12487
12633
|
const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
|
|
12488
12634
|
if (fromEmbeddings != null) {
|
|
12489
12635
|
let transformedList = fromEmbeddings;
|
|
@@ -12556,6 +12702,12 @@ function generatedImageFromMldev(fromObject) {
|
|
|
12556
12702
|
}
|
|
12557
12703
|
function generateImagesResponseFromMldev(fromObject) {
|
|
12558
12704
|
const toObject = {};
|
|
12705
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12706
|
+
'sdkHttpResponse',
|
|
12707
|
+
]);
|
|
12708
|
+
if (fromSdkHttpResponse != null) {
|
|
12709
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12710
|
+
}
|
|
12559
12711
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
12560
12712
|
'predictions',
|
|
12561
12713
|
]);
|
|
@@ -12636,6 +12788,12 @@ function modelFromMldev(fromObject) {
|
|
|
12636
12788
|
}
|
|
12637
12789
|
function listModelsResponseFromMldev(fromObject) {
|
|
12638
12790
|
const toObject = {};
|
|
12791
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12792
|
+
'sdkHttpResponse',
|
|
12793
|
+
]);
|
|
12794
|
+
if (fromSdkHttpResponse != null) {
|
|
12795
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12796
|
+
}
|
|
12639
12797
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
12640
12798
|
'nextPageToken',
|
|
12641
12799
|
]);
|
|
@@ -12660,6 +12818,12 @@ function deleteModelResponseFromMldev() {
|
|
|
12660
12818
|
}
|
|
12661
12819
|
function countTokensResponseFromMldev(fromObject) {
|
|
12662
12820
|
const toObject = {};
|
|
12821
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12822
|
+
'sdkHttpResponse',
|
|
12823
|
+
]);
|
|
12824
|
+
if (fromSdkHttpResponse != null) {
|
|
12825
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12826
|
+
}
|
|
12663
12827
|
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
12664
12828
|
if (fromTotalTokens != null) {
|
|
12665
12829
|
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
@@ -12672,7 +12836,7 @@ function countTokensResponseFromMldev(fromObject) {
|
|
|
12672
12836
|
}
|
|
12673
12837
|
return toObject;
|
|
12674
12838
|
}
|
|
12675
|
-
function videoFromMldev
|
|
12839
|
+
function videoFromMldev(fromObject) {
|
|
12676
12840
|
const toObject = {};
|
|
12677
12841
|
const fromUri = getValueByPath(fromObject, ['video', 'uri']);
|
|
12678
12842
|
if (fromUri != null) {
|
|
@@ -12691,15 +12855,15 @@ function videoFromMldev$1(fromObject) {
|
|
|
12691
12855
|
}
|
|
12692
12856
|
return toObject;
|
|
12693
12857
|
}
|
|
12694
|
-
function generatedVideoFromMldev
|
|
12858
|
+
function generatedVideoFromMldev(fromObject) {
|
|
12695
12859
|
const toObject = {};
|
|
12696
12860
|
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
12697
12861
|
if (fromVideo != null) {
|
|
12698
|
-
setValueByPath(toObject, ['video'], videoFromMldev
|
|
12862
|
+
setValueByPath(toObject, ['video'], videoFromMldev(fromVideo));
|
|
12699
12863
|
}
|
|
12700
12864
|
return toObject;
|
|
12701
12865
|
}
|
|
12702
|
-
function generateVideosResponseFromMldev
|
|
12866
|
+
function generateVideosResponseFromMldev(fromObject) {
|
|
12703
12867
|
const toObject = {};
|
|
12704
12868
|
const fromGeneratedVideos = getValueByPath(fromObject, [
|
|
12705
12869
|
'generatedSamples',
|
|
@@ -12708,7 +12872,7 @@ function generateVideosResponseFromMldev$1(fromObject) {
|
|
|
12708
12872
|
let transformedList = fromGeneratedVideos;
|
|
12709
12873
|
if (Array.isArray(transformedList)) {
|
|
12710
12874
|
transformedList = transformedList.map((item) => {
|
|
12711
|
-
return generatedVideoFromMldev
|
|
12875
|
+
return generatedVideoFromMldev(item);
|
|
12712
12876
|
});
|
|
12713
12877
|
}
|
|
12714
12878
|
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
@@ -12727,7 +12891,7 @@ function generateVideosResponseFromMldev$1(fromObject) {
|
|
|
12727
12891
|
}
|
|
12728
12892
|
return toObject;
|
|
12729
12893
|
}
|
|
12730
|
-
function generateVideosOperationFromMldev
|
|
12894
|
+
function generateVideosOperationFromMldev(fromObject) {
|
|
12731
12895
|
const toObject = {};
|
|
12732
12896
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
12733
12897
|
if (fromName != null) {
|
|
@@ -12750,7 +12914,7 @@ function generateVideosOperationFromMldev$1(fromObject) {
|
|
|
12750
12914
|
'generateVideoResponse',
|
|
12751
12915
|
]);
|
|
12752
12916
|
if (fromResponse != null) {
|
|
12753
|
-
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev
|
|
12917
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev(fromResponse));
|
|
12754
12918
|
}
|
|
12755
12919
|
return toObject;
|
|
12756
12920
|
}
|
|
@@ -13046,6 +13210,12 @@ function embedContentMetadataFromVertex(fromObject) {
|
|
|
13046
13210
|
}
|
|
13047
13211
|
function embedContentResponseFromVertex(fromObject) {
|
|
13048
13212
|
const toObject = {};
|
|
13213
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
13214
|
+
'sdkHttpResponse',
|
|
13215
|
+
]);
|
|
13216
|
+
if (fromSdkHttpResponse != null) {
|
|
13217
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
13218
|
+
}
|
|
13049
13219
|
const fromEmbeddings = getValueByPath(fromObject, [
|
|
13050
13220
|
'predictions[]',
|
|
13051
13221
|
'embeddings',
|
|
@@ -13129,6 +13299,12 @@ function generatedImageFromVertex(fromObject) {
|
|
|
13129
13299
|
}
|
|
13130
13300
|
function generateImagesResponseFromVertex(fromObject) {
|
|
13131
13301
|
const toObject = {};
|
|
13302
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
13303
|
+
'sdkHttpResponse',
|
|
13304
|
+
]);
|
|
13305
|
+
if (fromSdkHttpResponse != null) {
|
|
13306
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
13307
|
+
}
|
|
13132
13308
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
13133
13309
|
'predictions',
|
|
13134
13310
|
]);
|
|
@@ -13151,6 +13327,12 @@ function generateImagesResponseFromVertex(fromObject) {
|
|
|
13151
13327
|
}
|
|
13152
13328
|
function editImageResponseFromVertex(fromObject) {
|
|
13153
13329
|
const toObject = {};
|
|
13330
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
13331
|
+
'sdkHttpResponse',
|
|
13332
|
+
]);
|
|
13333
|
+
if (fromSdkHttpResponse != null) {
|
|
13334
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
13335
|
+
}
|
|
13154
13336
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
13155
13337
|
'predictions',
|
|
13156
13338
|
]);
|
|
@@ -13167,6 +13349,12 @@ function editImageResponseFromVertex(fromObject) {
|
|
|
13167
13349
|
}
|
|
13168
13350
|
function upscaleImageResponseFromVertex(fromObject) {
|
|
13169
13351
|
const toObject = {};
|
|
13352
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
13353
|
+
'sdkHttpResponse',
|
|
13354
|
+
]);
|
|
13355
|
+
if (fromSdkHttpResponse != null) {
|
|
13356
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
13357
|
+
}
|
|
13170
13358
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
13171
13359
|
'predictions',
|
|
13172
13360
|
]);
|
|
@@ -13286,6 +13474,12 @@ function modelFromVertex(fromObject) {
|
|
|
13286
13474
|
}
|
|
13287
13475
|
function listModelsResponseFromVertex(fromObject) {
|
|
13288
13476
|
const toObject = {};
|
|
13477
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
13478
|
+
'sdkHttpResponse',
|
|
13479
|
+
]);
|
|
13480
|
+
if (fromSdkHttpResponse != null) {
|
|
13481
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
13482
|
+
}
|
|
13289
13483
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
13290
13484
|
'nextPageToken',
|
|
13291
13485
|
]);
|
|
@@ -13310,6 +13504,12 @@ function deleteModelResponseFromVertex() {
|
|
|
13310
13504
|
}
|
|
13311
13505
|
function countTokensResponseFromVertex(fromObject) {
|
|
13312
13506
|
const toObject = {};
|
|
13507
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
13508
|
+
'sdkHttpResponse',
|
|
13509
|
+
]);
|
|
13510
|
+
if (fromSdkHttpResponse != null) {
|
|
13511
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
13512
|
+
}
|
|
13313
13513
|
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
13314
13514
|
if (fromTotalTokens != null) {
|
|
13315
13515
|
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
@@ -13318,13 +13518,19 @@ function countTokensResponseFromVertex(fromObject) {
|
|
|
13318
13518
|
}
|
|
13319
13519
|
function computeTokensResponseFromVertex(fromObject) {
|
|
13320
13520
|
const toObject = {};
|
|
13521
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
13522
|
+
'sdkHttpResponse',
|
|
13523
|
+
]);
|
|
13524
|
+
if (fromSdkHttpResponse != null) {
|
|
13525
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
13526
|
+
}
|
|
13321
13527
|
const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
|
|
13322
13528
|
if (fromTokensInfo != null) {
|
|
13323
13529
|
setValueByPath(toObject, ['tokensInfo'], fromTokensInfo);
|
|
13324
13530
|
}
|
|
13325
13531
|
return toObject;
|
|
13326
13532
|
}
|
|
13327
|
-
function videoFromVertex
|
|
13533
|
+
function videoFromVertex(fromObject) {
|
|
13328
13534
|
const toObject = {};
|
|
13329
13535
|
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
13330
13536
|
if (fromUri != null) {
|
|
@@ -13342,22 +13548,22 @@ function videoFromVertex$1(fromObject) {
|
|
|
13342
13548
|
}
|
|
13343
13549
|
return toObject;
|
|
13344
13550
|
}
|
|
13345
|
-
function generatedVideoFromVertex
|
|
13551
|
+
function generatedVideoFromVertex(fromObject) {
|
|
13346
13552
|
const toObject = {};
|
|
13347
13553
|
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
13348
13554
|
if (fromVideo != null) {
|
|
13349
|
-
setValueByPath(toObject, ['video'], videoFromVertex
|
|
13555
|
+
setValueByPath(toObject, ['video'], videoFromVertex(fromVideo));
|
|
13350
13556
|
}
|
|
13351
13557
|
return toObject;
|
|
13352
13558
|
}
|
|
13353
|
-
function generateVideosResponseFromVertex
|
|
13559
|
+
function generateVideosResponseFromVertex(fromObject) {
|
|
13354
13560
|
const toObject = {};
|
|
13355
13561
|
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
13356
13562
|
if (fromGeneratedVideos != null) {
|
|
13357
13563
|
let transformedList = fromGeneratedVideos;
|
|
13358
13564
|
if (Array.isArray(transformedList)) {
|
|
13359
13565
|
transformedList = transformedList.map((item) => {
|
|
13360
|
-
return generatedVideoFromVertex
|
|
13566
|
+
return generatedVideoFromVertex(item);
|
|
13361
13567
|
});
|
|
13362
13568
|
}
|
|
13363
13569
|
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
@@ -13376,7 +13582,7 @@ function generateVideosResponseFromVertex$1(fromObject) {
|
|
|
13376
13582
|
}
|
|
13377
13583
|
return toObject;
|
|
13378
13584
|
}
|
|
13379
|
-
function generateVideosOperationFromVertex
|
|
13585
|
+
function generateVideosOperationFromVertex(fromObject) {
|
|
13380
13586
|
const toObject = {};
|
|
13381
13587
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
13382
13588
|
if (fromName != null) {
|
|
@@ -13396,7 +13602,7 @@ function generateVideosOperationFromVertex$1(fromObject) {
|
|
|
13396
13602
|
}
|
|
13397
13603
|
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
13398
13604
|
if (fromResponse != null) {
|
|
13399
|
-
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex
|
|
13605
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex(fromResponse));
|
|
13400
13606
|
}
|
|
13401
13607
|
return toObject;
|
|
13402
13608
|
}
|
|
@@ -13429,18 +13635,6 @@ function setMcpUsageHeader(headers) {
|
|
|
13429
13635
|
const existingHeader = (_a = headers[GOOGLE_API_CLIENT_HEADER]) !== null && _a !== void 0 ? _a : '';
|
|
13430
13636
|
headers[GOOGLE_API_CLIENT_HEADER] = (existingHeader + ` ${MCP_LABEL}`).trimStart();
|
|
13431
13637
|
}
|
|
13432
|
-
// Checks whether the list of tools contains any MCP clients. Will return true
|
|
13433
|
-
// if there is at least one MCP client.
|
|
13434
|
-
function hasMcpClientTools(params) {
|
|
13435
|
-
var _a, _b, _c;
|
|
13436
|
-
return (_c = (_b = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools) === null || _b === void 0 ? void 0 : _b.some((tool) => isMcpCallableTool(tool))) !== null && _c !== void 0 ? _c : false;
|
|
13437
|
-
}
|
|
13438
|
-
// Checks whether the list of tools contains any non-MCP tools. Will return true
|
|
13439
|
-
// if there is at least one non-MCP tool.
|
|
13440
|
-
function hasNonMcpTools(params) {
|
|
13441
|
-
var _a, _b, _c;
|
|
13442
|
-
return ((_c = (_b = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools) === null || _b === void 0 ? void 0 : _b.some((tool) => !isMcpCallableTool(tool))) !== null && _c !== void 0 ? _c : false);
|
|
13443
|
-
}
|
|
13444
13638
|
// Returns true if the object is a MCP CallableTool, otherwise false.
|
|
13445
13639
|
function isMcpCallableTool(object) {
|
|
13446
13640
|
return (object !== null &&
|
|
@@ -13934,13 +14128,13 @@ class Live {
|
|
|
13934
14128
|
const websocketBaseUrl = this.apiClient.getWebsocketBaseUrl();
|
|
13935
14129
|
const apiVersion = this.apiClient.getApiVersion();
|
|
13936
14130
|
let url;
|
|
13937
|
-
const
|
|
14131
|
+
const clientHeaders = this.apiClient.getHeaders();
|
|
13938
14132
|
if (params.config &&
|
|
13939
14133
|
params.config.tools &&
|
|
13940
14134
|
hasMcpToolUsage(params.config.tools)) {
|
|
13941
|
-
setMcpUsageHeader(
|
|
14135
|
+
setMcpUsageHeader(clientHeaders);
|
|
13942
14136
|
}
|
|
13943
|
-
const headers = mapToHeaders(
|
|
14137
|
+
const headers = mapToHeaders(clientHeaders);
|
|
13944
14138
|
if (this.apiClient.isVertexAI()) {
|
|
13945
14139
|
url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
|
|
13946
14140
|
await this.auth.addAuthHeaders(headers);
|
|
@@ -14299,6 +14493,18 @@ function shouldDisableAfc(config) {
|
|
|
14299
14493
|
function isCallableTool(tool) {
|
|
14300
14494
|
return 'callTool' in tool && typeof tool.callTool === 'function';
|
|
14301
14495
|
}
|
|
14496
|
+
// Checks whether the list of tools contains any CallableTools. Will return true
|
|
14497
|
+
// if there is at least one CallableTool.
|
|
14498
|
+
function hasCallableTools(params) {
|
|
14499
|
+
var _a, _b, _c;
|
|
14500
|
+
return (_c = (_b = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools) === null || _b === void 0 ? void 0 : _b.some((tool) => isCallableTool(tool))) !== null && _c !== void 0 ? _c : false;
|
|
14501
|
+
}
|
|
14502
|
+
// Checks whether the list of tools contains any non-callable tools. Will return
|
|
14503
|
+
// true if there is at least one non-Callable tool.
|
|
14504
|
+
function hasNonCallableTools(params) {
|
|
14505
|
+
var _a, _b, _c;
|
|
14506
|
+
return (_c = (_b = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools) === null || _b === void 0 ? void 0 : _b.some((tool) => !isCallableTool(tool))) !== null && _c !== void 0 ? _c : false;
|
|
14507
|
+
}
|
|
14302
14508
|
/**
|
|
14303
14509
|
* Returns whether to append automatic function calling history to the
|
|
14304
14510
|
* response.
|
|
@@ -14357,12 +14563,12 @@ class Models extends BaseModule {
|
|
|
14357
14563
|
*/
|
|
14358
14564
|
this.generateContent = async (params) => {
|
|
14359
14565
|
var _a, _b, _c, _d, _e;
|
|
14360
|
-
const transformedParams = await this.
|
|
14566
|
+
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14361
14567
|
this.maybeMoveToResponseJsonSchem(params);
|
|
14362
|
-
if (!
|
|
14568
|
+
if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
|
|
14363
14569
|
return await this.generateContentInternal(transformedParams);
|
|
14364
14570
|
}
|
|
14365
|
-
if (
|
|
14571
|
+
if (hasNonCallableTools(params)) {
|
|
14366
14572
|
throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
|
|
14367
14573
|
}
|
|
14368
14574
|
let response;
|
|
@@ -14447,7 +14653,7 @@ class Models extends BaseModule {
|
|
|
14447
14653
|
this.generateContentStream = async (params) => {
|
|
14448
14654
|
this.maybeMoveToResponseJsonSchem(params);
|
|
14449
14655
|
if (shouldDisableAfc(params.config)) {
|
|
14450
|
-
const transformedParams = await this.
|
|
14656
|
+
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14451
14657
|
return await this.generateContentStreamInternal(transformedParams);
|
|
14452
14658
|
}
|
|
14453
14659
|
else {
|
|
@@ -14495,11 +14701,13 @@ class Models extends BaseModule {
|
|
|
14495
14701
|
response = {
|
|
14496
14702
|
generatedImages: generatedImages,
|
|
14497
14703
|
positivePromptSafetyAttributes: positivePromptSafetyAttributes,
|
|
14704
|
+
sdkHttpResponse: apiResponse.sdkHttpResponse,
|
|
14498
14705
|
};
|
|
14499
14706
|
}
|
|
14500
14707
|
else {
|
|
14501
14708
|
response = {
|
|
14502
14709
|
generatedImages: generatedImages,
|
|
14710
|
+
sdkHttpResponse: apiResponse.sdkHttpResponse,
|
|
14503
14711
|
};
|
|
14504
14712
|
}
|
|
14505
14713
|
return response;
|
|
@@ -14596,6 +14804,32 @@ class Models extends BaseModule {
|
|
|
14596
14804
|
};
|
|
14597
14805
|
return await this.upscaleImageInternal(apiParams);
|
|
14598
14806
|
};
|
|
14807
|
+
/**
|
|
14808
|
+
* Generates videos based on a text description and configuration.
|
|
14809
|
+
*
|
|
14810
|
+
* @param params - The parameters for generating videos.
|
|
14811
|
+
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
14812
|
+
*
|
|
14813
|
+
* @example
|
|
14814
|
+
* ```ts
|
|
14815
|
+
* const operation = await ai.models.generateVideos({
|
|
14816
|
+
* model: 'veo-2.0-generate-001',
|
|
14817
|
+
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
14818
|
+
* config: {
|
|
14819
|
+
* numberOfVideos: 1
|
|
14820
|
+
* });
|
|
14821
|
+
*
|
|
14822
|
+
* while (!operation.done) {
|
|
14823
|
+
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
14824
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
14825
|
+
* }
|
|
14826
|
+
*
|
|
14827
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
14828
|
+
* ```
|
|
14829
|
+
*/
|
|
14830
|
+
this.generateVideos = async (params) => {
|
|
14831
|
+
return await this.generateVideosInternal(params);
|
|
14832
|
+
};
|
|
14599
14833
|
}
|
|
14600
14834
|
/**
|
|
14601
14835
|
* This logic is needed for GenerateContentConfig only.
|
|
@@ -14621,7 +14855,7 @@ class Models extends BaseModule {
|
|
|
14621
14855
|
* modify the original params. Also sets the MCP usage header if there are
|
|
14622
14856
|
* MCP tools in the parameters.
|
|
14623
14857
|
*/
|
|
14624
|
-
async
|
|
14858
|
+
async processParamsMaybeAddMcpUsage(params) {
|
|
14625
14859
|
var _a, _b, _c;
|
|
14626
14860
|
const tools = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools;
|
|
14627
14861
|
if (!tools) {
|
|
@@ -14688,7 +14922,7 @@ class Models extends BaseModule {
|
|
|
14688
14922
|
remoteCallCount++;
|
|
14689
14923
|
wereFunctionsCalled = false;
|
|
14690
14924
|
}
|
|
14691
|
-
const transformedParams = yield __await(models.
|
|
14925
|
+
const transformedParams = yield __await(models.processParamsMaybeAddMcpUsage(params));
|
|
14692
14926
|
const response = yield __await(models.generateContentStreamInternal(transformedParams));
|
|
14693
14927
|
const functionResponses = [];
|
|
14694
14928
|
const responseContents = [];
|
|
@@ -14959,7 +15193,13 @@ class Models extends BaseModule {
|
|
|
14959
15193
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14960
15194
|
})
|
|
14961
15195
|
.then((httpResponse) => {
|
|
14962
|
-
return httpResponse.json()
|
|
15196
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15197
|
+
const response = jsonResponse;
|
|
15198
|
+
response.sdkHttpResponse = {
|
|
15199
|
+
headers: httpResponse.headers,
|
|
15200
|
+
};
|
|
15201
|
+
return response;
|
|
15202
|
+
});
|
|
14963
15203
|
});
|
|
14964
15204
|
return response.then((apiResponse) => {
|
|
14965
15205
|
const resp = embedContentResponseFromVertex(apiResponse);
|
|
@@ -14985,7 +15225,13 @@ class Models extends BaseModule {
|
|
|
14985
15225
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
14986
15226
|
})
|
|
14987
15227
|
.then((httpResponse) => {
|
|
14988
|
-
return httpResponse.json()
|
|
15228
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15229
|
+
const response = jsonResponse;
|
|
15230
|
+
response.sdkHttpResponse = {
|
|
15231
|
+
headers: httpResponse.headers,
|
|
15232
|
+
};
|
|
15233
|
+
return response;
|
|
15234
|
+
});
|
|
14989
15235
|
});
|
|
14990
15236
|
return response.then((apiResponse) => {
|
|
14991
15237
|
const resp = embedContentResponseFromMldev(apiResponse);
|
|
@@ -15036,7 +15282,13 @@ class Models extends BaseModule {
|
|
|
15036
15282
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15037
15283
|
})
|
|
15038
15284
|
.then((httpResponse) => {
|
|
15039
|
-
return httpResponse.json()
|
|
15285
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15286
|
+
const response = jsonResponse;
|
|
15287
|
+
response.sdkHttpResponse = {
|
|
15288
|
+
headers: httpResponse.headers,
|
|
15289
|
+
};
|
|
15290
|
+
return response;
|
|
15291
|
+
});
|
|
15040
15292
|
});
|
|
15041
15293
|
return response.then((apiResponse) => {
|
|
15042
15294
|
const resp = generateImagesResponseFromVertex(apiResponse);
|
|
@@ -15062,7 +15314,13 @@ class Models extends BaseModule {
|
|
|
15062
15314
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
15063
15315
|
})
|
|
15064
15316
|
.then((httpResponse) => {
|
|
15065
|
-
return httpResponse.json()
|
|
15317
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15318
|
+
const response = jsonResponse;
|
|
15319
|
+
response.sdkHttpResponse = {
|
|
15320
|
+
headers: httpResponse.headers,
|
|
15321
|
+
};
|
|
15322
|
+
return response;
|
|
15323
|
+
});
|
|
15066
15324
|
});
|
|
15067
15325
|
return response.then((apiResponse) => {
|
|
15068
15326
|
const resp = generateImagesResponseFromMldev(apiResponse);
|
|
@@ -15094,7 +15352,13 @@ class Models extends BaseModule {
|
|
|
15094
15352
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15095
15353
|
})
|
|
15096
15354
|
.then((httpResponse) => {
|
|
15097
|
-
return httpResponse.json()
|
|
15355
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15356
|
+
const response = jsonResponse;
|
|
15357
|
+
response.sdkHttpResponse = {
|
|
15358
|
+
headers: httpResponse.headers,
|
|
15359
|
+
};
|
|
15360
|
+
return response;
|
|
15361
|
+
});
|
|
15098
15362
|
});
|
|
15099
15363
|
return response.then((apiResponse) => {
|
|
15100
15364
|
const resp = editImageResponseFromVertex(apiResponse);
|
|
@@ -15129,7 +15393,13 @@ class Models extends BaseModule {
|
|
|
15129
15393
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15130
15394
|
})
|
|
15131
15395
|
.then((httpResponse) => {
|
|
15132
|
-
return httpResponse.json()
|
|
15396
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15397
|
+
const response = jsonResponse;
|
|
15398
|
+
response.sdkHttpResponse = {
|
|
15399
|
+
headers: httpResponse.headers,
|
|
15400
|
+
};
|
|
15401
|
+
return response;
|
|
15402
|
+
});
|
|
15133
15403
|
});
|
|
15134
15404
|
return response.then((apiResponse) => {
|
|
15135
15405
|
const resp = upscaleImageResponseFromVertex(apiResponse);
|
|
@@ -15226,9 +15496,15 @@ class Models extends BaseModule {
|
|
|
15226
15496
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15227
15497
|
})
|
|
15228
15498
|
.then((httpResponse) => {
|
|
15229
|
-
return httpResponse.json()
|
|
15230
|
-
|
|
15231
|
-
|
|
15499
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15500
|
+
const response = jsonResponse;
|
|
15501
|
+
response.sdkHttpResponse = {
|
|
15502
|
+
headers: httpResponse.headers,
|
|
15503
|
+
};
|
|
15504
|
+
return response;
|
|
15505
|
+
});
|
|
15506
|
+
});
|
|
15507
|
+
return response.then((apiResponse) => {
|
|
15232
15508
|
const resp = listModelsResponseFromVertex(apiResponse);
|
|
15233
15509
|
const typedResp = new ListModelsResponse();
|
|
15234
15510
|
Object.assign(typedResp, resp);
|
|
@@ -15252,7 +15528,13 @@ class Models extends BaseModule {
|
|
|
15252
15528
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
15253
15529
|
})
|
|
15254
15530
|
.then((httpResponse) => {
|
|
15255
|
-
return httpResponse.json()
|
|
15531
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15532
|
+
const response = jsonResponse;
|
|
15533
|
+
response.sdkHttpResponse = {
|
|
15534
|
+
headers: httpResponse.headers,
|
|
15535
|
+
};
|
|
15536
|
+
return response;
|
|
15537
|
+
});
|
|
15256
15538
|
});
|
|
15257
15539
|
return response.then((apiResponse) => {
|
|
15258
15540
|
const resp = listModelsResponseFromMldev(apiResponse);
|
|
@@ -15440,7 +15722,13 @@ class Models extends BaseModule {
|
|
|
15440
15722
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15441
15723
|
})
|
|
15442
15724
|
.then((httpResponse) => {
|
|
15443
|
-
return httpResponse.json()
|
|
15725
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15726
|
+
const response = jsonResponse;
|
|
15727
|
+
response.sdkHttpResponse = {
|
|
15728
|
+
headers: httpResponse.headers,
|
|
15729
|
+
};
|
|
15730
|
+
return response;
|
|
15731
|
+
});
|
|
15444
15732
|
});
|
|
15445
15733
|
return response.then((apiResponse) => {
|
|
15446
15734
|
const resp = countTokensResponseFromVertex(apiResponse);
|
|
@@ -15466,7 +15754,13 @@ class Models extends BaseModule {
|
|
|
15466
15754
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
15467
15755
|
})
|
|
15468
15756
|
.then((httpResponse) => {
|
|
15469
|
-
return httpResponse.json()
|
|
15757
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15758
|
+
const response = jsonResponse;
|
|
15759
|
+
response.sdkHttpResponse = {
|
|
15760
|
+
headers: httpResponse.headers,
|
|
15761
|
+
};
|
|
15762
|
+
return response;
|
|
15763
|
+
});
|
|
15470
15764
|
});
|
|
15471
15765
|
return response.then((apiResponse) => {
|
|
15472
15766
|
const resp = countTokensResponseFromMldev(apiResponse);
|
|
@@ -15516,7 +15810,13 @@ class Models extends BaseModule {
|
|
|
15516
15810
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15517
15811
|
})
|
|
15518
15812
|
.then((httpResponse) => {
|
|
15519
|
-
return httpResponse.json()
|
|
15813
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15814
|
+
const response = jsonResponse;
|
|
15815
|
+
response.sdkHttpResponse = {
|
|
15816
|
+
headers: httpResponse.headers,
|
|
15817
|
+
};
|
|
15818
|
+
return response;
|
|
15819
|
+
});
|
|
15520
15820
|
});
|
|
15521
15821
|
return response.then((apiResponse) => {
|
|
15522
15822
|
const resp = computeTokensResponseFromVertex(apiResponse);
|
|
@@ -15552,7 +15852,7 @@ class Models extends BaseModule {
|
|
|
15552
15852
|
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
15553
15853
|
* ```
|
|
15554
15854
|
*/
|
|
15555
|
-
async
|
|
15855
|
+
async generateVideosInternal(params) {
|
|
15556
15856
|
var _a, _b, _c, _d;
|
|
15557
15857
|
let response;
|
|
15558
15858
|
let path = '';
|
|
@@ -15577,8 +15877,10 @@ class Models extends BaseModule {
|
|
|
15577
15877
|
return httpResponse.json();
|
|
15578
15878
|
});
|
|
15579
15879
|
return response.then((apiResponse) => {
|
|
15580
|
-
const resp = generateVideosOperationFromVertex
|
|
15581
|
-
|
|
15880
|
+
const resp = generateVideosOperationFromVertex(apiResponse);
|
|
15881
|
+
const typedResp = new GenerateVideosOperation();
|
|
15882
|
+
Object.assign(typedResp, resp);
|
|
15883
|
+
return typedResp;
|
|
15582
15884
|
});
|
|
15583
15885
|
}
|
|
15584
15886
|
else {
|
|
@@ -15601,8 +15903,10 @@ class Models extends BaseModule {
|
|
|
15601
15903
|
return httpResponse.json();
|
|
15602
15904
|
});
|
|
15603
15905
|
return response.then((apiResponse) => {
|
|
15604
|
-
const resp = generateVideosOperationFromMldev
|
|
15605
|
-
|
|
15906
|
+
const resp = generateVideosOperationFromMldev(apiResponse);
|
|
15907
|
+
const typedResp = new GenerateVideosOperation();
|
|
15908
|
+
Object.assign(typedResp, resp);
|
|
15909
|
+
return typedResp;
|
|
15606
15910
|
});
|
|
15607
15911
|
}
|
|
15608
15912
|
}
|
|
@@ -15660,164 +15964,6 @@ function fetchPredictOperationParametersToVertex(fromObject) {
|
|
|
15660
15964
|
}
|
|
15661
15965
|
return toObject;
|
|
15662
15966
|
}
|
|
15663
|
-
function videoFromMldev(fromObject) {
|
|
15664
|
-
const toObject = {};
|
|
15665
|
-
const fromUri = getValueByPath(fromObject, ['video', 'uri']);
|
|
15666
|
-
if (fromUri != null) {
|
|
15667
|
-
setValueByPath(toObject, ['uri'], fromUri);
|
|
15668
|
-
}
|
|
15669
|
-
const fromVideoBytes = getValueByPath(fromObject, [
|
|
15670
|
-
'video',
|
|
15671
|
-
'encodedVideo',
|
|
15672
|
-
]);
|
|
15673
|
-
if (fromVideoBytes != null) {
|
|
15674
|
-
setValueByPath(toObject, ['videoBytes'], tBytes(fromVideoBytes));
|
|
15675
|
-
}
|
|
15676
|
-
const fromMimeType = getValueByPath(fromObject, ['encoding']);
|
|
15677
|
-
if (fromMimeType != null) {
|
|
15678
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
15679
|
-
}
|
|
15680
|
-
return toObject;
|
|
15681
|
-
}
|
|
15682
|
-
function generatedVideoFromMldev(fromObject) {
|
|
15683
|
-
const toObject = {};
|
|
15684
|
-
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
15685
|
-
if (fromVideo != null) {
|
|
15686
|
-
setValueByPath(toObject, ['video'], videoFromMldev(fromVideo));
|
|
15687
|
-
}
|
|
15688
|
-
return toObject;
|
|
15689
|
-
}
|
|
15690
|
-
function generateVideosResponseFromMldev(fromObject) {
|
|
15691
|
-
const toObject = {};
|
|
15692
|
-
const fromGeneratedVideos = getValueByPath(fromObject, [
|
|
15693
|
-
'generatedSamples',
|
|
15694
|
-
]);
|
|
15695
|
-
if (fromGeneratedVideos != null) {
|
|
15696
|
-
let transformedList = fromGeneratedVideos;
|
|
15697
|
-
if (Array.isArray(transformedList)) {
|
|
15698
|
-
transformedList = transformedList.map((item) => {
|
|
15699
|
-
return generatedVideoFromMldev(item);
|
|
15700
|
-
});
|
|
15701
|
-
}
|
|
15702
|
-
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
15703
|
-
}
|
|
15704
|
-
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
15705
|
-
'raiMediaFilteredCount',
|
|
15706
|
-
]);
|
|
15707
|
-
if (fromRaiMediaFilteredCount != null) {
|
|
15708
|
-
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
15709
|
-
}
|
|
15710
|
-
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
15711
|
-
'raiMediaFilteredReasons',
|
|
15712
|
-
]);
|
|
15713
|
-
if (fromRaiMediaFilteredReasons != null) {
|
|
15714
|
-
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
15715
|
-
}
|
|
15716
|
-
return toObject;
|
|
15717
|
-
}
|
|
15718
|
-
function generateVideosOperationFromMldev(fromObject) {
|
|
15719
|
-
const toObject = {};
|
|
15720
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
15721
|
-
if (fromName != null) {
|
|
15722
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
15723
|
-
}
|
|
15724
|
-
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
15725
|
-
if (fromMetadata != null) {
|
|
15726
|
-
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
15727
|
-
}
|
|
15728
|
-
const fromDone = getValueByPath(fromObject, ['done']);
|
|
15729
|
-
if (fromDone != null) {
|
|
15730
|
-
setValueByPath(toObject, ['done'], fromDone);
|
|
15731
|
-
}
|
|
15732
|
-
const fromError = getValueByPath(fromObject, ['error']);
|
|
15733
|
-
if (fromError != null) {
|
|
15734
|
-
setValueByPath(toObject, ['error'], fromError);
|
|
15735
|
-
}
|
|
15736
|
-
const fromResponse = getValueByPath(fromObject, [
|
|
15737
|
-
'response',
|
|
15738
|
-
'generateVideoResponse',
|
|
15739
|
-
]);
|
|
15740
|
-
if (fromResponse != null) {
|
|
15741
|
-
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev(fromResponse));
|
|
15742
|
-
}
|
|
15743
|
-
return toObject;
|
|
15744
|
-
}
|
|
15745
|
-
function videoFromVertex(fromObject) {
|
|
15746
|
-
const toObject = {};
|
|
15747
|
-
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
15748
|
-
if (fromUri != null) {
|
|
15749
|
-
setValueByPath(toObject, ['uri'], fromUri);
|
|
15750
|
-
}
|
|
15751
|
-
const fromVideoBytes = getValueByPath(fromObject, [
|
|
15752
|
-
'bytesBase64Encoded',
|
|
15753
|
-
]);
|
|
15754
|
-
if (fromVideoBytes != null) {
|
|
15755
|
-
setValueByPath(toObject, ['videoBytes'], tBytes(fromVideoBytes));
|
|
15756
|
-
}
|
|
15757
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
15758
|
-
if (fromMimeType != null) {
|
|
15759
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
15760
|
-
}
|
|
15761
|
-
return toObject;
|
|
15762
|
-
}
|
|
15763
|
-
function generatedVideoFromVertex(fromObject) {
|
|
15764
|
-
const toObject = {};
|
|
15765
|
-
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
15766
|
-
if (fromVideo != null) {
|
|
15767
|
-
setValueByPath(toObject, ['video'], videoFromVertex(fromVideo));
|
|
15768
|
-
}
|
|
15769
|
-
return toObject;
|
|
15770
|
-
}
|
|
15771
|
-
function generateVideosResponseFromVertex(fromObject) {
|
|
15772
|
-
const toObject = {};
|
|
15773
|
-
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
15774
|
-
if (fromGeneratedVideos != null) {
|
|
15775
|
-
let transformedList = fromGeneratedVideos;
|
|
15776
|
-
if (Array.isArray(transformedList)) {
|
|
15777
|
-
transformedList = transformedList.map((item) => {
|
|
15778
|
-
return generatedVideoFromVertex(item);
|
|
15779
|
-
});
|
|
15780
|
-
}
|
|
15781
|
-
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
15782
|
-
}
|
|
15783
|
-
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
15784
|
-
'raiMediaFilteredCount',
|
|
15785
|
-
]);
|
|
15786
|
-
if (fromRaiMediaFilteredCount != null) {
|
|
15787
|
-
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
15788
|
-
}
|
|
15789
|
-
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
15790
|
-
'raiMediaFilteredReasons',
|
|
15791
|
-
]);
|
|
15792
|
-
if (fromRaiMediaFilteredReasons != null) {
|
|
15793
|
-
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
15794
|
-
}
|
|
15795
|
-
return toObject;
|
|
15796
|
-
}
|
|
15797
|
-
function generateVideosOperationFromVertex(fromObject) {
|
|
15798
|
-
const toObject = {};
|
|
15799
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
15800
|
-
if (fromName != null) {
|
|
15801
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
15802
|
-
}
|
|
15803
|
-
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
15804
|
-
if (fromMetadata != null) {
|
|
15805
|
-
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
15806
|
-
}
|
|
15807
|
-
const fromDone = getValueByPath(fromObject, ['done']);
|
|
15808
|
-
if (fromDone != null) {
|
|
15809
|
-
setValueByPath(toObject, ['done'], fromDone);
|
|
15810
|
-
}
|
|
15811
|
-
const fromError = getValueByPath(fromObject, ['error']);
|
|
15812
|
-
if (fromError != null) {
|
|
15813
|
-
setValueByPath(toObject, ['error'], fromError);
|
|
15814
|
-
}
|
|
15815
|
-
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
15816
|
-
if (fromResponse != null) {
|
|
15817
|
-
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex(fromResponse));
|
|
15818
|
-
}
|
|
15819
|
-
return toObject;
|
|
15820
|
-
}
|
|
15821
15967
|
|
|
15822
15968
|
/**
|
|
15823
15969
|
* @license
|
|
@@ -15847,17 +15993,64 @@ class Operations extends BaseModule {
|
|
|
15847
15993
|
if (config && 'httpOptions' in config) {
|
|
15848
15994
|
httpOptions = config.httpOptions;
|
|
15849
15995
|
}
|
|
15850
|
-
|
|
15996
|
+
const rawOperation = await this.fetchPredictVideosOperationInternal({
|
|
15851
15997
|
operationName: operation.name,
|
|
15852
15998
|
resourceName: resourceName,
|
|
15853
15999
|
config: { httpOptions: httpOptions },
|
|
15854
16000
|
});
|
|
16001
|
+
return operation._fromAPIResponse({
|
|
16002
|
+
apiResponse: rawOperation,
|
|
16003
|
+
isVertexAI: true,
|
|
16004
|
+
});
|
|
15855
16005
|
}
|
|
15856
16006
|
else {
|
|
15857
|
-
|
|
16007
|
+
const rawOperation = await this.getVideosOperationInternal({
|
|
15858
16008
|
operationName: operation.name,
|
|
15859
16009
|
config: config,
|
|
15860
16010
|
});
|
|
16011
|
+
return operation._fromAPIResponse({
|
|
16012
|
+
apiResponse: rawOperation,
|
|
16013
|
+
isVertexAI: false,
|
|
16014
|
+
});
|
|
16015
|
+
}
|
|
16016
|
+
}
|
|
16017
|
+
/**
|
|
16018
|
+
* Gets the status of a long-running operation.
|
|
16019
|
+
*
|
|
16020
|
+
* @param parameters The parameters for the get operation request.
|
|
16021
|
+
* @return The updated Operation object, with the latest status or result.
|
|
16022
|
+
*/
|
|
16023
|
+
async get(parameters) {
|
|
16024
|
+
const operation = parameters.operation;
|
|
16025
|
+
const config = parameters.config;
|
|
16026
|
+
if (operation.name === undefined || operation.name === '') {
|
|
16027
|
+
throw new Error('Operation name is required.');
|
|
16028
|
+
}
|
|
16029
|
+
if (this.apiClient.isVertexAI()) {
|
|
16030
|
+
const resourceName = operation.name.split('/operations/')[0];
|
|
16031
|
+
let httpOptions = undefined;
|
|
16032
|
+
if (config && 'httpOptions' in config) {
|
|
16033
|
+
httpOptions = config.httpOptions;
|
|
16034
|
+
}
|
|
16035
|
+
const rawOperation = await this.fetchPredictVideosOperationInternal({
|
|
16036
|
+
operationName: operation.name,
|
|
16037
|
+
resourceName: resourceName,
|
|
16038
|
+
config: { httpOptions: httpOptions },
|
|
16039
|
+
});
|
|
16040
|
+
return operation._fromAPIResponse({
|
|
16041
|
+
apiResponse: rawOperation,
|
|
16042
|
+
isVertexAI: true,
|
|
16043
|
+
});
|
|
16044
|
+
}
|
|
16045
|
+
else {
|
|
16046
|
+
const rawOperation = await this.getVideosOperationInternal({
|
|
16047
|
+
operationName: operation.name,
|
|
16048
|
+
config: config,
|
|
16049
|
+
});
|
|
16050
|
+
return operation._fromAPIResponse({
|
|
16051
|
+
apiResponse: rawOperation,
|
|
16052
|
+
isVertexAI: false,
|
|
16053
|
+
});
|
|
15861
16054
|
}
|
|
15862
16055
|
}
|
|
15863
16056
|
async getVideosOperationInternal(params) {
|
|
@@ -15884,10 +16077,7 @@ class Operations extends BaseModule {
|
|
|
15884
16077
|
.then((httpResponse) => {
|
|
15885
16078
|
return httpResponse.json();
|
|
15886
16079
|
});
|
|
15887
|
-
return response
|
|
15888
|
-
const resp = generateVideosOperationFromVertex(apiResponse);
|
|
15889
|
-
return resp;
|
|
15890
|
-
});
|
|
16080
|
+
return response;
|
|
15891
16081
|
}
|
|
15892
16082
|
else {
|
|
15893
16083
|
const body = getOperationParametersToMldev(params);
|
|
@@ -15908,10 +16098,7 @@ class Operations extends BaseModule {
|
|
|
15908
16098
|
.then((httpResponse) => {
|
|
15909
16099
|
return httpResponse.json();
|
|
15910
16100
|
});
|
|
15911
|
-
return response
|
|
15912
|
-
const resp = generateVideosOperationFromMldev(apiResponse);
|
|
15913
|
-
return resp;
|
|
15914
|
-
});
|
|
16101
|
+
return response;
|
|
15915
16102
|
}
|
|
15916
16103
|
}
|
|
15917
16104
|
async fetchPredictVideosOperationInternal(params) {
|
|
@@ -15938,10 +16125,7 @@ class Operations extends BaseModule {
|
|
|
15938
16125
|
.then((httpResponse) => {
|
|
15939
16126
|
return httpResponse.json();
|
|
15940
16127
|
});
|
|
15941
|
-
return response
|
|
15942
|
-
const resp = generateVideosOperationFromVertex(apiResponse);
|
|
15943
|
-
return resp;
|
|
15944
|
-
});
|
|
16128
|
+
return response;
|
|
15945
16129
|
}
|
|
15946
16130
|
else {
|
|
15947
16131
|
throw new Error('This method is only supported by the Vertex AI.');
|
|
@@ -17084,6 +17268,12 @@ function tunedModelFromMldev(fromObject) {
|
|
|
17084
17268
|
}
|
|
17085
17269
|
function tuningJobFromMldev(fromObject) {
|
|
17086
17270
|
const toObject = {};
|
|
17271
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17272
|
+
'sdkHttpResponse',
|
|
17273
|
+
]);
|
|
17274
|
+
if (fromSdkHttpResponse != null) {
|
|
17275
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17276
|
+
}
|
|
17087
17277
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
17088
17278
|
if (fromName != null) {
|
|
17089
17279
|
setValueByPath(toObject, ['name'], fromName);
|
|
@@ -17168,6 +17358,12 @@ function tuningJobFromMldev(fromObject) {
|
|
|
17168
17358
|
}
|
|
17169
17359
|
function listTuningJobsResponseFromMldev(fromObject) {
|
|
17170
17360
|
const toObject = {};
|
|
17361
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17362
|
+
'sdkHttpResponse',
|
|
17363
|
+
]);
|
|
17364
|
+
if (fromSdkHttpResponse != null) {
|
|
17365
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17366
|
+
}
|
|
17171
17367
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
17172
17368
|
'nextPageToken',
|
|
17173
17369
|
]);
|
|
@@ -17188,6 +17384,12 @@ function listTuningJobsResponseFromMldev(fromObject) {
|
|
|
17188
17384
|
}
|
|
17189
17385
|
function tuningOperationFromMldev(fromObject) {
|
|
17190
17386
|
const toObject = {};
|
|
17387
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17388
|
+
'sdkHttpResponse',
|
|
17389
|
+
]);
|
|
17390
|
+
if (fromSdkHttpResponse != null) {
|
|
17391
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17392
|
+
}
|
|
17191
17393
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
17192
17394
|
if (fromName != null) {
|
|
17193
17395
|
setValueByPath(toObject, ['name'], fromName);
|
|
@@ -17250,6 +17452,12 @@ function tunedModelFromVertex(fromObject) {
|
|
|
17250
17452
|
}
|
|
17251
17453
|
function tuningJobFromVertex(fromObject) {
|
|
17252
17454
|
const toObject = {};
|
|
17455
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17456
|
+
'sdkHttpResponse',
|
|
17457
|
+
]);
|
|
17458
|
+
if (fromSdkHttpResponse != null) {
|
|
17459
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17460
|
+
}
|
|
17253
17461
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
17254
17462
|
if (fromName != null) {
|
|
17255
17463
|
setValueByPath(toObject, ['name'], fromName);
|
|
@@ -17356,6 +17564,12 @@ function tuningJobFromVertex(fromObject) {
|
|
|
17356
17564
|
}
|
|
17357
17565
|
function listTuningJobsResponseFromVertex(fromObject) {
|
|
17358
17566
|
const toObject = {};
|
|
17567
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17568
|
+
'sdkHttpResponse',
|
|
17569
|
+
]);
|
|
17570
|
+
if (fromSdkHttpResponse != null) {
|
|
17571
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17572
|
+
}
|
|
17359
17573
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
17360
17574
|
'nextPageToken',
|
|
17361
17575
|
]);
|
|
@@ -17462,7 +17676,13 @@ class Tunings extends BaseModule {
|
|
|
17462
17676
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
17463
17677
|
})
|
|
17464
17678
|
.then((httpResponse) => {
|
|
17465
|
-
return httpResponse.json()
|
|
17679
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17680
|
+
const response = jsonResponse;
|
|
17681
|
+
response.sdkHttpResponse = {
|
|
17682
|
+
headers: httpResponse.headers,
|
|
17683
|
+
};
|
|
17684
|
+
return response;
|
|
17685
|
+
});
|
|
17466
17686
|
});
|
|
17467
17687
|
return response.then((apiResponse) => {
|
|
17468
17688
|
const resp = tuningJobFromVertex(apiResponse);
|
|
@@ -17486,7 +17706,13 @@ class Tunings extends BaseModule {
|
|
|
17486
17706
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
17487
17707
|
})
|
|
17488
17708
|
.then((httpResponse) => {
|
|
17489
|
-
return httpResponse.json()
|
|
17709
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17710
|
+
const response = jsonResponse;
|
|
17711
|
+
response.sdkHttpResponse = {
|
|
17712
|
+
headers: httpResponse.headers,
|
|
17713
|
+
};
|
|
17714
|
+
return response;
|
|
17715
|
+
});
|
|
17490
17716
|
});
|
|
17491
17717
|
return response.then((apiResponse) => {
|
|
17492
17718
|
const resp = tuningJobFromMldev(apiResponse);
|
|
@@ -17516,7 +17742,13 @@ class Tunings extends BaseModule {
|
|
|
17516
17742
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
17517
17743
|
})
|
|
17518
17744
|
.then((httpResponse) => {
|
|
17519
|
-
return httpResponse.json()
|
|
17745
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17746
|
+
const response = jsonResponse;
|
|
17747
|
+
response.sdkHttpResponse = {
|
|
17748
|
+
headers: httpResponse.headers,
|
|
17749
|
+
};
|
|
17750
|
+
return response;
|
|
17751
|
+
});
|
|
17520
17752
|
});
|
|
17521
17753
|
return response.then((apiResponse) => {
|
|
17522
17754
|
const resp = listTuningJobsResponseFromVertex(apiResponse);
|
|
@@ -17542,7 +17774,13 @@ class Tunings extends BaseModule {
|
|
|
17542
17774
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
17543
17775
|
})
|
|
17544
17776
|
.then((httpResponse) => {
|
|
17545
|
-
return httpResponse.json()
|
|
17777
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17778
|
+
const response = jsonResponse;
|
|
17779
|
+
response.sdkHttpResponse = {
|
|
17780
|
+
headers: httpResponse.headers,
|
|
17781
|
+
};
|
|
17782
|
+
return response;
|
|
17783
|
+
});
|
|
17546
17784
|
});
|
|
17547
17785
|
return response.then((apiResponse) => {
|
|
17548
17786
|
const resp = listTuningJobsResponseFromMldev(apiResponse);
|
|
@@ -17574,7 +17812,13 @@ class Tunings extends BaseModule {
|
|
|
17574
17812
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
17575
17813
|
})
|
|
17576
17814
|
.then((httpResponse) => {
|
|
17577
|
-
return httpResponse.json()
|
|
17815
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17816
|
+
const response = jsonResponse;
|
|
17817
|
+
response.sdkHttpResponse = {
|
|
17818
|
+
headers: httpResponse.headers,
|
|
17819
|
+
};
|
|
17820
|
+
return response;
|
|
17821
|
+
});
|
|
17578
17822
|
});
|
|
17579
17823
|
return response.then((apiResponse) => {
|
|
17580
17824
|
const resp = tuningJobFromVertex(apiResponse);
|
|
@@ -17610,7 +17854,13 @@ class Tunings extends BaseModule {
|
|
|
17610
17854
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
17611
17855
|
})
|
|
17612
17856
|
.then((httpResponse) => {
|
|
17613
|
-
return httpResponse.json()
|
|
17857
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17858
|
+
const response = jsonResponse;
|
|
17859
|
+
response.sdkHttpResponse = {
|
|
17860
|
+
headers: httpResponse.headers,
|
|
17861
|
+
};
|
|
17862
|
+
return response;
|
|
17863
|
+
});
|
|
17614
17864
|
});
|
|
17615
17865
|
return response.then((apiResponse) => {
|
|
17616
17866
|
const resp = tuningOperationFromMldev(apiResponse);
|
|
@@ -17735,6 +17985,7 @@ exports.GenerateContentResponse = GenerateContentResponse;
|
|
|
17735
17985
|
exports.GenerateContentResponsePromptFeedback = GenerateContentResponsePromptFeedback;
|
|
17736
17986
|
exports.GenerateContentResponseUsageMetadata = GenerateContentResponseUsageMetadata;
|
|
17737
17987
|
exports.GenerateImagesResponse = GenerateImagesResponse;
|
|
17988
|
+
exports.GenerateVideosOperation = GenerateVideosOperation;
|
|
17738
17989
|
exports.GenerateVideosResponse = GenerateVideosResponse;
|
|
17739
17990
|
exports.GoogleGenAI = GoogleGenAI;
|
|
17740
17991
|
exports.HttpResponse = HttpResponse;
|