@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.
package/dist/web/web.d.ts CHANGED
@@ -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
 
@@ -5434,6 +5437,8 @@ export declare interface HttpOptions {
5434
5437
  - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
5435
5438
  - GeminiAPI backend API docs: https://ai.google.dev/api/rest */
5436
5439
  extraBody?: Record<string, unknown>;
5440
+ /** HTTP retry options for the request. */
5441
+ retryOptions?: HttpRetryOptions;
5437
5442
  }
5438
5443
 
5439
5444
  /**
@@ -5497,6 +5502,13 @@ export declare class HttpResponse {
5497
5502
  json(): Promise<unknown>;
5498
5503
  }
5499
5504
 
5505
+ /** HTTP retry options to be used in each of the requests. */
5506
+ export declare interface HttpRetryOptions {
5507
+ /** Maximum number of attempts, including the original request.
5508
+ If 0 or 1, it means no retries. If not specified, default to 5. */
5509
+ attempts?: number;
5510
+ }
5511
+
5500
5512
  /** An image. */
5501
5513
  declare interface Image_2 {
5502
5514
  /** The Cloud Storage URI of the image. ``Image`` can contain a value
@@ -5709,7 +5721,7 @@ declare interface Interaction {
5709
5721
  /**
5710
5722
  * Output only. The status of the interaction.
5711
5723
  */
5712
- status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5724
+ status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
5713
5725
  /**
5714
5726
  * The name of the `Agent` used for generating the interaction.
5715
5727
  */
@@ -5918,7 +5930,7 @@ declare interface InteractionStatusUpdate {
5918
5930
  event_id?: string;
5919
5931
  event_type?: 'interaction.status_update';
5920
5932
  interaction_id?: string;
5921
- status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5933
+ status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
5922
5934
  }
5923
5935
 
5924
5936
  /** Parameters for the private _Register method. */
@@ -7138,7 +7150,7 @@ declare interface MCPServerToolResultContent {
7138
7150
 
7139
7151
  declare namespace MCPServerToolResultContent {
7140
7152
  interface Items {
7141
- items?: Array<string | InteractionsAPI.ImageContent | unknown>;
7153
+ items?: Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent>;
7142
7154
  }
7143
7155
  }
7144
7156
 
@@ -7296,7 +7308,7 @@ export declare interface Model {
7296
7308
  /**
7297
7309
  * The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7298
7310
  */
7299
- 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 & {});
7311
+ 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 & {});
7300
7312
 
7301
7313
  /** Configuration for Model Armor integrations of prompt and responses. This data type is not supported in Gemini API. */
7302
7314
  export declare interface ModelArmorConfig {
@@ -10052,6 +10064,7 @@ declare namespace types {
10052
10064
  VideoMetadata,
10053
10065
  Part,
10054
10066
  Content,
10067
+ HttpRetryOptions,
10055
10068
  HttpOptions,
10056
10069
  Schema,
10057
10070
  ModelSelectionConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.40.0",
3
+ "version": "1.41.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",
@@ -105,6 +105,7 @@
105
105
  "web/package.json"
106
106
  ],
107
107
  "devDependencies": {
108
+ "@cfworker/json-schema": "^4.1.1",
108
109
  "@eslint/js": "9.20.0",
109
110
  "@microsoft/api-extractor": "^7.52.9",
110
111
  "@modelcontextprotocol/sdk": "^1.25.2",
@@ -114,7 +115,6 @@
114
115
  "@types/node-fetch": "^2.6.13",
115
116
  "@types/unist": "^3.0.3",
116
117
  "@types/ws": "^8.5.14",
117
- "@cfworker/json-schema": "^4.1.1",
118
118
  "c8": "^10.1.3",
119
119
  "eslint": "8.57.0",
120
120
  "gts": "^5.2.0",
@@ -142,6 +142,7 @@
142
142
  },
143
143
  "dependencies": {
144
144
  "google-auth-library": "^10.3.0",
145
+ "p-retry": "^7.1.1",
145
146
  "protobufjs": "^7.5.4",
146
147
  "ws": "^8.18.0"
147
148
  },