@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.
@@ -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;
@@ -3427,7 +3434,10 @@ export declare interface HttpOptions {
3427
3434
  headers?: Record<string, string>;
3428
3435
  /** Timeout for the request in milliseconds. */
3429
3436
  timeout?: number;
3430
- /** Extra parameters to add to the request body. */
3437
+ /** Extra parameters to add to the request body.
3438
+ The structure must match the backend API's request structure.
3439
+ - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
3440
+ - GeminiAPI backend API docs: https://ai.google.dev/api/rest */
3431
3441
  extraBody?: Record<string, unknown>;
3432
3442
  }
3433
3443
 
@@ -3510,11 +3520,38 @@ export { Image_2 as Image }
3510
3520
 
3511
3521
  /** Enum that specifies the language of the text in the prompt. */
3512
3522
  export declare enum ImagePromptLanguage {
3523
+ /**
3524
+ * Auto-detect the language.
3525
+ */
3513
3526
  auto = "auto",
3527
+ /**
3528
+ * English
3529
+ */
3514
3530
  en = "en",
3531
+ /**
3532
+ * Japanese
3533
+ */
3515
3534
  ja = "ja",
3535
+ /**
3536
+ * Korean
3537
+ */
3516
3538
  ko = "ko",
3517
- hi = "hi"
3539
+ /**
3540
+ * Hindi
3541
+ */
3542
+ hi = "hi",
3543
+ /**
3544
+ * Chinese
3545
+ */
3546
+ zh = "zh",
3547
+ /**
3548
+ * Portuguese
3549
+ */
3550
+ pt = "pt",
3551
+ /**
3552
+ * Spanish
3553
+ */
3554
+ es = "es"
3518
3555
  }
3519
3556
 
3520
3557
  /** Config for inlined request. */
@@ -3812,7 +3849,7 @@ export declare class Live {
3812
3849
  if (GOOGLE_GENAI_USE_VERTEXAI) {
3813
3850
  model = 'gemini-2.0-flash-live-preview-04-09';
3814
3851
  } else {
3815
- model = 'gemini-2.0-flash-live-001';
3852
+ model = 'gemini-live-2.5-flash-preview';
3816
3853
  }
3817
3854
  const session = await ai.live.connect({
3818
3855
  model: model,
@@ -4778,6 +4815,14 @@ export declare class Models extends BaseModule {
4778
4815
  * ```
4779
4816
  */
4780
4817
  generateContent: (params: types.GenerateContentParameters) => Promise<types.GenerateContentResponse>;
4818
+ /**
4819
+ * This logic is needed for GenerateContentConfig only.
4820
+ * Previously we made GenerateContentConfig.responseSchema field to accept
4821
+ * unknown. Since v1.9.0, we switch to use backend JSON schema support.
4822
+ * To maintain backward compatibility, we move the data that was treated as
4823
+ * JSON schema from the responseSchema field to the responseJsonSchema field.
4824
+ */
4825
+ private maybeMoveToResponseJsonSchem;
4781
4826
  /**
4782
4827
  * Makes an API request to generate content with a given model and yields the
4783
4828
  * response in chunks.
@@ -5052,18 +5097,6 @@ export declare interface MultiSpeakerVoiceConfig {
5052
5097
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
5053
5098
  }
5054
5099
 
5055
- /** A long-running operation. */
5056
- export declare interface Operation {
5057
- /** 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}`. */
5058
- name?: string;
5059
- /** 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. */
5060
- metadata?: Record<string, unknown>;
5061
- /** 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. */
5062
- done?: boolean;
5063
- /** The error result of the operation in case of failure or cancellation. */
5064
- error?: Record<string, unknown>;
5065
- }
5066
-
5067
5100
  /** Parameters for the get method of the operations module. */
5068
5101
  export declare interface OperationGetParameters {
5069
5102
  /** The operation to be retrieved. */
@@ -5790,7 +5823,7 @@ export declare class Session {
5790
5823
  if (GOOGLE_GENAI_USE_VERTEXAI) {
5791
5824
  model = 'gemini-2.0-flash-live-preview-04-09';
5792
5825
  } else {
5793
- model = 'gemini-2.0-flash-live-001';
5826
+ model = 'gemini-live-2.5-flash-preview';
5794
5827
  }
5795
5828
  const session = await ai.live.connect({
5796
5829
  model: model,
@@ -6085,14 +6118,20 @@ export declare class Tokens extends BaseModule {
6085
6118
  * @experimental
6086
6119
  *
6087
6120
  * @remarks
6088
- * Ephermeral auth tokens is only supported in the Gemini Developer API.
6121
+ * Ephemeral auth tokens is only supported in the Gemini Developer API.
6089
6122
  * It can be used for the session connection to the Live constrained API.
6123
+ * Support in v1alpha only.
6090
6124
  *
6091
6125
  * @param params - The parameters for the create request.
6092
6126
  * @return The created auth token.
6093
6127
  *
6094
6128
  * @example
6095
6129
  * ```ts
6130
+ * const ai = new GoogleGenAI({
6131
+ * apiKey: token.name,
6132
+ * httpOptions: { apiVersion: 'v1alpha' } // Support in v1alpha only.
6133
+ * });
6134
+ *
6096
6135
  * // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
6097
6136
  * // when using the token in Live API sessions. Each session connection can
6098
6137
  * // use a different configuration.
@@ -6357,6 +6396,18 @@ export declare interface TuningJob {
6357
6396
  tunedModelDisplayName?: string;
6358
6397
  }
6359
6398
 
6399
+ /** A long-running operation. */
6400
+ export declare interface TuningOperation {
6401
+ /** 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}`. */
6402
+ name?: string;
6403
+ /** 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. */
6404
+ metadata?: Record<string, unknown>;
6405
+ /** 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. */
6406
+ done?: boolean;
6407
+ /** The error result of the operation in case of failure or cancellation. */
6408
+ error?: Record<string, unknown>;
6409
+ }
6410
+
6360
6411
  declare class Tunings extends BaseModule {
6361
6412
  private readonly apiClient;
6362
6413
  constructor(apiClient: ApiClient);
@@ -6674,7 +6725,7 @@ declare namespace types {
6674
6725
  TuningValidationDataset,
6675
6726
  CreateTuningJobConfig,
6676
6727
  CreateTuningJobParameters,
6677
- Operation,
6728
+ TuningOperation,
6678
6729
  CreateCachedContentConfig,
6679
6730
  CreateCachedContentParameters,
6680
6731
  CachedContentUsageMetadata,
@@ -6803,7 +6854,8 @@ declare namespace types {
6803
6854
  ToolUnion,
6804
6855
  ToolListUnion,
6805
6856
  DownloadableFileUnion,
6806
- BatchJobSourceUnion
6857
+ BatchJobSourceUnion,
6858
+ BatchJobDestinationUnion
6807
6859
  }
6808
6860
  }
6809
6861