@google/genai 1.48.0 → 1.49.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.
@@ -465,6 +465,10 @@ export declare interface AudioChunk {
465
465
  */
466
466
  declare interface AudioContent {
467
467
  type: 'audio';
468
+ /**
469
+ * The number of audio channels.
470
+ */
471
+ channels?: number;
468
472
  /**
469
473
  * The audio content.
470
474
  */
@@ -472,7 +476,11 @@ declare interface AudioContent {
472
476
  /**
473
477
  * The mime type of the audio.
474
478
  */
475
- mime_type?: 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | 'audio/mpeg' | 'audio/m4a';
479
+ mime_type?: 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | 'audio/mpeg' | 'audio/m4a' | 'audio/l16';
480
+ /**
481
+ * The sample rate of the audio.
482
+ */
483
+ rate?: number;
476
484
  /**
477
485
  * The URI of the audio.
478
486
  */
@@ -653,24 +661,26 @@ declare interface BaseCreateAgentInteractionParams {
653
661
  */
654
662
  previous_interaction_id?: string;
655
663
  /**
656
- * Body param: Enforces that the generated response is a JSON object that complies with
657
- * the JSON schema specified in this field.
664
+ * Body param: Enforces that the generated response is a JSON object that complies
665
+ * with the JSON schema specified in this field.
658
666
  */
659
667
  response_format?: unknown;
660
668
  /**
661
- * Body param: The mime type of the response. This is required if response_format is set.
669
+ * Body param: The mime type of the response. This is required if response_format
670
+ * is set.
662
671
  */
663
672
  response_mime_type?: string;
664
673
  /**
665
674
  * Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
666
675
  */
667
- response_modalities?: Array<'text' | 'image' | 'audio'>;
676
+ response_modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'document'>;
668
677
  /**
669
678
  * Body param: The service tier for the interaction.
670
679
  */
671
680
  service_tier?: 'flex' | 'standard' | 'priority';
672
681
  /**
673
- * Body param: Input only. Whether to store the response and request for later retrieval.
682
+ * Body param: Input only. Whether to store the response and request for later
683
+ * retrieval.
674
684
  */
675
685
  store?: boolean;
676
686
  /**
@@ -713,24 +723,26 @@ declare interface BaseCreateModelInteractionParams {
713
723
  */
714
724
  previous_interaction_id?: string;
715
725
  /**
716
- * Body param: Enforces that the generated response is a JSON object that complies with
717
- * the JSON schema specified in this field.
726
+ * Body param: Enforces that the generated response is a JSON object that complies
727
+ * with the JSON schema specified in this field.
718
728
  */
719
729
  response_format?: unknown;
720
730
  /**
721
- * Body param: The mime type of the response. This is required if response_format is set.
731
+ * Body param: The mime type of the response. This is required if response_format
732
+ * is set.
722
733
  */
723
734
  response_mime_type?: string;
724
735
  /**
725
736
  * Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
726
737
  */
727
- response_modalities?: Array<'text' | 'image' | 'audio'>;
738
+ response_modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'document'>;
728
739
  /**
729
740
  * Body param: The service tier for the interaction.
730
741
  */
731
742
  service_tier?: 'flex' | 'standard' | 'priority';
732
743
  /**
733
- * Body param: Input only. Whether to store the response and request for later retrieval.
744
+ * Body param: Input only. Whether to store the response and request for later
745
+ * retrieval.
734
746
  */
735
747
  store?: boolean;
736
748
  /**
@@ -868,7 +880,8 @@ declare class BaseInteractions extends APIResource {
868
880
  */
869
881
  delete(id: string, params?: InteractionDeleteParams | null | undefined, options?: RequestOptions): APIPromise<unknown>;
870
882
  /**
871
- * Cancels an interaction by id. This only applies to background interactions that are still running.
883
+ * Cancels an interaction by id. This only applies to background interactions that
884
+ * are still running.
872
885
  *
873
886
  * @example
874
887
  * ```ts
@@ -879,7 +892,8 @@ declare class BaseInteractions extends APIResource {
879
892
  */
880
893
  cancel(id: string, params?: InteractionCancelParams | null | undefined, options?: RequestOptions): APIPromise<Interaction>;
881
894
  /**
882
- * Retrieves the full details of a single interaction based on its `Interaction.id`.
895
+ * Retrieves the full details of a single interaction based on its
896
+ * `Interaction.id`.
883
897
  *
884
898
  * @example
885
899
  * ```ts
@@ -1665,7 +1679,7 @@ declare interface ClientOptions {
1665
1679
  /**
1666
1680
  * The adapter to the parent API client instance (for accessing auth, project, location)
1667
1681
  */
1668
- clientAdapter: GeminiNextGenAPIClientAdapter;
1682
+ clientAdapter?: GeminiNextGenAPIClientAdapter | undefined;
1669
1683
  }
1670
1684
 
1671
1685
  /**
@@ -1828,8 +1842,7 @@ declare interface ContentDelta {
1828
1842
  event_type: 'content.delta';
1829
1843
  index: number;
1830
1844
  /**
1831
- * The event_id token to be used to resume the interaction stream, from
1832
- * this event.
1845
+ * The event_id token to be used to resume the interaction stream, from this event.
1833
1846
  */
1834
1847
  event_id?: string;
1835
1848
  }
@@ -1851,8 +1864,16 @@ declare namespace ContentDelta {
1851
1864
  }
1852
1865
  interface Audio {
1853
1866
  type: 'audio';
1867
+ /**
1868
+ * The number of audio channels.
1869
+ */
1870
+ channels?: number;
1854
1871
  data?: string;
1855
- mime_type?: 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | 'audio/mpeg' | 'audio/m4a';
1872
+ mime_type?: 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | 'audio/mpeg' | 'audio/m4a' | 'audio/l16';
1873
+ /**
1874
+ * The sample rate of the audio.
1875
+ */
1876
+ rate?: number;
1856
1877
  uri?: string;
1857
1878
  }
1858
1879
  interface Document {
@@ -2149,8 +2170,7 @@ declare interface ContentStart {
2149
2170
  event_type: 'content.start';
2150
2171
  index: number;
2151
2172
  /**
2152
- * The event_id token to be used to resume the interaction stream, from
2153
- * this event.
2173
+ * The event_id token to be used to resume the interaction stream, from this event.
2154
2174
  */
2155
2175
  event_id?: string;
2156
2176
  }
@@ -2159,8 +2179,7 @@ declare interface ContentStop {
2159
2179
  event_type: 'content.stop';
2160
2180
  index: number;
2161
2181
  /**
2162
- * The event_id token to be used to resume the interaction stream, from
2163
- * this event.
2182
+ * The event_id token to be used to resume the interaction stream, from this event.
2164
2183
  */
2165
2184
  event_id?: string;
2166
2185
  }
@@ -3399,8 +3418,7 @@ declare interface ErrorEvent_2 {
3399
3418
  */
3400
3419
  error?: ErrorEvent_2.Error;
3401
3420
  /**
3402
- * The event_id token to be used to resume the interaction stream, from
3403
- * this event.
3421
+ * The event_id token to be used to resume the interaction stream, from this event.
3404
3422
  */
3405
3423
  event_id?: string;
3406
3424
  }
@@ -5391,8 +5409,8 @@ declare namespace GoogleMapsResult {
5391
5409
  */
5392
5410
  place_id?: string;
5393
5411
  /**
5394
- * Snippets of reviews that are used to generate answers about the
5395
- * features of a given place in Google Maps.
5412
+ * Snippets of reviews that are used to generate answers about the features of a
5413
+ * given place in Google Maps.
5396
5414
  */
5397
5415
  review_snippets?: Array<Place.ReviewSnippet>;
5398
5416
  /**
@@ -5402,8 +5420,8 @@ declare namespace GoogleMapsResult {
5402
5420
  }
5403
5421
  namespace Place {
5404
5422
  /**
5405
- * Encapsulates a snippet of a user review that answers a question about
5406
- * the features of a specific place in Google Maps.
5423
+ * Encapsulates a snippet of a user review that answers a question about the
5424
+ * features of a specific place in Google Maps.
5407
5425
  */
5408
5426
  interface ReviewSnippet {
5409
5427
  /**
@@ -5489,7 +5507,7 @@ declare interface GoogleSearchCallContent {
5489
5507
  /**
5490
5508
  * The type of search grounding enabled.
5491
5509
  */
5492
- search_type?: 'web_search' | 'image_search';
5510
+ search_type?: 'web_search' | 'image_search' | 'enterprise_web_search';
5493
5511
  /**
5494
5512
  * A signature hash for backend validation.
5495
5513
  */
@@ -6235,8 +6253,8 @@ declare interface Interaction {
6235
6253
  */
6236
6254
  id: string;
6237
6255
  /**
6238
- * Required. Output only. The time at which the response was created in ISO 8601 format
6239
- * (YYYY-MM-DDThh:mm:ssZ).
6256
+ * Required. Output only. The time at which the response was created in ISO 8601
6257
+ * format (YYYY-MM-DDThh:mm:ssZ).
6240
6258
  */
6241
6259
  created: string;
6242
6260
  /**
@@ -6244,8 +6262,8 @@ declare interface Interaction {
6244
6262
  */
6245
6263
  status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
6246
6264
  /**
6247
- * Required. Output only. The time at which the response was last updated in ISO 8601 format
6248
- * (YYYY-MM-DDThh:mm:ssZ).
6265
+ * Required. Output only. The time at which the response was last updated in ISO
6266
+ * 8601 format (YYYY-MM-DDThh:mm:ssZ).
6249
6267
  */
6250
6268
  updated: string;
6251
6269
  /**
@@ -6273,8 +6291,8 @@ declare interface Interaction {
6273
6291
  */
6274
6292
  previous_interaction_id?: string;
6275
6293
  /**
6276
- * Enforces that the generated response is a JSON object that complies with
6277
- * the JSON schema specified in this field.
6294
+ * Enforces that the generated response is a JSON object that complies with the
6295
+ * JSON schema specified in this field.
6278
6296
  */
6279
6297
  response_format?: unknown;
6280
6298
  /**
@@ -6284,7 +6302,7 @@ declare interface Interaction {
6284
6302
  /**
6285
6303
  * The requested modalities of the response (TEXT, IMAGE, AUDIO).
6286
6304
  */
6287
- response_modalities?: Array<'text' | 'image' | 'audio'>;
6305
+ response_modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'document'>;
6288
6306
  /**
6289
6307
  * Output only. The role of the interaction.
6290
6308
  */
@@ -6317,13 +6335,12 @@ declare interface InteractionCancelParams {
6317
6335
  declare interface InteractionCompleteEvent {
6318
6336
  event_type: 'interaction.complete';
6319
6337
  /**
6320
- * Required. The completed interaction with empty outputs to reduce the payload size.
6321
- * Use the preceding ContentDelta events for the actual output.
6338
+ * Required. The completed interaction with empty outputs to reduce the payload
6339
+ * size. Use the preceding ContentDelta events for the actual output.
6322
6340
  */
6323
6341
  interaction: Interaction;
6324
6342
  /**
6325
- * The event_id token to be used to resume the interaction stream, from
6326
- * this event.
6343
+ * The event_id token to be used to resume the interaction stream, from this event.
6327
6344
  */
6328
6345
  event_id?: string;
6329
6346
  }
@@ -6356,25 +6373,30 @@ declare interface InteractionGetParamsBase {
6356
6373
  */
6357
6374
  include_input?: boolean;
6358
6375
  /**
6359
- * Query param: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
6376
+ * Query param: Optional. If set, resumes the interaction stream from the next
6377
+ * chunk after the event marked by the event id. Can only be used if `stream` is
6378
+ * true.
6360
6379
  */
6361
6380
  last_event_id?: string;
6362
6381
  /**
6363
- * Query param: If set to true, the generated content will be streamed incrementally.
6382
+ * Query param: If set to true, the generated content will be streamed
6383
+ * incrementally.
6364
6384
  */
6365
6385
  stream?: boolean;
6366
6386
  }
6367
6387
 
6368
6388
  declare interface InteractionGetParamsNonStreaming extends InteractionGetParamsBase {
6369
6389
  /**
6370
- * Query param: If set to true, the generated content will be streamed incrementally.
6390
+ * Query param: If set to true, the generated content will be streamed
6391
+ * incrementally.
6371
6392
  */
6372
6393
  stream?: false;
6373
6394
  }
6374
6395
 
6375
6396
  declare interface InteractionGetParamsStreaming extends InteractionGetParamsBase {
6376
6397
  /**
6377
- * Query param: If set to true, the generated content will be streamed incrementally.
6398
+ * Query param: If set to true, the generated content will be streamed
6399
+ * incrementally.
6378
6400
  */
6379
6401
  stream: true;
6380
6402
  }
@@ -6471,8 +6493,7 @@ declare interface InteractionStartEvent {
6471
6493
  */
6472
6494
  interaction: Interaction;
6473
6495
  /**
6474
- * The event_id token to be used to resume the interaction stream, from
6475
- * this event.
6496
+ * The event_id token to be used to resume the interaction stream, from this event.
6476
6497
  */
6477
6498
  event_id?: string;
6478
6499
  }
@@ -6482,8 +6503,7 @@ declare interface InteractionStatusUpdate {
6482
6503
  interaction_id: string;
6483
6504
  status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
6484
6505
  /**
6485
- * The event_id token to be used to resume the interaction stream, from
6486
- * this event.
6506
+ * The event_id token to be used to resume the interaction stream, from this event.
6487
6507
  */
6488
6508
  event_id?: string;
6489
6509
  }
@@ -7874,7 +7894,8 @@ export declare interface Model {
7874
7894
  }
7875
7895
 
7876
7896
  /**
7877
- * The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7897
+ * The model that will complete your prompt.\n\nSee
7898
+ * [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7878
7899
  */
7879
7900
  declare type Model_2 = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
7880
7901
 
@@ -8137,29 +8158,15 @@ export declare class Models extends BaseModule {
8137
8158
  /**
8138
8159
  * Recontextualizes an image.
8139
8160
  *
8140
- * There are two types of recontextualization currently supported:
8141
- * 1) Imagen Product Recontext - Generate images of products in new scenes
8142
- * and contexts.
8143
- * 2) Virtual Try-On: Generate images of persons modeling fashion products.
8161
+ * There is one type of recontextualization currently supported:
8162
+ * 1) Virtual Try-On: Generate images of persons modeling fashion products.
8144
8163
  *
8145
8164
  * @param params - The parameters for recontextualizing an image.
8146
8165
  * @return The response from the API.
8147
8166
  *
8148
8167
  * @example
8149
8168
  * ```ts
8150
- * const response1 = await ai.models.recontextImage({
8151
- * model: 'imagen-product-recontext-preview-06-30',
8152
- * source: {
8153
- * prompt: 'In a modern kitchen setting.',
8154
- * productImages: [productImage],
8155
- * },
8156
- * config: {
8157
- * numberOfImages: 1,
8158
- * },
8159
- * });
8160
- * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
8161
- *
8162
- * const response2 = await ai.models.recontextImage({
8169
+ * const response = await ai.models.recontextImage({
8163
8170
  * model: 'virtual-try-on-001',
8164
8171
  * source: {
8165
8172
  * personImage: personImage,
@@ -8169,7 +8176,7 @@ export declare class Models extends BaseModule {
8169
8176
  * numberOfImages: 1,
8170
8177
  * },
8171
8178
  * });
8172
- * console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
8179
+ * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
8173
8180
  * ```
8174
8181
  */
8175
8182
  recontextImage(params: types.RecontextImageParameters): Promise<types.RecontextImageResponse>;
@@ -8828,8 +8835,8 @@ declare interface PlaceCitation {
8828
8835
  */
8829
8836
  place_id?: string;
8830
8837
  /**
8831
- * Snippets of reviews that are used to generate answers about the
8832
- * features of a given place in Google Maps.
8838
+ * Snippets of reviews that are used to generate answers about the features of a
8839
+ * given place in Google Maps.
8833
8840
  */
8834
8841
  review_snippets?: Array<PlaceCitation.ReviewSnippet>;
8835
8842
  /**
@@ -8846,8 +8853,8 @@ declare interface PlaceCitation {
8846
8853
 
8847
8854
  declare namespace PlaceCitation {
8848
8855
  /**
8849
- * Encapsulates a snippet of a user review that answers a question about
8850
- * the features of a specific place in Google Maps.
8856
+ * Encapsulates a snippet of a user review that answers a question about the
8857
+ * features of a specific place in Google Maps.
8851
8858
  */
8852
8859
  interface ReviewSnippet {
8853
8860
  /**
@@ -10335,7 +10342,7 @@ export declare interface Tool {
10335
10342
  /**
10336
10343
  * A tool that can be used by the model.
10337
10344
  */
10338
- declare type Tool_2 = Function_2 | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.GoogleSearch | Tool_2.FileSearch | Tool_2.GoogleMaps;
10345
+ declare type Tool_2 = Function_2 | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.GoogleSearch | Tool_2.FileSearch | Tool_2.GoogleMaps | Tool_2.Retrieval;
10339
10346
 
10340
10347
  declare namespace Tool_2 {
10341
10348
  /**
@@ -10384,8 +10391,7 @@ declare namespace Tool_2 {
10384
10391
  */
10385
10392
  name?: string;
10386
10393
  /**
10387
- * The full URL for the MCPServer endpoint.
10388
- * Example: "https://api.example.com/mcp"
10394
+ * The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
10389
10395
  */
10390
10396
  url?: string;
10391
10397
  }
@@ -10397,7 +10403,7 @@ declare namespace Tool_2 {
10397
10403
  /**
10398
10404
  * The types of search grounding to enable.
10399
10405
  */
10400
- search_types?: Array<'web_search' | 'image_search'>;
10406
+ search_types?: Array<'web_search' | 'image_search' | 'enterprise_web_search'>;
10401
10407
  }
10402
10408
  /**
10403
10409
  * A tool that can be used by the model to search files.
@@ -10436,6 +10442,35 @@ declare namespace Tool_2 {
10436
10442
  */
10437
10443
  longitude?: number;
10438
10444
  }
10445
+ /**
10446
+ * A tool that can be used by the model to retrieve files.
10447
+ */
10448
+ interface Retrieval {
10449
+ type: 'retrieval';
10450
+ /**
10451
+ * The types of file retrieval to enable.
10452
+ */
10453
+ retrieval_types?: Array<'vertex_ai_search'>;
10454
+ /**
10455
+ * Used to specify configuration for VertexAISearch.
10456
+ */
10457
+ vertex_ai_search_config?: Retrieval.VertexAISearchConfig;
10458
+ }
10459
+ namespace Retrieval {
10460
+ /**
10461
+ * Used to specify configuration for VertexAISearch.
10462
+ */
10463
+ interface VertexAISearchConfig {
10464
+ /**
10465
+ * Optional. Used to specify Vertex AI Search datastores.
10466
+ */
10467
+ datastores?: Array<string>;
10468
+ /**
10469
+ * Optional. Used to specify Vertex AI Search engine.
10470
+ */
10471
+ engine?: string;
10472
+ }
10473
+ }
10439
10474
  }
10440
10475
 
10441
10476
  /** A predicted server-side `ToolCall` returned from the model.
@@ -10876,8 +10911,7 @@ export declare interface TuningValidationDataset {
10876
10911
  declare interface Turn {
10877
10912
  content?: Array<Content_2> | string;
10878
10913
  /**
10879
- * The originator of this turn. Must be user for input or model for
10880
- * model output.
10914
+ * The originator of this turn. Must be user for input or model for model output.
10881
10915
  */
10882
10916
  role?: string;
10883
10917
  }
@@ -11926,7 +11960,7 @@ declare namespace Usage {
11926
11960
  /**
11927
11961
  * The modality associated with the token count.
11928
11962
  */
11929
- modality?: 'text' | 'image' | 'audio';
11963
+ modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
11930
11964
  /**
11931
11965
  * Number of tokens for the modality.
11932
11966
  */
@@ -11939,7 +11973,7 @@ declare namespace Usage {
11939
11973
  /**
11940
11974
  * The modality associated with the token count.
11941
11975
  */
11942
- modality?: 'text' | 'image' | 'audio';
11976
+ modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
11943
11977
  /**
11944
11978
  * Number of tokens for the modality.
11945
11979
  */
@@ -11952,7 +11986,7 @@ declare namespace Usage {
11952
11986
  /**
11953
11987
  * The modality associated with the token count.
11954
11988
  */
11955
- modality?: 'text' | 'image' | 'audio';
11989
+ modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
11956
11990
  /**
11957
11991
  * Number of tokens for the modality.
11958
11992
  */
@@ -11965,7 +11999,7 @@ declare namespace Usage {
11965
11999
  /**
11966
12000
  * The modality associated with the token count.
11967
12001
  */
11968
- modality?: 'text' | 'image' | 'audio';
12002
+ modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
11969
12003
  /**
11970
12004
  * Number of tokens for the modality.
11971
12005
  */
@@ -1897,7 +1897,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
1897
1897
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
1898
1898
  const USER_AGENT_HEADER = 'User-Agent';
1899
1899
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
1900
- const SDK_VERSION = '1.48.0'; // x-release-please-version
1900
+ const SDK_VERSION = '1.49.0'; // x-release-please-version
1901
1901
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
1902
1902
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
1903
1903
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';