@google/genai 0.9.0 → 0.10.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/README.md +30 -5
- package/dist/genai.d.ts +229 -2
- package/dist/index.js +297 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +297 -87
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +336 -86
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +229 -2
- package/dist/web/index.mjs +338 -87
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +229 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2025 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Overrides the base URLs for the Gemini API and Vertex AI API.
|
|
10
|
+
*
|
|
11
|
+
* @remarks This function should be called before initializing the SDK. If the
|
|
12
|
+
* base URLs are set after initializing the SDK, the base URLs will not be
|
|
13
|
+
* updated. Base URLs provided in the HttpOptions will also take precedence over
|
|
14
|
+
* URLs set here.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {GoogleGenAI, setDefaultBaseUrls} from '@google/genai';
|
|
19
|
+
* // Override the base URL for the Gemini API.
|
|
20
|
+
* setDefaultBaseUrls({geminiUrl:'https://gemini.google.com'});
|
|
21
|
+
*
|
|
22
|
+
* // Override the base URL for the Vertex AI API.
|
|
23
|
+
* setDefaultBaseUrls({vertexUrl: 'https://vertexai.googleapis.com'});
|
|
24
|
+
*
|
|
25
|
+
* const ai = new GoogleGenAI({apiKey: 'GEMINI_API_KEY'});
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
function setDefaultBaseUrls(baseUrlParams) {
|
|
29
|
+
baseUrlParams.geminiUrl;
|
|
30
|
+
baseUrlParams.vertexUrl;
|
|
31
|
+
}
|
|
32
|
+
|
|
3
33
|
/**
|
|
4
34
|
* @license
|
|
5
35
|
* Copyright 2025 Google LLC
|
|
@@ -175,6 +205,36 @@ function tCachesModel(apiClient, model) {
|
|
|
175
205
|
return transformedModel;
|
|
176
206
|
}
|
|
177
207
|
}
|
|
208
|
+
function tBlobs(apiClient, blobs) {
|
|
209
|
+
if (Array.isArray(blobs)) {
|
|
210
|
+
return blobs.map((blob) => tBlob(apiClient, blob));
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
return [tBlob(apiClient, blobs)];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function tBlob(apiClient, blob) {
|
|
217
|
+
if (typeof blob === 'object' && blob !== null) {
|
|
218
|
+
return blob;
|
|
219
|
+
}
|
|
220
|
+
throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof blob}`);
|
|
221
|
+
}
|
|
222
|
+
function tImageBlob(apiClient, blob) {
|
|
223
|
+
const transformedBlob = tBlob(apiClient, blob);
|
|
224
|
+
if (transformedBlob.mimeType &&
|
|
225
|
+
transformedBlob.mimeType.startsWith('image/')) {
|
|
226
|
+
return transformedBlob;
|
|
227
|
+
}
|
|
228
|
+
throw new Error(`Unsupported mime type: ${transformedBlob.mimeType}`);
|
|
229
|
+
}
|
|
230
|
+
function tAudioBlob(apiClient, blob) {
|
|
231
|
+
const transformedBlob = tBlob(apiClient, blob);
|
|
232
|
+
if (transformedBlob.mimeType &&
|
|
233
|
+
transformedBlob.mimeType.startsWith('audio/')) {
|
|
234
|
+
return transformedBlob;
|
|
235
|
+
}
|
|
236
|
+
throw new Error(`Unsupported mime type: ${transformedBlob.mimeType}`);
|
|
237
|
+
}
|
|
178
238
|
function tPart(apiClient, origin) {
|
|
179
239
|
if (origin === null || origin === undefined) {
|
|
180
240
|
throw new Error('PartUnion is required');
|
|
@@ -298,38 +358,11 @@ function tContents(apiClient, origin) {
|
|
|
298
358
|
}
|
|
299
359
|
return result;
|
|
300
360
|
}
|
|
301
|
-
function processSchema(apiClient, schema) {
|
|
302
|
-
if (!apiClient.isVertexAI()) {
|
|
303
|
-
if ('default' in schema) {
|
|
304
|
-
throw new Error('Default value is not supported in the response schema for the Gemini API.');
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
if ('anyOf' in schema) {
|
|
308
|
-
if (schema['anyOf'] !== undefined) {
|
|
309
|
-
for (const subSchema of schema['anyOf']) {
|
|
310
|
-
processSchema(apiClient, subSchema);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
if ('items' in schema) {
|
|
315
|
-
if (schema['items'] !== undefined) {
|
|
316
|
-
processSchema(apiClient, schema['items']);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
if ('properties' in schema) {
|
|
320
|
-
if (schema['properties'] !== undefined) {
|
|
321
|
-
for (const subSchema of Object.values(schema['properties'])) {
|
|
322
|
-
processSchema(apiClient, subSchema);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
361
|
function tSchema(apiClient, schema) {
|
|
328
|
-
processSchema(apiClient, schema);
|
|
329
362
|
return schema;
|
|
330
363
|
}
|
|
331
364
|
function tSpeechConfig(apiClient, speechConfig) {
|
|
332
|
-
if (typeof speechConfig === 'object'
|
|
365
|
+
if (typeof speechConfig === 'object') {
|
|
333
366
|
return speechConfig;
|
|
334
367
|
}
|
|
335
368
|
else if (typeof speechConfig === 'string') {
|
|
@@ -1536,6 +1569,7 @@ exports.FinishReason = void 0;
|
|
|
1536
1569
|
FinishReason["MAX_TOKENS"] = "MAX_TOKENS";
|
|
1537
1570
|
FinishReason["SAFETY"] = "SAFETY";
|
|
1538
1571
|
FinishReason["RECITATION"] = "RECITATION";
|
|
1572
|
+
FinishReason["LANGUAGE"] = "LANGUAGE";
|
|
1539
1573
|
FinishReason["OTHER"] = "OTHER";
|
|
1540
1574
|
FinishReason["BLOCKLIST"] = "BLOCKLIST";
|
|
1541
1575
|
FinishReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
@@ -1918,6 +1952,42 @@ class GenerateContentResponse {
|
|
|
1918
1952
|
// part.text === '' is different from part.text is null
|
|
1919
1953
|
return anyTextPartText ? text : undefined;
|
|
1920
1954
|
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Returns the concatenation of all inline data parts from the first candidate
|
|
1957
|
+
* in the response.
|
|
1958
|
+
*
|
|
1959
|
+
* @remarks
|
|
1960
|
+
* If there are multiple candidates in the response, the inline data from the
|
|
1961
|
+
* first one will be returned. If there are non-inline data parts in the
|
|
1962
|
+
* response, the concatenation of all inline data parts will be returned, and
|
|
1963
|
+
* a warning will be logged.
|
|
1964
|
+
*/
|
|
1965
|
+
get data() {
|
|
1966
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1967
|
+
if (((_d = (_c = (_b = (_a = this.candidates) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.parts) === null || _d === void 0 ? void 0 : _d.length) === 0) {
|
|
1968
|
+
return undefined;
|
|
1969
|
+
}
|
|
1970
|
+
if (this.candidates && this.candidates.length > 1) {
|
|
1971
|
+
console.warn('there are multiple candidates in the response, returning data from the first one.');
|
|
1972
|
+
}
|
|
1973
|
+
let data = '';
|
|
1974
|
+
const nonDataParts = [];
|
|
1975
|
+
for (const part of (_h = (_g = (_f = (_e = this.candidates) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.content) === null || _g === void 0 ? void 0 : _g.parts) !== null && _h !== void 0 ? _h : []) {
|
|
1976
|
+
for (const [fieldName, fieldValue] of Object.entries(part)) {
|
|
1977
|
+
if (fieldName !== 'inlineData' &&
|
|
1978
|
+
(fieldValue !== null || fieldValue !== undefined)) {
|
|
1979
|
+
nonDataParts.push(fieldName);
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
if (part.inlineData && typeof part.inlineData.data === 'string') {
|
|
1983
|
+
data += atob(part.inlineData.data);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
if (nonDataParts.length > 0) {
|
|
1987
|
+
console.warn(`there are non-data parts ${nonDataParts} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`);
|
|
1988
|
+
}
|
|
1989
|
+
return data.length > 0 ? btoa(data) : undefined;
|
|
1990
|
+
}
|
|
1921
1991
|
/**
|
|
1922
1992
|
* Returns the function calls from the first candidate in the response.
|
|
1923
1993
|
*
|
|
@@ -2173,7 +2243,7 @@ class Caches extends BaseModule {
|
|
|
2173
2243
|
* ```
|
|
2174
2244
|
*/
|
|
2175
2245
|
async create(params) {
|
|
2176
|
-
var _a, _b;
|
|
2246
|
+
var _a, _b, _c, _d;
|
|
2177
2247
|
let response;
|
|
2178
2248
|
let path = '';
|
|
2179
2249
|
let queryParams = {};
|
|
@@ -2191,6 +2261,7 @@ class Caches extends BaseModule {
|
|
|
2191
2261
|
body: JSON.stringify(body),
|
|
2192
2262
|
httpMethod: 'POST',
|
|
2193
2263
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
2264
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
2194
2265
|
})
|
|
2195
2266
|
.then((httpResponse) => {
|
|
2196
2267
|
return httpResponse.json();
|
|
@@ -2213,7 +2284,8 @@ class Caches extends BaseModule {
|
|
|
2213
2284
|
queryParams: queryParams,
|
|
2214
2285
|
body: JSON.stringify(body),
|
|
2215
2286
|
httpMethod: 'POST',
|
|
2216
|
-
httpOptions: (
|
|
2287
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
2288
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
2217
2289
|
})
|
|
2218
2290
|
.then((httpResponse) => {
|
|
2219
2291
|
return httpResponse.json();
|
|
@@ -2236,7 +2308,7 @@ class Caches extends BaseModule {
|
|
|
2236
2308
|
* ```
|
|
2237
2309
|
*/
|
|
2238
2310
|
async get(params) {
|
|
2239
|
-
var _a, _b;
|
|
2311
|
+
var _a, _b, _c, _d;
|
|
2240
2312
|
let response;
|
|
2241
2313
|
let path = '';
|
|
2242
2314
|
let queryParams = {};
|
|
@@ -2254,6 +2326,7 @@ class Caches extends BaseModule {
|
|
|
2254
2326
|
body: JSON.stringify(body),
|
|
2255
2327
|
httpMethod: 'GET',
|
|
2256
2328
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
2329
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
2257
2330
|
})
|
|
2258
2331
|
.then((httpResponse) => {
|
|
2259
2332
|
return httpResponse.json();
|
|
@@ -2276,7 +2349,8 @@ class Caches extends BaseModule {
|
|
|
2276
2349
|
queryParams: queryParams,
|
|
2277
2350
|
body: JSON.stringify(body),
|
|
2278
2351
|
httpMethod: 'GET',
|
|
2279
|
-
httpOptions: (
|
|
2352
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
2353
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
2280
2354
|
})
|
|
2281
2355
|
.then((httpResponse) => {
|
|
2282
2356
|
return httpResponse.json();
|
|
@@ -2299,7 +2373,7 @@ class Caches extends BaseModule {
|
|
|
2299
2373
|
* ```
|
|
2300
2374
|
*/
|
|
2301
2375
|
async delete(params) {
|
|
2302
|
-
var _a, _b;
|
|
2376
|
+
var _a, _b, _c, _d;
|
|
2303
2377
|
let response;
|
|
2304
2378
|
let path = '';
|
|
2305
2379
|
let queryParams = {};
|
|
@@ -2317,6 +2391,7 @@ class Caches extends BaseModule {
|
|
|
2317
2391
|
body: JSON.stringify(body),
|
|
2318
2392
|
httpMethod: 'DELETE',
|
|
2319
2393
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
2394
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
2320
2395
|
})
|
|
2321
2396
|
.then((httpResponse) => {
|
|
2322
2397
|
return httpResponse.json();
|
|
@@ -2341,7 +2416,8 @@ class Caches extends BaseModule {
|
|
|
2341
2416
|
queryParams: queryParams,
|
|
2342
2417
|
body: JSON.stringify(body),
|
|
2343
2418
|
httpMethod: 'DELETE',
|
|
2344
|
-
httpOptions: (
|
|
2419
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
2420
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
2345
2421
|
})
|
|
2346
2422
|
.then((httpResponse) => {
|
|
2347
2423
|
return httpResponse.json();
|
|
@@ -2369,7 +2445,7 @@ class Caches extends BaseModule {
|
|
|
2369
2445
|
* ```
|
|
2370
2446
|
*/
|
|
2371
2447
|
async update(params) {
|
|
2372
|
-
var _a, _b;
|
|
2448
|
+
var _a, _b, _c, _d;
|
|
2373
2449
|
let response;
|
|
2374
2450
|
let path = '';
|
|
2375
2451
|
let queryParams = {};
|
|
@@ -2387,6 +2463,7 @@ class Caches extends BaseModule {
|
|
|
2387
2463
|
body: JSON.stringify(body),
|
|
2388
2464
|
httpMethod: 'PATCH',
|
|
2389
2465
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
2466
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
2390
2467
|
})
|
|
2391
2468
|
.then((httpResponse) => {
|
|
2392
2469
|
return httpResponse.json();
|
|
@@ -2409,7 +2486,8 @@ class Caches extends BaseModule {
|
|
|
2409
2486
|
queryParams: queryParams,
|
|
2410
2487
|
body: JSON.stringify(body),
|
|
2411
2488
|
httpMethod: 'PATCH',
|
|
2412
|
-
httpOptions: (
|
|
2489
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
2490
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
2413
2491
|
})
|
|
2414
2492
|
.then((httpResponse) => {
|
|
2415
2493
|
return httpResponse.json();
|
|
@@ -2421,7 +2499,7 @@ class Caches extends BaseModule {
|
|
|
2421
2499
|
}
|
|
2422
2500
|
}
|
|
2423
2501
|
async listInternal(params) {
|
|
2424
|
-
var _a, _b;
|
|
2502
|
+
var _a, _b, _c, _d;
|
|
2425
2503
|
let response;
|
|
2426
2504
|
let path = '';
|
|
2427
2505
|
let queryParams = {};
|
|
@@ -2439,6 +2517,7 @@ class Caches extends BaseModule {
|
|
|
2439
2517
|
body: JSON.stringify(body),
|
|
2440
2518
|
httpMethod: 'GET',
|
|
2441
2519
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
2520
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
2442
2521
|
})
|
|
2443
2522
|
.then((httpResponse) => {
|
|
2444
2523
|
return httpResponse.json();
|
|
@@ -2463,7 +2542,8 @@ class Caches extends BaseModule {
|
|
|
2463
2542
|
queryParams: queryParams,
|
|
2464
2543
|
body: JSON.stringify(body),
|
|
2465
2544
|
httpMethod: 'GET',
|
|
2466
|
-
httpOptions: (
|
|
2545
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
2546
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
2467
2547
|
})
|
|
2468
2548
|
.then((httpResponse) => {
|
|
2469
2549
|
return httpResponse.json();
|
|
@@ -2845,7 +2925,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
2845
2925
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
2846
2926
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
2847
2927
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
2848
|
-
const SDK_VERSION = '0.
|
|
2928
|
+
const SDK_VERSION = '0.10.0'; // x-release-please-version
|
|
2849
2929
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
2850
2930
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
2851
2931
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -2974,7 +3054,7 @@ class ApiClient {
|
|
|
2974
3054
|
getWebsocketBaseUrl() {
|
|
2975
3055
|
const baseUrl = this.getBaseUrl();
|
|
2976
3056
|
const urlParts = new URL(baseUrl);
|
|
2977
|
-
urlParts.protocol = 'wss';
|
|
3057
|
+
urlParts.protocol = urlParts.protocol == 'http:' ? 'ws' : 'wss';
|
|
2978
3058
|
return urlParts.toString();
|
|
2979
3059
|
}
|
|
2980
3060
|
setBaseUrl(url) {
|
|
@@ -3038,7 +3118,7 @@ class ApiClient {
|
|
|
3038
3118
|
else {
|
|
3039
3119
|
requestInit.body = request.body;
|
|
3040
3120
|
}
|
|
3041
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions);
|
|
3121
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
3042
3122
|
return this.unaryApiCall(url, requestInit, request.httpMethod);
|
|
3043
3123
|
}
|
|
3044
3124
|
patchHttpOptions(baseHttpOptions, requestHttpOptions) {
|
|
@@ -3072,14 +3152,21 @@ class ApiClient {
|
|
|
3072
3152
|
}
|
|
3073
3153
|
let requestInit = {};
|
|
3074
3154
|
requestInit.body = request.body;
|
|
3075
|
-
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions);
|
|
3155
|
+
requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
|
|
3076
3156
|
return this.streamApiCall(url, requestInit, request.httpMethod);
|
|
3077
3157
|
}
|
|
3078
|
-
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions) {
|
|
3079
|
-
if (httpOptions && httpOptions.timeout
|
|
3158
|
+
async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, abortSignal) {
|
|
3159
|
+
if ((httpOptions && httpOptions.timeout) || abortSignal) {
|
|
3080
3160
|
const abortController = new AbortController();
|
|
3081
3161
|
const signal = abortController.signal;
|
|
3082
|
-
|
|
3162
|
+
if (httpOptions.timeout && (httpOptions === null || httpOptions === void 0 ? void 0 : httpOptions.timeout) > 0) {
|
|
3163
|
+
setTimeout(() => abortController.abort(), httpOptions.timeout);
|
|
3164
|
+
}
|
|
3165
|
+
if (abortSignal) {
|
|
3166
|
+
abortSignal.addEventListener('abort', () => {
|
|
3167
|
+
abortController.abort();
|
|
3168
|
+
});
|
|
3169
|
+
}
|
|
3083
3170
|
requestInit.signal = signal;
|
|
3084
3171
|
}
|
|
3085
3172
|
requestInit.headers = await this.getHeadersInternal(httpOptions);
|
|
@@ -3134,6 +3221,30 @@ class ApiClient {
|
|
|
3134
3221
|
break;
|
|
3135
3222
|
}
|
|
3136
3223
|
const chunkString = decoder.decode(value);
|
|
3224
|
+
// Parse and throw an error if the chunk contains an error.
|
|
3225
|
+
try {
|
|
3226
|
+
const chunkJson = JSON.parse(chunkString);
|
|
3227
|
+
if ('error' in chunkJson) {
|
|
3228
|
+
const errorJson = JSON.parse(JSON.stringify(chunkJson['error']));
|
|
3229
|
+
const status = errorJson['status'];
|
|
3230
|
+
const code = errorJson['code'];
|
|
3231
|
+
const errorMessage = `got status: ${status}. ${JSON.stringify(chunkJson)}`;
|
|
3232
|
+
if (code >= 400 && code < 500) {
|
|
3233
|
+
const clientError = new ClientError(errorMessage);
|
|
3234
|
+
throw clientError;
|
|
3235
|
+
}
|
|
3236
|
+
else if (code >= 500 && code < 600) {
|
|
3237
|
+
const serverError = new ServerError(errorMessage);
|
|
3238
|
+
throw serverError;
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
catch (e) {
|
|
3243
|
+
const error = e;
|
|
3244
|
+
if (error.name === 'ClientError' || error.name === 'ServerError') {
|
|
3245
|
+
throw e;
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3137
3248
|
buffer += chunkString;
|
|
3138
3249
|
let match = buffer.match(responseLineRE);
|
|
3139
3250
|
while (match) {
|
|
@@ -3272,7 +3383,7 @@ async function throwErrorIfNotOK(response) {
|
|
|
3272
3383
|
else {
|
|
3273
3384
|
errorBody = {
|
|
3274
3385
|
error: {
|
|
3275
|
-
message:
|
|
3386
|
+
message: await response.text(),
|
|
3276
3387
|
code: response.status,
|
|
3277
3388
|
status: response.statusText,
|
|
3278
3389
|
},
|
|
@@ -3724,7 +3835,7 @@ class Files extends BaseModule {
|
|
|
3724
3835
|
});
|
|
3725
3836
|
}
|
|
3726
3837
|
async listInternal(params) {
|
|
3727
|
-
var _a;
|
|
3838
|
+
var _a, _b;
|
|
3728
3839
|
let response;
|
|
3729
3840
|
let path = '';
|
|
3730
3841
|
let queryParams = {};
|
|
@@ -3745,6 +3856,7 @@ class Files extends BaseModule {
|
|
|
3745
3856
|
body: JSON.stringify(body),
|
|
3746
3857
|
httpMethod: 'GET',
|
|
3747
3858
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3859
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
3748
3860
|
})
|
|
3749
3861
|
.then((httpResponse) => {
|
|
3750
3862
|
return httpResponse.json();
|
|
@@ -3758,7 +3870,7 @@ class Files extends BaseModule {
|
|
|
3758
3870
|
}
|
|
3759
3871
|
}
|
|
3760
3872
|
async createInternal(params) {
|
|
3761
|
-
var _a;
|
|
3873
|
+
var _a, _b;
|
|
3762
3874
|
let response;
|
|
3763
3875
|
let path = '';
|
|
3764
3876
|
let queryParams = {};
|
|
@@ -3779,6 +3891,7 @@ class Files extends BaseModule {
|
|
|
3779
3891
|
body: JSON.stringify(body),
|
|
3780
3892
|
httpMethod: 'POST',
|
|
3781
3893
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3894
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
3782
3895
|
})
|
|
3783
3896
|
.then((httpResponse) => {
|
|
3784
3897
|
return httpResponse.json();
|
|
@@ -3807,7 +3920,7 @@ class Files extends BaseModule {
|
|
|
3807
3920
|
* ```
|
|
3808
3921
|
*/
|
|
3809
3922
|
async get(params) {
|
|
3810
|
-
var _a;
|
|
3923
|
+
var _a, _b;
|
|
3811
3924
|
let response;
|
|
3812
3925
|
let path = '';
|
|
3813
3926
|
let queryParams = {};
|
|
@@ -3828,6 +3941,7 @@ class Files extends BaseModule {
|
|
|
3828
3941
|
body: JSON.stringify(body),
|
|
3829
3942
|
httpMethod: 'GET',
|
|
3830
3943
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3944
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
3831
3945
|
})
|
|
3832
3946
|
.then((httpResponse) => {
|
|
3833
3947
|
return httpResponse.json();
|
|
@@ -3852,7 +3966,7 @@ class Files extends BaseModule {
|
|
|
3852
3966
|
* ```
|
|
3853
3967
|
*/
|
|
3854
3968
|
async delete(params) {
|
|
3855
|
-
var _a;
|
|
3969
|
+
var _a, _b;
|
|
3856
3970
|
let response;
|
|
3857
3971
|
let path = '';
|
|
3858
3972
|
let queryParams = {};
|
|
@@ -3873,6 +3987,7 @@ class Files extends BaseModule {
|
|
|
3873
3987
|
body: JSON.stringify(body),
|
|
3874
3988
|
httpMethod: 'DELETE',
|
|
3875
3989
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3990
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
3876
3991
|
})
|
|
3877
3992
|
.then((httpResponse) => {
|
|
3878
3993
|
return httpResponse.json();
|
|
@@ -4683,6 +4798,91 @@ function liveConnectParametersToVertex(apiClient, fromObject) {
|
|
|
4683
4798
|
}
|
|
4684
4799
|
return toObject;
|
|
4685
4800
|
}
|
|
4801
|
+
function activityStartToMldev() {
|
|
4802
|
+
const toObject = {};
|
|
4803
|
+
return toObject;
|
|
4804
|
+
}
|
|
4805
|
+
function activityStartToVertex() {
|
|
4806
|
+
const toObject = {};
|
|
4807
|
+
return toObject;
|
|
4808
|
+
}
|
|
4809
|
+
function activityEndToMldev() {
|
|
4810
|
+
const toObject = {};
|
|
4811
|
+
return toObject;
|
|
4812
|
+
}
|
|
4813
|
+
function activityEndToVertex() {
|
|
4814
|
+
const toObject = {};
|
|
4815
|
+
return toObject;
|
|
4816
|
+
}
|
|
4817
|
+
function liveSendRealtimeInputParametersToMldev(apiClient, fromObject) {
|
|
4818
|
+
const toObject = {};
|
|
4819
|
+
const fromMedia = getValueByPath(fromObject, ['media']);
|
|
4820
|
+
if (fromMedia != null) {
|
|
4821
|
+
setValueByPath(toObject, ['mediaChunks'], tBlobs(apiClient, fromMedia));
|
|
4822
|
+
}
|
|
4823
|
+
const fromAudio = getValueByPath(fromObject, ['audio']);
|
|
4824
|
+
if (fromAudio != null) {
|
|
4825
|
+
setValueByPath(toObject, ['audio'], tAudioBlob(apiClient, fromAudio));
|
|
4826
|
+
}
|
|
4827
|
+
const fromAudioStreamEnd = getValueByPath(fromObject, [
|
|
4828
|
+
'audioStreamEnd',
|
|
4829
|
+
]);
|
|
4830
|
+
if (fromAudioStreamEnd != null) {
|
|
4831
|
+
setValueByPath(toObject, ['audioStreamEnd'], fromAudioStreamEnd);
|
|
4832
|
+
}
|
|
4833
|
+
const fromVideo = getValueByPath(fromObject, ['video']);
|
|
4834
|
+
if (fromVideo != null) {
|
|
4835
|
+
setValueByPath(toObject, ['video'], tImageBlob(apiClient, fromVideo));
|
|
4836
|
+
}
|
|
4837
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
4838
|
+
if (fromText != null) {
|
|
4839
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
4840
|
+
}
|
|
4841
|
+
const fromActivityStart = getValueByPath(fromObject, [
|
|
4842
|
+
'activityStart',
|
|
4843
|
+
]);
|
|
4844
|
+
if (fromActivityStart != null) {
|
|
4845
|
+
setValueByPath(toObject, ['activityStart'], activityStartToMldev());
|
|
4846
|
+
}
|
|
4847
|
+
const fromActivityEnd = getValueByPath(fromObject, ['activityEnd']);
|
|
4848
|
+
if (fromActivityEnd != null) {
|
|
4849
|
+
setValueByPath(toObject, ['activityEnd'], activityEndToMldev());
|
|
4850
|
+
}
|
|
4851
|
+
return toObject;
|
|
4852
|
+
}
|
|
4853
|
+
function liveSendRealtimeInputParametersToVertex(apiClient, fromObject) {
|
|
4854
|
+
const toObject = {};
|
|
4855
|
+
const fromMedia = getValueByPath(fromObject, ['media']);
|
|
4856
|
+
if (fromMedia != null) {
|
|
4857
|
+
setValueByPath(toObject, ['mediaChunks'], tBlobs(apiClient, fromMedia));
|
|
4858
|
+
}
|
|
4859
|
+
if (getValueByPath(fromObject, ['audio']) !== undefined) {
|
|
4860
|
+
throw new Error('audio parameter is not supported in Vertex AI.');
|
|
4861
|
+
}
|
|
4862
|
+
const fromAudioStreamEnd = getValueByPath(fromObject, [
|
|
4863
|
+
'audioStreamEnd',
|
|
4864
|
+
]);
|
|
4865
|
+
if (fromAudioStreamEnd != null) {
|
|
4866
|
+
setValueByPath(toObject, ['audioStreamEnd'], fromAudioStreamEnd);
|
|
4867
|
+
}
|
|
4868
|
+
if (getValueByPath(fromObject, ['video']) !== undefined) {
|
|
4869
|
+
throw new Error('video parameter is not supported in Vertex AI.');
|
|
4870
|
+
}
|
|
4871
|
+
if (getValueByPath(fromObject, ['text']) !== undefined) {
|
|
4872
|
+
throw new Error('text parameter is not supported in Vertex AI.');
|
|
4873
|
+
}
|
|
4874
|
+
const fromActivityStart = getValueByPath(fromObject, [
|
|
4875
|
+
'activityStart',
|
|
4876
|
+
]);
|
|
4877
|
+
if (fromActivityStart != null) {
|
|
4878
|
+
setValueByPath(toObject, ['activityStart'], activityStartToVertex());
|
|
4879
|
+
}
|
|
4880
|
+
const fromActivityEnd = getValueByPath(fromObject, ['activityEnd']);
|
|
4881
|
+
if (fromActivityEnd != null) {
|
|
4882
|
+
setValueByPath(toObject, ['activityEnd'], activityEndToVertex());
|
|
4883
|
+
}
|
|
4884
|
+
return toObject;
|
|
4885
|
+
}
|
|
4686
4886
|
function liveServerSetupCompleteFromMldev() {
|
|
4687
4887
|
const toObject = {};
|
|
4688
4888
|
return toObject;
|
|
@@ -8030,21 +8230,6 @@ class Session {
|
|
|
8030
8230
|
clientContent: { turnComplete: params.turnComplete },
|
|
8031
8231
|
};
|
|
8032
8232
|
}
|
|
8033
|
-
tLiveClientRealtimeInput(apiClient, params) {
|
|
8034
|
-
let clientMessage = {};
|
|
8035
|
-
if (!('media' in params) || !params.media) {
|
|
8036
|
-
throw new Error(`Failed to convert realtime input "media", type: '${typeof params.media}'`);
|
|
8037
|
-
}
|
|
8038
|
-
// LiveClientRealtimeInput
|
|
8039
|
-
clientMessage = {
|
|
8040
|
-
realtimeInput: {
|
|
8041
|
-
mediaChunks: [params.media],
|
|
8042
|
-
activityStart: params.activityStart,
|
|
8043
|
-
activityEnd: params.activityEnd,
|
|
8044
|
-
},
|
|
8045
|
-
};
|
|
8046
|
-
return clientMessage;
|
|
8047
|
-
}
|
|
8048
8233
|
tLiveClienttToolResponse(apiClient, params) {
|
|
8049
8234
|
let functionResponses = [];
|
|
8050
8235
|
if (params.functionResponses == null) {
|
|
@@ -8152,10 +8337,17 @@ class Session {
|
|
|
8152
8337
|
of audio and image mimetypes are allowed.
|
|
8153
8338
|
*/
|
|
8154
8339
|
sendRealtimeInput(params) {
|
|
8155
|
-
|
|
8156
|
-
|
|
8340
|
+
let clientMessage = {};
|
|
8341
|
+
if (this.apiClient.isVertexAI()) {
|
|
8342
|
+
clientMessage = {
|
|
8343
|
+
'realtimeInput': liveSendRealtimeInputParametersToVertex(this.apiClient, params),
|
|
8344
|
+
};
|
|
8345
|
+
}
|
|
8346
|
+
else {
|
|
8347
|
+
clientMessage = {
|
|
8348
|
+
'realtimeInput': liveSendRealtimeInputParametersToMldev(this.apiClient, params),
|
|
8349
|
+
};
|
|
8157
8350
|
}
|
|
8158
|
-
const clientMessage = this.tLiveClientRealtimeInput(this.apiClient, params);
|
|
8159
8351
|
this.conn.send(JSON.stringify(clientMessage));
|
|
8160
8352
|
}
|
|
8161
8353
|
/**
|
|
@@ -8376,7 +8568,7 @@ class Models extends BaseModule {
|
|
|
8376
8568
|
};
|
|
8377
8569
|
}
|
|
8378
8570
|
async generateContentInternal(params) {
|
|
8379
|
-
var _a, _b;
|
|
8571
|
+
var _a, _b, _c, _d;
|
|
8380
8572
|
let response;
|
|
8381
8573
|
let path = '';
|
|
8382
8574
|
let queryParams = {};
|
|
@@ -8394,6 +8586,7 @@ class Models extends BaseModule {
|
|
|
8394
8586
|
body: JSON.stringify(body),
|
|
8395
8587
|
httpMethod: 'POST',
|
|
8396
8588
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8589
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8397
8590
|
})
|
|
8398
8591
|
.then((httpResponse) => {
|
|
8399
8592
|
return httpResponse.json();
|
|
@@ -8418,7 +8611,8 @@ class Models extends BaseModule {
|
|
|
8418
8611
|
queryParams: queryParams,
|
|
8419
8612
|
body: JSON.stringify(body),
|
|
8420
8613
|
httpMethod: 'POST',
|
|
8421
|
-
httpOptions: (
|
|
8614
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
8615
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
8422
8616
|
})
|
|
8423
8617
|
.then((httpResponse) => {
|
|
8424
8618
|
return httpResponse.json();
|
|
@@ -8432,7 +8626,7 @@ class Models extends BaseModule {
|
|
|
8432
8626
|
}
|
|
8433
8627
|
}
|
|
8434
8628
|
async generateContentStreamInternal(params) {
|
|
8435
|
-
var _a, _b;
|
|
8629
|
+
var _a, _b, _c, _d;
|
|
8436
8630
|
let response;
|
|
8437
8631
|
let path = '';
|
|
8438
8632
|
let queryParams = {};
|
|
@@ -8450,6 +8644,7 @@ class Models extends BaseModule {
|
|
|
8450
8644
|
body: JSON.stringify(body),
|
|
8451
8645
|
httpMethod: 'POST',
|
|
8452
8646
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8647
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8453
8648
|
});
|
|
8454
8649
|
return response.then(function (apiResponse) {
|
|
8455
8650
|
return __asyncGenerator(this, arguments, function* () {
|
|
@@ -8488,7 +8683,8 @@ class Models extends BaseModule {
|
|
|
8488
8683
|
queryParams: queryParams,
|
|
8489
8684
|
body: JSON.stringify(body),
|
|
8490
8685
|
httpMethod: 'POST',
|
|
8491
|
-
httpOptions: (
|
|
8686
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
8687
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
8492
8688
|
});
|
|
8493
8689
|
return response.then(function (apiResponse) {
|
|
8494
8690
|
return __asyncGenerator(this, arguments, function* () {
|
|
@@ -8537,7 +8733,7 @@ class Models extends BaseModule {
|
|
|
8537
8733
|
* ```
|
|
8538
8734
|
*/
|
|
8539
8735
|
async embedContent(params) {
|
|
8540
|
-
var _a, _b;
|
|
8736
|
+
var _a, _b, _c, _d;
|
|
8541
8737
|
let response;
|
|
8542
8738
|
let path = '';
|
|
8543
8739
|
let queryParams = {};
|
|
@@ -8555,6 +8751,7 @@ class Models extends BaseModule {
|
|
|
8555
8751
|
body: JSON.stringify(body),
|
|
8556
8752
|
httpMethod: 'POST',
|
|
8557
8753
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8754
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8558
8755
|
})
|
|
8559
8756
|
.then((httpResponse) => {
|
|
8560
8757
|
return httpResponse.json();
|
|
@@ -8579,7 +8776,8 @@ class Models extends BaseModule {
|
|
|
8579
8776
|
queryParams: queryParams,
|
|
8580
8777
|
body: JSON.stringify(body),
|
|
8581
8778
|
httpMethod: 'POST',
|
|
8582
|
-
httpOptions: (
|
|
8779
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
8780
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
8583
8781
|
})
|
|
8584
8782
|
.then((httpResponse) => {
|
|
8585
8783
|
return httpResponse.json();
|
|
@@ -8612,7 +8810,7 @@ class Models extends BaseModule {
|
|
|
8612
8810
|
* ```
|
|
8613
8811
|
*/
|
|
8614
8812
|
async generateImagesInternal(params) {
|
|
8615
|
-
var _a, _b;
|
|
8813
|
+
var _a, _b, _c, _d;
|
|
8616
8814
|
let response;
|
|
8617
8815
|
let path = '';
|
|
8618
8816
|
let queryParams = {};
|
|
@@ -8630,6 +8828,7 @@ class Models extends BaseModule {
|
|
|
8630
8828
|
body: JSON.stringify(body),
|
|
8631
8829
|
httpMethod: 'POST',
|
|
8632
8830
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8831
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8633
8832
|
})
|
|
8634
8833
|
.then((httpResponse) => {
|
|
8635
8834
|
return httpResponse.json();
|
|
@@ -8654,7 +8853,8 @@ class Models extends BaseModule {
|
|
|
8654
8853
|
queryParams: queryParams,
|
|
8655
8854
|
body: JSON.stringify(body),
|
|
8656
8855
|
httpMethod: 'POST',
|
|
8657
|
-
httpOptions: (
|
|
8856
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
8857
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
8658
8858
|
})
|
|
8659
8859
|
.then((httpResponse) => {
|
|
8660
8860
|
return httpResponse.json();
|
|
@@ -8676,7 +8876,7 @@ class Models extends BaseModule {
|
|
|
8676
8876
|
* ```
|
|
8677
8877
|
*/
|
|
8678
8878
|
async get(params) {
|
|
8679
|
-
var _a, _b;
|
|
8879
|
+
var _a, _b, _c, _d;
|
|
8680
8880
|
let response;
|
|
8681
8881
|
let path = '';
|
|
8682
8882
|
let queryParams = {};
|
|
@@ -8694,6 +8894,7 @@ class Models extends BaseModule {
|
|
|
8694
8894
|
body: JSON.stringify(body),
|
|
8695
8895
|
httpMethod: 'GET',
|
|
8696
8896
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8897
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8697
8898
|
})
|
|
8698
8899
|
.then((httpResponse) => {
|
|
8699
8900
|
return httpResponse.json();
|
|
@@ -8716,7 +8917,8 @@ class Models extends BaseModule {
|
|
|
8716
8917
|
queryParams: queryParams,
|
|
8717
8918
|
body: JSON.stringify(body),
|
|
8718
8919
|
httpMethod: 'GET',
|
|
8719
|
-
httpOptions: (
|
|
8920
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
8921
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
8720
8922
|
})
|
|
8721
8923
|
.then((httpResponse) => {
|
|
8722
8924
|
return httpResponse.json();
|
|
@@ -8744,7 +8946,7 @@ class Models extends BaseModule {
|
|
|
8744
8946
|
* ```
|
|
8745
8947
|
*/
|
|
8746
8948
|
async countTokens(params) {
|
|
8747
|
-
var _a, _b;
|
|
8949
|
+
var _a, _b, _c, _d;
|
|
8748
8950
|
let response;
|
|
8749
8951
|
let path = '';
|
|
8750
8952
|
let queryParams = {};
|
|
@@ -8762,6 +8964,7 @@ class Models extends BaseModule {
|
|
|
8762
8964
|
body: JSON.stringify(body),
|
|
8763
8965
|
httpMethod: 'POST',
|
|
8764
8966
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8967
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8765
8968
|
})
|
|
8766
8969
|
.then((httpResponse) => {
|
|
8767
8970
|
return httpResponse.json();
|
|
@@ -8786,7 +8989,8 @@ class Models extends BaseModule {
|
|
|
8786
8989
|
queryParams: queryParams,
|
|
8787
8990
|
body: JSON.stringify(body),
|
|
8788
8991
|
httpMethod: 'POST',
|
|
8789
|
-
httpOptions: (
|
|
8992
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
8993
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
8790
8994
|
})
|
|
8791
8995
|
.then((httpResponse) => {
|
|
8792
8996
|
return httpResponse.json();
|
|
@@ -8818,7 +9022,7 @@ class Models extends BaseModule {
|
|
|
8818
9022
|
* ```
|
|
8819
9023
|
*/
|
|
8820
9024
|
async computeTokens(params) {
|
|
8821
|
-
var _a;
|
|
9025
|
+
var _a, _b;
|
|
8822
9026
|
let response;
|
|
8823
9027
|
let path = '';
|
|
8824
9028
|
let queryParams = {};
|
|
@@ -8836,6 +9040,7 @@ class Models extends BaseModule {
|
|
|
8836
9040
|
body: JSON.stringify(body),
|
|
8837
9041
|
httpMethod: 'POST',
|
|
8838
9042
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9043
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8839
9044
|
})
|
|
8840
9045
|
.then((httpResponse) => {
|
|
8841
9046
|
return httpResponse.json();
|
|
@@ -8875,7 +9080,7 @@ class Models extends BaseModule {
|
|
|
8875
9080
|
* ```
|
|
8876
9081
|
*/
|
|
8877
9082
|
async generateVideos(params) {
|
|
8878
|
-
var _a, _b;
|
|
9083
|
+
var _a, _b, _c, _d;
|
|
8879
9084
|
let response;
|
|
8880
9085
|
let path = '';
|
|
8881
9086
|
let queryParams = {};
|
|
@@ -8893,6 +9098,7 @@ class Models extends BaseModule {
|
|
|
8893
9098
|
body: JSON.stringify(body),
|
|
8894
9099
|
httpMethod: 'POST',
|
|
8895
9100
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9101
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8896
9102
|
})
|
|
8897
9103
|
.then((httpResponse) => {
|
|
8898
9104
|
return httpResponse.json();
|
|
@@ -8915,7 +9121,8 @@ class Models extends BaseModule {
|
|
|
8915
9121
|
queryParams: queryParams,
|
|
8916
9122
|
body: JSON.stringify(body),
|
|
8917
9123
|
httpMethod: 'POST',
|
|
8918
|
-
httpOptions: (
|
|
9124
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
9125
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
8919
9126
|
})
|
|
8920
9127
|
.then((httpResponse) => {
|
|
8921
9128
|
return httpResponse.json();
|
|
@@ -9182,7 +9389,7 @@ class Operations extends BaseModule {
|
|
|
9182
9389
|
}
|
|
9183
9390
|
}
|
|
9184
9391
|
async getVideosOperationInternal(params) {
|
|
9185
|
-
var _a, _b;
|
|
9392
|
+
var _a, _b, _c, _d;
|
|
9186
9393
|
let response;
|
|
9187
9394
|
let path = '';
|
|
9188
9395
|
let queryParams = {};
|
|
@@ -9200,6 +9407,7 @@ class Operations extends BaseModule {
|
|
|
9200
9407
|
body: JSON.stringify(body),
|
|
9201
9408
|
httpMethod: 'GET',
|
|
9202
9409
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9410
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9203
9411
|
})
|
|
9204
9412
|
.then((httpResponse) => {
|
|
9205
9413
|
return httpResponse.json();
|
|
@@ -9222,7 +9430,8 @@ class Operations extends BaseModule {
|
|
|
9222
9430
|
queryParams: queryParams,
|
|
9223
9431
|
body: JSON.stringify(body),
|
|
9224
9432
|
httpMethod: 'GET',
|
|
9225
|
-
httpOptions: (
|
|
9433
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
9434
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
9226
9435
|
})
|
|
9227
9436
|
.then((httpResponse) => {
|
|
9228
9437
|
return httpResponse.json();
|
|
@@ -9234,7 +9443,7 @@ class Operations extends BaseModule {
|
|
|
9234
9443
|
}
|
|
9235
9444
|
}
|
|
9236
9445
|
async fetchPredictVideosOperationInternal(params) {
|
|
9237
|
-
var _a;
|
|
9446
|
+
var _a, _b;
|
|
9238
9447
|
let response;
|
|
9239
9448
|
let path = '';
|
|
9240
9449
|
let queryParams = {};
|
|
@@ -9252,6 +9461,7 @@ class Operations extends BaseModule {
|
|
|
9252
9461
|
body: JSON.stringify(body),
|
|
9253
9462
|
httpMethod: 'POST',
|
|
9254
9463
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9464
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9255
9465
|
})
|
|
9256
9466
|
.then((httpResponse) => {
|
|
9257
9467
|
return httpResponse.json();
|
|
@@ -9388,4 +9598,5 @@ exports.createPartFromFunctionResponse = createPartFromFunctionResponse;
|
|
|
9388
9598
|
exports.createPartFromText = createPartFromText;
|
|
9389
9599
|
exports.createPartFromUri = createPartFromUri;
|
|
9390
9600
|
exports.createUserContent = createUserContent;
|
|
9601
|
+
exports.setDefaultBaseUrls = setDefaultBaseUrls;
|
|
9391
9602
|
//# sourceMappingURL=index.js.map
|