@google/genai 1.18.0 → 1.20.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 +72 -2
- package/dist/index.cjs +330 -104
- package/dist/index.mjs +331 -105
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +330 -104
- package/dist/node/index.mjs +331 -105
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +72 -2
- package/dist/web/index.mjs +331 -105
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +72 -2
- package/package.json +4 -1
package/dist/genai.d.ts
CHANGED
|
@@ -1517,6 +1517,8 @@ export declare interface CreateTuningJobConfig {
|
|
|
1517
1517
|
batchSize?: number;
|
|
1518
1518
|
/** The learning rate hyperparameter for tuning. If not set, a default of 0.001 or 0.0002 will be calculated based on the number of training examples. */
|
|
1519
1519
|
learningRate?: number;
|
|
1520
|
+
/** Optional. The labels with user-defined metadata to organize TuningJob and generated resources such as Model and Endpoint. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels. */
|
|
1521
|
+
labels?: Record<string, string>;
|
|
1520
1522
|
}
|
|
1521
1523
|
|
|
1522
1524
|
/** Supervised fine-tuning job creation parameters - optional fields. */
|
|
@@ -2949,6 +2951,8 @@ export declare interface GenerateVideosConfig {
|
|
|
2949
2951
|
be associated with a type. Veo 2 supports up to 3 asset images *or* 1
|
|
2950
2952
|
style image. */
|
|
2951
2953
|
referenceImages?: VideoGenerationReferenceImage[];
|
|
2954
|
+
/** The mask to use for generating videos. */
|
|
2955
|
+
mask?: VideoGenerationMask;
|
|
2952
2956
|
/** Compression quality of the generated videos. */
|
|
2953
2957
|
compressionQuality?: VideoCompressionQuality;
|
|
2954
2958
|
}
|
|
@@ -2965,13 +2969,13 @@ export declare class GenerateVideosOperation implements Operation<GenerateVideos
|
|
|
2965
2969
|
error?: Record<string, unknown>;
|
|
2966
2970
|
/** The generated videos. */
|
|
2967
2971
|
response?: GenerateVideosResponse;
|
|
2968
|
-
/** The full HTTP response. */
|
|
2969
|
-
sdkHttpResponse?: HttpResponse;
|
|
2970
2972
|
/**
|
|
2971
2973
|
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
2972
2974
|
* @internal
|
|
2973
2975
|
*/
|
|
2974
2976
|
_fromAPIResponse({ apiResponse, isVertexAI, }: OperationFromAPIResponseParameters): Operation<GenerateVideosResponse>;
|
|
2977
|
+
/** The full HTTP response. */
|
|
2978
|
+
sdkHttpResponse?: HttpResponse;
|
|
2975
2979
|
}
|
|
2976
2980
|
|
|
2977
2981
|
/** Class that represents the parameters for generating videos. */
|
|
@@ -4702,6 +4706,12 @@ export declare interface LiveServerContent {
|
|
|
4702
4706
|
outputTranscription?: Transcription;
|
|
4703
4707
|
/** Metadata related to url context retrieval tool. */
|
|
4704
4708
|
urlContextMetadata?: UrlContextMetadata;
|
|
4709
|
+
/** Reason for the turn is complete. */
|
|
4710
|
+
turnCompleteReason?: TurnCompleteReason;
|
|
4711
|
+
/** If true, indicates that the model is not generating content because
|
|
4712
|
+
it is waiting for more input from the user, e.g. because it expects the
|
|
4713
|
+
user to continue talking. */
|
|
4714
|
+
waitingForInput?: boolean;
|
|
4705
4715
|
}
|
|
4706
4716
|
|
|
4707
4717
|
/** Server will not be able to service client soon. */
|
|
@@ -7006,6 +7016,26 @@ export declare interface TuningValidationDataset {
|
|
|
7006
7016
|
vertexDatasetResource?: string;
|
|
7007
7017
|
}
|
|
7008
7018
|
|
|
7019
|
+
/** The reason why the turn is complete. */
|
|
7020
|
+
export declare enum TurnCompleteReason {
|
|
7021
|
+
/**
|
|
7022
|
+
* Default value. Reason is unspecified.
|
|
7023
|
+
*/
|
|
7024
|
+
TURN_COMPLETE_REASON_UNSPECIFIED = "TURN_COMPLETE_REASON_UNSPECIFIED",
|
|
7025
|
+
/**
|
|
7026
|
+
* The function call generated by the model is invalid.
|
|
7027
|
+
*/
|
|
7028
|
+
MALFORMED_FUNCTION_CALL = "MALFORMED_FUNCTION_CALL",
|
|
7029
|
+
/**
|
|
7030
|
+
* The response is rejected by the model.
|
|
7031
|
+
*/
|
|
7032
|
+
RESPONSE_REJECTED = "RESPONSE_REJECTED",
|
|
7033
|
+
/**
|
|
7034
|
+
* Needs more input from the user.
|
|
7035
|
+
*/
|
|
7036
|
+
NEED_MORE_INPUT = "NEED_MORE_INPUT"
|
|
7037
|
+
}
|
|
7038
|
+
|
|
7009
7039
|
/** Options about which input is included in the user's turn. */
|
|
7010
7040
|
export declare enum TurnCoverage {
|
|
7011
7041
|
/**
|
|
@@ -7103,9 +7133,11 @@ declare namespace types {
|
|
|
7103
7133
|
EditMode,
|
|
7104
7134
|
SegmentMode,
|
|
7105
7135
|
VideoGenerationReferenceType,
|
|
7136
|
+
VideoGenerationMaskMode,
|
|
7106
7137
|
VideoCompressionQuality,
|
|
7107
7138
|
FileState,
|
|
7108
7139
|
FileSource,
|
|
7140
|
+
TurnCompleteReason,
|
|
7109
7141
|
MediaModality,
|
|
7110
7142
|
StartSensitivity,
|
|
7111
7143
|
EndSensitivity,
|
|
@@ -7266,6 +7298,7 @@ declare namespace types {
|
|
|
7266
7298
|
Video,
|
|
7267
7299
|
GenerateVideosSource,
|
|
7268
7300
|
VideoGenerationReferenceImage,
|
|
7301
|
+
VideoGenerationMask,
|
|
7269
7302
|
GenerateVideosConfig,
|
|
7270
7303
|
GenerateVideosParameters,
|
|
7271
7304
|
GeneratedVideo,
|
|
@@ -7740,6 +7773,43 @@ export declare enum VideoCompressionQuality {
|
|
|
7740
7773
|
LOSSLESS = "LOSSLESS"
|
|
7741
7774
|
}
|
|
7742
7775
|
|
|
7776
|
+
/** A mask for video generation. */
|
|
7777
|
+
export declare interface VideoGenerationMask {
|
|
7778
|
+
/** The image mask to use for generating videos. */
|
|
7779
|
+
image?: Image_2;
|
|
7780
|
+
/** Describes how the mask will be used. Inpainting masks must
|
|
7781
|
+
match the aspect ratio of the input video. Outpainting masks can be
|
|
7782
|
+
either 9:16 or 16:9. */
|
|
7783
|
+
maskMode?: VideoGenerationMaskMode;
|
|
7784
|
+
}
|
|
7785
|
+
|
|
7786
|
+
/** Enum for the mask mode of a video generation mask. */
|
|
7787
|
+
export declare enum VideoGenerationMaskMode {
|
|
7788
|
+
/**
|
|
7789
|
+
* The image mask contains a masked rectangular region which is
|
|
7790
|
+
applied on the first frame of the input video. The object described in
|
|
7791
|
+
the prompt is inserted into this region and will appear in subsequent
|
|
7792
|
+
frames.
|
|
7793
|
+
*/
|
|
7794
|
+
INSERT = "INSERT",
|
|
7795
|
+
/**
|
|
7796
|
+
* The image mask is used to determine an object in the
|
|
7797
|
+
first video frame to track. This object is removed from the video.
|
|
7798
|
+
*/
|
|
7799
|
+
REMOVE = "REMOVE",
|
|
7800
|
+
/**
|
|
7801
|
+
* The image mask is used to determine a region in the
|
|
7802
|
+
video. Objects in this region will be removed.
|
|
7803
|
+
*/
|
|
7804
|
+
REMOVE_STATIC = "REMOVE_STATIC",
|
|
7805
|
+
/**
|
|
7806
|
+
* The image mask contains a masked rectangular region where
|
|
7807
|
+
the input video will go. The remaining area will be generated. Video
|
|
7808
|
+
masks are not supported.
|
|
7809
|
+
*/
|
|
7810
|
+
OUTPAINT = "OUTPAINT"
|
|
7811
|
+
}
|
|
7812
|
+
|
|
7743
7813
|
/** A reference image for video generation. */
|
|
7744
7814
|
export declare interface VideoGenerationReferenceImage {
|
|
7745
7815
|
/** The reference image. */
|
package/dist/index.cjs
CHANGED
|
@@ -185,6 +185,216 @@ function tBytes$1(fromBytes) {
|
|
|
185
185
|
* SPDX-License-Identifier: Apache-2.0
|
|
186
186
|
*/
|
|
187
187
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
188
|
+
function getOperationParametersToMldev(fromObject) {
|
|
189
|
+
const toObject = {};
|
|
190
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
191
|
+
'operationName',
|
|
192
|
+
]);
|
|
193
|
+
if (fromOperationName != null) {
|
|
194
|
+
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
195
|
+
}
|
|
196
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
197
|
+
if (fromConfig != null) {
|
|
198
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
199
|
+
}
|
|
200
|
+
return toObject;
|
|
201
|
+
}
|
|
202
|
+
function fetchPredictOperationParametersToVertex(fromObject) {
|
|
203
|
+
const toObject = {};
|
|
204
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
205
|
+
'operationName',
|
|
206
|
+
]);
|
|
207
|
+
if (fromOperationName != null) {
|
|
208
|
+
setValueByPath(toObject, ['operationName'], fromOperationName);
|
|
209
|
+
}
|
|
210
|
+
const fromResourceName = getValueByPath(fromObject, ['resourceName']);
|
|
211
|
+
if (fromResourceName != null) {
|
|
212
|
+
setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
|
|
213
|
+
}
|
|
214
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
215
|
+
if (fromConfig != null) {
|
|
216
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
217
|
+
}
|
|
218
|
+
return toObject;
|
|
219
|
+
}
|
|
220
|
+
function getOperationParametersToVertex(fromObject) {
|
|
221
|
+
const toObject = {};
|
|
222
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
223
|
+
'operationName',
|
|
224
|
+
]);
|
|
225
|
+
if (fromOperationName != null) {
|
|
226
|
+
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
227
|
+
}
|
|
228
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
229
|
+
if (fromConfig != null) {
|
|
230
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
231
|
+
}
|
|
232
|
+
return toObject;
|
|
233
|
+
}
|
|
234
|
+
function videoFromMldev$1(fromObject) {
|
|
235
|
+
const toObject = {};
|
|
236
|
+
const fromUri = getValueByPath(fromObject, ['video', 'uri']);
|
|
237
|
+
if (fromUri != null) {
|
|
238
|
+
setValueByPath(toObject, ['uri'], fromUri);
|
|
239
|
+
}
|
|
240
|
+
const fromVideoBytes = getValueByPath(fromObject, [
|
|
241
|
+
'video',
|
|
242
|
+
'encodedVideo',
|
|
243
|
+
]);
|
|
244
|
+
if (fromVideoBytes != null) {
|
|
245
|
+
setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
|
|
246
|
+
}
|
|
247
|
+
const fromMimeType = getValueByPath(fromObject, ['encoding']);
|
|
248
|
+
if (fromMimeType != null) {
|
|
249
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
250
|
+
}
|
|
251
|
+
return toObject;
|
|
252
|
+
}
|
|
253
|
+
function generatedVideoFromMldev$1(fromObject) {
|
|
254
|
+
const toObject = {};
|
|
255
|
+
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
256
|
+
if (fromVideo != null) {
|
|
257
|
+
setValueByPath(toObject, ['video'], videoFromMldev$1(fromVideo));
|
|
258
|
+
}
|
|
259
|
+
return toObject;
|
|
260
|
+
}
|
|
261
|
+
function generateVideosResponseFromMldev$1(fromObject) {
|
|
262
|
+
const toObject = {};
|
|
263
|
+
const fromGeneratedVideos = getValueByPath(fromObject, [
|
|
264
|
+
'generatedSamples',
|
|
265
|
+
]);
|
|
266
|
+
if (fromGeneratedVideos != null) {
|
|
267
|
+
let transformedList = fromGeneratedVideos;
|
|
268
|
+
if (Array.isArray(transformedList)) {
|
|
269
|
+
transformedList = transformedList.map((item) => {
|
|
270
|
+
return generatedVideoFromMldev$1(item);
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
274
|
+
}
|
|
275
|
+
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
276
|
+
'raiMediaFilteredCount',
|
|
277
|
+
]);
|
|
278
|
+
if (fromRaiMediaFilteredCount != null) {
|
|
279
|
+
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
280
|
+
}
|
|
281
|
+
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
282
|
+
'raiMediaFilteredReasons',
|
|
283
|
+
]);
|
|
284
|
+
if (fromRaiMediaFilteredReasons != null) {
|
|
285
|
+
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
286
|
+
}
|
|
287
|
+
return toObject;
|
|
288
|
+
}
|
|
289
|
+
function generateVideosOperationFromMldev$1(fromObject) {
|
|
290
|
+
const toObject = {};
|
|
291
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
292
|
+
if (fromName != null) {
|
|
293
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
294
|
+
}
|
|
295
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
296
|
+
if (fromMetadata != null) {
|
|
297
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
298
|
+
}
|
|
299
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
300
|
+
if (fromDone != null) {
|
|
301
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
302
|
+
}
|
|
303
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
304
|
+
if (fromError != null) {
|
|
305
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
306
|
+
}
|
|
307
|
+
const fromResponse = getValueByPath(fromObject, [
|
|
308
|
+
'response',
|
|
309
|
+
'generateVideoResponse',
|
|
310
|
+
]);
|
|
311
|
+
if (fromResponse != null) {
|
|
312
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(fromResponse));
|
|
313
|
+
}
|
|
314
|
+
return toObject;
|
|
315
|
+
}
|
|
316
|
+
function videoFromVertex$1(fromObject) {
|
|
317
|
+
const toObject = {};
|
|
318
|
+
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
319
|
+
if (fromUri != null) {
|
|
320
|
+
setValueByPath(toObject, ['uri'], fromUri);
|
|
321
|
+
}
|
|
322
|
+
const fromVideoBytes = getValueByPath(fromObject, [
|
|
323
|
+
'bytesBase64Encoded',
|
|
324
|
+
]);
|
|
325
|
+
if (fromVideoBytes != null) {
|
|
326
|
+
setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
|
|
327
|
+
}
|
|
328
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
329
|
+
if (fromMimeType != null) {
|
|
330
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
331
|
+
}
|
|
332
|
+
return toObject;
|
|
333
|
+
}
|
|
334
|
+
function generatedVideoFromVertex$1(fromObject) {
|
|
335
|
+
const toObject = {};
|
|
336
|
+
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
337
|
+
if (fromVideo != null) {
|
|
338
|
+
setValueByPath(toObject, ['video'], videoFromVertex$1(fromVideo));
|
|
339
|
+
}
|
|
340
|
+
return toObject;
|
|
341
|
+
}
|
|
342
|
+
function generateVideosResponseFromVertex$1(fromObject) {
|
|
343
|
+
const toObject = {};
|
|
344
|
+
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
345
|
+
if (fromGeneratedVideos != null) {
|
|
346
|
+
let transformedList = fromGeneratedVideos;
|
|
347
|
+
if (Array.isArray(transformedList)) {
|
|
348
|
+
transformedList = transformedList.map((item) => {
|
|
349
|
+
return generatedVideoFromVertex$1(item);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
353
|
+
}
|
|
354
|
+
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
355
|
+
'raiMediaFilteredCount',
|
|
356
|
+
]);
|
|
357
|
+
if (fromRaiMediaFilteredCount != null) {
|
|
358
|
+
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
359
|
+
}
|
|
360
|
+
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
361
|
+
'raiMediaFilteredReasons',
|
|
362
|
+
]);
|
|
363
|
+
if (fromRaiMediaFilteredReasons != null) {
|
|
364
|
+
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
365
|
+
}
|
|
366
|
+
return toObject;
|
|
367
|
+
}
|
|
368
|
+
function generateVideosOperationFromVertex$1(fromObject) {
|
|
369
|
+
const toObject = {};
|
|
370
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
371
|
+
if (fromName != null) {
|
|
372
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
373
|
+
}
|
|
374
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
375
|
+
if (fromMetadata != null) {
|
|
376
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
377
|
+
}
|
|
378
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
379
|
+
if (fromDone != null) {
|
|
380
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
381
|
+
}
|
|
382
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
383
|
+
if (fromError != null) {
|
|
384
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
385
|
+
}
|
|
386
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
387
|
+
if (fromResponse != null) {
|
|
388
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(fromResponse));
|
|
389
|
+
}
|
|
390
|
+
return toObject;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* @license
|
|
395
|
+
* Copyright 2025 Google LLC
|
|
396
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
397
|
+
*/
|
|
188
398
|
/** Required. Outcome of the code execution. */
|
|
189
399
|
exports.Outcome = void 0;
|
|
190
400
|
(function (Outcome) {
|
|
@@ -906,6 +1116,33 @@ exports.VideoGenerationReferenceType = void 0;
|
|
|
906
1116
|
*/
|
|
907
1117
|
VideoGenerationReferenceType["STYLE"] = "STYLE";
|
|
908
1118
|
})(exports.VideoGenerationReferenceType || (exports.VideoGenerationReferenceType = {}));
|
|
1119
|
+
/** Enum for the mask mode of a video generation mask. */
|
|
1120
|
+
exports.VideoGenerationMaskMode = void 0;
|
|
1121
|
+
(function (VideoGenerationMaskMode) {
|
|
1122
|
+
/**
|
|
1123
|
+
* The image mask contains a masked rectangular region which is
|
|
1124
|
+
applied on the first frame of the input video. The object described in
|
|
1125
|
+
the prompt is inserted into this region and will appear in subsequent
|
|
1126
|
+
frames.
|
|
1127
|
+
*/
|
|
1128
|
+
VideoGenerationMaskMode["INSERT"] = "INSERT";
|
|
1129
|
+
/**
|
|
1130
|
+
* The image mask is used to determine an object in the
|
|
1131
|
+
first video frame to track. This object is removed from the video.
|
|
1132
|
+
*/
|
|
1133
|
+
VideoGenerationMaskMode["REMOVE"] = "REMOVE";
|
|
1134
|
+
/**
|
|
1135
|
+
* The image mask is used to determine a region in the
|
|
1136
|
+
video. Objects in this region will be removed.
|
|
1137
|
+
*/
|
|
1138
|
+
VideoGenerationMaskMode["REMOVE_STATIC"] = "REMOVE_STATIC";
|
|
1139
|
+
/**
|
|
1140
|
+
* The image mask contains a masked rectangular region where
|
|
1141
|
+
the input video will go. The remaining area will be generated. Video
|
|
1142
|
+
masks are not supported.
|
|
1143
|
+
*/
|
|
1144
|
+
VideoGenerationMaskMode["OUTPAINT"] = "OUTPAINT";
|
|
1145
|
+
})(exports.VideoGenerationMaskMode || (exports.VideoGenerationMaskMode = {}));
|
|
909
1146
|
/** Enum that controls the compression quality of the generated videos. */
|
|
910
1147
|
exports.VideoCompressionQuality = void 0;
|
|
911
1148
|
(function (VideoCompressionQuality) {
|
|
@@ -935,6 +1172,26 @@ exports.FileSource = void 0;
|
|
|
935
1172
|
FileSource["UPLOADED"] = "UPLOADED";
|
|
936
1173
|
FileSource["GENERATED"] = "GENERATED";
|
|
937
1174
|
})(exports.FileSource || (exports.FileSource = {}));
|
|
1175
|
+
/** The reason why the turn is complete. */
|
|
1176
|
+
exports.TurnCompleteReason = void 0;
|
|
1177
|
+
(function (TurnCompleteReason) {
|
|
1178
|
+
/**
|
|
1179
|
+
* Default value. Reason is unspecified.
|
|
1180
|
+
*/
|
|
1181
|
+
TurnCompleteReason["TURN_COMPLETE_REASON_UNSPECIFIED"] = "TURN_COMPLETE_REASON_UNSPECIFIED";
|
|
1182
|
+
/**
|
|
1183
|
+
* The function call generated by the model is invalid.
|
|
1184
|
+
*/
|
|
1185
|
+
TurnCompleteReason["MALFORMED_FUNCTION_CALL"] = "MALFORMED_FUNCTION_CALL";
|
|
1186
|
+
/**
|
|
1187
|
+
* The response is rejected by the model.
|
|
1188
|
+
*/
|
|
1189
|
+
TurnCompleteReason["RESPONSE_REJECTED"] = "RESPONSE_REJECTED";
|
|
1190
|
+
/**
|
|
1191
|
+
* Needs more input from the user.
|
|
1192
|
+
*/
|
|
1193
|
+
TurnCompleteReason["NEED_MORE_INPUT"] = "NEED_MORE_INPUT";
|
|
1194
|
+
})(exports.TurnCompleteReason || (exports.TurnCompleteReason = {}));
|
|
938
1195
|
/** Server content modalities. */
|
|
939
1196
|
exports.MediaModality = void 0;
|
|
940
1197
|
(function (MediaModality) {
|
|
@@ -1576,54 +1833,15 @@ class GenerateVideosOperation {
|
|
|
1576
1833
|
*/
|
|
1577
1834
|
_fromAPIResponse({ apiResponse, isVertexAI, }) {
|
|
1578
1835
|
const operation = new GenerateVideosOperation();
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
operation.done = apiResponse['done'];
|
|
1582
|
-
operation.error = apiResponse['error'];
|
|
1836
|
+
let response;
|
|
1837
|
+
const op = apiResponse;
|
|
1583
1838
|
if (isVertexAI) {
|
|
1584
|
-
|
|
1585
|
-
if (response) {
|
|
1586
|
-
const operationResponse = new GenerateVideosResponse();
|
|
1587
|
-
const responseVideos = response['videos'];
|
|
1588
|
-
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1589
|
-
return {
|
|
1590
|
-
video: {
|
|
1591
|
-
uri: generatedVideo['gcsUri'],
|
|
1592
|
-
videoBytes: generatedVideo['bytesBase64Encoded']
|
|
1593
|
-
? tBytes$1(generatedVideo['bytesBase64Encoded'])
|
|
1594
|
-
: undefined,
|
|
1595
|
-
mimeType: generatedVideo['mimeType'],
|
|
1596
|
-
},
|
|
1597
|
-
};
|
|
1598
|
-
});
|
|
1599
|
-
operationResponse.raiMediaFilteredCount = response['raiMediaFilteredCount'];
|
|
1600
|
-
operationResponse.raiMediaFilteredReasons = response['raiMediaFilteredReasons'];
|
|
1601
|
-
operation.response = operationResponse;
|
|
1602
|
-
}
|
|
1839
|
+
response = generateVideosOperationFromVertex$1(op);
|
|
1603
1840
|
}
|
|
1604
1841
|
else {
|
|
1605
|
-
|
|
1606
|
-
if (response) {
|
|
1607
|
-
const operationResponse = new GenerateVideosResponse();
|
|
1608
|
-
const generatedVideoResponse = response['generateVideoResponse'];
|
|
1609
|
-
const responseVideos = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['generatedSamples'];
|
|
1610
|
-
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1611
|
-
const video = generatedVideo['video'];
|
|
1612
|
-
return {
|
|
1613
|
-
video: {
|
|
1614
|
-
uri: video === null || video === void 0 ? void 0 : video['uri'],
|
|
1615
|
-
videoBytes: (video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1616
|
-
? tBytes$1(video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1617
|
-
: undefined,
|
|
1618
|
-
mimeType: generatedVideo['encoding'],
|
|
1619
|
-
},
|
|
1620
|
-
};
|
|
1621
|
-
});
|
|
1622
|
-
operationResponse.raiMediaFilteredCount = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredCount'];
|
|
1623
|
-
operationResponse.raiMediaFilteredReasons = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredReasons'];
|
|
1624
|
-
operation.response = operationResponse;
|
|
1625
|
-
}
|
|
1842
|
+
response = generateVideosOperationFromMldev$1(op);
|
|
1626
1843
|
}
|
|
1844
|
+
Object.assign(operation, response);
|
|
1627
1845
|
return operation;
|
|
1628
1846
|
}
|
|
1629
1847
|
}
|
|
@@ -5600,8 +5818,9 @@ function fileDataToVertex$2(fromObject) {
|
|
|
5600
5818
|
}
|
|
5601
5819
|
function functionCallToVertex$2(fromObject) {
|
|
5602
5820
|
const toObject = {};
|
|
5603
|
-
|
|
5604
|
-
|
|
5821
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5822
|
+
if (fromId != null) {
|
|
5823
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5605
5824
|
}
|
|
5606
5825
|
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5607
5826
|
if (fromArgs != null) {
|
|
@@ -7026,7 +7245,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7026
7245
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7027
7246
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7028
7247
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7029
|
-
const SDK_VERSION = '1.
|
|
7248
|
+
const SDK_VERSION = '1.20.0'; // x-release-please-version
|
|
7030
7249
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7031
7250
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7032
7251
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -9103,8 +9322,9 @@ function fileDataToVertex$1(fromObject) {
|
|
|
9103
9322
|
}
|
|
9104
9323
|
function functionCallToVertex$1(fromObject) {
|
|
9105
9324
|
const toObject = {};
|
|
9106
|
-
|
|
9107
|
-
|
|
9325
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
9326
|
+
if (fromId != null) {
|
|
9327
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
9108
9328
|
}
|
|
9109
9329
|
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9110
9330
|
if (fromArgs != null) {
|
|
@@ -9877,6 +10097,18 @@ function liveServerContentFromMldev(fromObject) {
|
|
|
9877
10097
|
if (fromUrlContextMetadata != null) {
|
|
9878
10098
|
setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromMldev$1(fromUrlContextMetadata));
|
|
9879
10099
|
}
|
|
10100
|
+
const fromTurnCompleteReason = getValueByPath(fromObject, [
|
|
10101
|
+
'turnCompleteReason',
|
|
10102
|
+
]);
|
|
10103
|
+
if (fromTurnCompleteReason != null) {
|
|
10104
|
+
setValueByPath(toObject, ['turnCompleteReason'], fromTurnCompleteReason);
|
|
10105
|
+
}
|
|
10106
|
+
const fromWaitingForInput = getValueByPath(fromObject, [
|
|
10107
|
+
'waitingForInput',
|
|
10108
|
+
]);
|
|
10109
|
+
if (fromWaitingForInput != null) {
|
|
10110
|
+
setValueByPath(toObject, ['waitingForInput'], fromWaitingForInput);
|
|
10111
|
+
}
|
|
9880
10112
|
return toObject;
|
|
9881
10113
|
}
|
|
9882
10114
|
function liveServerToolCallFromMldev(fromObject) {
|
|
@@ -10301,6 +10533,10 @@ function fileDataFromVertex$1(fromObject) {
|
|
|
10301
10533
|
}
|
|
10302
10534
|
function functionCallFromVertex$1(fromObject) {
|
|
10303
10535
|
const toObject = {};
|
|
10536
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
10537
|
+
if (fromId != null) {
|
|
10538
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
10539
|
+
}
|
|
10304
10540
|
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10305
10541
|
if (fromArgs != null) {
|
|
10306
10542
|
setValueByPath(toObject, ['args'], fromArgs);
|
|
@@ -10433,6 +10669,18 @@ function liveServerContentFromVertex(fromObject) {
|
|
|
10433
10669
|
if (fromOutputTranscription != null) {
|
|
10434
10670
|
setValueByPath(toObject, ['outputTranscription'], transcriptionFromVertex(fromOutputTranscription));
|
|
10435
10671
|
}
|
|
10672
|
+
const fromTurnCompleteReason = getValueByPath(fromObject, [
|
|
10673
|
+
'turnCompleteReason',
|
|
10674
|
+
]);
|
|
10675
|
+
if (fromTurnCompleteReason != null) {
|
|
10676
|
+
setValueByPath(toObject, ['turnCompleteReason'], fromTurnCompleteReason);
|
|
10677
|
+
}
|
|
10678
|
+
const fromWaitingForInput = getValueByPath(fromObject, [
|
|
10679
|
+
'waitingForInput',
|
|
10680
|
+
]);
|
|
10681
|
+
if (fromWaitingForInput != null) {
|
|
10682
|
+
setValueByPath(toObject, ['waitingForInput'], fromWaitingForInput);
|
|
10683
|
+
}
|
|
10436
10684
|
return toObject;
|
|
10437
10685
|
}
|
|
10438
10686
|
function liveServerToolCallFromVertex(fromObject) {
|
|
@@ -11683,6 +11931,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
11683
11931
|
if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
|
|
11684
11932
|
throw new Error('referenceImages parameter is not supported in Gemini API.');
|
|
11685
11933
|
}
|
|
11934
|
+
if (getValueByPath(fromObject, ['mask']) !== undefined) {
|
|
11935
|
+
throw new Error('mask parameter is not supported in Gemini API.');
|
|
11936
|
+
}
|
|
11686
11937
|
if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
|
|
11687
11938
|
throw new Error('compressionQuality parameter is not supported in Gemini API.');
|
|
11688
11939
|
}
|
|
@@ -11765,8 +12016,9 @@ function fileDataToVertex(fromObject) {
|
|
|
11765
12016
|
}
|
|
11766
12017
|
function functionCallToVertex(fromObject) {
|
|
11767
12018
|
const toObject = {};
|
|
11768
|
-
|
|
11769
|
-
|
|
12019
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
12020
|
+
if (fromId != null) {
|
|
12021
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
11770
12022
|
}
|
|
11771
12023
|
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
11772
12024
|
if (fromArgs != null) {
|
|
@@ -13290,6 +13542,18 @@ function videoGenerationReferenceImageToVertex(fromObject) {
|
|
|
13290
13542
|
}
|
|
13291
13543
|
return toObject;
|
|
13292
13544
|
}
|
|
13545
|
+
function videoGenerationMaskToVertex(fromObject) {
|
|
13546
|
+
const toObject = {};
|
|
13547
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
13548
|
+
if (fromImage != null) {
|
|
13549
|
+
setValueByPath(toObject, ['_self'], imageToVertex(fromImage));
|
|
13550
|
+
}
|
|
13551
|
+
const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
|
|
13552
|
+
if (fromMaskMode != null) {
|
|
13553
|
+
setValueByPath(toObject, ['maskMode'], fromMaskMode);
|
|
13554
|
+
}
|
|
13555
|
+
return toObject;
|
|
13556
|
+
}
|
|
13293
13557
|
function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
13294
13558
|
const toObject = {};
|
|
13295
13559
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -13368,6 +13632,10 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
|
13368
13632
|
}
|
|
13369
13633
|
setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
|
|
13370
13634
|
}
|
|
13635
|
+
const fromMask = getValueByPath(fromObject, ['mask']);
|
|
13636
|
+
if (parentObject !== undefined && fromMask != null) {
|
|
13637
|
+
setValueByPath(parentObject, ['instances[0]', 'mask'], videoGenerationMaskToVertex(fromMask));
|
|
13638
|
+
}
|
|
13371
13639
|
const fromCompressionQuality = getValueByPath(fromObject, [
|
|
13372
13640
|
'compressionQuality',
|
|
13373
13641
|
]);
|
|
@@ -14026,6 +14294,10 @@ function fileDataFromVertex(fromObject) {
|
|
|
14026
14294
|
}
|
|
14027
14295
|
function functionCallFromVertex(fromObject) {
|
|
14028
14296
|
const toObject = {};
|
|
14297
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
14298
|
+
if (fromId != null) {
|
|
14299
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
14300
|
+
}
|
|
14029
14301
|
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
14030
14302
|
if (fromArgs != null) {
|
|
14031
14303
|
setValueByPath(toObject, ['args'], fromArgs);
|
|
@@ -17163,59 +17435,6 @@ class Models extends BaseModule {
|
|
|
17163
17435
|
}
|
|
17164
17436
|
}
|
|
17165
17437
|
|
|
17166
|
-
/**
|
|
17167
|
-
* @license
|
|
17168
|
-
* Copyright 2025 Google LLC
|
|
17169
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
17170
|
-
*/
|
|
17171
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
17172
|
-
function getOperationParametersToMldev(fromObject) {
|
|
17173
|
-
const toObject = {};
|
|
17174
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
17175
|
-
'operationName',
|
|
17176
|
-
]);
|
|
17177
|
-
if (fromOperationName != null) {
|
|
17178
|
-
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
17179
|
-
}
|
|
17180
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
17181
|
-
if (fromConfig != null) {
|
|
17182
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
17183
|
-
}
|
|
17184
|
-
return toObject;
|
|
17185
|
-
}
|
|
17186
|
-
function fetchPredictOperationParametersToVertex(fromObject) {
|
|
17187
|
-
const toObject = {};
|
|
17188
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
17189
|
-
'operationName',
|
|
17190
|
-
]);
|
|
17191
|
-
if (fromOperationName != null) {
|
|
17192
|
-
setValueByPath(toObject, ['operationName'], fromOperationName);
|
|
17193
|
-
}
|
|
17194
|
-
const fromResourceName = getValueByPath(fromObject, ['resourceName']);
|
|
17195
|
-
if (fromResourceName != null) {
|
|
17196
|
-
setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
|
|
17197
|
-
}
|
|
17198
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
17199
|
-
if (fromConfig != null) {
|
|
17200
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
17201
|
-
}
|
|
17202
|
-
return toObject;
|
|
17203
|
-
}
|
|
17204
|
-
function getOperationParametersToVertex(fromObject) {
|
|
17205
|
-
const toObject = {};
|
|
17206
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
17207
|
-
'operationName',
|
|
17208
|
-
]);
|
|
17209
|
-
if (fromOperationName != null) {
|
|
17210
|
-
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
17211
|
-
}
|
|
17212
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
17213
|
-
if (fromConfig != null) {
|
|
17214
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
17215
|
-
}
|
|
17216
|
-
return toObject;
|
|
17217
|
-
}
|
|
17218
|
-
|
|
17219
17438
|
/**
|
|
17220
17439
|
* @license
|
|
17221
17440
|
* Copyright 2025 Google LLC
|
|
@@ -18397,6 +18616,9 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
18397
18616
|
if (parentObject !== undefined && fromLearningRate != null) {
|
|
18398
18617
|
setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
|
|
18399
18618
|
}
|
|
18619
|
+
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
18620
|
+
throw new Error('labels parameter is not supported in Gemini API.');
|
|
18621
|
+
}
|
|
18400
18622
|
return toObject;
|
|
18401
18623
|
}
|
|
18402
18624
|
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
@@ -18552,6 +18774,10 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
18552
18774
|
if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
|
|
18553
18775
|
throw new Error('learningRate parameter is not supported in Vertex AI.');
|
|
18554
18776
|
}
|
|
18777
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
18778
|
+
if (parentObject !== undefined && fromLabels != null) {
|
|
18779
|
+
setValueByPath(parentObject, ['labels'], fromLabels);
|
|
18780
|
+
}
|
|
18555
18781
|
return toObject;
|
|
18556
18782
|
}
|
|
18557
18783
|
function createTuningJobParametersPrivateToVertex(fromObject) {
|