@google/genai 1.40.0 → 1.41.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.
@@ -763,6 +763,7 @@ declare class BaseGeminiNextGenAPIClient {
763
763
  timeout: number;
764
764
  }>;
765
765
  private buildHeaders;
766
+ private _makeAbort;
766
767
  private buildBody;
767
768
  static DEFAULT_TIMEOUT: number;
768
769
  }
@@ -777,7 +778,7 @@ declare class BaseInteractions extends APIResource {
777
778
  * const interaction = await client.interactions.create({
778
779
  * api_version: 'api_version',
779
780
  * input: 'string',
780
- * model: 'gemini-2.5-pro',
781
+ * model: 'gemini-2.5-flash',
781
782
  * });
782
783
  * ```
783
784
  */
@@ -1827,11 +1828,11 @@ declare namespace ContentDelta {
1827
1828
  /**
1828
1829
  * Tool call result delta.
1829
1830
  */
1830
- result?: FunctionResultDelta.Items | string;
1831
+ result?: FunctionResultDelta.Items | unknown | string;
1831
1832
  }
1832
1833
  namespace FunctionResultDelta {
1833
1834
  interface Items {
1834
- items?: Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent | unknown>;
1835
+ items?: Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent>;
1835
1836
  }
1836
1837
  }
1837
1838
  interface CodeExecutionCallDelta {
@@ -1919,12 +1920,12 @@ declare namespace ContentDelta {
1919
1920
  /**
1920
1921
  * Tool call result delta.
1921
1922
  */
1922
- result?: MCPServerToolResultDelta.Items | string;
1923
+ result?: MCPServerToolResultDelta.Items | unknown | string;
1923
1924
  server_name?: string;
1924
1925
  }
1925
1926
  namespace MCPServerToolResultDelta {
1926
1927
  interface Items {
1927
- items?: Array<string | InteractionsAPI.ImageContent | unknown>;
1928
+ items?: Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent>;
1928
1929
  }
1929
1930
  }
1930
1931
  interface FileSearchCallDelta {
@@ -2484,6 +2485,8 @@ export declare interface CreateTuningJobConfig {
2484
2485
  sftLossWeightMultiplier?: number;
2485
2486
  /** The Google Cloud Storage location where the tuning job outputs are written. */
2486
2487
  outputUri?: string;
2488
+ /** The encryption spec of the tuning job. Customer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with provided encryption key. */
2489
+ encryptionSpec?: EncryptionSpec;
2487
2490
  }
2488
2491
 
2489
2492
  /** Fine-tuning job creation parameters - optional fields. */
@@ -3962,7 +3965,7 @@ declare interface FunctionResultContent {
3962
3965
 
3963
3966
  declare namespace FunctionResultContent {
3964
3967
  interface Items {
3965
- items?: Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent | unknown>;
3968
+ items?: Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent>;
3966
3969
  }
3967
3970
  }
3968
3971
 
@@ -5441,6 +5444,8 @@ export declare interface HttpOptions {
5441
5444
  - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
5442
5445
  - GeminiAPI backend API docs: https://ai.google.dev/api/rest */
5443
5446
  extraBody?: Record<string, unknown>;
5447
+ /** HTTP retry options for the request. */
5448
+ retryOptions?: HttpRetryOptions;
5444
5449
  }
5445
5450
 
5446
5451
  /**
@@ -5504,6 +5509,13 @@ export declare class HttpResponse {
5504
5509
  json(): Promise<unknown>;
5505
5510
  }
5506
5511
 
5512
+ /** HTTP retry options to be used in each of the requests. */
5513
+ export declare interface HttpRetryOptions {
5514
+ /** Maximum number of attempts, including the original request.
5515
+ If 0 or 1, it means no retries. If not specified, default to 5. */
5516
+ attempts?: number;
5517
+ }
5518
+
5507
5519
  /** An image. */
5508
5520
  declare interface Image_2 {
5509
5521
  /** The Cloud Storage URI of the image. ``Image`` can contain a value
@@ -5716,7 +5728,7 @@ declare interface Interaction {
5716
5728
  /**
5717
5729
  * Output only. The status of the interaction.
5718
5730
  */
5719
- status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5731
+ status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
5720
5732
  /**
5721
5733
  * The name of the `Agent` used for generating the interaction.
5722
5734
  */
@@ -5925,7 +5937,7 @@ declare interface InteractionStatusUpdate {
5925
5937
  event_id?: string;
5926
5938
  event_type?: 'interaction.status_update';
5927
5939
  interaction_id?: string;
5928
- status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5940
+ status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
5929
5941
  }
5930
5942
 
5931
5943
  /** Parameters for the private _Register method. */
@@ -7145,7 +7157,7 @@ declare interface MCPServerToolResultContent {
7145
7157
 
7146
7158
  declare namespace MCPServerToolResultContent {
7147
7159
  interface Items {
7148
- items?: Array<string | InteractionsAPI.ImageContent | unknown>;
7160
+ items?: Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent>;
7149
7161
  }
7150
7162
  }
7151
7163
 
@@ -7303,7 +7315,7 @@ export declare interface Model {
7303
7315
  /**
7304
7316
  * The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7305
7317
  */
7306
- declare type Model_2 = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-native-audio-dialog' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-pro-preview' | 'gemini-3-flash-preview' | (string & {});
7318
+ declare type Model_2 = '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' | (string & {});
7307
7319
 
7308
7320
  /** Configuration for Model Armor integrations of prompt and responses. This data type is not supported in Gemini API. */
7309
7321
  export declare interface ModelArmorConfig {
@@ -10059,6 +10071,7 @@ declare namespace types {
10059
10071
  VideoMetadata,
10060
10072
  Part,
10061
10073
  Content,
10074
+ HttpRetryOptions,
10062
10075
  HttpOptions,
10063
10076
  Schema,
10064
10077
  ModelSelectionConfig,
@@ -566,6 +566,15 @@ declare interface HttpOptions {
566
566
  - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
567
567
  - GeminiAPI backend API docs: https://ai.google.dev/api/rest */
568
568
  extraBody?: Record<string, unknown>;
569
+ /** HTTP retry options for the request. */
570
+ retryOptions?: HttpRetryOptions;
571
+ }
572
+
573
+ /** HTTP retry options to be used in each of the requests. */
574
+ declare interface HttpRetryOptions {
575
+ /** Maximum number of attempts, including the original request.
576
+ If 0 or 1, it means no retries. If not specified, default to 5. */
577
+ attempts?: number;
569
578
  }
570
579
 
571
580
  /** Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive). The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time. */