@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.
@@ -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 interface GenerateVideosOperation {
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 generated videos. */
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. */
@@ -3702,6 +3723,8 @@ export declare interface ListBatchJobsParameters {
3702
3723
 
3703
3724
  /** Config for batches.list return value. */
3704
3725
  export declare class ListBatchJobsResponse {
3726
+ /** Used to retain the full HTTP response. */
3727
+ sdkHttpResponse?: HttpResponse;
3705
3728
  nextPageToken?: string;
3706
3729
  batchJobs?: BatchJob[];
3707
3730
  }
@@ -3729,6 +3752,8 @@ export declare interface ListCachedContentsParameters {
3729
3752
  }
3730
3753
 
3731
3754
  export declare class ListCachedContentsResponse {
3755
+ /** Used to retain the full HTTP response. */
3756
+ sdkHttpResponse?: HttpResponse;
3732
3757
  nextPageToken?: string;
3733
3758
  /** List of cached contents.
3734
3759
  */
@@ -3758,6 +3783,8 @@ export declare interface ListFilesParameters {
3758
3783
 
3759
3784
  /** Response for the list files method. */
3760
3785
  export declare class ListFilesResponse {
3786
+ /** Used to retain the full HTTP response. */
3787
+ sdkHttpResponse?: HttpResponse;
3761
3788
  /** A token to retrieve next page of results. */
3762
3789
  nextPageToken?: string;
3763
3790
  /** The list of files. */
@@ -3786,6 +3813,8 @@ export declare interface ListModelsParameters {
3786
3813
  }
3787
3814
 
3788
3815
  export declare class ListModelsResponse {
3816
+ /** Used to retain the full HTTP response. */
3817
+ sdkHttpResponse?: HttpResponse;
3789
3818
  nextPageToken?: string;
3790
3819
  models?: Model[];
3791
3820
  }
@@ -3813,6 +3842,8 @@ export declare interface ListTuningJobsParameters {
3813
3842
 
3814
3843
  /** Response for the list tuning jobs method. */
3815
3844
  export declare class ListTuningJobsResponse {
3845
+ /** Used to retain the full HTTP response. */
3846
+ sdkHttpResponse?: HttpResponse;
3816
3847
  /** A token to retrieve the next page of results. Pass to ListTuningJobsRequest.page_token to obtain that page. */
3817
3848
  nextPageToken?: string;
3818
3849
  /** List of TuningJobs in the requested page. */
@@ -4871,7 +4902,7 @@ export declare class Models extends BaseModule {
4871
4902
  * modify the original params. Also sets the MCP usage header if there are
4872
4903
  * MCP tools in the parameters.
4873
4904
  */
4874
- private processParamsForMcpUsage;
4905
+ private processParamsMaybeAddMcpUsage;
4875
4906
  private initAfcToolsMap;
4876
4907
  private processAfcStream;
4877
4908
  /**
@@ -4937,6 +4968,30 @@ export declare class Models extends BaseModule {
4937
4968
  * ```
4938
4969
  */
4939
4970
  upscaleImage: (params: types.UpscaleImageParameters) => Promise<types.UpscaleImageResponse>;
4971
+ /**
4972
+ * Generates videos based on a text description and configuration.
4973
+ *
4974
+ * @param params - The parameters for generating videos.
4975
+ * @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
4976
+ *
4977
+ * @example
4978
+ * ```ts
4979
+ * const operation = await ai.models.generateVideos({
4980
+ * model: 'veo-2.0-generate-001',
4981
+ * prompt: 'A neon hologram of a cat driving at top speed',
4982
+ * config: {
4983
+ * numberOfVideos: 1
4984
+ * });
4985
+ *
4986
+ * while (!operation.done) {
4987
+ * await new Promise(resolve => setTimeout(resolve, 10000));
4988
+ * operation = await ai.operations.getVideosOperation({operation: operation});
4989
+ * }
4990
+ *
4991
+ * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
4992
+ * ```
4993
+ */
4994
+ generateVideos: (params: types.GenerateVideosParameters) => Promise<types.GenerateVideosOperation>;
4940
4995
  private generateContentInternal;
4941
4996
  private generateContentStreamInternal;
4942
4997
  /**
@@ -5082,7 +5137,7 @@ export declare class Models extends BaseModule {
5082
5137
  * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
5083
5138
  * ```
5084
5139
  */
5085
- generateVideos(params: types.GenerateVideosParameters): Promise<types.GenerateVideosOperation>;
5140
+ private generateVideosInternal;
5086
5141
  }
5087
5142
 
5088
5143
  /** Config for model selection. */
@@ -5097,10 +5152,37 @@ export declare interface MultiSpeakerVoiceConfig {
5097
5152
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
5098
5153
  }
5099
5154
 
5155
+ /** A long-running operation. */
5156
+ export declare interface Operation<T> {
5157
+ /** 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}`. */
5158
+ name?: string;
5159
+ /** 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. */
5160
+ metadata?: Record<string, unknown>;
5161
+ /** 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. */
5162
+ done?: boolean;
5163
+ /** The error result of the operation in case of failure or cancellation. */
5164
+ error?: Record<string, unknown>;
5165
+ /** The response if the operation is successful. */
5166
+ response?: T;
5167
+ /**
5168
+ * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
5169
+ * @internal
5170
+ */
5171
+ _fromAPIResponse({ apiResponse, isVertexAI, }: OperationFromAPIResponseParameters): Operation<T>;
5172
+ }
5173
+
5174
+ /** Parameters of the fromAPIResponse method of the Operation class. */
5175
+ export declare interface OperationFromAPIResponseParameters {
5176
+ /** The API response to be converted to an Operation. */
5177
+ apiResponse: Record<string, unknown>;
5178
+ /** Whether the API response is from Vertex AI. */
5179
+ isVertexAI: boolean;
5180
+ }
5181
+
5100
5182
  /** Parameters for the get method of the operations module. */
5101
- export declare interface OperationGetParameters {
5183
+ export declare interface OperationGetParameters<T, U extends Operation<T>> {
5102
5184
  /** The operation to be retrieved. */
5103
- operation: GenerateVideosOperation;
5185
+ operation: U;
5104
5186
  /** Used to override the default configuration. */
5105
5187
  config?: GetOperationConfig;
5106
5188
  }
@@ -5114,7 +5196,14 @@ export declare class Operations extends BaseModule {
5114
5196
  * @param parameters The parameters for the get operation request.
5115
5197
  * @return The updated Operation object, with the latest status or result.
5116
5198
  */
5117
- getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
5199
+ getVideosOperation(parameters: types.OperationGetParameters<types.GenerateVideosResponse, types.GenerateVideosOperation>): Promise<types.GenerateVideosOperation>;
5200
+ /**
5201
+ * Gets the status of a long-running operation.
5202
+ *
5203
+ * @param parameters The parameters for the get operation request.
5204
+ * @return The updated Operation object, with the latest status or result.
5205
+ */
5206
+ get<T, U extends types.Operation<T>>(parameters: types.OperationGetParameters<T, U>): Promise<types.Operation<T>>;
5118
5207
  private getVideosOperationInternal;
5119
5208
  private fetchPredictVideosOperationInternal;
5120
5209
  }
@@ -5139,14 +5228,6 @@ export declare enum Outcome {
5139
5228
  OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
5140
5229
  }
5141
5230
 
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
5231
  export declare enum PagedItem {
5151
5232
  PAGED_ITEM_BATCH_JOBS = "batchJobs",
5152
5233
  PAGED_ITEM_MODELS = "models",
@@ -5164,6 +5245,7 @@ declare interface PagedItemConfig {
5164
5245
 
5165
5246
  declare interface PagedItemResponse<T> {
5166
5247
  nextPageToken?: string;
5248
+ sdkHttpResponse?: types.HttpResponse;
5167
5249
  batchJobs?: T[];
5168
5250
  models?: T[];
5169
5251
  tuningJobs?: T[];
@@ -5179,6 +5261,7 @@ export declare class Pager<T> implements AsyncIterable<T> {
5179
5261
  private pageInternal;
5180
5262
  private paramsInternal;
5181
5263
  private pageInternalSize;
5264
+ private sdkHttpResponseInternal?;
5182
5265
  protected requestInternal: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>;
5183
5266
  protected idxInternal: number;
5184
5267
  constructor(name: PagedItem, request: (params: PagedItemConfig) => Promise<PagedItemResponse<T>>, response: PagedItemResponse<T>, params: PagedItemConfig);
@@ -5203,6 +5286,10 @@ export declare class Pager<T> implements AsyncIterable<T> {
5203
5286
  * The number of items in the page is less than or equal to the page length.
5204
5287
  */
5205
5288
  get pageSize(): number;
5289
+ /**
5290
+ * Returns the headers of the API response.
5291
+ */
5292
+ get sdkHttpResponse(): types.HttpResponse | undefined;
5206
5293
  /**
5207
5294
  * Returns the parameters when making the API request for the next page.
5208
5295
  *
@@ -6350,6 +6437,8 @@ export declare interface TuningExample {
6350
6437
 
6351
6438
  /** A tuning job. */
6352
6439
  export declare interface TuningJob {
6440
+ /** Used to retain the full HTTP response. */
6441
+ sdkHttpResponse?: HttpResponse;
6353
6442
  /** Output only. Identifier. Resource name of a TuningJob. Format: `projects/{project}/locations/{location}/tuningJobs/{tuning_job}` */
6354
6443
  name?: string;
6355
6444
  /** Output only. The detailed state of the job. */
@@ -6398,6 +6487,8 @@ export declare interface TuningJob {
6398
6487
 
6399
6488
  /** A long-running operation. */
6400
6489
  export declare interface TuningOperation {
6490
+ /** Used to retain the full HTTP response. */
6491
+ sdkHttpResponse?: HttpResponse;
6401
6492
  /** 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}`. */
6402
6493
  name?: string;
6403
6494
  /** 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. */
@@ -6696,7 +6787,6 @@ declare namespace types {
6696
6787
  GenerateVideosParameters,
6697
6788
  GeneratedVideo,
6698
6789
  GenerateVideosResponse,
6699
- GenerateVideosOperation,
6700
6790
  GetTuningJobConfig,
6701
6791
  GetTuningJobParameters,
6702
6792
  TunedModelCheckpoint,
@@ -6800,6 +6890,10 @@ declare namespace types {
6800
6890
  LiveServerGoAway,
6801
6891
  LiveServerSessionResumptionUpdate,
6802
6892
  LiveServerMessage,
6893
+ OperationGetParameters,
6894
+ OperationFromAPIResponseParameters,
6895
+ Operation,
6896
+ GenerateVideosOperation,
6803
6897
  AutomaticActivityDetection,
6804
6898
  RealtimeInputConfig,
6805
6899
  SessionResumptionConfig,
@@ -6843,7 +6937,6 @@ declare namespace types {
6843
6937
  LiveConnectConstraints,
6844
6938
  CreateAuthTokenConfig,
6845
6939
  CreateAuthTokenParameters,
6846
- OperationGetParameters,
6847
6940
  BlobImageUnion,
6848
6941
  PartUnion,
6849
6942
  PartListUnion,
@@ -7005,6 +7098,8 @@ export declare interface UpscaleImageParameters {
7005
7098
  }
7006
7099
 
7007
7100
  export declare class UpscaleImageResponse {
7101
+ /** Used to retain the full HTTP response. */
7102
+ sdkHttpResponse?: HttpResponse;
7008
7103
  /** Generated images. */
7009
7104
  generatedImages?: GeneratedImage[];
7010
7105
  }