@google/genai 1.10.0 → 1.11.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 +95 -18
- package/dist/index.cjs +327 -228
- package/dist/index.mjs +327 -229
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +335 -236
- package/dist/node/index.mjs +335 -237
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +95 -18
- package/dist/web/index.mjs +335 -237
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +95 -18
- package/package.json +2 -2
package/dist/genai.d.ts
CHANGED
|
@@ -2755,6 +2755,10 @@ export declare interface GenerateImagesConfig {
|
|
|
2755
2755
|
/** Whether to add a watermark to the generated images.
|
|
2756
2756
|
*/
|
|
2757
2757
|
addWatermark?: boolean;
|
|
2758
|
+
/** The size of the largest dimension of the generated image.
|
|
2759
|
+
Supported sizes are 1K and 2K (not supported for Imagen 3 models).
|
|
2760
|
+
*/
|
|
2761
|
+
imageSize?: string;
|
|
2758
2762
|
/** Whether to use the prompt rewriting logic.
|
|
2759
2763
|
*/
|
|
2760
2764
|
enhancePrompt?: boolean;
|
|
@@ -2825,8 +2829,8 @@ export declare interface GenerateVideosConfig {
|
|
|
2825
2829
|
compressionQuality?: VideoCompressionQuality;
|
|
2826
2830
|
}
|
|
2827
2831
|
|
|
2828
|
-
/** A video generation operation. */
|
|
2829
|
-
export declare
|
|
2832
|
+
/** A video generation long-running operation. */
|
|
2833
|
+
export declare class GenerateVideosOperation implements Operation<GenerateVideosResponse> {
|
|
2830
2834
|
/** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
|
|
2831
2835
|
name?: string;
|
|
2832
2836
|
/** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */
|
|
@@ -2835,8 +2839,13 @@ export declare interface GenerateVideosOperation {
|
|
|
2835
2839
|
done?: boolean;
|
|
2836
2840
|
/** The error result of the operation in case of failure or cancellation. */
|
|
2837
2841
|
error?: Record<string, unknown>;
|
|
2838
|
-
/** The
|
|
2842
|
+
/** The response if the operation is successful. */
|
|
2839
2843
|
response?: GenerateVideosResponse;
|
|
2844
|
+
/**
|
|
2845
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
2846
|
+
* @internal
|
|
2847
|
+
*/
|
|
2848
|
+
_fromAPIResponse({ apiResponse, isVertexAI, }: OperationFromAPIResponseParameters): Operation<GenerateVideosResponse>;
|
|
2840
2849
|
}
|
|
2841
2850
|
|
|
2842
2851
|
/** Class that represents the parameters for generating videos. */
|
|
@@ -3690,6 +3699,8 @@ export declare interface ListBatchJobsParameters {
|
|
|
3690
3699
|
|
|
3691
3700
|
/** Config for batches.list return value. */
|
|
3692
3701
|
export declare class ListBatchJobsResponse {
|
|
3702
|
+
/** Used to retain the full HTTP response. */
|
|
3703
|
+
sdkHttpResponse?: HttpResponse;
|
|
3693
3704
|
nextPageToken?: string;
|
|
3694
3705
|
batchJobs?: BatchJob[];
|
|
3695
3706
|
}
|
|
@@ -3717,6 +3728,8 @@ export declare interface ListCachedContentsParameters {
|
|
|
3717
3728
|
}
|
|
3718
3729
|
|
|
3719
3730
|
export declare class ListCachedContentsResponse {
|
|
3731
|
+
/** Used to retain the full HTTP response. */
|
|
3732
|
+
sdkHttpResponse?: HttpResponse;
|
|
3720
3733
|
nextPageToken?: string;
|
|
3721
3734
|
/** List of cached contents.
|
|
3722
3735
|
*/
|
|
@@ -3746,6 +3759,8 @@ export declare interface ListFilesParameters {
|
|
|
3746
3759
|
|
|
3747
3760
|
/** Response for the list files method. */
|
|
3748
3761
|
export declare class ListFilesResponse {
|
|
3762
|
+
/** Used to retain the full HTTP response. */
|
|
3763
|
+
sdkHttpResponse?: HttpResponse;
|
|
3749
3764
|
/** A token to retrieve next page of results. */
|
|
3750
3765
|
nextPageToken?: string;
|
|
3751
3766
|
/** The list of files. */
|
|
@@ -3774,6 +3789,8 @@ export declare interface ListModelsParameters {
|
|
|
3774
3789
|
}
|
|
3775
3790
|
|
|
3776
3791
|
export declare class ListModelsResponse {
|
|
3792
|
+
/** Used to retain the full HTTP response. */
|
|
3793
|
+
sdkHttpResponse?: HttpResponse;
|
|
3777
3794
|
nextPageToken?: string;
|
|
3778
3795
|
models?: Model[];
|
|
3779
3796
|
}
|
|
@@ -3801,6 +3818,8 @@ export declare interface ListTuningJobsParameters {
|
|
|
3801
3818
|
|
|
3802
3819
|
/** Response for the list tuning jobs method. */
|
|
3803
3820
|
export declare class ListTuningJobsResponse {
|
|
3821
|
+
/** Used to retain the full HTTP response. */
|
|
3822
|
+
sdkHttpResponse?: HttpResponse;
|
|
3804
3823
|
/** A token to retrieve the next page of results. Pass to ListTuningJobsRequest.page_token to obtain that page. */
|
|
3805
3824
|
nextPageToken?: string;
|
|
3806
3825
|
/** List of TuningJobs in the requested page. */
|
|
@@ -4859,7 +4878,7 @@ export declare class Models extends BaseModule {
|
|
|
4859
4878
|
* modify the original params. Also sets the MCP usage header if there are
|
|
4860
4879
|
* MCP tools in the parameters.
|
|
4861
4880
|
*/
|
|
4862
|
-
private
|
|
4881
|
+
private processParamsMaybeAddMcpUsage;
|
|
4863
4882
|
private initAfcToolsMap;
|
|
4864
4883
|
private processAfcStream;
|
|
4865
4884
|
/**
|
|
@@ -4925,6 +4944,30 @@ export declare class Models extends BaseModule {
|
|
|
4925
4944
|
* ```
|
|
4926
4945
|
*/
|
|
4927
4946
|
upscaleImage: (params: types.UpscaleImageParameters) => Promise<types.UpscaleImageResponse>;
|
|
4947
|
+
/**
|
|
4948
|
+
* Generates videos based on a text description and configuration.
|
|
4949
|
+
*
|
|
4950
|
+
* @param params - The parameters for generating videos.
|
|
4951
|
+
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
4952
|
+
*
|
|
4953
|
+
* @example
|
|
4954
|
+
* ```ts
|
|
4955
|
+
* const operation = await ai.models.generateVideos({
|
|
4956
|
+
* model: 'veo-2.0-generate-001',
|
|
4957
|
+
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
4958
|
+
* config: {
|
|
4959
|
+
* numberOfVideos: 1
|
|
4960
|
+
* });
|
|
4961
|
+
*
|
|
4962
|
+
* while (!operation.done) {
|
|
4963
|
+
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
4964
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
4965
|
+
* }
|
|
4966
|
+
*
|
|
4967
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
4968
|
+
* ```
|
|
4969
|
+
*/
|
|
4970
|
+
generateVideos: (params: types.GenerateVideosParameters) => Promise<types.GenerateVideosOperation>;
|
|
4928
4971
|
private generateContentInternal;
|
|
4929
4972
|
private generateContentStreamInternal;
|
|
4930
4973
|
/**
|
|
@@ -5070,7 +5113,7 @@ export declare class Models extends BaseModule {
|
|
|
5070
5113
|
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
5071
5114
|
* ```
|
|
5072
5115
|
*/
|
|
5073
|
-
|
|
5116
|
+
private generateVideosInternal;
|
|
5074
5117
|
}
|
|
5075
5118
|
|
|
5076
5119
|
/** Config for model selection. */
|
|
@@ -5085,10 +5128,37 @@ export declare interface MultiSpeakerVoiceConfig {
|
|
|
5085
5128
|
speakerVoiceConfigs?: SpeakerVoiceConfig[];
|
|
5086
5129
|
}
|
|
5087
5130
|
|
|
5131
|
+
/** A long-running operation. */
|
|
5132
|
+
export declare interface Operation<T> {
|
|
5133
|
+
/** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
|
|
5134
|
+
name?: string;
|
|
5135
|
+
/** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */
|
|
5136
|
+
metadata?: Record<string, unknown>;
|
|
5137
|
+
/** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */
|
|
5138
|
+
done?: boolean;
|
|
5139
|
+
/** The error result of the operation in case of failure or cancellation. */
|
|
5140
|
+
error?: Record<string, unknown>;
|
|
5141
|
+
/** The response if the operation is successful. */
|
|
5142
|
+
response?: T;
|
|
5143
|
+
/**
|
|
5144
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
5145
|
+
* @internal
|
|
5146
|
+
*/
|
|
5147
|
+
_fromAPIResponse({ apiResponse, isVertexAI, }: OperationFromAPIResponseParameters): Operation<T>;
|
|
5148
|
+
}
|
|
5149
|
+
|
|
5150
|
+
/** Parameters of the fromAPIResponse method of the Operation class. */
|
|
5151
|
+
export declare interface OperationFromAPIResponseParameters {
|
|
5152
|
+
/** The API response to be converted to an Operation. */
|
|
5153
|
+
apiResponse: Record<string, unknown>;
|
|
5154
|
+
/** Whether the API response is from Vertex AI. */
|
|
5155
|
+
isVertexAI: boolean;
|
|
5156
|
+
}
|
|
5157
|
+
|
|
5088
5158
|
/** Parameters for the get method of the operations module. */
|
|
5089
|
-
export declare interface OperationGetParameters {
|
|
5159
|
+
export declare interface OperationGetParameters<T, U extends Operation<T>> {
|
|
5090
5160
|
/** The operation to be retrieved. */
|
|
5091
|
-
operation:
|
|
5161
|
+
operation: U;
|
|
5092
5162
|
/** Used to override the default configuration. */
|
|
5093
5163
|
config?: GetOperationConfig;
|
|
5094
5164
|
}
|
|
@@ -5102,7 +5172,14 @@ export declare class Operations extends BaseModule {
|
|
|
5102
5172
|
* @param parameters The parameters for the get operation request.
|
|
5103
5173
|
* @return The updated Operation object, with the latest status or result.
|
|
5104
5174
|
*/
|
|
5105
|
-
getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
|
|
5175
|
+
getVideosOperation(parameters: types.OperationGetParameters<types.GenerateVideosResponse, types.GenerateVideosOperation>): Promise<types.GenerateVideosOperation>;
|
|
5176
|
+
/**
|
|
5177
|
+
* Gets the status of a long-running operation.
|
|
5178
|
+
*
|
|
5179
|
+
* @param parameters The parameters for the get operation request.
|
|
5180
|
+
* @return The updated Operation object, with the latest status or result.
|
|
5181
|
+
*/
|
|
5182
|
+
get<T, U extends types.Operation<T>>(parameters: types.OperationGetParameters<T, U>): Promise<types.Operation<T>>;
|
|
5106
5183
|
private getVideosOperationInternal;
|
|
5107
5184
|
private fetchPredictVideosOperationInternal;
|
|
5108
5185
|
}
|
|
@@ -5127,14 +5204,6 @@ export declare enum Outcome {
|
|
|
5127
5204
|
OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
|
|
5128
5205
|
}
|
|
5129
5206
|
|
|
5130
|
-
/**
|
|
5131
|
-
* @license
|
|
5132
|
-
* Copyright 2025 Google LLC
|
|
5133
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5134
|
-
*/
|
|
5135
|
-
/**
|
|
5136
|
-
* Pagers for the GenAI List APIs.
|
|
5137
|
-
*/
|
|
5138
5207
|
export declare enum PagedItem {
|
|
5139
5208
|
PAGED_ITEM_BATCH_JOBS = "batchJobs",
|
|
5140
5209
|
PAGED_ITEM_MODELS = "models",
|
|
@@ -5152,6 +5221,7 @@ declare interface PagedItemConfig {
|
|
|
5152
5221
|
|
|
5153
5222
|
declare interface PagedItemResponse<T> {
|
|
5154
5223
|
nextPageToken?: string;
|
|
5224
|
+
sdkHttpResponse?: types.HttpResponse;
|
|
5155
5225
|
batchJobs?: T[];
|
|
5156
5226
|
models?: T[];
|
|
5157
5227
|
tuningJobs?: T[];
|
|
@@ -5167,6 +5237,7 @@ export declare class Pager<T> implements AsyncIterable<T> {
|
|
|
5167
5237
|
private pageInternal;
|
|
5168
5238
|
private paramsInternal;
|
|
5169
5239
|
private pageInternalSize;
|
|
5240
|
+
private sdkHttpResponseInternal?;
|
|
5170
5241
|
protected requestInternal: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>;
|
|
5171
5242
|
protected idxInternal: number;
|
|
5172
5243
|
constructor(name: PagedItem, request: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>, response: PagedItemResponse<T>, params: PagedItemConfig);
|
|
@@ -5191,6 +5262,10 @@ export declare class Pager<T> implements AsyncIterable<T> {
|
|
|
5191
5262
|
* The number of items in the page is less than or equal to the page length.
|
|
5192
5263
|
*/
|
|
5193
5264
|
get pageSize(): number;
|
|
5265
|
+
/**
|
|
5266
|
+
* Returns the headers of the API response.
|
|
5267
|
+
*/
|
|
5268
|
+
get sdkHttpResponse(): types.HttpResponse | undefined;
|
|
5194
5269
|
/**
|
|
5195
5270
|
* Returns the parameters when making the API request for the next page.
|
|
5196
5271
|
*
|
|
@@ -6684,7 +6759,6 @@ declare namespace types {
|
|
|
6684
6759
|
GenerateVideosParameters,
|
|
6685
6760
|
GeneratedVideo,
|
|
6686
6761
|
GenerateVideosResponse,
|
|
6687
|
-
GenerateVideosOperation,
|
|
6688
6762
|
GetTuningJobConfig,
|
|
6689
6763
|
GetTuningJobParameters,
|
|
6690
6764
|
TunedModelCheckpoint,
|
|
@@ -6788,6 +6862,10 @@ declare namespace types {
|
|
|
6788
6862
|
LiveServerGoAway,
|
|
6789
6863
|
LiveServerSessionResumptionUpdate,
|
|
6790
6864
|
LiveServerMessage,
|
|
6865
|
+
OperationGetParameters,
|
|
6866
|
+
OperationFromAPIResponseParameters,
|
|
6867
|
+
Operation,
|
|
6868
|
+
GenerateVideosOperation,
|
|
6791
6869
|
AutomaticActivityDetection,
|
|
6792
6870
|
RealtimeInputConfig,
|
|
6793
6871
|
SessionResumptionConfig,
|
|
@@ -6831,7 +6909,6 @@ declare namespace types {
|
|
|
6831
6909
|
LiveConnectConstraints,
|
|
6832
6910
|
CreateAuthTokenConfig,
|
|
6833
6911
|
CreateAuthTokenParameters,
|
|
6834
|
-
OperationGetParameters,
|
|
6835
6912
|
BlobImageUnion,
|
|
6836
6913
|
PartUnion,
|
|
6837
6914
|
PartListUnion,
|