@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.
@@ -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 interface GenerateVideosOperation {
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 generated videos. */
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. */
@@ -3702,6 +3711,8 @@ export declare interface ListBatchJobsParameters {
3702
3711
 
3703
3712
  /** Config for batches.list return value. */
3704
3713
  export declare class ListBatchJobsResponse {
3714
+ /** Used to retain the full HTTP response. */
3715
+ sdkHttpResponse?: HttpResponse;
3705
3716
  nextPageToken?: string;
3706
3717
  batchJobs?: BatchJob[];
3707
3718
  }
@@ -3729,6 +3740,8 @@ export declare interface ListCachedContentsParameters {
3729
3740
  }
3730
3741
 
3731
3742
  export declare class ListCachedContentsResponse {
3743
+ /** Used to retain the full HTTP response. */
3744
+ sdkHttpResponse?: HttpResponse;
3732
3745
  nextPageToken?: string;
3733
3746
  /** List of cached contents.
3734
3747
  */
@@ -3758,6 +3771,8 @@ export declare interface ListFilesParameters {
3758
3771
 
3759
3772
  /** Response for the list files method. */
3760
3773
  export declare class ListFilesResponse {
3774
+ /** Used to retain the full HTTP response. */
3775
+ sdkHttpResponse?: HttpResponse;
3761
3776
  /** A token to retrieve next page of results. */
3762
3777
  nextPageToken?: string;
3763
3778
  /** The list of files. */
@@ -3786,6 +3801,8 @@ export declare interface ListModelsParameters {
3786
3801
  }
3787
3802
 
3788
3803
  export declare class ListModelsResponse {
3804
+ /** Used to retain the full HTTP response. */
3805
+ sdkHttpResponse?: HttpResponse;
3789
3806
  nextPageToken?: string;
3790
3807
  models?: Model[];
3791
3808
  }
@@ -3813,6 +3830,8 @@ export declare interface ListTuningJobsParameters {
3813
3830
 
3814
3831
  /** Response for the list tuning jobs method. */
3815
3832
  export declare class ListTuningJobsResponse {
3833
+ /** Used to retain the full HTTP response. */
3834
+ sdkHttpResponse?: HttpResponse;
3816
3835
  /** A token to retrieve the next page of results. Pass to ListTuningJobsRequest.page_token to obtain that page. */
3817
3836
  nextPageToken?: string;
3818
3837
  /** List of TuningJobs in the requested page. */
@@ -4871,7 +4890,7 @@ export declare class Models extends BaseModule {
4871
4890
  * modify the original params. Also sets the MCP usage header if there are
4872
4891
  * MCP tools in the parameters.
4873
4892
  */
4874
- private processParamsForMcpUsage;
4893
+ private processParamsMaybeAddMcpUsage;
4875
4894
  private initAfcToolsMap;
4876
4895
  private processAfcStream;
4877
4896
  /**
@@ -4937,6 +4956,30 @@ export declare class Models extends BaseModule {
4937
4956
  * ```
4938
4957
  */
4939
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>;
4940
4983
  private generateContentInternal;
4941
4984
  private generateContentStreamInternal;
4942
4985
  /**
@@ -5082,7 +5125,7 @@ export declare class Models extends BaseModule {
5082
5125
  * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
5083
5126
  * ```
5084
5127
  */
5085
- generateVideos(params: types.GenerateVideosParameters): Promise<types.GenerateVideosOperation>;
5128
+ private generateVideosInternal;
5086
5129
  }
5087
5130
 
5088
5131
  /** Config for model selection. */
@@ -5097,10 +5140,37 @@ export declare interface MultiSpeakerVoiceConfig {
5097
5140
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
5098
5141
  }
5099
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
+
5100
5170
  /** Parameters for the get method of the operations module. */
5101
- export declare interface OperationGetParameters {
5171
+ export declare interface OperationGetParameters<T, U extends Operation<T>> {
5102
5172
  /** The operation to be retrieved. */
5103
- operation: GenerateVideosOperation;
5173
+ operation: U;
5104
5174
  /** Used to override the default configuration. */
5105
5175
  config?: GetOperationConfig;
5106
5176
  }
@@ -5114,7 +5184,14 @@ export declare class Operations extends BaseModule {
5114
5184
  * @param parameters The parameters for the get operation request.
5115
5185
  * @return The updated Operation object, with the latest status or result.
5116
5186
  */
5117
- 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>>;
5118
5195
  private getVideosOperationInternal;
5119
5196
  private fetchPredictVideosOperationInternal;
5120
5197
  }
@@ -5139,14 +5216,6 @@ export declare enum Outcome {
5139
5216
  OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
5140
5217
  }
5141
5218
 
5142
- /**
5143
- * @license
5144
- * Copyright 2025 Google LLC
5145
- * SPDX-License-Identifier: Apache-2.0
5146
- */
5147
- /**
5148
- * Pagers for the GenAI List APIs.
5149
- */
5150
5219
  export declare enum PagedItem {
5151
5220
  PAGED_ITEM_BATCH_JOBS = "batchJobs",
5152
5221
  PAGED_ITEM_MODELS = "models",
@@ -5164,6 +5233,7 @@ declare interface PagedItemConfig {
5164
5233
 
5165
5234
  declare interface PagedItemResponse<T> {
5166
5235
  nextPageToken?: string;
5236
+ sdkHttpResponse?: types.HttpResponse;
5167
5237
  batchJobs?: T[];
5168
5238
  models?: T[];
5169
5239
  tuningJobs?: T[];
@@ -5179,6 +5249,7 @@ export declare class Pager<T> implements AsyncIterable<T> {
5179
5249
  private pageInternal;
5180
5250
  private paramsInternal;
5181
5251
  private pageInternalSize;
5252
+ private sdkHttpResponseInternal?;
5182
5253
  protected requestInternal: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>;
5183
5254
  protected idxInternal: number;
5184
5255
  constructor(name: PagedItem, request: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>, response: PagedItemResponse<T>, params: PagedItemConfig);
@@ -5203,6 +5274,10 @@ export declare class Pager<T> implements AsyncIterable<T> {
5203
5274
  * The number of items in the page is less than or equal to the page length.
5204
5275
  */
5205
5276
  get pageSize(): number;
5277
+ /**
5278
+ * Returns the headers of the API response.
5279
+ */
5280
+ get sdkHttpResponse(): types.HttpResponse | undefined;
5206
5281
  /**
5207
5282
  * Returns the parameters when making the API request for the next page.
5208
5283
  *
@@ -6696,7 +6771,6 @@ declare namespace types {
6696
6771
  GenerateVideosParameters,
6697
6772
  GeneratedVideo,
6698
6773
  GenerateVideosResponse,
6699
- GenerateVideosOperation,
6700
6774
  GetTuningJobConfig,
6701
6775
  GetTuningJobParameters,
6702
6776
  TunedModelCheckpoint,
@@ -6800,6 +6874,10 @@ declare namespace types {
6800
6874
  LiveServerGoAway,
6801
6875
  LiveServerSessionResumptionUpdate,
6802
6876
  LiveServerMessage,
6877
+ OperationGetParameters,
6878
+ OperationFromAPIResponseParameters,
6879
+ Operation,
6880
+ GenerateVideosOperation,
6803
6881
  AutomaticActivityDetection,
6804
6882
  RealtimeInputConfig,
6805
6883
  SessionResumptionConfig,
@@ -6843,7 +6921,6 @@ declare namespace types {
6843
6921
  LiveConnectConstraints,
6844
6922
  CreateAuthTokenConfig,
6845
6923
  CreateAuthTokenParameters,
6846
- OperationGetParameters,
6847
6924
  BlobImageUnion,
6848
6925
  PartUnion,
6849
6926
  PartListUnion,