@google/genai 1.8.0 → 1.10.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
@@ -560,6 +560,8 @@ export declare interface BatchJobDestination {
560
560
  inlinedResponses?: InlinedResponse[];
561
561
  }
562
562
 
563
+ export declare type BatchJobDestinationUnion = BatchJobDestination | string;
564
+
563
565
  /** Config for `src` parameter. */
564
566
  export declare interface BatchJobSource {
565
567
  /** Storage format of the input files. Must be one of:
@@ -1229,7 +1231,7 @@ export declare interface CreateBatchJobConfig {
1229
1231
  /** GCS or BigQuery URI prefix for the output predictions. Example:
1230
1232
  "gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
1231
1233
  */
1232
- dest?: string;
1234
+ dest?: BatchJobDestinationUnion;
1233
1235
  }
1234
1236
 
1235
1237
  /** Config for batches.create parameters. */
@@ -1745,6 +1747,9 @@ export declare interface EditImageConfig {
1745
1747
  only).
1746
1748
  */
1747
1749
  outputCompressionQuality?: number;
1750
+ /** Whether to add a watermark to the generated images.
1751
+ */
1752
+ addWatermark?: boolean;
1748
1753
  /** Describes the editing mode for the request. */
1749
1754
  editMode?: EditMode;
1750
1755
  /** The number of sampling steps. A higher value has better image
@@ -2480,6 +2485,8 @@ export declare interface GenerateContentParameters {
2480
2485
 
2481
2486
  /** Response message for PredictionService.GenerateContent. */
2482
2487
  export declare class GenerateContentResponse {
2488
+ /** Used to retain the full HTTP response. */
2489
+ sdkHttpResponse?: HttpResponse;
2483
2490
  /** Response variations returned by the model.
2484
2491
  */
2485
2492
  candidates?: Candidate[];
@@ -2800,7 +2807,7 @@ export declare interface GenerateVideosConfig {
2800
2807
  seed?: number;
2801
2808
  /** The aspect ratio for the generated video. 16:9 (landscape) and 9:16 (portrait) are supported. */
2802
2809
  aspectRatio?: string;
2803
- /** The resolution for the generated video. 1280x720, 1920x1080 are supported. */
2810
+ /** The resolution for the generated video. 720p and 1080p are supported. */
2804
2811
  resolution?: string;
2805
2812
  /** Whether allow to generate person videos, and restrict to specific ages. Supported values are: dont_allow, allow_adult. */
2806
2813
  personGeneration?: string;
@@ -3420,7 +3427,10 @@ export declare interface HttpOptions {
3420
3427
  headers?: Record<string, string>;
3421
3428
  /** Timeout for the request in milliseconds. */
3422
3429
  timeout?: number;
3423
- /** Extra parameters to add to the request body. */
3430
+ /** Extra parameters to add to the request body.
3431
+ The structure must match the backend API's request structure.
3432
+ - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
3433
+ - GeminiAPI backend API docs: https://ai.google.dev/api/rest */
3424
3434
  extraBody?: Record<string, unknown>;
3425
3435
  }
3426
3436
 
@@ -3503,11 +3513,38 @@ export { Image_2 as Image }
3503
3513
 
3504
3514
  /** Enum that specifies the language of the text in the prompt. */
3505
3515
  export declare enum ImagePromptLanguage {
3516
+ /**
3517
+ * Auto-detect the language.
3518
+ */
3506
3519
  auto = "auto",
3520
+ /**
3521
+ * English
3522
+ */
3507
3523
  en = "en",
3524
+ /**
3525
+ * Japanese
3526
+ */
3508
3527
  ja = "ja",
3528
+ /**
3529
+ * Korean
3530
+ */
3509
3531
  ko = "ko",
3510
- hi = "hi"
3532
+ /**
3533
+ * Hindi
3534
+ */
3535
+ hi = "hi",
3536
+ /**
3537
+ * Chinese
3538
+ */
3539
+ zh = "zh",
3540
+ /**
3541
+ * Portuguese
3542
+ */
3543
+ pt = "pt",
3544
+ /**
3545
+ * Spanish
3546
+ */
3547
+ es = "es"
3511
3548
  }
3512
3549
 
3513
3550
  /** Config for inlined request. */
@@ -3805,7 +3842,7 @@ export declare class Live {
3805
3842
  if (GOOGLE_GENAI_USE_VERTEXAI) {
3806
3843
  model = 'gemini-2.0-flash-live-preview-04-09';
3807
3844
  } else {
3808
- model = 'gemini-2.0-flash-live-001';
3845
+ model = 'gemini-live-2.5-flash-preview';
3809
3846
  }
3810
3847
  const session = await ai.live.connect({
3811
3848
  model: model,
@@ -4771,6 +4808,14 @@ export declare class Models extends BaseModule {
4771
4808
  * ```
4772
4809
  */
4773
4810
  generateContent: (params: types.GenerateContentParameters) => Promise<types.GenerateContentResponse>;
4811
+ /**
4812
+ * This logic is needed for GenerateContentConfig only.
4813
+ * Previously we made GenerateContentConfig.responseSchema field to accept
4814
+ * unknown. Since v1.9.0, we switch to use backend JSON schema support.
4815
+ * To maintain backward compatibility, we move the data that was treated as
4816
+ * JSON schema from the responseSchema field to the responseJsonSchema field.
4817
+ */
4818
+ private maybeMoveToResponseJsonSchem;
4774
4819
  /**
4775
4820
  * Makes an API request to generate content with a given model and yields the
4776
4821
  * response in chunks.
@@ -5045,18 +5090,6 @@ export declare interface MultiSpeakerVoiceConfig {
5045
5090
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
5046
5091
  }
5047
5092
 
5048
- /** A long-running operation. */
5049
- export declare interface Operation {
5050
- /** 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}`. */
5051
- name?: string;
5052
- /** 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. */
5053
- metadata?: Record<string, unknown>;
5054
- /** 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. */
5055
- done?: boolean;
5056
- /** The error result of the operation in case of failure or cancellation. */
5057
- error?: Record<string, unknown>;
5058
- }
5059
-
5060
5093
  /** Parameters for the get method of the operations module. */
5061
5094
  export declare interface OperationGetParameters {
5062
5095
  /** The operation to be retrieved. */
@@ -5783,7 +5816,7 @@ export declare class Session {
5783
5816
  if (GOOGLE_GENAI_USE_VERTEXAI) {
5784
5817
  model = 'gemini-2.0-flash-live-preview-04-09';
5785
5818
  } else {
5786
- model = 'gemini-2.0-flash-live-001';
5819
+ model = 'gemini-live-2.5-flash-preview';
5787
5820
  }
5788
5821
  const session = await ai.live.connect({
5789
5822
  model: model,
@@ -6078,14 +6111,20 @@ export declare class Tokens extends BaseModule {
6078
6111
  * @experimental
6079
6112
  *
6080
6113
  * @remarks
6081
- * Ephermeral auth tokens is only supported in the Gemini Developer API.
6114
+ * Ephemeral auth tokens is only supported in the Gemini Developer API.
6082
6115
  * It can be used for the session connection to the Live constrained API.
6116
+ * Support in v1alpha only.
6083
6117
  *
6084
6118
  * @param params - The parameters for the create request.
6085
6119
  * @return The created auth token.
6086
6120
  *
6087
6121
  * @example
6088
6122
  * ```ts
6123
+ * const ai = new GoogleGenAI({
6124
+ * apiKey: token.name,
6125
+ * httpOptions: { apiVersion: 'v1alpha' } // Support in v1alpha only.
6126
+ * });
6127
+ *
6089
6128
  * // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
6090
6129
  * // when using the token in Live API sessions. Each session connection can
6091
6130
  * // use a different configuration.
@@ -6350,6 +6389,18 @@ export declare interface TuningJob {
6350
6389
  tunedModelDisplayName?: string;
6351
6390
  }
6352
6391
 
6392
+ /** A long-running operation. */
6393
+ export declare interface TuningOperation {
6394
+ /** 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}`. */
6395
+ name?: string;
6396
+ /** 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. */
6397
+ metadata?: Record<string, unknown>;
6398
+ /** 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. */
6399
+ done?: boolean;
6400
+ /** The error result of the operation in case of failure or cancellation. */
6401
+ error?: Record<string, unknown>;
6402
+ }
6403
+
6353
6404
  declare class Tunings extends BaseModule {
6354
6405
  private readonly apiClient;
6355
6406
  constructor(apiClient: ApiClient);
@@ -6667,7 +6718,7 @@ declare namespace types {
6667
6718
  TuningValidationDataset,
6668
6719
  CreateTuningJobConfig,
6669
6720
  CreateTuningJobParameters,
6670
- Operation,
6721
+ TuningOperation,
6671
6722
  CreateCachedContentConfig,
6672
6723
  CreateCachedContentParameters,
6673
6724
  CachedContentUsageMetadata,
@@ -6796,7 +6847,8 @@ declare namespace types {
6796
6847
  ToolUnion,
6797
6848
  ToolListUnion,
6798
6849
  DownloadableFileUnion,
6799
- BatchJobSourceUnion
6850
+ BatchJobSourceUnion,
6851
+ BatchJobDestinationUnion
6800
6852
  }
6801
6853
  }
6802
6854
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",
@@ -91,13 +91,13 @@
91
91
  "tsx": "^4.19.4",
92
92
  "typedoc": "^0.27.0",
93
93
  "typescript": "~5.2.0",
94
- "typescript-eslint": "8.24.1"
94
+ "typescript-eslint": "8.24.1",
95
+ "zod": "^3.22.4",
96
+ "zod-to-json-schema": "^3.22.4"
95
97
  },
96
98
  "dependencies": {
97
99
  "google-auth-library": "^9.14.2",
98
- "ws": "^8.18.0",
99
- "zod": "^3.22.4",
100
- "zod-to-json-schema": "^3.22.4"
100
+ "ws": "^8.18.0"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "@modelcontextprotocol/sdk": "^1.11.0"