@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/node/index.cjs
CHANGED
|
@@ -72,18 +72,18 @@ function getDefaultBaseUrls() {
|
|
|
72
72
|
* 2. Base URLs set via the latest call to setDefaultBaseUrls.
|
|
73
73
|
* 3. Base URLs set via environment variables.
|
|
74
74
|
*/
|
|
75
|
-
function getBaseUrl(
|
|
76
|
-
var _a, _b
|
|
77
|
-
if (!(
|
|
75
|
+
function getBaseUrl(httpOptions, vertexai, vertexBaseUrlFromEnv, geminiBaseUrlFromEnv) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
if (!(httpOptions === null || httpOptions === void 0 ? void 0 : httpOptions.baseUrl)) {
|
|
78
78
|
const defaultBaseUrls = getDefaultBaseUrls();
|
|
79
|
-
if (
|
|
80
|
-
return (
|
|
79
|
+
if (vertexai) {
|
|
80
|
+
return (_a = defaultBaseUrls.vertexUrl) !== null && _a !== void 0 ? _a : vertexBaseUrlFromEnv;
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
|
-
return (
|
|
83
|
+
return (_b = defaultBaseUrls.geminiUrl) !== null && _b !== void 0 ? _b : geminiBaseUrlFromEnv;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
return
|
|
86
|
+
return httpOptions.baseUrl;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
@@ -218,6 +218,20 @@ function getValueByPath(data, keys) {
|
|
|
218
218
|
* Copyright 2025 Google LLC
|
|
219
219
|
* SPDX-License-Identifier: Apache-2.0
|
|
220
220
|
*/
|
|
221
|
+
function tBytes$1(fromBytes) {
|
|
222
|
+
if (typeof fromBytes !== 'string') {
|
|
223
|
+
throw new Error('fromImageBytes must be a string');
|
|
224
|
+
}
|
|
225
|
+
// TODO(b/389133914): Remove dummy bytes converter.
|
|
226
|
+
return fromBytes;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @license
|
|
231
|
+
* Copyright 2025 Google LLC
|
|
232
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
233
|
+
*/
|
|
234
|
+
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
221
235
|
/** Required. Outcome of the code execution. */
|
|
222
236
|
exports.Outcome = void 0;
|
|
223
237
|
(function (Outcome) {
|
|
@@ -1711,6 +1725,65 @@ class LiveServerMessage {
|
|
|
1711
1725
|
return data.length > 0 ? btoa(data) : undefined;
|
|
1712
1726
|
}
|
|
1713
1727
|
}
|
|
1728
|
+
/** A video generation long-running operation. */
|
|
1729
|
+
class GenerateVideosOperation {
|
|
1730
|
+
/**
|
|
1731
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
1732
|
+
* @internal
|
|
1733
|
+
*/
|
|
1734
|
+
_fromAPIResponse({ apiResponse, isVertexAI, }) {
|
|
1735
|
+
const operation = new GenerateVideosOperation();
|
|
1736
|
+
operation.name = apiResponse['name'];
|
|
1737
|
+
operation.metadata = apiResponse['metadata'];
|
|
1738
|
+
operation.done = apiResponse['done'];
|
|
1739
|
+
operation.error = apiResponse['error'];
|
|
1740
|
+
if (isVertexAI) {
|
|
1741
|
+
const response = apiResponse['response'];
|
|
1742
|
+
if (response) {
|
|
1743
|
+
const operationResponse = new GenerateVideosResponse();
|
|
1744
|
+
const responseVideos = response['videos'];
|
|
1745
|
+
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1746
|
+
return {
|
|
1747
|
+
video: {
|
|
1748
|
+
uri: generatedVideo['gcsUri'],
|
|
1749
|
+
videoBytes: generatedVideo['bytesBase64Encoded']
|
|
1750
|
+
? tBytes$1(generatedVideo['bytesBase64Encoded'])
|
|
1751
|
+
: undefined,
|
|
1752
|
+
mimeType: generatedVideo['mimeType'],
|
|
1753
|
+
},
|
|
1754
|
+
};
|
|
1755
|
+
});
|
|
1756
|
+
operationResponse.raiMediaFilteredCount = response['raiMediaFilteredCount'];
|
|
1757
|
+
operationResponse.raiMediaFilteredReasons = response['raiMediaFilteredReasons'];
|
|
1758
|
+
operation.response = operationResponse;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
else {
|
|
1762
|
+
const response = apiResponse['response'];
|
|
1763
|
+
if (response) {
|
|
1764
|
+
const operationResponse = new GenerateVideosResponse();
|
|
1765
|
+
const generatedVideoResponse = response['generateVideoResponse'];
|
|
1766
|
+
const responseVideos = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['generatedSamples'];
|
|
1767
|
+
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1768
|
+
const video = generatedVideo['video'];
|
|
1769
|
+
return {
|
|
1770
|
+
video: {
|
|
1771
|
+
uri: video === null || video === void 0 ? void 0 : video['uri'],
|
|
1772
|
+
videoBytes: (video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1773
|
+
? tBytes$1(video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1774
|
+
: undefined,
|
|
1775
|
+
mimeType: generatedVideo['encoding'],
|
|
1776
|
+
},
|
|
1777
|
+
};
|
|
1778
|
+
});
|
|
1779
|
+
operationResponse.raiMediaFilteredCount = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredCount'];
|
|
1780
|
+
operationResponse.raiMediaFilteredReasons = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredReasons'];
|
|
1781
|
+
operation.response = operationResponse;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
return operation;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1714
1787
|
/** Client generated response to a `ToolCall` received from the server.
|
|
1715
1788
|
|
|
1716
1789
|
Individual `FunctionResponse` objects are matched to the respective
|
|
@@ -2272,11 +2345,7 @@ function tTuningJobStatus(status) {
|
|
|
2272
2345
|
}
|
|
2273
2346
|
}
|
|
2274
2347
|
function tBytes(fromImageBytes) {
|
|
2275
|
-
|
|
2276
|
-
throw new Error('fromImageBytes must be a string');
|
|
2277
|
-
}
|
|
2278
|
-
// TODO(b/389133914): Remove dummy bytes converter.
|
|
2279
|
-
return fromImageBytes;
|
|
2348
|
+
return tBytes$1(fromImageBytes);
|
|
2280
2349
|
}
|
|
2281
2350
|
function _isFile(origin) {
|
|
2282
2351
|
return (origin !== null &&
|
|
@@ -3764,6 +3833,12 @@ function batchJobFromMldev(fromObject) {
|
|
|
3764
3833
|
}
|
|
3765
3834
|
function listBatchJobsResponseFromMldev(fromObject) {
|
|
3766
3835
|
const toObject = {};
|
|
3836
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
3837
|
+
'sdkHttpResponse',
|
|
3838
|
+
]);
|
|
3839
|
+
if (fromSdkHttpResponse != null) {
|
|
3840
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
3841
|
+
}
|
|
3767
3842
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
3768
3843
|
'nextPageToken',
|
|
3769
3844
|
]);
|
|
@@ -3905,6 +3980,12 @@ function batchJobFromVertex(fromObject) {
|
|
|
3905
3980
|
}
|
|
3906
3981
|
function listBatchJobsResponseFromVertex(fromObject) {
|
|
3907
3982
|
const toObject = {};
|
|
3983
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
3984
|
+
'sdkHttpResponse',
|
|
3985
|
+
]);
|
|
3986
|
+
if (fromSdkHttpResponse != null) {
|
|
3987
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
3988
|
+
}
|
|
3908
3989
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
3909
3990
|
'nextPageToken',
|
|
3910
3991
|
]);
|
|
@@ -3947,9 +4028,6 @@ function deleteResourceJobFromVertex(fromObject) {
|
|
|
3947
4028
|
* Copyright 2025 Google LLC
|
|
3948
4029
|
* SPDX-License-Identifier: Apache-2.0
|
|
3949
4030
|
*/
|
|
3950
|
-
/**
|
|
3951
|
-
* Pagers for the GenAI List APIs.
|
|
3952
|
-
*/
|
|
3953
4031
|
exports.PagedItem = void 0;
|
|
3954
4032
|
(function (PagedItem) {
|
|
3955
4033
|
PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
|
|
@@ -3972,9 +4050,10 @@ class Pager {
|
|
|
3972
4050
|
var _a, _b;
|
|
3973
4051
|
this.nameInternal = name;
|
|
3974
4052
|
this.pageInternal = response[this.nameInternal] || [];
|
|
4053
|
+
this.sdkHttpResponseInternal = response === null || response === void 0 ? void 0 : response.sdkHttpResponse;
|
|
3975
4054
|
this.idxInternal = 0;
|
|
3976
4055
|
let requestParams = { config: {} };
|
|
3977
|
-
if (!params) {
|
|
4056
|
+
if (!params || Object.keys(params).length === 0) {
|
|
3978
4057
|
requestParams = { config: {} };
|
|
3979
4058
|
}
|
|
3980
4059
|
else if (typeof params === 'object') {
|
|
@@ -4018,6 +4097,12 @@ class Pager {
|
|
|
4018
4097
|
get pageSize() {
|
|
4019
4098
|
return this.pageInternalSize;
|
|
4020
4099
|
}
|
|
4100
|
+
/**
|
|
4101
|
+
* Returns the headers of the API response.
|
|
4102
|
+
*/
|
|
4103
|
+
get sdkHttpResponse() {
|
|
4104
|
+
return this.sdkHttpResponseInternal;
|
|
4105
|
+
}
|
|
4021
4106
|
/**
|
|
4022
4107
|
* Returns the parameters when making the API request for the next page.
|
|
4023
4108
|
*
|
|
@@ -4387,7 +4472,13 @@ class Batches extends BaseModule {
|
|
|
4387
4472
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4388
4473
|
})
|
|
4389
4474
|
.then((httpResponse) => {
|
|
4390
|
-
return httpResponse.json()
|
|
4475
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
4476
|
+
const response = jsonResponse;
|
|
4477
|
+
response.sdkHttpResponse = {
|
|
4478
|
+
headers: httpResponse.headers,
|
|
4479
|
+
};
|
|
4480
|
+
return response;
|
|
4481
|
+
});
|
|
4391
4482
|
});
|
|
4392
4483
|
return response.then((apiResponse) => {
|
|
4393
4484
|
const resp = listBatchJobsResponseFromVertex(apiResponse);
|
|
@@ -4413,7 +4504,13 @@ class Batches extends BaseModule {
|
|
|
4413
4504
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4414
4505
|
})
|
|
4415
4506
|
.then((httpResponse) => {
|
|
4416
|
-
return httpResponse.json()
|
|
4507
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
4508
|
+
const response = jsonResponse;
|
|
4509
|
+
response.sdkHttpResponse = {
|
|
4510
|
+
headers: httpResponse.headers,
|
|
4511
|
+
};
|
|
4512
|
+
return response;
|
|
4513
|
+
});
|
|
4417
4514
|
});
|
|
4418
4515
|
return response.then((apiResponse) => {
|
|
4419
4516
|
const resp = listBatchJobsResponseFromMldev(apiResponse);
|
|
@@ -5466,6 +5563,12 @@ function deleteCachedContentResponseFromMldev() {
|
|
|
5466
5563
|
}
|
|
5467
5564
|
function listCachedContentsResponseFromMldev(fromObject) {
|
|
5468
5565
|
const toObject = {};
|
|
5566
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
5567
|
+
'sdkHttpResponse',
|
|
5568
|
+
]);
|
|
5569
|
+
if (fromSdkHttpResponse != null) {
|
|
5570
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
5571
|
+
}
|
|
5469
5572
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
5470
5573
|
'nextPageToken',
|
|
5471
5574
|
]);
|
|
@@ -5526,6 +5629,12 @@ function deleteCachedContentResponseFromVertex() {
|
|
|
5526
5629
|
}
|
|
5527
5630
|
function listCachedContentsResponseFromVertex(fromObject) {
|
|
5528
5631
|
const toObject = {};
|
|
5632
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
5633
|
+
'sdkHttpResponse',
|
|
5634
|
+
]);
|
|
5635
|
+
if (fromSdkHttpResponse != null) {
|
|
5636
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
5637
|
+
}
|
|
5529
5638
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
5530
5639
|
'nextPageToken',
|
|
5531
5640
|
]);
|
|
@@ -5878,7 +5987,13 @@ class Caches extends BaseModule {
|
|
|
5878
5987
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
5879
5988
|
})
|
|
5880
5989
|
.then((httpResponse) => {
|
|
5881
|
-
return httpResponse.json()
|
|
5990
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
5991
|
+
const response = jsonResponse;
|
|
5992
|
+
response.sdkHttpResponse = {
|
|
5993
|
+
headers: httpResponse.headers,
|
|
5994
|
+
};
|
|
5995
|
+
return response;
|
|
5996
|
+
});
|
|
5882
5997
|
});
|
|
5883
5998
|
return response.then((apiResponse) => {
|
|
5884
5999
|
const resp = listCachedContentsResponseFromVertex(apiResponse);
|
|
@@ -5904,7 +6019,13 @@ class Caches extends BaseModule {
|
|
|
5904
6019
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
5905
6020
|
})
|
|
5906
6021
|
.then((httpResponse) => {
|
|
5907
|
-
return httpResponse.json()
|
|
6022
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
6023
|
+
const response = jsonResponse;
|
|
6024
|
+
response.sdkHttpResponse = {
|
|
6025
|
+
headers: httpResponse.headers,
|
|
6026
|
+
};
|
|
6027
|
+
return response;
|
|
6028
|
+
});
|
|
5908
6029
|
});
|
|
5909
6030
|
return response.then((apiResponse) => {
|
|
5910
6031
|
const resp = listCachedContentsResponseFromMldev(apiResponse);
|
|
@@ -6542,6 +6663,12 @@ function fileFromMldev(fromObject) {
|
|
|
6542
6663
|
}
|
|
6543
6664
|
function listFilesResponseFromMldev(fromObject) {
|
|
6544
6665
|
const toObject = {};
|
|
6666
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
6667
|
+
'sdkHttpResponse',
|
|
6668
|
+
]);
|
|
6669
|
+
if (fromSdkHttpResponse != null) {
|
|
6670
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
6671
|
+
}
|
|
6545
6672
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
6546
6673
|
'nextPageToken',
|
|
6547
6674
|
]);
|
|
@@ -6703,7 +6830,13 @@ class Files extends BaseModule {
|
|
|
6703
6830
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
6704
6831
|
})
|
|
6705
6832
|
.then((httpResponse) => {
|
|
6706
|
-
return httpResponse.json()
|
|
6833
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
6834
|
+
const response = jsonResponse;
|
|
6835
|
+
response.sdkHttpResponse = {
|
|
6836
|
+
headers: httpResponse.headers,
|
|
6837
|
+
};
|
|
6838
|
+
return response;
|
|
6839
|
+
});
|
|
6707
6840
|
});
|
|
6708
6841
|
return response.then((apiResponse) => {
|
|
6709
6842
|
const resp = listFilesResponseFromMldev(apiResponse);
|
|
@@ -9929,6 +10062,9 @@ function generateImagesConfigToMldev(fromObject, parentObject) {
|
|
|
9929
10062
|
if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
|
|
9930
10063
|
throw new Error('addWatermark parameter is not supported in Gemini API.');
|
|
9931
10064
|
}
|
|
10065
|
+
if (getValueByPath(fromObject, ['imageSize']) !== undefined) {
|
|
10066
|
+
throw new Error('imageSize parameter is not supported in Gemini API.');
|
|
10067
|
+
}
|
|
9932
10068
|
if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
|
|
9933
10069
|
throw new Error('enhancePrompt parameter is not supported in Gemini API.');
|
|
9934
10070
|
}
|
|
@@ -11005,6 +11141,10 @@ function generateImagesConfigToVertex(fromObject, parentObject) {
|
|
|
11005
11141
|
if (parentObject !== undefined && fromAddWatermark != null) {
|
|
11006
11142
|
setValueByPath(parentObject, ['parameters', 'addWatermark'], fromAddWatermark);
|
|
11007
11143
|
}
|
|
11144
|
+
const fromImageSize = getValueByPath(fromObject, ['imageSize']);
|
|
11145
|
+
if (parentObject !== undefined && fromImageSize != null) {
|
|
11146
|
+
setValueByPath(parentObject, ['parameters', 'sampleImageSize'], fromImageSize);
|
|
11147
|
+
}
|
|
11008
11148
|
const fromEnhancePrompt = getValueByPath(fromObject, [
|
|
11009
11149
|
'enhancePrompt',
|
|
11010
11150
|
]);
|
|
@@ -11843,6 +11983,12 @@ function embedContentMetadataFromMldev() {
|
|
|
11843
11983
|
}
|
|
11844
11984
|
function embedContentResponseFromMldev(fromObject) {
|
|
11845
11985
|
const toObject = {};
|
|
11986
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
11987
|
+
'sdkHttpResponse',
|
|
11988
|
+
]);
|
|
11989
|
+
if (fromSdkHttpResponse != null) {
|
|
11990
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
11991
|
+
}
|
|
11846
11992
|
const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
|
|
11847
11993
|
if (fromEmbeddings != null) {
|
|
11848
11994
|
let transformedList = fromEmbeddings;
|
|
@@ -11915,6 +12061,12 @@ function generatedImageFromMldev(fromObject) {
|
|
|
11915
12061
|
}
|
|
11916
12062
|
function generateImagesResponseFromMldev(fromObject) {
|
|
11917
12063
|
const toObject = {};
|
|
12064
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12065
|
+
'sdkHttpResponse',
|
|
12066
|
+
]);
|
|
12067
|
+
if (fromSdkHttpResponse != null) {
|
|
12068
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12069
|
+
}
|
|
11918
12070
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
11919
12071
|
'predictions',
|
|
11920
12072
|
]);
|
|
@@ -11995,6 +12147,12 @@ function modelFromMldev(fromObject) {
|
|
|
11995
12147
|
}
|
|
11996
12148
|
function listModelsResponseFromMldev(fromObject) {
|
|
11997
12149
|
const toObject = {};
|
|
12150
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12151
|
+
'sdkHttpResponse',
|
|
12152
|
+
]);
|
|
12153
|
+
if (fromSdkHttpResponse != null) {
|
|
12154
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12155
|
+
}
|
|
11998
12156
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
11999
12157
|
'nextPageToken',
|
|
12000
12158
|
]);
|
|
@@ -12019,6 +12177,12 @@ function deleteModelResponseFromMldev() {
|
|
|
12019
12177
|
}
|
|
12020
12178
|
function countTokensResponseFromMldev(fromObject) {
|
|
12021
12179
|
const toObject = {};
|
|
12180
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12181
|
+
'sdkHttpResponse',
|
|
12182
|
+
]);
|
|
12183
|
+
if (fromSdkHttpResponse != null) {
|
|
12184
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12185
|
+
}
|
|
12022
12186
|
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
12023
12187
|
if (fromTotalTokens != null) {
|
|
12024
12188
|
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
@@ -12031,7 +12195,7 @@ function countTokensResponseFromMldev(fromObject) {
|
|
|
12031
12195
|
}
|
|
12032
12196
|
return toObject;
|
|
12033
12197
|
}
|
|
12034
|
-
function videoFromMldev
|
|
12198
|
+
function videoFromMldev(fromObject) {
|
|
12035
12199
|
const toObject = {};
|
|
12036
12200
|
const fromUri = getValueByPath(fromObject, ['video', 'uri']);
|
|
12037
12201
|
if (fromUri != null) {
|
|
@@ -12050,15 +12214,15 @@ function videoFromMldev$1(fromObject) {
|
|
|
12050
12214
|
}
|
|
12051
12215
|
return toObject;
|
|
12052
12216
|
}
|
|
12053
|
-
function generatedVideoFromMldev
|
|
12217
|
+
function generatedVideoFromMldev(fromObject) {
|
|
12054
12218
|
const toObject = {};
|
|
12055
12219
|
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
12056
12220
|
if (fromVideo != null) {
|
|
12057
|
-
setValueByPath(toObject, ['video'], videoFromMldev
|
|
12221
|
+
setValueByPath(toObject, ['video'], videoFromMldev(fromVideo));
|
|
12058
12222
|
}
|
|
12059
12223
|
return toObject;
|
|
12060
12224
|
}
|
|
12061
|
-
function generateVideosResponseFromMldev
|
|
12225
|
+
function generateVideosResponseFromMldev(fromObject) {
|
|
12062
12226
|
const toObject = {};
|
|
12063
12227
|
const fromGeneratedVideos = getValueByPath(fromObject, [
|
|
12064
12228
|
'generatedSamples',
|
|
@@ -12067,7 +12231,7 @@ function generateVideosResponseFromMldev$1(fromObject) {
|
|
|
12067
12231
|
let transformedList = fromGeneratedVideos;
|
|
12068
12232
|
if (Array.isArray(transformedList)) {
|
|
12069
12233
|
transformedList = transformedList.map((item) => {
|
|
12070
|
-
return generatedVideoFromMldev
|
|
12234
|
+
return generatedVideoFromMldev(item);
|
|
12071
12235
|
});
|
|
12072
12236
|
}
|
|
12073
12237
|
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
@@ -12086,7 +12250,7 @@ function generateVideosResponseFromMldev$1(fromObject) {
|
|
|
12086
12250
|
}
|
|
12087
12251
|
return toObject;
|
|
12088
12252
|
}
|
|
12089
|
-
function generateVideosOperationFromMldev
|
|
12253
|
+
function generateVideosOperationFromMldev(fromObject) {
|
|
12090
12254
|
const toObject = {};
|
|
12091
12255
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
12092
12256
|
if (fromName != null) {
|
|
@@ -12109,7 +12273,7 @@ function generateVideosOperationFromMldev$1(fromObject) {
|
|
|
12109
12273
|
'generateVideoResponse',
|
|
12110
12274
|
]);
|
|
12111
12275
|
if (fromResponse != null) {
|
|
12112
|
-
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev
|
|
12276
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev(fromResponse));
|
|
12113
12277
|
}
|
|
12114
12278
|
return toObject;
|
|
12115
12279
|
}
|
|
@@ -12405,6 +12569,12 @@ function embedContentMetadataFromVertex(fromObject) {
|
|
|
12405
12569
|
}
|
|
12406
12570
|
function embedContentResponseFromVertex(fromObject) {
|
|
12407
12571
|
const toObject = {};
|
|
12572
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12573
|
+
'sdkHttpResponse',
|
|
12574
|
+
]);
|
|
12575
|
+
if (fromSdkHttpResponse != null) {
|
|
12576
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12577
|
+
}
|
|
12408
12578
|
const fromEmbeddings = getValueByPath(fromObject, [
|
|
12409
12579
|
'predictions[]',
|
|
12410
12580
|
'embeddings',
|
|
@@ -12488,6 +12658,12 @@ function generatedImageFromVertex(fromObject) {
|
|
|
12488
12658
|
}
|
|
12489
12659
|
function generateImagesResponseFromVertex(fromObject) {
|
|
12490
12660
|
const toObject = {};
|
|
12661
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12662
|
+
'sdkHttpResponse',
|
|
12663
|
+
]);
|
|
12664
|
+
if (fromSdkHttpResponse != null) {
|
|
12665
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12666
|
+
}
|
|
12491
12667
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
12492
12668
|
'predictions',
|
|
12493
12669
|
]);
|
|
@@ -12510,6 +12686,12 @@ function generateImagesResponseFromVertex(fromObject) {
|
|
|
12510
12686
|
}
|
|
12511
12687
|
function editImageResponseFromVertex(fromObject) {
|
|
12512
12688
|
const toObject = {};
|
|
12689
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12690
|
+
'sdkHttpResponse',
|
|
12691
|
+
]);
|
|
12692
|
+
if (fromSdkHttpResponse != null) {
|
|
12693
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12694
|
+
}
|
|
12513
12695
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
12514
12696
|
'predictions',
|
|
12515
12697
|
]);
|
|
@@ -12526,6 +12708,12 @@ function editImageResponseFromVertex(fromObject) {
|
|
|
12526
12708
|
}
|
|
12527
12709
|
function upscaleImageResponseFromVertex(fromObject) {
|
|
12528
12710
|
const toObject = {};
|
|
12711
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12712
|
+
'sdkHttpResponse',
|
|
12713
|
+
]);
|
|
12714
|
+
if (fromSdkHttpResponse != null) {
|
|
12715
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12716
|
+
}
|
|
12529
12717
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
12530
12718
|
'predictions',
|
|
12531
12719
|
]);
|
|
@@ -12645,6 +12833,12 @@ function modelFromVertex(fromObject) {
|
|
|
12645
12833
|
}
|
|
12646
12834
|
function listModelsResponseFromVertex(fromObject) {
|
|
12647
12835
|
const toObject = {};
|
|
12836
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12837
|
+
'sdkHttpResponse',
|
|
12838
|
+
]);
|
|
12839
|
+
if (fromSdkHttpResponse != null) {
|
|
12840
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12841
|
+
}
|
|
12648
12842
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
12649
12843
|
'nextPageToken',
|
|
12650
12844
|
]);
|
|
@@ -12669,6 +12863,12 @@ function deleteModelResponseFromVertex() {
|
|
|
12669
12863
|
}
|
|
12670
12864
|
function countTokensResponseFromVertex(fromObject) {
|
|
12671
12865
|
const toObject = {};
|
|
12866
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12867
|
+
'sdkHttpResponse',
|
|
12868
|
+
]);
|
|
12869
|
+
if (fromSdkHttpResponse != null) {
|
|
12870
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12871
|
+
}
|
|
12672
12872
|
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
12673
12873
|
if (fromTotalTokens != null) {
|
|
12674
12874
|
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
@@ -12677,13 +12877,19 @@ function countTokensResponseFromVertex(fromObject) {
|
|
|
12677
12877
|
}
|
|
12678
12878
|
function computeTokensResponseFromVertex(fromObject) {
|
|
12679
12879
|
const toObject = {};
|
|
12880
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
12881
|
+
'sdkHttpResponse',
|
|
12882
|
+
]);
|
|
12883
|
+
if (fromSdkHttpResponse != null) {
|
|
12884
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
12885
|
+
}
|
|
12680
12886
|
const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
|
|
12681
12887
|
if (fromTokensInfo != null) {
|
|
12682
12888
|
setValueByPath(toObject, ['tokensInfo'], fromTokensInfo);
|
|
12683
12889
|
}
|
|
12684
12890
|
return toObject;
|
|
12685
12891
|
}
|
|
12686
|
-
function videoFromVertex
|
|
12892
|
+
function videoFromVertex(fromObject) {
|
|
12687
12893
|
const toObject = {};
|
|
12688
12894
|
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
12689
12895
|
if (fromUri != null) {
|
|
@@ -12701,22 +12907,22 @@ function videoFromVertex$1(fromObject) {
|
|
|
12701
12907
|
}
|
|
12702
12908
|
return toObject;
|
|
12703
12909
|
}
|
|
12704
|
-
function generatedVideoFromVertex
|
|
12910
|
+
function generatedVideoFromVertex(fromObject) {
|
|
12705
12911
|
const toObject = {};
|
|
12706
12912
|
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
12707
12913
|
if (fromVideo != null) {
|
|
12708
|
-
setValueByPath(toObject, ['video'], videoFromVertex
|
|
12914
|
+
setValueByPath(toObject, ['video'], videoFromVertex(fromVideo));
|
|
12709
12915
|
}
|
|
12710
12916
|
return toObject;
|
|
12711
12917
|
}
|
|
12712
|
-
function generateVideosResponseFromVertex
|
|
12918
|
+
function generateVideosResponseFromVertex(fromObject) {
|
|
12713
12919
|
const toObject = {};
|
|
12714
12920
|
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
12715
12921
|
if (fromGeneratedVideos != null) {
|
|
12716
12922
|
let transformedList = fromGeneratedVideos;
|
|
12717
12923
|
if (Array.isArray(transformedList)) {
|
|
12718
12924
|
transformedList = transformedList.map((item) => {
|
|
12719
|
-
return generatedVideoFromVertex
|
|
12925
|
+
return generatedVideoFromVertex(item);
|
|
12720
12926
|
});
|
|
12721
12927
|
}
|
|
12722
12928
|
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
@@ -12735,7 +12941,7 @@ function generateVideosResponseFromVertex$1(fromObject) {
|
|
|
12735
12941
|
}
|
|
12736
12942
|
return toObject;
|
|
12737
12943
|
}
|
|
12738
|
-
function generateVideosOperationFromVertex
|
|
12944
|
+
function generateVideosOperationFromVertex(fromObject) {
|
|
12739
12945
|
const toObject = {};
|
|
12740
12946
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
12741
12947
|
if (fromName != null) {
|
|
@@ -12755,7 +12961,7 @@ function generateVideosOperationFromVertex$1(fromObject) {
|
|
|
12755
12961
|
}
|
|
12756
12962
|
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
12757
12963
|
if (fromResponse != null) {
|
|
12758
|
-
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex
|
|
12964
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex(fromResponse));
|
|
12759
12965
|
}
|
|
12760
12966
|
return toObject;
|
|
12761
12967
|
}
|
|
@@ -12769,7 +12975,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12769
12975
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12770
12976
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12771
12977
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12772
|
-
const SDK_VERSION = '1.
|
|
12978
|
+
const SDK_VERSION = '1.12.0'; // x-release-please-version
|
|
12773
12979
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12774
12980
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12775
12981
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -13362,18 +13568,6 @@ function setMcpUsageHeader(headers) {
|
|
|
13362
13568
|
const existingHeader = (_a = headers[GOOGLE_API_CLIENT_HEADER]) !== null && _a !== void 0 ? _a : '';
|
|
13363
13569
|
headers[GOOGLE_API_CLIENT_HEADER] = (existingHeader + ` ${MCP_LABEL}`).trimStart();
|
|
13364
13570
|
}
|
|
13365
|
-
// Checks whether the list of tools contains any MCP clients. Will return true
|
|
13366
|
-
// if there is at least one MCP client.
|
|
13367
|
-
function hasMcpClientTools(params) {
|
|
13368
|
-
var _a, _b, _c;
|
|
13369
|
-
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;
|
|
13370
|
-
}
|
|
13371
|
-
// Checks whether the list of tools contains any non-MCP tools. Will return true
|
|
13372
|
-
// if there is at least one non-MCP tool.
|
|
13373
|
-
function hasNonMcpTools(params) {
|
|
13374
|
-
var _a, _b, _c;
|
|
13375
|
-
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);
|
|
13376
|
-
}
|
|
13377
13571
|
// Returns true if the object is a MCP CallableTool, otherwise false.
|
|
13378
13572
|
function isMcpCallableTool(object) {
|
|
13379
13573
|
return (object !== null &&
|
|
@@ -13867,13 +14061,13 @@ class Live {
|
|
|
13867
14061
|
const websocketBaseUrl = this.apiClient.getWebsocketBaseUrl();
|
|
13868
14062
|
const apiVersion = this.apiClient.getApiVersion();
|
|
13869
14063
|
let url;
|
|
13870
|
-
const
|
|
14064
|
+
const clientHeaders = this.apiClient.getHeaders();
|
|
13871
14065
|
if (params.config &&
|
|
13872
14066
|
params.config.tools &&
|
|
13873
14067
|
hasMcpToolUsage(params.config.tools)) {
|
|
13874
|
-
setMcpUsageHeader(
|
|
14068
|
+
setMcpUsageHeader(clientHeaders);
|
|
13875
14069
|
}
|
|
13876
|
-
const headers = mapToHeaders(
|
|
14070
|
+
const headers = mapToHeaders(clientHeaders);
|
|
13877
14071
|
if (this.apiClient.isVertexAI()) {
|
|
13878
14072
|
url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
|
|
13879
14073
|
await this.auth.addAuthHeaders(headers);
|
|
@@ -14232,6 +14426,18 @@ function shouldDisableAfc(config) {
|
|
|
14232
14426
|
function isCallableTool(tool) {
|
|
14233
14427
|
return 'callTool' in tool && typeof tool.callTool === 'function';
|
|
14234
14428
|
}
|
|
14429
|
+
// Checks whether the list of tools contains any CallableTools. Will return true
|
|
14430
|
+
// if there is at least one CallableTool.
|
|
14431
|
+
function hasCallableTools(params) {
|
|
14432
|
+
var _a, _b, _c;
|
|
14433
|
+
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;
|
|
14434
|
+
}
|
|
14435
|
+
// Checks whether the list of tools contains any non-callable tools. Will return
|
|
14436
|
+
// true if there is at least one non-Callable tool.
|
|
14437
|
+
function hasNonCallableTools(params) {
|
|
14438
|
+
var _a, _b, _c;
|
|
14439
|
+
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;
|
|
14440
|
+
}
|
|
14235
14441
|
/**
|
|
14236
14442
|
* Returns whether to append automatic function calling history to the
|
|
14237
14443
|
* response.
|
|
@@ -14290,12 +14496,12 @@ class Models extends BaseModule {
|
|
|
14290
14496
|
*/
|
|
14291
14497
|
this.generateContent = async (params) => {
|
|
14292
14498
|
var _a, _b, _c, _d, _e;
|
|
14293
|
-
const transformedParams = await this.
|
|
14499
|
+
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14294
14500
|
this.maybeMoveToResponseJsonSchem(params);
|
|
14295
|
-
if (!
|
|
14501
|
+
if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
|
|
14296
14502
|
return await this.generateContentInternal(transformedParams);
|
|
14297
14503
|
}
|
|
14298
|
-
if (
|
|
14504
|
+
if (hasNonCallableTools(params)) {
|
|
14299
14505
|
throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
|
|
14300
14506
|
}
|
|
14301
14507
|
let response;
|
|
@@ -14380,7 +14586,7 @@ class Models extends BaseModule {
|
|
|
14380
14586
|
this.generateContentStream = async (params) => {
|
|
14381
14587
|
this.maybeMoveToResponseJsonSchem(params);
|
|
14382
14588
|
if (shouldDisableAfc(params.config)) {
|
|
14383
|
-
const transformedParams = await this.
|
|
14589
|
+
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14384
14590
|
return await this.generateContentStreamInternal(transformedParams);
|
|
14385
14591
|
}
|
|
14386
14592
|
else {
|
|
@@ -14428,11 +14634,13 @@ class Models extends BaseModule {
|
|
|
14428
14634
|
response = {
|
|
14429
14635
|
generatedImages: generatedImages,
|
|
14430
14636
|
positivePromptSafetyAttributes: positivePromptSafetyAttributes,
|
|
14637
|
+
sdkHttpResponse: apiResponse.sdkHttpResponse,
|
|
14431
14638
|
};
|
|
14432
14639
|
}
|
|
14433
14640
|
else {
|
|
14434
14641
|
response = {
|
|
14435
14642
|
generatedImages: generatedImages,
|
|
14643
|
+
sdkHttpResponse: apiResponse.sdkHttpResponse,
|
|
14436
14644
|
};
|
|
14437
14645
|
}
|
|
14438
14646
|
return response;
|
|
@@ -14529,6 +14737,32 @@ class Models extends BaseModule {
|
|
|
14529
14737
|
};
|
|
14530
14738
|
return await this.upscaleImageInternal(apiParams);
|
|
14531
14739
|
};
|
|
14740
|
+
/**
|
|
14741
|
+
* Generates videos based on a text description and configuration.
|
|
14742
|
+
*
|
|
14743
|
+
* @param params - The parameters for generating videos.
|
|
14744
|
+
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
14745
|
+
*
|
|
14746
|
+
* @example
|
|
14747
|
+
* ```ts
|
|
14748
|
+
* const operation = await ai.models.generateVideos({
|
|
14749
|
+
* model: 'veo-2.0-generate-001',
|
|
14750
|
+
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
14751
|
+
* config: {
|
|
14752
|
+
* numberOfVideos: 1
|
|
14753
|
+
* });
|
|
14754
|
+
*
|
|
14755
|
+
* while (!operation.done) {
|
|
14756
|
+
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
14757
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
14758
|
+
* }
|
|
14759
|
+
*
|
|
14760
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
14761
|
+
* ```
|
|
14762
|
+
*/
|
|
14763
|
+
this.generateVideos = async (params) => {
|
|
14764
|
+
return await this.generateVideosInternal(params);
|
|
14765
|
+
};
|
|
14532
14766
|
}
|
|
14533
14767
|
/**
|
|
14534
14768
|
* This logic is needed for GenerateContentConfig only.
|
|
@@ -14554,7 +14788,7 @@ class Models extends BaseModule {
|
|
|
14554
14788
|
* modify the original params. Also sets the MCP usage header if there are
|
|
14555
14789
|
* MCP tools in the parameters.
|
|
14556
14790
|
*/
|
|
14557
|
-
async
|
|
14791
|
+
async processParamsMaybeAddMcpUsage(params) {
|
|
14558
14792
|
var _a, _b, _c;
|
|
14559
14793
|
const tools = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools;
|
|
14560
14794
|
if (!tools) {
|
|
@@ -14621,7 +14855,7 @@ class Models extends BaseModule {
|
|
|
14621
14855
|
remoteCallCount++;
|
|
14622
14856
|
wereFunctionsCalled = false;
|
|
14623
14857
|
}
|
|
14624
|
-
const transformedParams = yield __await(models.
|
|
14858
|
+
const transformedParams = yield __await(models.processParamsMaybeAddMcpUsage(params));
|
|
14625
14859
|
const response = yield __await(models.generateContentStreamInternal(transformedParams));
|
|
14626
14860
|
const functionResponses = [];
|
|
14627
14861
|
const responseContents = [];
|
|
@@ -14892,7 +15126,13 @@ class Models extends BaseModule {
|
|
|
14892
15126
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14893
15127
|
})
|
|
14894
15128
|
.then((httpResponse) => {
|
|
14895
|
-
return httpResponse.json()
|
|
15129
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15130
|
+
const response = jsonResponse;
|
|
15131
|
+
response.sdkHttpResponse = {
|
|
15132
|
+
headers: httpResponse.headers,
|
|
15133
|
+
};
|
|
15134
|
+
return response;
|
|
15135
|
+
});
|
|
14896
15136
|
});
|
|
14897
15137
|
return response.then((apiResponse) => {
|
|
14898
15138
|
const resp = embedContentResponseFromVertex(apiResponse);
|
|
@@ -14918,7 +15158,13 @@ class Models extends BaseModule {
|
|
|
14918
15158
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
14919
15159
|
})
|
|
14920
15160
|
.then((httpResponse) => {
|
|
14921
|
-
return httpResponse.json()
|
|
15161
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15162
|
+
const response = jsonResponse;
|
|
15163
|
+
response.sdkHttpResponse = {
|
|
15164
|
+
headers: httpResponse.headers,
|
|
15165
|
+
};
|
|
15166
|
+
return response;
|
|
15167
|
+
});
|
|
14922
15168
|
});
|
|
14923
15169
|
return response.then((apiResponse) => {
|
|
14924
15170
|
const resp = embedContentResponseFromMldev(apiResponse);
|
|
@@ -14969,7 +15215,13 @@ class Models extends BaseModule {
|
|
|
14969
15215
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14970
15216
|
})
|
|
14971
15217
|
.then((httpResponse) => {
|
|
14972
|
-
return httpResponse.json()
|
|
15218
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15219
|
+
const response = jsonResponse;
|
|
15220
|
+
response.sdkHttpResponse = {
|
|
15221
|
+
headers: httpResponse.headers,
|
|
15222
|
+
};
|
|
15223
|
+
return response;
|
|
15224
|
+
});
|
|
14973
15225
|
});
|
|
14974
15226
|
return response.then((apiResponse) => {
|
|
14975
15227
|
const resp = generateImagesResponseFromVertex(apiResponse);
|
|
@@ -14995,7 +15247,13 @@ class Models extends BaseModule {
|
|
|
14995
15247
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
14996
15248
|
})
|
|
14997
15249
|
.then((httpResponse) => {
|
|
14998
|
-
return httpResponse.json()
|
|
15250
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15251
|
+
const response = jsonResponse;
|
|
15252
|
+
response.sdkHttpResponse = {
|
|
15253
|
+
headers: httpResponse.headers,
|
|
15254
|
+
};
|
|
15255
|
+
return response;
|
|
15256
|
+
});
|
|
14999
15257
|
});
|
|
15000
15258
|
return response.then((apiResponse) => {
|
|
15001
15259
|
const resp = generateImagesResponseFromMldev(apiResponse);
|
|
@@ -15027,7 +15285,13 @@ class Models extends BaseModule {
|
|
|
15027
15285
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15028
15286
|
})
|
|
15029
15287
|
.then((httpResponse) => {
|
|
15030
|
-
return httpResponse.json()
|
|
15288
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15289
|
+
const response = jsonResponse;
|
|
15290
|
+
response.sdkHttpResponse = {
|
|
15291
|
+
headers: httpResponse.headers,
|
|
15292
|
+
};
|
|
15293
|
+
return response;
|
|
15294
|
+
});
|
|
15031
15295
|
});
|
|
15032
15296
|
return response.then((apiResponse) => {
|
|
15033
15297
|
const resp = editImageResponseFromVertex(apiResponse);
|
|
@@ -15062,13 +15326,19 @@ class Models extends BaseModule {
|
|
|
15062
15326
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15063
15327
|
})
|
|
15064
15328
|
.then((httpResponse) => {
|
|
15065
|
-
return httpResponse.json()
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
15329
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15330
|
+
const response = jsonResponse;
|
|
15331
|
+
response.sdkHttpResponse = {
|
|
15332
|
+
headers: httpResponse.headers,
|
|
15333
|
+
};
|
|
15334
|
+
return response;
|
|
15335
|
+
});
|
|
15336
|
+
});
|
|
15337
|
+
return response.then((apiResponse) => {
|
|
15338
|
+
const resp = upscaleImageResponseFromVertex(apiResponse);
|
|
15339
|
+
const typedResp = new UpscaleImageResponse();
|
|
15340
|
+
Object.assign(typedResp, resp);
|
|
15341
|
+
return typedResp;
|
|
15072
15342
|
});
|
|
15073
15343
|
}
|
|
15074
15344
|
else {
|
|
@@ -15159,7 +15429,13 @@ class Models extends BaseModule {
|
|
|
15159
15429
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15160
15430
|
})
|
|
15161
15431
|
.then((httpResponse) => {
|
|
15162
|
-
return httpResponse.json()
|
|
15432
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15433
|
+
const response = jsonResponse;
|
|
15434
|
+
response.sdkHttpResponse = {
|
|
15435
|
+
headers: httpResponse.headers,
|
|
15436
|
+
};
|
|
15437
|
+
return response;
|
|
15438
|
+
});
|
|
15163
15439
|
});
|
|
15164
15440
|
return response.then((apiResponse) => {
|
|
15165
15441
|
const resp = listModelsResponseFromVertex(apiResponse);
|
|
@@ -15185,7 +15461,13 @@ class Models extends BaseModule {
|
|
|
15185
15461
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
15186
15462
|
})
|
|
15187
15463
|
.then((httpResponse) => {
|
|
15188
|
-
return httpResponse.json()
|
|
15464
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15465
|
+
const response = jsonResponse;
|
|
15466
|
+
response.sdkHttpResponse = {
|
|
15467
|
+
headers: httpResponse.headers,
|
|
15468
|
+
};
|
|
15469
|
+
return response;
|
|
15470
|
+
});
|
|
15189
15471
|
});
|
|
15190
15472
|
return response.then((apiResponse) => {
|
|
15191
15473
|
const resp = listModelsResponseFromMldev(apiResponse);
|
|
@@ -15373,7 +15655,13 @@ class Models extends BaseModule {
|
|
|
15373
15655
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15374
15656
|
})
|
|
15375
15657
|
.then((httpResponse) => {
|
|
15376
|
-
return httpResponse.json()
|
|
15658
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15659
|
+
const response = jsonResponse;
|
|
15660
|
+
response.sdkHttpResponse = {
|
|
15661
|
+
headers: httpResponse.headers,
|
|
15662
|
+
};
|
|
15663
|
+
return response;
|
|
15664
|
+
});
|
|
15377
15665
|
});
|
|
15378
15666
|
return response.then((apiResponse) => {
|
|
15379
15667
|
const resp = countTokensResponseFromVertex(apiResponse);
|
|
@@ -15399,7 +15687,13 @@ class Models extends BaseModule {
|
|
|
15399
15687
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
15400
15688
|
})
|
|
15401
15689
|
.then((httpResponse) => {
|
|
15402
|
-
return httpResponse.json()
|
|
15690
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15691
|
+
const response = jsonResponse;
|
|
15692
|
+
response.sdkHttpResponse = {
|
|
15693
|
+
headers: httpResponse.headers,
|
|
15694
|
+
};
|
|
15695
|
+
return response;
|
|
15696
|
+
});
|
|
15403
15697
|
});
|
|
15404
15698
|
return response.then((apiResponse) => {
|
|
15405
15699
|
const resp = countTokensResponseFromMldev(apiResponse);
|
|
@@ -15449,7 +15743,13 @@ class Models extends BaseModule {
|
|
|
15449
15743
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15450
15744
|
})
|
|
15451
15745
|
.then((httpResponse) => {
|
|
15452
|
-
return httpResponse.json()
|
|
15746
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
15747
|
+
const response = jsonResponse;
|
|
15748
|
+
response.sdkHttpResponse = {
|
|
15749
|
+
headers: httpResponse.headers,
|
|
15750
|
+
};
|
|
15751
|
+
return response;
|
|
15752
|
+
});
|
|
15453
15753
|
});
|
|
15454
15754
|
return response.then((apiResponse) => {
|
|
15455
15755
|
const resp = computeTokensResponseFromVertex(apiResponse);
|
|
@@ -15485,7 +15785,7 @@ class Models extends BaseModule {
|
|
|
15485
15785
|
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
15486
15786
|
* ```
|
|
15487
15787
|
*/
|
|
15488
|
-
async
|
|
15788
|
+
async generateVideosInternal(params) {
|
|
15489
15789
|
var _a, _b, _c, _d;
|
|
15490
15790
|
let response;
|
|
15491
15791
|
let path = '';
|
|
@@ -15510,8 +15810,10 @@ class Models extends BaseModule {
|
|
|
15510
15810
|
return httpResponse.json();
|
|
15511
15811
|
});
|
|
15512
15812
|
return response.then((apiResponse) => {
|
|
15513
|
-
const resp = generateVideosOperationFromVertex
|
|
15514
|
-
|
|
15813
|
+
const resp = generateVideosOperationFromVertex(apiResponse);
|
|
15814
|
+
const typedResp = new GenerateVideosOperation();
|
|
15815
|
+
Object.assign(typedResp, resp);
|
|
15816
|
+
return typedResp;
|
|
15515
15817
|
});
|
|
15516
15818
|
}
|
|
15517
15819
|
else {
|
|
@@ -15534,8 +15836,10 @@ class Models extends BaseModule {
|
|
|
15534
15836
|
return httpResponse.json();
|
|
15535
15837
|
});
|
|
15536
15838
|
return response.then((apiResponse) => {
|
|
15537
|
-
const resp = generateVideosOperationFromMldev
|
|
15538
|
-
|
|
15839
|
+
const resp = generateVideosOperationFromMldev(apiResponse);
|
|
15840
|
+
const typedResp = new GenerateVideosOperation();
|
|
15841
|
+
Object.assign(typedResp, resp);
|
|
15842
|
+
return typedResp;
|
|
15539
15843
|
});
|
|
15540
15844
|
}
|
|
15541
15845
|
}
|
|
@@ -15593,164 +15897,6 @@ function fetchPredictOperationParametersToVertex(fromObject) {
|
|
|
15593
15897
|
}
|
|
15594
15898
|
return toObject;
|
|
15595
15899
|
}
|
|
15596
|
-
function videoFromMldev(fromObject) {
|
|
15597
|
-
const toObject = {};
|
|
15598
|
-
const fromUri = getValueByPath(fromObject, ['video', 'uri']);
|
|
15599
|
-
if (fromUri != null) {
|
|
15600
|
-
setValueByPath(toObject, ['uri'], fromUri);
|
|
15601
|
-
}
|
|
15602
|
-
const fromVideoBytes = getValueByPath(fromObject, [
|
|
15603
|
-
'video',
|
|
15604
|
-
'encodedVideo',
|
|
15605
|
-
]);
|
|
15606
|
-
if (fromVideoBytes != null) {
|
|
15607
|
-
setValueByPath(toObject, ['videoBytes'], tBytes(fromVideoBytes));
|
|
15608
|
-
}
|
|
15609
|
-
const fromMimeType = getValueByPath(fromObject, ['encoding']);
|
|
15610
|
-
if (fromMimeType != null) {
|
|
15611
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
15612
|
-
}
|
|
15613
|
-
return toObject;
|
|
15614
|
-
}
|
|
15615
|
-
function generatedVideoFromMldev(fromObject) {
|
|
15616
|
-
const toObject = {};
|
|
15617
|
-
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
15618
|
-
if (fromVideo != null) {
|
|
15619
|
-
setValueByPath(toObject, ['video'], videoFromMldev(fromVideo));
|
|
15620
|
-
}
|
|
15621
|
-
return toObject;
|
|
15622
|
-
}
|
|
15623
|
-
function generateVideosResponseFromMldev(fromObject) {
|
|
15624
|
-
const toObject = {};
|
|
15625
|
-
const fromGeneratedVideos = getValueByPath(fromObject, [
|
|
15626
|
-
'generatedSamples',
|
|
15627
|
-
]);
|
|
15628
|
-
if (fromGeneratedVideos != null) {
|
|
15629
|
-
let transformedList = fromGeneratedVideos;
|
|
15630
|
-
if (Array.isArray(transformedList)) {
|
|
15631
|
-
transformedList = transformedList.map((item) => {
|
|
15632
|
-
return generatedVideoFromMldev(item);
|
|
15633
|
-
});
|
|
15634
|
-
}
|
|
15635
|
-
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
15636
|
-
}
|
|
15637
|
-
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
15638
|
-
'raiMediaFilteredCount',
|
|
15639
|
-
]);
|
|
15640
|
-
if (fromRaiMediaFilteredCount != null) {
|
|
15641
|
-
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
15642
|
-
}
|
|
15643
|
-
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
15644
|
-
'raiMediaFilteredReasons',
|
|
15645
|
-
]);
|
|
15646
|
-
if (fromRaiMediaFilteredReasons != null) {
|
|
15647
|
-
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
15648
|
-
}
|
|
15649
|
-
return toObject;
|
|
15650
|
-
}
|
|
15651
|
-
function generateVideosOperationFromMldev(fromObject) {
|
|
15652
|
-
const toObject = {};
|
|
15653
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
15654
|
-
if (fromName != null) {
|
|
15655
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
15656
|
-
}
|
|
15657
|
-
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
15658
|
-
if (fromMetadata != null) {
|
|
15659
|
-
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
15660
|
-
}
|
|
15661
|
-
const fromDone = getValueByPath(fromObject, ['done']);
|
|
15662
|
-
if (fromDone != null) {
|
|
15663
|
-
setValueByPath(toObject, ['done'], fromDone);
|
|
15664
|
-
}
|
|
15665
|
-
const fromError = getValueByPath(fromObject, ['error']);
|
|
15666
|
-
if (fromError != null) {
|
|
15667
|
-
setValueByPath(toObject, ['error'], fromError);
|
|
15668
|
-
}
|
|
15669
|
-
const fromResponse = getValueByPath(fromObject, [
|
|
15670
|
-
'response',
|
|
15671
|
-
'generateVideoResponse',
|
|
15672
|
-
]);
|
|
15673
|
-
if (fromResponse != null) {
|
|
15674
|
-
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev(fromResponse));
|
|
15675
|
-
}
|
|
15676
|
-
return toObject;
|
|
15677
|
-
}
|
|
15678
|
-
function videoFromVertex(fromObject) {
|
|
15679
|
-
const toObject = {};
|
|
15680
|
-
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
15681
|
-
if (fromUri != null) {
|
|
15682
|
-
setValueByPath(toObject, ['uri'], fromUri);
|
|
15683
|
-
}
|
|
15684
|
-
const fromVideoBytes = getValueByPath(fromObject, [
|
|
15685
|
-
'bytesBase64Encoded',
|
|
15686
|
-
]);
|
|
15687
|
-
if (fromVideoBytes != null) {
|
|
15688
|
-
setValueByPath(toObject, ['videoBytes'], tBytes(fromVideoBytes));
|
|
15689
|
-
}
|
|
15690
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
15691
|
-
if (fromMimeType != null) {
|
|
15692
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
15693
|
-
}
|
|
15694
|
-
return toObject;
|
|
15695
|
-
}
|
|
15696
|
-
function generatedVideoFromVertex(fromObject) {
|
|
15697
|
-
const toObject = {};
|
|
15698
|
-
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
15699
|
-
if (fromVideo != null) {
|
|
15700
|
-
setValueByPath(toObject, ['video'], videoFromVertex(fromVideo));
|
|
15701
|
-
}
|
|
15702
|
-
return toObject;
|
|
15703
|
-
}
|
|
15704
|
-
function generateVideosResponseFromVertex(fromObject) {
|
|
15705
|
-
const toObject = {};
|
|
15706
|
-
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
15707
|
-
if (fromGeneratedVideos != null) {
|
|
15708
|
-
let transformedList = fromGeneratedVideos;
|
|
15709
|
-
if (Array.isArray(transformedList)) {
|
|
15710
|
-
transformedList = transformedList.map((item) => {
|
|
15711
|
-
return generatedVideoFromVertex(item);
|
|
15712
|
-
});
|
|
15713
|
-
}
|
|
15714
|
-
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
15715
|
-
}
|
|
15716
|
-
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
15717
|
-
'raiMediaFilteredCount',
|
|
15718
|
-
]);
|
|
15719
|
-
if (fromRaiMediaFilteredCount != null) {
|
|
15720
|
-
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
15721
|
-
}
|
|
15722
|
-
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
15723
|
-
'raiMediaFilteredReasons',
|
|
15724
|
-
]);
|
|
15725
|
-
if (fromRaiMediaFilteredReasons != null) {
|
|
15726
|
-
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
15727
|
-
}
|
|
15728
|
-
return toObject;
|
|
15729
|
-
}
|
|
15730
|
-
function generateVideosOperationFromVertex(fromObject) {
|
|
15731
|
-
const toObject = {};
|
|
15732
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
15733
|
-
if (fromName != null) {
|
|
15734
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
15735
|
-
}
|
|
15736
|
-
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
15737
|
-
if (fromMetadata != null) {
|
|
15738
|
-
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
15739
|
-
}
|
|
15740
|
-
const fromDone = getValueByPath(fromObject, ['done']);
|
|
15741
|
-
if (fromDone != null) {
|
|
15742
|
-
setValueByPath(toObject, ['done'], fromDone);
|
|
15743
|
-
}
|
|
15744
|
-
const fromError = getValueByPath(fromObject, ['error']);
|
|
15745
|
-
if (fromError != null) {
|
|
15746
|
-
setValueByPath(toObject, ['error'], fromError);
|
|
15747
|
-
}
|
|
15748
|
-
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
15749
|
-
if (fromResponse != null) {
|
|
15750
|
-
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex(fromResponse));
|
|
15751
|
-
}
|
|
15752
|
-
return toObject;
|
|
15753
|
-
}
|
|
15754
15900
|
|
|
15755
15901
|
/**
|
|
15756
15902
|
* @license
|
|
@@ -15780,17 +15926,64 @@ class Operations extends BaseModule {
|
|
|
15780
15926
|
if (config && 'httpOptions' in config) {
|
|
15781
15927
|
httpOptions = config.httpOptions;
|
|
15782
15928
|
}
|
|
15783
|
-
|
|
15929
|
+
const rawOperation = await this.fetchPredictVideosOperationInternal({
|
|
15784
15930
|
operationName: operation.name,
|
|
15785
15931
|
resourceName: resourceName,
|
|
15786
15932
|
config: { httpOptions: httpOptions },
|
|
15787
15933
|
});
|
|
15934
|
+
return operation._fromAPIResponse({
|
|
15935
|
+
apiResponse: rawOperation,
|
|
15936
|
+
isVertexAI: true,
|
|
15937
|
+
});
|
|
15788
15938
|
}
|
|
15789
15939
|
else {
|
|
15790
|
-
|
|
15940
|
+
const rawOperation = await this.getVideosOperationInternal({
|
|
15791
15941
|
operationName: operation.name,
|
|
15792
15942
|
config: config,
|
|
15793
15943
|
});
|
|
15944
|
+
return operation._fromAPIResponse({
|
|
15945
|
+
apiResponse: rawOperation,
|
|
15946
|
+
isVertexAI: false,
|
|
15947
|
+
});
|
|
15948
|
+
}
|
|
15949
|
+
}
|
|
15950
|
+
/**
|
|
15951
|
+
* Gets the status of a long-running operation.
|
|
15952
|
+
*
|
|
15953
|
+
* @param parameters The parameters for the get operation request.
|
|
15954
|
+
* @return The updated Operation object, with the latest status or result.
|
|
15955
|
+
*/
|
|
15956
|
+
async get(parameters) {
|
|
15957
|
+
const operation = parameters.operation;
|
|
15958
|
+
const config = parameters.config;
|
|
15959
|
+
if (operation.name === undefined || operation.name === '') {
|
|
15960
|
+
throw new Error('Operation name is required.');
|
|
15961
|
+
}
|
|
15962
|
+
if (this.apiClient.isVertexAI()) {
|
|
15963
|
+
const resourceName = operation.name.split('/operations/')[0];
|
|
15964
|
+
let httpOptions = undefined;
|
|
15965
|
+
if (config && 'httpOptions' in config) {
|
|
15966
|
+
httpOptions = config.httpOptions;
|
|
15967
|
+
}
|
|
15968
|
+
const rawOperation = await this.fetchPredictVideosOperationInternal({
|
|
15969
|
+
operationName: operation.name,
|
|
15970
|
+
resourceName: resourceName,
|
|
15971
|
+
config: { httpOptions: httpOptions },
|
|
15972
|
+
});
|
|
15973
|
+
return operation._fromAPIResponse({
|
|
15974
|
+
apiResponse: rawOperation,
|
|
15975
|
+
isVertexAI: true,
|
|
15976
|
+
});
|
|
15977
|
+
}
|
|
15978
|
+
else {
|
|
15979
|
+
const rawOperation = await this.getVideosOperationInternal({
|
|
15980
|
+
operationName: operation.name,
|
|
15981
|
+
config: config,
|
|
15982
|
+
});
|
|
15983
|
+
return operation._fromAPIResponse({
|
|
15984
|
+
apiResponse: rawOperation,
|
|
15985
|
+
isVertexAI: false,
|
|
15986
|
+
});
|
|
15794
15987
|
}
|
|
15795
15988
|
}
|
|
15796
15989
|
async getVideosOperationInternal(params) {
|
|
@@ -15817,10 +16010,7 @@ class Operations extends BaseModule {
|
|
|
15817
16010
|
.then((httpResponse) => {
|
|
15818
16011
|
return httpResponse.json();
|
|
15819
16012
|
});
|
|
15820
|
-
return response
|
|
15821
|
-
const resp = generateVideosOperationFromVertex(apiResponse);
|
|
15822
|
-
return resp;
|
|
15823
|
-
});
|
|
16013
|
+
return response;
|
|
15824
16014
|
}
|
|
15825
16015
|
else {
|
|
15826
16016
|
const body = getOperationParametersToMldev(params);
|
|
@@ -15841,10 +16031,7 @@ class Operations extends BaseModule {
|
|
|
15841
16031
|
.then((httpResponse) => {
|
|
15842
16032
|
return httpResponse.json();
|
|
15843
16033
|
});
|
|
15844
|
-
return response
|
|
15845
|
-
const resp = generateVideosOperationFromMldev(apiResponse);
|
|
15846
|
-
return resp;
|
|
15847
|
-
});
|
|
16034
|
+
return response;
|
|
15848
16035
|
}
|
|
15849
16036
|
}
|
|
15850
16037
|
async fetchPredictVideosOperationInternal(params) {
|
|
@@ -15871,10 +16058,7 @@ class Operations extends BaseModule {
|
|
|
15871
16058
|
.then((httpResponse) => {
|
|
15872
16059
|
return httpResponse.json();
|
|
15873
16060
|
});
|
|
15874
|
-
return response
|
|
15875
|
-
const resp = generateVideosOperationFromVertex(apiResponse);
|
|
15876
|
-
return resp;
|
|
15877
|
-
});
|
|
16061
|
+
return response;
|
|
15878
16062
|
}
|
|
15879
16063
|
else {
|
|
15880
16064
|
throw new Error('This method is only supported by the Vertex AI.');
|
|
@@ -17191,6 +17375,12 @@ function tunedModelFromMldev(fromObject) {
|
|
|
17191
17375
|
}
|
|
17192
17376
|
function tuningJobFromMldev(fromObject) {
|
|
17193
17377
|
const toObject = {};
|
|
17378
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17379
|
+
'sdkHttpResponse',
|
|
17380
|
+
]);
|
|
17381
|
+
if (fromSdkHttpResponse != null) {
|
|
17382
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17383
|
+
}
|
|
17194
17384
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
17195
17385
|
if (fromName != null) {
|
|
17196
17386
|
setValueByPath(toObject, ['name'], fromName);
|
|
@@ -17275,6 +17465,12 @@ function tuningJobFromMldev(fromObject) {
|
|
|
17275
17465
|
}
|
|
17276
17466
|
function listTuningJobsResponseFromMldev(fromObject) {
|
|
17277
17467
|
const toObject = {};
|
|
17468
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17469
|
+
'sdkHttpResponse',
|
|
17470
|
+
]);
|
|
17471
|
+
if (fromSdkHttpResponse != null) {
|
|
17472
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17473
|
+
}
|
|
17278
17474
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
17279
17475
|
'nextPageToken',
|
|
17280
17476
|
]);
|
|
@@ -17295,6 +17491,12 @@ function listTuningJobsResponseFromMldev(fromObject) {
|
|
|
17295
17491
|
}
|
|
17296
17492
|
function tuningOperationFromMldev(fromObject) {
|
|
17297
17493
|
const toObject = {};
|
|
17494
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17495
|
+
'sdkHttpResponse',
|
|
17496
|
+
]);
|
|
17497
|
+
if (fromSdkHttpResponse != null) {
|
|
17498
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17499
|
+
}
|
|
17298
17500
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
17299
17501
|
if (fromName != null) {
|
|
17300
17502
|
setValueByPath(toObject, ['name'], fromName);
|
|
@@ -17357,6 +17559,12 @@ function tunedModelFromVertex(fromObject) {
|
|
|
17357
17559
|
}
|
|
17358
17560
|
function tuningJobFromVertex(fromObject) {
|
|
17359
17561
|
const toObject = {};
|
|
17562
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17563
|
+
'sdkHttpResponse',
|
|
17564
|
+
]);
|
|
17565
|
+
if (fromSdkHttpResponse != null) {
|
|
17566
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17567
|
+
}
|
|
17360
17568
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
17361
17569
|
if (fromName != null) {
|
|
17362
17570
|
setValueByPath(toObject, ['name'], fromName);
|
|
@@ -17463,6 +17671,12 @@ function tuningJobFromVertex(fromObject) {
|
|
|
17463
17671
|
}
|
|
17464
17672
|
function listTuningJobsResponseFromVertex(fromObject) {
|
|
17465
17673
|
const toObject = {};
|
|
17674
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
17675
|
+
'sdkHttpResponse',
|
|
17676
|
+
]);
|
|
17677
|
+
if (fromSdkHttpResponse != null) {
|
|
17678
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
17679
|
+
}
|
|
17466
17680
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
17467
17681
|
'nextPageToken',
|
|
17468
17682
|
]);
|
|
@@ -17569,7 +17783,13 @@ class Tunings extends BaseModule {
|
|
|
17569
17783
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
17570
17784
|
})
|
|
17571
17785
|
.then((httpResponse) => {
|
|
17572
|
-
return httpResponse.json()
|
|
17786
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17787
|
+
const response = jsonResponse;
|
|
17788
|
+
response.sdkHttpResponse = {
|
|
17789
|
+
headers: httpResponse.headers,
|
|
17790
|
+
};
|
|
17791
|
+
return response;
|
|
17792
|
+
});
|
|
17573
17793
|
});
|
|
17574
17794
|
return response.then((apiResponse) => {
|
|
17575
17795
|
const resp = tuningJobFromVertex(apiResponse);
|
|
@@ -17593,7 +17813,13 @@ class Tunings extends BaseModule {
|
|
|
17593
17813
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
17594
17814
|
})
|
|
17595
17815
|
.then((httpResponse) => {
|
|
17596
|
-
return httpResponse.json()
|
|
17816
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17817
|
+
const response = jsonResponse;
|
|
17818
|
+
response.sdkHttpResponse = {
|
|
17819
|
+
headers: httpResponse.headers,
|
|
17820
|
+
};
|
|
17821
|
+
return response;
|
|
17822
|
+
});
|
|
17597
17823
|
});
|
|
17598
17824
|
return response.then((apiResponse) => {
|
|
17599
17825
|
const resp = tuningJobFromMldev(apiResponse);
|
|
@@ -17623,7 +17849,13 @@ class Tunings extends BaseModule {
|
|
|
17623
17849
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
17624
17850
|
})
|
|
17625
17851
|
.then((httpResponse) => {
|
|
17626
|
-
return httpResponse.json()
|
|
17852
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17853
|
+
const response = jsonResponse;
|
|
17854
|
+
response.sdkHttpResponse = {
|
|
17855
|
+
headers: httpResponse.headers,
|
|
17856
|
+
};
|
|
17857
|
+
return response;
|
|
17858
|
+
});
|
|
17627
17859
|
});
|
|
17628
17860
|
return response.then((apiResponse) => {
|
|
17629
17861
|
const resp = listTuningJobsResponseFromVertex(apiResponse);
|
|
@@ -17649,7 +17881,13 @@ class Tunings extends BaseModule {
|
|
|
17649
17881
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
17650
17882
|
})
|
|
17651
17883
|
.then((httpResponse) => {
|
|
17652
|
-
return httpResponse.json()
|
|
17884
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17885
|
+
const response = jsonResponse;
|
|
17886
|
+
response.sdkHttpResponse = {
|
|
17887
|
+
headers: httpResponse.headers,
|
|
17888
|
+
};
|
|
17889
|
+
return response;
|
|
17890
|
+
});
|
|
17653
17891
|
});
|
|
17654
17892
|
return response.then((apiResponse) => {
|
|
17655
17893
|
const resp = listTuningJobsResponseFromMldev(apiResponse);
|
|
@@ -17681,7 +17919,13 @@ class Tunings extends BaseModule {
|
|
|
17681
17919
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
17682
17920
|
})
|
|
17683
17921
|
.then((httpResponse) => {
|
|
17684
|
-
return httpResponse.json()
|
|
17922
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17923
|
+
const response = jsonResponse;
|
|
17924
|
+
response.sdkHttpResponse = {
|
|
17925
|
+
headers: httpResponse.headers,
|
|
17926
|
+
};
|
|
17927
|
+
return response;
|
|
17928
|
+
});
|
|
17685
17929
|
});
|
|
17686
17930
|
return response.then((apiResponse) => {
|
|
17687
17931
|
const resp = tuningJobFromVertex(apiResponse);
|
|
@@ -17717,7 +17961,13 @@ class Tunings extends BaseModule {
|
|
|
17717
17961
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
17718
17962
|
})
|
|
17719
17963
|
.then((httpResponse) => {
|
|
17720
|
-
return httpResponse.json()
|
|
17964
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
17965
|
+
const response = jsonResponse;
|
|
17966
|
+
response.sdkHttpResponse = {
|
|
17967
|
+
headers: httpResponse.headers,
|
|
17968
|
+
};
|
|
17969
|
+
return response;
|
|
17970
|
+
});
|
|
17721
17971
|
});
|
|
17722
17972
|
return response.then((apiResponse) => {
|
|
17723
17973
|
const resp = tuningOperationFromMldev(apiResponse);
|
|
@@ -18074,7 +18324,7 @@ class GoogleGenAI {
|
|
|
18074
18324
|
this.apiKey = undefined;
|
|
18075
18325
|
}
|
|
18076
18326
|
}
|
|
18077
|
-
const baseUrl = getBaseUrl(options, getEnv('GOOGLE_VERTEX_BASE_URL'), getEnv('GOOGLE_GEMINI_BASE_URL'));
|
|
18327
|
+
const baseUrl = getBaseUrl(options.httpOptions, options.vertexai, getEnv('GOOGLE_VERTEX_BASE_URL'), getEnv('GOOGLE_GEMINI_BASE_URL'));
|
|
18078
18328
|
if (baseUrl) {
|
|
18079
18329
|
if (options.httpOptions) {
|
|
18080
18330
|
options.httpOptions.baseUrl = baseUrl;
|
|
@@ -18153,6 +18403,7 @@ exports.GenerateContentResponse = GenerateContentResponse;
|
|
|
18153
18403
|
exports.GenerateContentResponsePromptFeedback = GenerateContentResponsePromptFeedback;
|
|
18154
18404
|
exports.GenerateContentResponseUsageMetadata = GenerateContentResponseUsageMetadata;
|
|
18155
18405
|
exports.GenerateImagesResponse = GenerateImagesResponse;
|
|
18406
|
+
exports.GenerateVideosOperation = GenerateVideosOperation;
|
|
18156
18407
|
exports.GenerateVideosResponse = GenerateVideosResponse;
|
|
18157
18408
|
exports.GoogleGenAI = GoogleGenAI;
|
|
18158
18409
|
exports.HttpResponse = HttpResponse;
|