@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.
package/dist/web/web.d.ts CHANGED
@@ -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
  }
@@ -5384,8 +5402,8 @@ declare namespace GoogleMapsResult {
5384
5402
  */
5385
5403
  place_id?: string;
5386
5404
  /**
5387
- * Snippets of reviews that are used to generate answers about the
5388
- * features of a given place in Google Maps.
5405
+ * Snippets of reviews that are used to generate answers about the features of a
5406
+ * given place in Google Maps.
5389
5407
  */
5390
5408
  review_snippets?: Array<Place.ReviewSnippet>;
5391
5409
  /**
@@ -5395,8 +5413,8 @@ declare namespace GoogleMapsResult {
5395
5413
  }
5396
5414
  namespace Place {
5397
5415
  /**
5398
- * Encapsulates a snippet of a user review that answers a question about
5399
- * the features of a specific place in Google Maps.
5416
+ * Encapsulates a snippet of a user review that answers a question about the
5417
+ * features of a specific place in Google Maps.
5400
5418
  */
5401
5419
  interface ReviewSnippet {
5402
5420
  /**
@@ -5482,7 +5500,7 @@ declare interface GoogleSearchCallContent {
5482
5500
  /**
5483
5501
  * The type of search grounding enabled.
5484
5502
  */
5485
- search_type?: 'web_search' | 'image_search';
5503
+ search_type?: 'web_search' | 'image_search' | 'enterprise_web_search';
5486
5504
  /**
5487
5505
  * A signature hash for backend validation.
5488
5506
  */
@@ -6228,8 +6246,8 @@ declare interface Interaction {
6228
6246
  */
6229
6247
  id: string;
6230
6248
  /**
6231
- * Required. Output only. The time at which the response was created in ISO 8601 format
6232
- * (YYYY-MM-DDThh:mm:ssZ).
6249
+ * Required. Output only. The time at which the response was created in ISO 8601
6250
+ * format (YYYY-MM-DDThh:mm:ssZ).
6233
6251
  */
6234
6252
  created: string;
6235
6253
  /**
@@ -6237,8 +6255,8 @@ declare interface Interaction {
6237
6255
  */
6238
6256
  status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
6239
6257
  /**
6240
- * Required. Output only. The time at which the response was last updated in ISO 8601 format
6241
- * (YYYY-MM-DDThh:mm:ssZ).
6258
+ * Required. Output only. The time at which the response was last updated in ISO
6259
+ * 8601 format (YYYY-MM-DDThh:mm:ssZ).
6242
6260
  */
6243
6261
  updated: string;
6244
6262
  /**
@@ -6266,8 +6284,8 @@ declare interface Interaction {
6266
6284
  */
6267
6285
  previous_interaction_id?: string;
6268
6286
  /**
6269
- * Enforces that the generated response is a JSON object that complies with
6270
- * the JSON schema specified in this field.
6287
+ * Enforces that the generated response is a JSON object that complies with the
6288
+ * JSON schema specified in this field.
6271
6289
  */
6272
6290
  response_format?: unknown;
6273
6291
  /**
@@ -6277,7 +6295,7 @@ declare interface Interaction {
6277
6295
  /**
6278
6296
  * The requested modalities of the response (TEXT, IMAGE, AUDIO).
6279
6297
  */
6280
- response_modalities?: Array<'text' | 'image' | 'audio'>;
6298
+ response_modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'document'>;
6281
6299
  /**
6282
6300
  * Output only. The role of the interaction.
6283
6301
  */
@@ -6310,13 +6328,12 @@ declare interface InteractionCancelParams {
6310
6328
  declare interface InteractionCompleteEvent {
6311
6329
  event_type: 'interaction.complete';
6312
6330
  /**
6313
- * Required. The completed interaction with empty outputs to reduce the payload size.
6314
- * Use the preceding ContentDelta events for the actual output.
6331
+ * Required. The completed interaction with empty outputs to reduce the payload
6332
+ * size. Use the preceding ContentDelta events for the actual output.
6315
6333
  */
6316
6334
  interaction: Interaction;
6317
6335
  /**
6318
- * The event_id token to be used to resume the interaction stream, from
6319
- * this event.
6336
+ * The event_id token to be used to resume the interaction stream, from this event.
6320
6337
  */
6321
6338
  event_id?: string;
6322
6339
  }
@@ -6349,25 +6366,30 @@ declare interface InteractionGetParamsBase {
6349
6366
  */
6350
6367
  include_input?: boolean;
6351
6368
  /**
6352
- * 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.
6369
+ * Query param: Optional. If set, resumes the interaction stream from the next
6370
+ * chunk after the event marked by the event id. Can only be used if `stream` is
6371
+ * true.
6353
6372
  */
6354
6373
  last_event_id?: string;
6355
6374
  /**
6356
- * Query param: If set to true, the generated content will be streamed incrementally.
6375
+ * Query param: If set to true, the generated content will be streamed
6376
+ * incrementally.
6357
6377
  */
6358
6378
  stream?: boolean;
6359
6379
  }
6360
6380
 
6361
6381
  declare interface InteractionGetParamsNonStreaming extends InteractionGetParamsBase {
6362
6382
  /**
6363
- * Query param: If set to true, the generated content will be streamed incrementally.
6383
+ * Query param: If set to true, the generated content will be streamed
6384
+ * incrementally.
6364
6385
  */
6365
6386
  stream?: false;
6366
6387
  }
6367
6388
 
6368
6389
  declare interface InteractionGetParamsStreaming extends InteractionGetParamsBase {
6369
6390
  /**
6370
- * Query param: If set to true, the generated content will be streamed incrementally.
6391
+ * Query param: If set to true, the generated content will be streamed
6392
+ * incrementally.
6371
6393
  */
6372
6394
  stream: true;
6373
6395
  }
@@ -6464,8 +6486,7 @@ declare interface InteractionStartEvent {
6464
6486
  */
6465
6487
  interaction: Interaction;
6466
6488
  /**
6467
- * The event_id token to be used to resume the interaction stream, from
6468
- * this event.
6489
+ * The event_id token to be used to resume the interaction stream, from this event.
6469
6490
  */
6470
6491
  event_id?: string;
6471
6492
  }
@@ -6475,8 +6496,7 @@ declare interface InteractionStatusUpdate {
6475
6496
  interaction_id: string;
6476
6497
  status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
6477
6498
  /**
6478
- * The event_id token to be used to resume the interaction stream, from
6479
- * this event.
6499
+ * The event_id token to be used to resume the interaction stream, from this event.
6480
6500
  */
6481
6501
  event_id?: string;
6482
6502
  }
@@ -7867,7 +7887,8 @@ export declare interface Model {
7867
7887
  }
7868
7888
 
7869
7889
  /**
7870
- * The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7890
+ * The model that will complete your prompt.\n\nSee
7891
+ * [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7871
7892
  */
7872
7893
  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 & {});
7873
7894
 
@@ -8130,29 +8151,15 @@ export declare class Models extends BaseModule {
8130
8151
  /**
8131
8152
  * Recontextualizes an image.
8132
8153
  *
8133
- * There are two types of recontextualization currently supported:
8134
- * 1) Imagen Product Recontext - Generate images of products in new scenes
8135
- * and contexts.
8136
- * 2) Virtual Try-On: Generate images of persons modeling fashion products.
8154
+ * There is one type of recontextualization currently supported:
8155
+ * 1) Virtual Try-On: Generate images of persons modeling fashion products.
8137
8156
  *
8138
8157
  * @param params - The parameters for recontextualizing an image.
8139
8158
  * @return The response from the API.
8140
8159
  *
8141
8160
  * @example
8142
8161
  * ```ts
8143
- * const response1 = await ai.models.recontextImage({
8144
- * model: 'imagen-product-recontext-preview-06-30',
8145
- * source: {
8146
- * prompt: 'In a modern kitchen setting.',
8147
- * productImages: [productImage],
8148
- * },
8149
- * config: {
8150
- * numberOfImages: 1,
8151
- * },
8152
- * });
8153
- * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
8154
- *
8155
- * const response2 = await ai.models.recontextImage({
8162
+ * const response = await ai.models.recontextImage({
8156
8163
  * model: 'virtual-try-on-001',
8157
8164
  * source: {
8158
8165
  * personImage: personImage,
@@ -8162,7 +8169,7 @@ export declare class Models extends BaseModule {
8162
8169
  * numberOfImages: 1,
8163
8170
  * },
8164
8171
  * });
8165
- * console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
8172
+ * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
8166
8173
  * ```
8167
8174
  */
8168
8175
  recontextImage(params: types.RecontextImageParameters): Promise<types.RecontextImageResponse>;
@@ -8821,8 +8828,8 @@ declare interface PlaceCitation {
8821
8828
  */
8822
8829
  place_id?: string;
8823
8830
  /**
8824
- * Snippets of reviews that are used to generate answers about the
8825
- * features of a given place in Google Maps.
8831
+ * Snippets of reviews that are used to generate answers about the features of a
8832
+ * given place in Google Maps.
8826
8833
  */
8827
8834
  review_snippets?: Array<PlaceCitation.ReviewSnippet>;
8828
8835
  /**
@@ -8839,8 +8846,8 @@ declare interface PlaceCitation {
8839
8846
 
8840
8847
  declare namespace PlaceCitation {
8841
8848
  /**
8842
- * Encapsulates a snippet of a user review that answers a question about
8843
- * the features of a specific place in Google Maps.
8849
+ * Encapsulates a snippet of a user review that answers a question about the
8850
+ * features of a specific place in Google Maps.
8844
8851
  */
8845
8852
  interface ReviewSnippet {
8846
8853
  /**
@@ -10328,7 +10335,7 @@ export declare interface Tool {
10328
10335
  /**
10329
10336
  * A tool that can be used by the model.
10330
10337
  */
10331
- 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;
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 | Tool_2.Retrieval;
10332
10339
 
10333
10340
  declare namespace Tool_2 {
10334
10341
  /**
@@ -10377,8 +10384,7 @@ declare namespace Tool_2 {
10377
10384
  */
10378
10385
  name?: string;
10379
10386
  /**
10380
- * The full URL for the MCPServer endpoint.
10381
- * Example: "https://api.example.com/mcp"
10387
+ * The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
10382
10388
  */
10383
10389
  url?: string;
10384
10390
  }
@@ -10390,7 +10396,7 @@ declare namespace Tool_2 {
10390
10396
  /**
10391
10397
  * The types of search grounding to enable.
10392
10398
  */
10393
- search_types?: Array<'web_search' | 'image_search'>;
10399
+ search_types?: Array<'web_search' | 'image_search' | 'enterprise_web_search'>;
10394
10400
  }
10395
10401
  /**
10396
10402
  * A tool that can be used by the model to search files.
@@ -10429,6 +10435,35 @@ declare namespace Tool_2 {
10429
10435
  */
10430
10436
  longitude?: number;
10431
10437
  }
10438
+ /**
10439
+ * A tool that can be used by the model to retrieve files.
10440
+ */
10441
+ interface Retrieval {
10442
+ type: 'retrieval';
10443
+ /**
10444
+ * The types of file retrieval to enable.
10445
+ */
10446
+ retrieval_types?: Array<'vertex_ai_search'>;
10447
+ /**
10448
+ * Used to specify configuration for VertexAISearch.
10449
+ */
10450
+ vertex_ai_search_config?: Retrieval.VertexAISearchConfig;
10451
+ }
10452
+ namespace Retrieval {
10453
+ /**
10454
+ * Used to specify configuration for VertexAISearch.
10455
+ */
10456
+ interface VertexAISearchConfig {
10457
+ /**
10458
+ * Optional. Used to specify Vertex AI Search datastores.
10459
+ */
10460
+ datastores?: Array<string>;
10461
+ /**
10462
+ * Optional. Used to specify Vertex AI Search engine.
10463
+ */
10464
+ engine?: string;
10465
+ }
10466
+ }
10432
10467
  }
10433
10468
 
10434
10469
  /** A predicted server-side `ToolCall` returned from the model.
@@ -10869,8 +10904,7 @@ export declare interface TuningValidationDataset {
10869
10904
  declare interface Turn {
10870
10905
  content?: Array<Content_2> | string;
10871
10906
  /**
10872
- * The originator of this turn. Must be user for input or model for
10873
- * model output.
10907
+ * The originator of this turn. Must be user for input or model for model output.
10874
10908
  */
10875
10909
  role?: string;
10876
10910
  }
@@ -11919,7 +11953,7 @@ declare namespace Usage {
11919
11953
  /**
11920
11954
  * The modality associated with the token count.
11921
11955
  */
11922
- modality?: 'text' | 'image' | 'audio';
11956
+ modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
11923
11957
  /**
11924
11958
  * Number of tokens for the modality.
11925
11959
  */
@@ -11932,7 +11966,7 @@ declare namespace Usage {
11932
11966
  /**
11933
11967
  * The modality associated with the token count.
11934
11968
  */
11935
- modality?: 'text' | 'image' | 'audio';
11969
+ modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
11936
11970
  /**
11937
11971
  * Number of tokens for the modality.
11938
11972
  */
@@ -11945,7 +11979,7 @@ declare namespace Usage {
11945
11979
  /**
11946
11980
  * The modality associated with the token count.
11947
11981
  */
11948
- modality?: 'text' | 'image' | 'audio';
11982
+ modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
11949
11983
  /**
11950
11984
  * Number of tokens for the modality.
11951
11985
  */
@@ -11958,7 +11992,7 @@ declare namespace Usage {
11958
11992
  /**
11959
11993
  * The modality associated with the token count.
11960
11994
  */
11961
- modality?: 'text' | 'image' | 'audio';
11995
+ modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
11962
11996
  /**
11963
11997
  * Number of tokens for the modality.
11964
11998
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.48.0",
3
+ "version": "1.49.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",