@google/genai 1.1.0 → 1.3.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
@@ -1,4 +1,4 @@
1
- import { Client } from '@modelcontextprotocol/sdk/client/index.js';
1
+ import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
2
  import { GoogleAuthOptions } from 'google-auth-library';
3
3
 
4
4
  /** Marks the end of user activity.
@@ -272,6 +272,12 @@ export declare interface AuthConfigOidcConfig {
272
272
  serviceAccount?: string;
273
273
  }
274
274
 
275
+ /** Config for auth_tokens.create parameters. */
276
+ export declare interface AuthToken {
277
+ /** The name of the auth token. */
278
+ name?: string;
279
+ }
280
+
275
281
  /** Type of auth scheme. */
276
282
  export declare enum AuthType {
277
283
  AUTH_TYPE_UNSPECIFIED = "AUTH_TYPE_UNSPECIFIED",
@@ -855,7 +861,7 @@ export declare class ControlReferenceImage {
855
861
  /** Configuration for the control reference image. */
856
862
  config?: ControlReferenceConfig;
857
863
  /** Internal method to convert to ReferenceImageAPIInternal. */
858
- toReferenceImageAPI(): any;
864
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
859
865
  }
860
866
 
861
867
  /** Enum representing the control type of a control reference image. */
@@ -938,11 +944,17 @@ export declare interface CreateAuthTokenConfig {
938
944
  not count as a use. */
939
945
  uses?: number;
940
946
  /** Configuration specific to Live API connections created using this token. */
941
- liveEphemeralParameters?: LiveEphemeralParameters;
947
+ liveConnectConstraints?: LiveConnectConstraints;
942
948
  /** Additional fields to lock in the effective LiveConnectParameters. */
943
949
  lockAdditionalFields?: string[];
944
950
  }
945
951
 
952
+ /** Config for auth_tokens.create parameters. */
953
+ export declare interface CreateAuthTokenParameters {
954
+ /** Optional parameters for the request. */
955
+ config?: CreateAuthTokenConfig;
956
+ }
957
+
946
958
  /** Optional configuration for cached content creation. */
947
959
  export declare interface CreateCachedContentConfig {
948
960
  /** Used to override HTTP request options. */
@@ -1837,7 +1849,11 @@ export declare enum FinishReason {
1837
1849
  /**
1838
1850
  * Token generation stopped because generated images have safety violations.
1839
1851
  */
1840
- IMAGE_SAFETY = "IMAGE_SAFETY"
1852
+ IMAGE_SAFETY = "IMAGE_SAFETY",
1853
+ /**
1854
+ * The tool call generated by the model is invalid.
1855
+ */
1856
+ UNEXPECTED_TOOL_CALL = "UNEXPECTED_TOOL_CALL"
1841
1857
  }
1842
1858
 
1843
1859
  /** A function call. */
@@ -2408,6 +2424,8 @@ export declare interface GenerateVideosConfig {
2408
2424
  negativePrompt?: string;
2409
2425
  /** Whether to use the prompt rewriting logic. */
2410
2426
  enhancePrompt?: boolean;
2427
+ /** Whether to generate audio along with the video. */
2428
+ generateAudio?: boolean;
2411
2429
  }
2412
2430
 
2413
2431
  /** A video generation operation. */
@@ -2670,6 +2688,7 @@ export declare class GoogleGenAI {
2670
2688
  readonly caches: Caches;
2671
2689
  readonly files: Files;
2672
2690
  readonly operations: Operations;
2691
+ readonly authTokens: Tokens;
2673
2692
  readonly tunings: Tunings;
2674
2693
  constructor(options: GoogleGenAIOptions);
2675
2694
  }
@@ -3547,6 +3566,16 @@ export declare interface LiveConnectConfig {
3547
3566
  proactivity?: ProactivityConfig;
3548
3567
  }
3549
3568
 
3569
+ /** Config for LiveConnectConstraints for Auth Token creation. */
3570
+ export declare interface LiveConnectConstraints {
3571
+ /** ID of the model to configure in the ephemeral token for Live API.
3572
+ For a list of models, see `Gemini models
3573
+ <https://ai.google.dev/gemini-api/docs/models>`. */
3574
+ model?: string;
3575
+ /** Configuration specific to Live API connections created using this token. */
3576
+ config?: LiveConnectConfig;
3577
+ }
3578
+
3550
3579
  /** Parameters for connecting to the live API. */
3551
3580
  export declare interface LiveConnectParameters {
3552
3581
  /** ID of the model to use. For a list of models, see `Google models
@@ -3559,16 +3588,6 @@ export declare interface LiveConnectParameters {
3559
3588
  config?: LiveConnectConfig;
3560
3589
  }
3561
3590
 
3562
- /** Config for LiveEphemeralParameters for Auth Token creation. */
3563
- export declare interface LiveEphemeralParameters {
3564
- /** ID of the model to configure in the ephemeral token for Live API.
3565
- For a list of models, see `Gemini models
3566
- <https://ai.google.dev/gemini-api/docs/models>`. */
3567
- model?: string;
3568
- /** Configuration specific to Live API connections created using this token. */
3569
- config?: LiveConnectConfig;
3570
- }
3571
-
3572
3591
  /**
3573
3592
  LiveMusic class encapsulates the configuration for live music
3574
3593
  generation via Lyria Live models.
@@ -3700,8 +3719,6 @@ export declare interface LiveMusicGenerationConfig {
3700
3719
  muteDrums?: boolean;
3701
3720
  /** Whether the audio output should contain only bass and drums. */
3702
3721
  onlyBassAndDrums?: boolean;
3703
- /** The mode of music generation. Default mode is QUALITY. */
3704
- musicGenerationMode?: MusicGenerationMode;
3705
3722
  }
3706
3723
 
3707
3724
  /** The playback control signal to apply to the music generation. */
@@ -4064,7 +4081,7 @@ export declare class MaskReferenceImage {
4064
4081
  /** Configuration for the mask reference image. */
4065
4082
  config?: MaskReferenceConfig;
4066
4083
  /** Internal method to convert to ReferenceImageAPIInternal. */
4067
- toReferenceImageAPI(): any;
4084
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
4068
4085
  }
4069
4086
 
4070
4087
  /** Enum representing the mask mode of a mask reference image. */
@@ -4151,7 +4168,7 @@ export declare enum Modality {
4151
4168
  */
4152
4169
  IMAGE = "IMAGE",
4153
4170
  /**
4154
- * Indicates the model should return images.
4171
+ * Indicates the model should return audio.
4155
4172
  */
4156
4173
  AUDIO = "AUDIO"
4157
4174
  }
@@ -4525,24 +4542,6 @@ export declare interface MultiSpeakerVoiceConfig {
4525
4542
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
4526
4543
  }
4527
4544
 
4528
- /** The mode of music generation. */
4529
- export declare enum MusicGenerationMode {
4530
- /**
4531
- * This value is unused.
4532
- */
4533
- MUSIC_GENERATION_MODE_UNSPECIFIED = "MUSIC_GENERATION_MODE_UNSPECIFIED",
4534
- /**
4535
- * Steer text prompts to regions of latent space with higher quality
4536
- music.
4537
- */
4538
- QUALITY = "QUALITY",
4539
- /**
4540
- * Steer text prompts to regions of latent space with a larger diversity
4541
- of music.
4542
- */
4543
- DIVERSITY = "DIVERSITY"
4544
- }
4545
-
4546
4545
  /** A long-running operation. */
4547
4546
  export declare interface Operation {
4548
4547
  /** 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}`. */
@@ -4577,11 +4576,6 @@ export declare class Operations extends BaseModule {
4577
4576
  private fetchPredictVideosOperationInternal;
4578
4577
  }
4579
4578
 
4580
- /**
4581
- * @license
4582
- * Copyright 2025 Google LLC
4583
- * SPDX-License-Identifier: Apache-2.0
4584
- */
4585
4579
  /** Required. Outcome of the code execution. */
4586
4580
  export declare enum Outcome {
4587
4581
  /**
@@ -4744,6 +4738,8 @@ export declare interface Part {
4744
4738
  inlineData?: Blob_2;
4745
4739
  /** Optional. URI based data. */
4746
4740
  fileData?: FileData;
4741
+ /** An opaque signature for the thought so it can be reused in subsequent requests. */
4742
+ thoughtSignature?: string;
4747
4743
  /** Optional. Result of executing the [ExecutableCode]. */
4748
4744
  codeExecutionResult?: CodeExecutionResult;
4749
4745
  /** Optional. Code generated by the model that is meant to be executed. */
@@ -4869,7 +4865,7 @@ export declare class RawReferenceImage {
4869
4865
  /** The type of the reference image. Only set by the SDK. */
4870
4866
  referenceType?: string;
4871
4867
  /** Internal method to convert to ReferenceImageAPIInternal. */
4872
- toReferenceImageAPI(): any;
4868
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
4873
4869
  }
4874
4870
 
4875
4871
  /** Marks the end of user activity.
@@ -4888,6 +4884,24 @@ export declare interface RealtimeInputConfig {
4888
4884
 
4889
4885
  export declare type ReferenceImage = RawReferenceImage | MaskReferenceImage | ControlReferenceImage | StyleReferenceImage | SubjectReferenceImage;
4890
4886
 
4887
+ /** Private class that represents a Reference image that is sent to API. */
4888
+ declare interface ReferenceImageAPIInternal {
4889
+ /** The reference image for the editing operation. */
4890
+ referenceImage?: types.Image;
4891
+ /** The id of the reference image. */
4892
+ referenceId?: number;
4893
+ /** The type of the reference image. Only set by the SDK. */
4894
+ referenceType?: string;
4895
+ /** Configuration for the mask reference image. */
4896
+ maskImageConfig?: types.MaskReferenceConfig;
4897
+ /** Configuration for the control reference image. */
4898
+ controlImageConfig?: types.ControlReferenceConfig;
4899
+ /** Configuration for the style reference image. */
4900
+ styleImageConfig?: types.StyleReferenceConfig;
4901
+ /** Configuration for the subject reference image. */
4902
+ subjectImageConfig?: types.SubjectReferenceConfig;
4903
+ }
4904
+
4891
4905
  /** Represents a recorded session. */
4892
4906
  export declare interface ReplayFile {
4893
4907
  replayId?: string;
@@ -5380,7 +5394,7 @@ export declare class StyleReferenceImage {
5380
5394
  /** Configuration for the style reference image. */
5381
5395
  config?: StyleReferenceConfig;
5382
5396
  /** Internal method to convert to ReferenceImageAPIInternal. */
5383
- toReferenceImageAPI(): any;
5397
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
5384
5398
  }
5385
5399
 
5386
5400
  /** Configuration for a Subject reference image. */
@@ -5408,7 +5422,7 @@ export declare class SubjectReferenceImage {
5408
5422
  referenceType?: string;
5409
5423
  /** Configuration for the subject reference image. */
5410
5424
  config?: SubjectReferenceConfig;
5411
- toReferenceImageAPI(): any;
5425
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
5412
5426
  }
5413
5427
 
5414
5428
  /** Enum representing the subject type of a subject reference image. */
@@ -5537,6 +5551,89 @@ export declare interface ThinkingConfig {
5537
5551
  thinkingBudget?: number;
5538
5552
  }
5539
5553
 
5554
+ export declare class Tokens extends BaseModule {
5555
+ private readonly apiClient;
5556
+ constructor(apiClient: ApiClient);
5557
+ /**
5558
+ * Creates an ephemeral auth token resource.
5559
+ *
5560
+ * @experimental
5561
+ *
5562
+ * @remarks
5563
+ * Ephermeral auth tokens is only supported in the Gemini Developer API.
5564
+ * It can be used for the session connection to the Live constrained API.
5565
+ *
5566
+ * @param params - The parameters for the create request.
5567
+ * @return The created auth token.
5568
+ *
5569
+ * @example
5570
+ * ```ts
5571
+ * // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
5572
+ * // when using the token in Live API sessions. Each session connection can
5573
+ * // use a different configuration.
5574
+ * const config: CreateAuthTokenConfig = {
5575
+ * uses: 3,
5576
+ * expireTime: '2025-05-01T00:00:00Z',
5577
+ * }
5578
+ * const token = await ai.tokens.create(config);
5579
+ *
5580
+ * // Case 2: If LiveEphemeralParameters is set, lock all fields in
5581
+ * // LiveConnectConfig when using the token in Live API sessions. For
5582
+ * // example, changing `outputAudioTranscription` in the Live API
5583
+ * // connection will be ignored by the API.
5584
+ * const config: CreateAuthTokenConfig =
5585
+ * uses: 3,
5586
+ * expireTime: '2025-05-01T00:00:00Z',
5587
+ * LiveEphemeralParameters: {
5588
+ * model: 'gemini-2.0-flash-001',
5589
+ * config: {
5590
+ * 'responseModalities': ['AUDIO'],
5591
+ * 'systemInstruction': 'Always answer in English.',
5592
+ * }
5593
+ * }
5594
+ * }
5595
+ * const token = await ai.tokens.create(config);
5596
+ *
5597
+ * // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
5598
+ * // set, lock LiveConnectConfig with set and additional fields (e.g.
5599
+ * // responseModalities, systemInstruction, temperature in this example) when
5600
+ * // using the token in Live API sessions.
5601
+ * const config: CreateAuthTokenConfig =
5602
+ * uses: 3,
5603
+ * expireTime: '2025-05-01T00:00:00Z',
5604
+ * LiveEphemeralParameters: {
5605
+ * model: 'gemini-2.0-flash-001',
5606
+ * config: {
5607
+ * 'responseModalities': ['AUDIO'],
5608
+ * 'systemInstruction': 'Always answer in English.',
5609
+ * }
5610
+ * },
5611
+ * lockAdditionalFields: ['temperature'],
5612
+ * }
5613
+ * const token = await ai.tokens.create(config);
5614
+ *
5615
+ * // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
5616
+ * // empty array, lock LiveConnectConfig with set fields (e.g.
5617
+ * // responseModalities, systemInstruction in this example) when using the
5618
+ * // token in Live API sessions.
5619
+ * const config: CreateAuthTokenConfig =
5620
+ * uses: 3,
5621
+ * expireTime: '2025-05-01T00:00:00Z',
5622
+ * LiveEphemeralParameters: {
5623
+ * model: 'gemini-2.0-flash-001',
5624
+ * config: {
5625
+ * 'responseModalities': ['AUDIO'],
5626
+ * 'systemInstruction': 'Always answer in English.',
5627
+ * }
5628
+ * },
5629
+ * lockAdditionalFields: [],
5630
+ * }
5631
+ * const token = await ai.tokens.create(config);
5632
+ * ```
5633
+ */
5634
+ create(params: types.CreateAuthTokenParameters): Promise<types.AuthToken>;
5635
+ }
5636
+
5540
5637
  /** Tokens info with a list of tokens and the corresponding list of token ids. */
5541
5638
  export declare interface TokensInfo {
5542
5639
  /** Optional. Optional fields for the role from the corresponding Content. */
@@ -5865,7 +5962,6 @@ declare namespace types {
5865
5962
  TurnCoverage,
5866
5963
  FunctionResponseScheduling,
5867
5964
  Scale,
5868
- MusicGenerationMode,
5869
5965
  LiveMusicPlaybackControl,
5870
5966
  VideoMetadata,
5871
5967
  Blob_2 as Blob,
@@ -6122,8 +6218,10 @@ declare namespace types {
6122
6218
  LiveMusicConnectParameters,
6123
6219
  LiveMusicSetConfigParameters,
6124
6220
  LiveMusicSetWeightedPromptsParameters,
6125
- LiveEphemeralParameters,
6221
+ AuthToken,
6222
+ LiveConnectConstraints,
6126
6223
  CreateAuthTokenConfig,
6224
+ CreateAuthTokenParameters,
6127
6225
  OperationGetParameters,
6128
6226
  BlobImageUnion,
6129
6227
  PartUnion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",