@google/genai 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/genai.d.ts +113 -18
- package/dist/index.cjs +497 -246
- package/dist/index.mjs +497 -247
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +509 -258
- package/dist/node/index.mjs +509 -259
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +113 -18
- package/dist/web/index.mjs +504 -254
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +113 -18
- package/package.json +5 -5
package/dist/genai.d.ts
CHANGED
|
@@ -1041,6 +1041,8 @@ export declare interface ComputeTokensParameters {
|
|
|
1041
1041
|
|
|
1042
1042
|
/** Response for computing tokens. */
|
|
1043
1043
|
export declare class ComputeTokensResponse {
|
|
1044
|
+
/** Used to retain the full HTTP response. */
|
|
1045
|
+
sdkHttpResponse?: HttpResponse;
|
|
1044
1046
|
/** Lists of tokens info from the input. A ComputeTokensRequest could have multiple instances with a prompt in each instance. We also need to return lists of tokens info for the request with multiple instances. */
|
|
1045
1047
|
tokensInfo?: TokensInfo[];
|
|
1046
1048
|
}
|
|
@@ -1168,6 +1170,8 @@ export declare interface CountTokensParameters {
|
|
|
1168
1170
|
|
|
1169
1171
|
/** Response for counting tokens. */
|
|
1170
1172
|
export declare class CountTokensResponse {
|
|
1173
|
+
/** Used to retain the full HTTP response. */
|
|
1174
|
+
sdkHttpResponse?: HttpResponse;
|
|
1171
1175
|
/** Total number of tokens. */
|
|
1172
1176
|
totalTokens?: number;
|
|
1173
1177
|
/** Number of tokens in the cached part of the prompt (the cached content). */
|
|
@@ -1771,6 +1775,8 @@ export declare interface EditImageParameters {
|
|
|
1771
1775
|
|
|
1772
1776
|
/** Response for the request to edit an image. */
|
|
1773
1777
|
export declare class EditImageResponse {
|
|
1778
|
+
/** Used to retain the full HTTP response. */
|
|
1779
|
+
sdkHttpResponse?: HttpResponse;
|
|
1774
1780
|
/** Generated images. */
|
|
1775
1781
|
generatedImages?: GeneratedImage[];
|
|
1776
1782
|
}
|
|
@@ -1844,6 +1850,8 @@ export declare interface EmbedContentParameters {
|
|
|
1844
1850
|
|
|
1845
1851
|
/** Response for the embed_content method. */
|
|
1846
1852
|
export declare class EmbedContentResponse {
|
|
1853
|
+
/** Used to retain the full HTTP response. */
|
|
1854
|
+
sdkHttpResponse?: HttpResponse;
|
|
1847
1855
|
/** The embeddings for each request, in the same order as provided in
|
|
1848
1856
|
the batch request.
|
|
1849
1857
|
*/
|
|
@@ -2755,6 +2763,10 @@ export declare interface GenerateImagesConfig {
|
|
|
2755
2763
|
/** Whether to add a watermark to the generated images.
|
|
2756
2764
|
*/
|
|
2757
2765
|
addWatermark?: boolean;
|
|
2766
|
+
/** The size of the largest dimension of the generated image.
|
|
2767
|
+
Supported sizes are 1K and 2K (not supported for Imagen 3 models).
|
|
2768
|
+
*/
|
|
2769
|
+
imageSize?: string;
|
|
2758
2770
|
/** Whether to use the prompt rewriting logic.
|
|
2759
2771
|
*/
|
|
2760
2772
|
enhancePrompt?: boolean;
|
|
@@ -2775,6 +2787,8 @@ export declare interface GenerateImagesParameters {
|
|
|
2775
2787
|
|
|
2776
2788
|
/** The output images response. */
|
|
2777
2789
|
export declare class GenerateImagesResponse {
|
|
2790
|
+
/** Used to retain the full HTTP response. */
|
|
2791
|
+
sdkHttpResponse?: HttpResponse;
|
|
2778
2792
|
/** List of generated images.
|
|
2779
2793
|
*/
|
|
2780
2794
|
generatedImages?: GeneratedImage[];
|
|
@@ -2825,8 +2839,8 @@ export declare interface GenerateVideosConfig {
|
|
|
2825
2839
|
compressionQuality?: VideoCompressionQuality;
|
|
2826
2840
|
}
|
|
2827
2841
|
|
|
2828
|
-
/** A video generation operation. */
|
|
2829
|
-
export declare
|
|
2842
|
+
/** A video generation long-running operation. */
|
|
2843
|
+
export declare class GenerateVideosOperation implements Operation<GenerateVideosResponse> {
|
|
2830
2844
|
/** 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
2845
|
name?: string;
|
|
2832
2846
|
/** 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 +2849,15 @@ export declare interface GenerateVideosOperation {
|
|
|
2835
2849
|
done?: boolean;
|
|
2836
2850
|
/** The error result of the operation in case of failure or cancellation. */
|
|
2837
2851
|
error?: Record<string, unknown>;
|
|
2838
|
-
/** The
|
|
2852
|
+
/** The response if the operation is successful. */
|
|
2839
2853
|
response?: GenerateVideosResponse;
|
|
2854
|
+
/** The full HTTP response. */
|
|
2855
|
+
sdkHttpResponse?: HttpResponse;
|
|
2856
|
+
/**
|
|
2857
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
2858
|
+
* @internal
|
|
2859
|
+
*/
|
|
2860
|
+
_fromAPIResponse({ apiResponse, isVertexAI, }: OperationFromAPIResponseParameters): Operation<GenerateVideosResponse>;
|
|
2840
2861
|
}
|
|
2841
2862
|
|
|
2842
2863
|
/** Class that represents the parameters for generating videos. */
|
|
@@ -3690,6 +3711,8 @@ export declare interface ListBatchJobsParameters {
|
|
|
3690
3711
|
|
|
3691
3712
|
/** Config for batches.list return value. */
|
|
3692
3713
|
export declare class ListBatchJobsResponse {
|
|
3714
|
+
/** Used to retain the full HTTP response. */
|
|
3715
|
+
sdkHttpResponse?: HttpResponse;
|
|
3693
3716
|
nextPageToken?: string;
|
|
3694
3717
|
batchJobs?: BatchJob[];
|
|
3695
3718
|
}
|
|
@@ -3717,6 +3740,8 @@ export declare interface ListCachedContentsParameters {
|
|
|
3717
3740
|
}
|
|
3718
3741
|
|
|
3719
3742
|
export declare class ListCachedContentsResponse {
|
|
3743
|
+
/** Used to retain the full HTTP response. */
|
|
3744
|
+
sdkHttpResponse?: HttpResponse;
|
|
3720
3745
|
nextPageToken?: string;
|
|
3721
3746
|
/** List of cached contents.
|
|
3722
3747
|
*/
|
|
@@ -3746,6 +3771,8 @@ export declare interface ListFilesParameters {
|
|
|
3746
3771
|
|
|
3747
3772
|
/** Response for the list files method. */
|
|
3748
3773
|
export declare class ListFilesResponse {
|
|
3774
|
+
/** Used to retain the full HTTP response. */
|
|
3775
|
+
sdkHttpResponse?: HttpResponse;
|
|
3749
3776
|
/** A token to retrieve next page of results. */
|
|
3750
3777
|
nextPageToken?: string;
|
|
3751
3778
|
/** The list of files. */
|
|
@@ -3774,6 +3801,8 @@ export declare interface ListModelsParameters {
|
|
|
3774
3801
|
}
|
|
3775
3802
|
|
|
3776
3803
|
export declare class ListModelsResponse {
|
|
3804
|
+
/** Used to retain the full HTTP response. */
|
|
3805
|
+
sdkHttpResponse?: HttpResponse;
|
|
3777
3806
|
nextPageToken?: string;
|
|
3778
3807
|
models?: Model[];
|
|
3779
3808
|
}
|
|
@@ -3801,6 +3830,8 @@ export declare interface ListTuningJobsParameters {
|
|
|
3801
3830
|
|
|
3802
3831
|
/** Response for the list tuning jobs method. */
|
|
3803
3832
|
export declare class ListTuningJobsResponse {
|
|
3833
|
+
/** Used to retain the full HTTP response. */
|
|
3834
|
+
sdkHttpResponse?: HttpResponse;
|
|
3804
3835
|
/** A token to retrieve the next page of results. Pass to ListTuningJobsRequest.page_token to obtain that page. */
|
|
3805
3836
|
nextPageToken?: string;
|
|
3806
3837
|
/** List of TuningJobs in the requested page. */
|
|
@@ -4859,7 +4890,7 @@ export declare class Models extends BaseModule {
|
|
|
4859
4890
|
* modify the original params. Also sets the MCP usage header if there are
|
|
4860
4891
|
* MCP tools in the parameters.
|
|
4861
4892
|
*/
|
|
4862
|
-
private
|
|
4893
|
+
private processParamsMaybeAddMcpUsage;
|
|
4863
4894
|
private initAfcToolsMap;
|
|
4864
4895
|
private processAfcStream;
|
|
4865
4896
|
/**
|
|
@@ -4925,6 +4956,30 @@ export declare class Models extends BaseModule {
|
|
|
4925
4956
|
* ```
|
|
4926
4957
|
*/
|
|
4927
4958
|
upscaleImage: (params: types.UpscaleImageParameters) => Promise<types.UpscaleImageResponse>;
|
|
4959
|
+
/**
|
|
4960
|
+
* Generates videos based on a text description and configuration.
|
|
4961
|
+
*
|
|
4962
|
+
* @param params - The parameters for generating videos.
|
|
4963
|
+
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
4964
|
+
*
|
|
4965
|
+
* @example
|
|
4966
|
+
* ```ts
|
|
4967
|
+
* const operation = await ai.models.generateVideos({
|
|
4968
|
+
* model: 'veo-2.0-generate-001',
|
|
4969
|
+
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
4970
|
+
* config: {
|
|
4971
|
+
* numberOfVideos: 1
|
|
4972
|
+
* });
|
|
4973
|
+
*
|
|
4974
|
+
* while (!operation.done) {
|
|
4975
|
+
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
4976
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
4977
|
+
* }
|
|
4978
|
+
*
|
|
4979
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
4980
|
+
* ```
|
|
4981
|
+
*/
|
|
4982
|
+
generateVideos: (params: types.GenerateVideosParameters) => Promise<types.GenerateVideosOperation>;
|
|
4928
4983
|
private generateContentInternal;
|
|
4929
4984
|
private generateContentStreamInternal;
|
|
4930
4985
|
/**
|
|
@@ -5070,7 +5125,7 @@ export declare class Models extends BaseModule {
|
|
|
5070
5125
|
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
5071
5126
|
* ```
|
|
5072
5127
|
*/
|
|
5073
|
-
|
|
5128
|
+
private generateVideosInternal;
|
|
5074
5129
|
}
|
|
5075
5130
|
|
|
5076
5131
|
/** Config for model selection. */
|
|
@@ -5085,10 +5140,37 @@ export declare interface MultiSpeakerVoiceConfig {
|
|
|
5085
5140
|
speakerVoiceConfigs?: SpeakerVoiceConfig[];
|
|
5086
5141
|
}
|
|
5087
5142
|
|
|
5143
|
+
/** A long-running operation. */
|
|
5144
|
+
export declare interface Operation<T> {
|
|
5145
|
+
/** 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}`. */
|
|
5146
|
+
name?: string;
|
|
5147
|
+
/** 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. */
|
|
5148
|
+
metadata?: Record<string, unknown>;
|
|
5149
|
+
/** 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. */
|
|
5150
|
+
done?: boolean;
|
|
5151
|
+
/** The error result of the operation in case of failure or cancellation. */
|
|
5152
|
+
error?: Record<string, unknown>;
|
|
5153
|
+
/** The response if the operation is successful. */
|
|
5154
|
+
response?: T;
|
|
5155
|
+
/**
|
|
5156
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
5157
|
+
* @internal
|
|
5158
|
+
*/
|
|
5159
|
+
_fromAPIResponse({ apiResponse, isVertexAI, }: OperationFromAPIResponseParameters): Operation<T>;
|
|
5160
|
+
}
|
|
5161
|
+
|
|
5162
|
+
/** Parameters of the fromAPIResponse method of the Operation class. */
|
|
5163
|
+
export declare interface OperationFromAPIResponseParameters {
|
|
5164
|
+
/** The API response to be converted to an Operation. */
|
|
5165
|
+
apiResponse: Record<string, unknown>;
|
|
5166
|
+
/** Whether the API response is from Vertex AI. */
|
|
5167
|
+
isVertexAI: boolean;
|
|
5168
|
+
}
|
|
5169
|
+
|
|
5088
5170
|
/** Parameters for the get method of the operations module. */
|
|
5089
|
-
export declare interface OperationGetParameters {
|
|
5171
|
+
export declare interface OperationGetParameters<T, U extends Operation<T>> {
|
|
5090
5172
|
/** The operation to be retrieved. */
|
|
5091
|
-
operation:
|
|
5173
|
+
operation: U;
|
|
5092
5174
|
/** Used to override the default configuration. */
|
|
5093
5175
|
config?: GetOperationConfig;
|
|
5094
5176
|
}
|
|
@@ -5102,7 +5184,14 @@ export declare class Operations extends BaseModule {
|
|
|
5102
5184
|
* @param parameters The parameters for the get operation request.
|
|
5103
5185
|
* @return The updated Operation object, with the latest status or result.
|
|
5104
5186
|
*/
|
|
5105
|
-
getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
|
|
5187
|
+
getVideosOperation(parameters: types.OperationGetParameters<types.GenerateVideosResponse, types.GenerateVideosOperation>): Promise<types.GenerateVideosOperation>;
|
|
5188
|
+
/**
|
|
5189
|
+
* Gets the status of a long-running operation.
|
|
5190
|
+
*
|
|
5191
|
+
* @param parameters The parameters for the get operation request.
|
|
5192
|
+
* @return The updated Operation object, with the latest status or result.
|
|
5193
|
+
*/
|
|
5194
|
+
get<T, U extends types.Operation<T>>(parameters: types.OperationGetParameters<T, U>): Promise<types.Operation<T>>;
|
|
5106
5195
|
private getVideosOperationInternal;
|
|
5107
5196
|
private fetchPredictVideosOperationInternal;
|
|
5108
5197
|
}
|
|
@@ -5127,14 +5216,6 @@ export declare enum Outcome {
|
|
|
5127
5216
|
OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
|
|
5128
5217
|
}
|
|
5129
5218
|
|
|
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
5219
|
export declare enum PagedItem {
|
|
5139
5220
|
PAGED_ITEM_BATCH_JOBS = "batchJobs",
|
|
5140
5221
|
PAGED_ITEM_MODELS = "models",
|
|
@@ -5152,6 +5233,7 @@ declare interface PagedItemConfig {
|
|
|
5152
5233
|
|
|
5153
5234
|
declare interface PagedItemResponse<T> {
|
|
5154
5235
|
nextPageToken?: string;
|
|
5236
|
+
sdkHttpResponse?: types.HttpResponse;
|
|
5155
5237
|
batchJobs?: T[];
|
|
5156
5238
|
models?: T[];
|
|
5157
5239
|
tuningJobs?: T[];
|
|
@@ -5167,6 +5249,7 @@ export declare class Pager<T> implements AsyncIterable<T> {
|
|
|
5167
5249
|
private pageInternal;
|
|
5168
5250
|
private paramsInternal;
|
|
5169
5251
|
private pageInternalSize;
|
|
5252
|
+
private sdkHttpResponseInternal?;
|
|
5170
5253
|
protected requestInternal: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>;
|
|
5171
5254
|
protected idxInternal: number;
|
|
5172
5255
|
constructor(name: PagedItem, request: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>, response: PagedItemResponse<T>, params: PagedItemConfig);
|
|
@@ -5191,6 +5274,10 @@ export declare class Pager<T> implements AsyncIterable<T> {
|
|
|
5191
5274
|
* The number of items in the page is less than or equal to the page length.
|
|
5192
5275
|
*/
|
|
5193
5276
|
get pageSize(): number;
|
|
5277
|
+
/**
|
|
5278
|
+
* Returns the headers of the API response.
|
|
5279
|
+
*/
|
|
5280
|
+
get sdkHttpResponse(): types.HttpResponse | undefined;
|
|
5194
5281
|
/**
|
|
5195
5282
|
* Returns the parameters when making the API request for the next page.
|
|
5196
5283
|
*
|
|
@@ -6338,6 +6425,8 @@ export declare interface TuningExample {
|
|
|
6338
6425
|
|
|
6339
6426
|
/** A tuning job. */
|
|
6340
6427
|
export declare interface TuningJob {
|
|
6428
|
+
/** Used to retain the full HTTP response. */
|
|
6429
|
+
sdkHttpResponse?: HttpResponse;
|
|
6341
6430
|
/** Output only. Identifier. Resource name of a TuningJob. Format: `projects/{project}/locations/{location}/tuningJobs/{tuning_job}` */
|
|
6342
6431
|
name?: string;
|
|
6343
6432
|
/** Output only. The detailed state of the job. */
|
|
@@ -6386,6 +6475,8 @@ export declare interface TuningJob {
|
|
|
6386
6475
|
|
|
6387
6476
|
/** A long-running operation. */
|
|
6388
6477
|
export declare interface TuningOperation {
|
|
6478
|
+
/** Used to retain the full HTTP response. */
|
|
6479
|
+
sdkHttpResponse?: HttpResponse;
|
|
6389
6480
|
/** 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}`. */
|
|
6390
6481
|
name?: string;
|
|
6391
6482
|
/** 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. */
|
|
@@ -6684,7 +6775,6 @@ declare namespace types {
|
|
|
6684
6775
|
GenerateVideosParameters,
|
|
6685
6776
|
GeneratedVideo,
|
|
6686
6777
|
GenerateVideosResponse,
|
|
6687
|
-
GenerateVideosOperation,
|
|
6688
6778
|
GetTuningJobConfig,
|
|
6689
6779
|
GetTuningJobParameters,
|
|
6690
6780
|
TunedModelCheckpoint,
|
|
@@ -6788,6 +6878,10 @@ declare namespace types {
|
|
|
6788
6878
|
LiveServerGoAway,
|
|
6789
6879
|
LiveServerSessionResumptionUpdate,
|
|
6790
6880
|
LiveServerMessage,
|
|
6881
|
+
OperationGetParameters,
|
|
6882
|
+
OperationFromAPIResponseParameters,
|
|
6883
|
+
Operation,
|
|
6884
|
+
GenerateVideosOperation,
|
|
6791
6885
|
AutomaticActivityDetection,
|
|
6792
6886
|
RealtimeInputConfig,
|
|
6793
6887
|
SessionResumptionConfig,
|
|
@@ -6831,7 +6925,6 @@ declare namespace types {
|
|
|
6831
6925
|
LiveConnectConstraints,
|
|
6832
6926
|
CreateAuthTokenConfig,
|
|
6833
6927
|
CreateAuthTokenParameters,
|
|
6834
|
-
OperationGetParameters,
|
|
6835
6928
|
BlobImageUnion,
|
|
6836
6929
|
PartUnion,
|
|
6837
6930
|
PartListUnion,
|
|
@@ -6993,6 +7086,8 @@ export declare interface UpscaleImageParameters {
|
|
|
6993
7086
|
}
|
|
6994
7087
|
|
|
6995
7088
|
export declare class UpscaleImageResponse {
|
|
7089
|
+
/** Used to retain the full HTTP response. */
|
|
7090
|
+
sdkHttpResponse?: HttpResponse;
|
|
6996
7091
|
/** Generated images. */
|
|
6997
7092
|
generatedImages?: GeneratedImage[];
|
|
6998
7093
|
}
|