@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/web/web.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. */
|
|
@@ -3695,6 +3704,8 @@ export declare interface ListBatchJobsParameters {
|
|
|
3695
3704
|
|
|
3696
3705
|
/** Config for batches.list return value. */
|
|
3697
3706
|
export declare class ListBatchJobsResponse {
|
|
3707
|
+
/** Used to retain the full HTTP response. */
|
|
3708
|
+
sdkHttpResponse?: HttpResponse;
|
|
3698
3709
|
nextPageToken?: string;
|
|
3699
3710
|
batchJobs?: BatchJob[];
|
|
3700
3711
|
}
|
|
@@ -3722,6 +3733,8 @@ export declare interface ListCachedContentsParameters {
|
|
|
3722
3733
|
}
|
|
3723
3734
|
|
|
3724
3735
|
export declare class ListCachedContentsResponse {
|
|
3736
|
+
/** Used to retain the full HTTP response. */
|
|
3737
|
+
sdkHttpResponse?: HttpResponse;
|
|
3725
3738
|
nextPageToken?: string;
|
|
3726
3739
|
/** List of cached contents.
|
|
3727
3740
|
*/
|
|
@@ -3751,6 +3764,8 @@ export declare interface ListFilesParameters {
|
|
|
3751
3764
|
|
|
3752
3765
|
/** Response for the list files method. */
|
|
3753
3766
|
export declare class ListFilesResponse {
|
|
3767
|
+
/** Used to retain the full HTTP response. */
|
|
3768
|
+
sdkHttpResponse?: HttpResponse;
|
|
3754
3769
|
/** A token to retrieve next page of results. */
|
|
3755
3770
|
nextPageToken?: string;
|
|
3756
3771
|
/** The list of files. */
|
|
@@ -3779,6 +3794,8 @@ export declare interface ListModelsParameters {
|
|
|
3779
3794
|
}
|
|
3780
3795
|
|
|
3781
3796
|
export declare class ListModelsResponse {
|
|
3797
|
+
/** Used to retain the full HTTP response. */
|
|
3798
|
+
sdkHttpResponse?: HttpResponse;
|
|
3782
3799
|
nextPageToken?: string;
|
|
3783
3800
|
models?: Model[];
|
|
3784
3801
|
}
|
|
@@ -3806,6 +3823,8 @@ export declare interface ListTuningJobsParameters {
|
|
|
3806
3823
|
|
|
3807
3824
|
/** Response for the list tuning jobs method. */
|
|
3808
3825
|
export declare class ListTuningJobsResponse {
|
|
3826
|
+
/** Used to retain the full HTTP response. */
|
|
3827
|
+
sdkHttpResponse?: HttpResponse;
|
|
3809
3828
|
/** A token to retrieve the next page of results. Pass to ListTuningJobsRequest.page_token to obtain that page. */
|
|
3810
3829
|
nextPageToken?: string;
|
|
3811
3830
|
/** List of TuningJobs in the requested page. */
|
|
@@ -4864,7 +4883,7 @@ export declare class Models extends BaseModule {
|
|
|
4864
4883
|
* modify the original params. Also sets the MCP usage header if there are
|
|
4865
4884
|
* MCP tools in the parameters.
|
|
4866
4885
|
*/
|
|
4867
|
-
private
|
|
4886
|
+
private processParamsMaybeAddMcpUsage;
|
|
4868
4887
|
private initAfcToolsMap;
|
|
4869
4888
|
private processAfcStream;
|
|
4870
4889
|
/**
|
|
@@ -4930,6 +4949,30 @@ export declare class Models extends BaseModule {
|
|
|
4930
4949
|
* ```
|
|
4931
4950
|
*/
|
|
4932
4951
|
upscaleImage: (params: types.UpscaleImageParameters) => Promise<types.UpscaleImageResponse>;
|
|
4952
|
+
/**
|
|
4953
|
+
* Generates videos based on a text description and configuration.
|
|
4954
|
+
*
|
|
4955
|
+
* @param params - The parameters for generating videos.
|
|
4956
|
+
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
4957
|
+
*
|
|
4958
|
+
* @example
|
|
4959
|
+
* ```ts
|
|
4960
|
+
* const operation = await ai.models.generateVideos({
|
|
4961
|
+
* model: 'veo-2.0-generate-001',
|
|
4962
|
+
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
4963
|
+
* config: {
|
|
4964
|
+
* numberOfVideos: 1
|
|
4965
|
+
* });
|
|
4966
|
+
*
|
|
4967
|
+
* while (!operation.done) {
|
|
4968
|
+
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
4969
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
4970
|
+
* }
|
|
4971
|
+
*
|
|
4972
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
4973
|
+
* ```
|
|
4974
|
+
*/
|
|
4975
|
+
generateVideos: (params: types.GenerateVideosParameters) => Promise<types.GenerateVideosOperation>;
|
|
4933
4976
|
private generateContentInternal;
|
|
4934
4977
|
private generateContentStreamInternal;
|
|
4935
4978
|
/**
|
|
@@ -5075,7 +5118,7 @@ export declare class Models extends BaseModule {
|
|
|
5075
5118
|
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
5076
5119
|
* ```
|
|
5077
5120
|
*/
|
|
5078
|
-
|
|
5121
|
+
private generateVideosInternal;
|
|
5079
5122
|
}
|
|
5080
5123
|
|
|
5081
5124
|
/** Config for model selection. */
|
|
@@ -5090,10 +5133,37 @@ export declare interface MultiSpeakerVoiceConfig {
|
|
|
5090
5133
|
speakerVoiceConfigs?: SpeakerVoiceConfig[];
|
|
5091
5134
|
}
|
|
5092
5135
|
|
|
5136
|
+
/** A long-running operation. */
|
|
5137
|
+
export declare interface Operation<T> {
|
|
5138
|
+
/** 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}`. */
|
|
5139
|
+
name?: string;
|
|
5140
|
+
/** 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. */
|
|
5141
|
+
metadata?: Record<string, unknown>;
|
|
5142
|
+
/** 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. */
|
|
5143
|
+
done?: boolean;
|
|
5144
|
+
/** The error result of the operation in case of failure or cancellation. */
|
|
5145
|
+
error?: Record<string, unknown>;
|
|
5146
|
+
/** The response if the operation is successful. */
|
|
5147
|
+
response?: T;
|
|
5148
|
+
/**
|
|
5149
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
5150
|
+
* @internal
|
|
5151
|
+
*/
|
|
5152
|
+
_fromAPIResponse({ apiResponse, isVertexAI, }: OperationFromAPIResponseParameters): Operation<T>;
|
|
5153
|
+
}
|
|
5154
|
+
|
|
5155
|
+
/** Parameters of the fromAPIResponse method of the Operation class. */
|
|
5156
|
+
export declare interface OperationFromAPIResponseParameters {
|
|
5157
|
+
/** The API response to be converted to an Operation. */
|
|
5158
|
+
apiResponse: Record<string, unknown>;
|
|
5159
|
+
/** Whether the API response is from Vertex AI. */
|
|
5160
|
+
isVertexAI: boolean;
|
|
5161
|
+
}
|
|
5162
|
+
|
|
5093
5163
|
/** Parameters for the get method of the operations module. */
|
|
5094
|
-
export declare interface OperationGetParameters {
|
|
5164
|
+
export declare interface OperationGetParameters<T, U extends Operation<T>> {
|
|
5095
5165
|
/** The operation to be retrieved. */
|
|
5096
|
-
operation:
|
|
5166
|
+
operation: U;
|
|
5097
5167
|
/** Used to override the default configuration. */
|
|
5098
5168
|
config?: GetOperationConfig;
|
|
5099
5169
|
}
|
|
@@ -5107,7 +5177,14 @@ export declare class Operations extends BaseModule {
|
|
|
5107
5177
|
* @param parameters The parameters for the get operation request.
|
|
5108
5178
|
* @return The updated Operation object, with the latest status or result.
|
|
5109
5179
|
*/
|
|
5110
|
-
getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
|
|
5180
|
+
getVideosOperation(parameters: types.OperationGetParameters<types.GenerateVideosResponse, types.GenerateVideosOperation>): Promise<types.GenerateVideosOperation>;
|
|
5181
|
+
/**
|
|
5182
|
+
* Gets the status of a long-running operation.
|
|
5183
|
+
*
|
|
5184
|
+
* @param parameters The parameters for the get operation request.
|
|
5185
|
+
* @return The updated Operation object, with the latest status or result.
|
|
5186
|
+
*/
|
|
5187
|
+
get<T, U extends types.Operation<T>>(parameters: types.OperationGetParameters<T, U>): Promise<types.Operation<T>>;
|
|
5111
5188
|
private getVideosOperationInternal;
|
|
5112
5189
|
private fetchPredictVideosOperationInternal;
|
|
5113
5190
|
}
|
|
@@ -5132,14 +5209,6 @@ export declare enum Outcome {
|
|
|
5132
5209
|
OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
|
|
5133
5210
|
}
|
|
5134
5211
|
|
|
5135
|
-
/**
|
|
5136
|
-
* @license
|
|
5137
|
-
* Copyright 2025 Google LLC
|
|
5138
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5139
|
-
*/
|
|
5140
|
-
/**
|
|
5141
|
-
* Pagers for the GenAI List APIs.
|
|
5142
|
-
*/
|
|
5143
5212
|
export declare enum PagedItem {
|
|
5144
5213
|
PAGED_ITEM_BATCH_JOBS = "batchJobs",
|
|
5145
5214
|
PAGED_ITEM_MODELS = "models",
|
|
@@ -5157,6 +5226,7 @@ declare interface PagedItemConfig {
|
|
|
5157
5226
|
|
|
5158
5227
|
declare interface PagedItemResponse<T> {
|
|
5159
5228
|
nextPageToken?: string;
|
|
5229
|
+
sdkHttpResponse?: types.HttpResponse;
|
|
5160
5230
|
batchJobs?: T[];
|
|
5161
5231
|
models?: T[];
|
|
5162
5232
|
tuningJobs?: T[];
|
|
@@ -5172,6 +5242,7 @@ export declare class Pager<T> implements AsyncIterable<T> {
|
|
|
5172
5242
|
private pageInternal;
|
|
5173
5243
|
private paramsInternal;
|
|
5174
5244
|
private pageInternalSize;
|
|
5245
|
+
private sdkHttpResponseInternal?;
|
|
5175
5246
|
protected requestInternal: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>;
|
|
5176
5247
|
protected idxInternal: number;
|
|
5177
5248
|
constructor(name: PagedItem, request: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>, response: PagedItemResponse<T>, params: PagedItemConfig);
|
|
@@ -5196,6 +5267,10 @@ export declare class Pager<T> implements AsyncIterable<T> {
|
|
|
5196
5267
|
* The number of items in the page is less than or equal to the page length.
|
|
5197
5268
|
*/
|
|
5198
5269
|
get pageSize(): number;
|
|
5270
|
+
/**
|
|
5271
|
+
* Returns the headers of the API response.
|
|
5272
|
+
*/
|
|
5273
|
+
get sdkHttpResponse(): types.HttpResponse | undefined;
|
|
5199
5274
|
/**
|
|
5200
5275
|
* Returns the parameters when making the API request for the next page.
|
|
5201
5276
|
*
|
|
@@ -6689,7 +6764,6 @@ declare namespace types {
|
|
|
6689
6764
|
GenerateVideosParameters,
|
|
6690
6765
|
GeneratedVideo,
|
|
6691
6766
|
GenerateVideosResponse,
|
|
6692
|
-
GenerateVideosOperation,
|
|
6693
6767
|
GetTuningJobConfig,
|
|
6694
6768
|
GetTuningJobParameters,
|
|
6695
6769
|
TunedModelCheckpoint,
|
|
@@ -6793,6 +6867,10 @@ declare namespace types {
|
|
|
6793
6867
|
LiveServerGoAway,
|
|
6794
6868
|
LiveServerSessionResumptionUpdate,
|
|
6795
6869
|
LiveServerMessage,
|
|
6870
|
+
OperationGetParameters,
|
|
6871
|
+
OperationFromAPIResponseParameters,
|
|
6872
|
+
Operation,
|
|
6873
|
+
GenerateVideosOperation,
|
|
6796
6874
|
AutomaticActivityDetection,
|
|
6797
6875
|
RealtimeInputConfig,
|
|
6798
6876
|
SessionResumptionConfig,
|
|
@@ -6836,7 +6914,6 @@ declare namespace types {
|
|
|
6836
6914
|
LiveConnectConstraints,
|
|
6837
6915
|
CreateAuthTokenConfig,
|
|
6838
6916
|
CreateAuthTokenParameters,
|
|
6839
|
-
OperationGetParameters,
|
|
6840
6917
|
BlobImageUnion,
|
|
6841
6918
|
PartUnion,
|
|
6842
6919
|
PartListUnion,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google/genai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/node/index.mjs",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"system-test": "tsc && jasmine dist/test/system/**/*_test.js",
|
|
45
45
|
"test-server-tests": "tsc && GOOGLE_CLOUD_PROJECT=googcloudproj GOOGLE_CLOUD_LOCATION=googcloudloc jasmine dist/test/system/node/*_test.js !dist/test/system/node/live_test.js -- --test-server",
|
|
46
46
|
"test-server-tests:record": "tsc && jasmine --fail-fast dist/test/system/node/*_test.js !dist/test/system/node/live_test.js -- --test-server --record",
|
|
47
|
-
"docs": "typedoc && ts-node scripts/add_docsite_license_headers.ts",
|
|
47
|
+
"docs": "typedoc && node --loader ts-node/esm scripts/add_docsite_license_headers.ts",
|
|
48
48
|
"pages-main": "node --loader ts-node/esm scripts/generate_pages.ts main",
|
|
49
49
|
"pages-release": "node --loader ts-node/esm scripts/generate_pages.ts release",
|
|
50
50
|
"format": "prettier '**/*.ts' '**/*.mjs' '**/*.json' --write",
|