@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.
@@ -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. */
@@ -2677,6 +2695,7 @@ export declare class GoogleGenAI {
2677
2695
  readonly caches: Caches;
2678
2696
  readonly files: Files;
2679
2697
  readonly operations: Operations;
2698
+ readonly authTokens: Tokens;
2680
2699
  readonly tunings: Tunings;
2681
2700
  constructor(options: GoogleGenAIOptions);
2682
2701
  }
@@ -3554,6 +3573,16 @@ export declare interface LiveConnectConfig {
3554
3573
  proactivity?: ProactivityConfig;
3555
3574
  }
3556
3575
 
3576
+ /** Config for LiveConnectConstraints for Auth Token creation. */
3577
+ export declare interface LiveConnectConstraints {
3578
+ /** ID of the model to configure in the ephemeral token for Live API.
3579
+ For a list of models, see `Gemini models
3580
+ <https://ai.google.dev/gemini-api/docs/models>`. */
3581
+ model?: string;
3582
+ /** Configuration specific to Live API connections created using this token. */
3583
+ config?: LiveConnectConfig;
3584
+ }
3585
+
3557
3586
  /** Parameters for connecting to the live API. */
3558
3587
  export declare interface LiveConnectParameters {
3559
3588
  /** ID of the model to use. For a list of models, see `Google models
@@ -3566,16 +3595,6 @@ export declare interface LiveConnectParameters {
3566
3595
  config?: LiveConnectConfig;
3567
3596
  }
3568
3597
 
3569
- /** Config for LiveEphemeralParameters for Auth Token creation. */
3570
- export declare interface LiveEphemeralParameters {
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
-
3579
3598
  /**
3580
3599
  LiveMusic class encapsulates the configuration for live music
3581
3600
  generation via Lyria Live models.
@@ -3707,8 +3726,6 @@ export declare interface LiveMusicGenerationConfig {
3707
3726
  muteDrums?: boolean;
3708
3727
  /** Whether the audio output should contain only bass and drums. */
3709
3728
  onlyBassAndDrums?: boolean;
3710
- /** The mode of music generation. Default mode is QUALITY. */
3711
- musicGenerationMode?: MusicGenerationMode;
3712
3729
  }
3713
3730
 
3714
3731
  /** The playback control signal to apply to the music generation. */
@@ -4071,7 +4088,7 @@ export declare class MaskReferenceImage {
4071
4088
  /** Configuration for the mask reference image. */
4072
4089
  config?: MaskReferenceConfig;
4073
4090
  /** Internal method to convert to ReferenceImageAPIInternal. */
4074
- toReferenceImageAPI(): any;
4091
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
4075
4092
  }
4076
4093
 
4077
4094
  /** Enum representing the mask mode of a mask reference image. */
@@ -4158,7 +4175,7 @@ export declare enum Modality {
4158
4175
  */
4159
4176
  IMAGE = "IMAGE",
4160
4177
  /**
4161
- * Indicates the model should return images.
4178
+ * Indicates the model should return audio.
4162
4179
  */
4163
4180
  AUDIO = "AUDIO"
4164
4181
  }
@@ -4532,24 +4549,6 @@ export declare interface MultiSpeakerVoiceConfig {
4532
4549
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
4533
4550
  }
4534
4551
 
4535
- /** The mode of music generation. */
4536
- export declare enum MusicGenerationMode {
4537
- /**
4538
- * This value is unused.
4539
- */
4540
- MUSIC_GENERATION_MODE_UNSPECIFIED = "MUSIC_GENERATION_MODE_UNSPECIFIED",
4541
- /**
4542
- * Steer text prompts to regions of latent space with higher quality
4543
- music.
4544
- */
4545
- QUALITY = "QUALITY",
4546
- /**
4547
- * Steer text prompts to regions of latent space with a larger diversity
4548
- of music.
4549
- */
4550
- DIVERSITY = "DIVERSITY"
4551
- }
4552
-
4553
4552
  /** A long-running operation. */
4554
4553
  export declare interface Operation {
4555
4554
  /** 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}`. */
@@ -4584,11 +4583,6 @@ export declare class Operations extends BaseModule {
4584
4583
  private fetchPredictVideosOperationInternal;
4585
4584
  }
4586
4585
 
4587
- /**
4588
- * @license
4589
- * Copyright 2025 Google LLC
4590
- * SPDX-License-Identifier: Apache-2.0
4591
- */
4592
4586
  /** Required. Outcome of the code execution. */
4593
4587
  export declare enum Outcome {
4594
4588
  /**
@@ -4751,6 +4745,8 @@ export declare interface Part {
4751
4745
  inlineData?: Blob_2;
4752
4746
  /** Optional. URI based data. */
4753
4747
  fileData?: FileData;
4748
+ /** An opaque signature for the thought so it can be reused in subsequent requests. */
4749
+ thoughtSignature?: string;
4754
4750
  /** Optional. Result of executing the [ExecutableCode]. */
4755
4751
  codeExecutionResult?: CodeExecutionResult;
4756
4752
  /** Optional. Code generated by the model that is meant to be executed. */
@@ -4876,7 +4872,7 @@ export declare class RawReferenceImage {
4876
4872
  /** The type of the reference image. Only set by the SDK. */
4877
4873
  referenceType?: string;
4878
4874
  /** Internal method to convert to ReferenceImageAPIInternal. */
4879
- toReferenceImageAPI(): any;
4875
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
4880
4876
  }
4881
4877
 
4882
4878
  /** Marks the end of user activity.
@@ -4895,6 +4891,24 @@ export declare interface RealtimeInputConfig {
4895
4891
 
4896
4892
  export declare type ReferenceImage = RawReferenceImage | MaskReferenceImage | ControlReferenceImage | StyleReferenceImage | SubjectReferenceImage;
4897
4893
 
4894
+ /** Private class that represents a Reference image that is sent to API. */
4895
+ declare interface ReferenceImageAPIInternal {
4896
+ /** The reference image for the editing operation. */
4897
+ referenceImage?: types.Image;
4898
+ /** The id of the reference image. */
4899
+ referenceId?: number;
4900
+ /** The type of the reference image. Only set by the SDK. */
4901
+ referenceType?: string;
4902
+ /** Configuration for the mask reference image. */
4903
+ maskImageConfig?: types.MaskReferenceConfig;
4904
+ /** Configuration for the control reference image. */
4905
+ controlImageConfig?: types.ControlReferenceConfig;
4906
+ /** Configuration for the style reference image. */
4907
+ styleImageConfig?: types.StyleReferenceConfig;
4908
+ /** Configuration for the subject reference image. */
4909
+ subjectImageConfig?: types.SubjectReferenceConfig;
4910
+ }
4911
+
4898
4912
  /** Represents a recorded session. */
4899
4913
  export declare interface ReplayFile {
4900
4914
  replayId?: string;
@@ -5387,7 +5401,7 @@ export declare class StyleReferenceImage {
5387
5401
  /** Configuration for the style reference image. */
5388
5402
  config?: StyleReferenceConfig;
5389
5403
  /** Internal method to convert to ReferenceImageAPIInternal. */
5390
- toReferenceImageAPI(): any;
5404
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
5391
5405
  }
5392
5406
 
5393
5407
  /** Configuration for a Subject reference image. */
@@ -5415,7 +5429,7 @@ export declare class SubjectReferenceImage {
5415
5429
  referenceType?: string;
5416
5430
  /** Configuration for the subject reference image. */
5417
5431
  config?: SubjectReferenceConfig;
5418
- toReferenceImageAPI(): any;
5432
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
5419
5433
  }
5420
5434
 
5421
5435
  /** Enum representing the subject type of a subject reference image. */
@@ -5544,6 +5558,89 @@ export declare interface ThinkingConfig {
5544
5558
  thinkingBudget?: number;
5545
5559
  }
5546
5560
 
5561
+ export declare class Tokens extends BaseModule {
5562
+ private readonly apiClient;
5563
+ constructor(apiClient: ApiClient);
5564
+ /**
5565
+ * Creates an ephemeral auth token resource.
5566
+ *
5567
+ * @experimental
5568
+ *
5569
+ * @remarks
5570
+ * Ephermeral auth tokens is only supported in the Gemini Developer API.
5571
+ * It can be used for the session connection to the Live constrained API.
5572
+ *
5573
+ * @param params - The parameters for the create request.
5574
+ * @return The created auth token.
5575
+ *
5576
+ * @example
5577
+ * ```ts
5578
+ * // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
5579
+ * // when using the token in Live API sessions. Each session connection can
5580
+ * // use a different configuration.
5581
+ * const config: CreateAuthTokenConfig = {
5582
+ * uses: 3,
5583
+ * expireTime: '2025-05-01T00:00:00Z',
5584
+ * }
5585
+ * const token = await ai.tokens.create(config);
5586
+ *
5587
+ * // Case 2: If LiveEphemeralParameters is set, lock all fields in
5588
+ * // LiveConnectConfig when using the token in Live API sessions. For
5589
+ * // example, changing `outputAudioTranscription` in the Live API
5590
+ * // connection will be ignored by the API.
5591
+ * const config: CreateAuthTokenConfig =
5592
+ * uses: 3,
5593
+ * expireTime: '2025-05-01T00:00:00Z',
5594
+ * LiveEphemeralParameters: {
5595
+ * model: 'gemini-2.0-flash-001',
5596
+ * config: {
5597
+ * 'responseModalities': ['AUDIO'],
5598
+ * 'systemInstruction': 'Always answer in English.',
5599
+ * }
5600
+ * }
5601
+ * }
5602
+ * const token = await ai.tokens.create(config);
5603
+ *
5604
+ * // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
5605
+ * // set, lock LiveConnectConfig with set and additional fields (e.g.
5606
+ * // responseModalities, systemInstruction, temperature in this example) when
5607
+ * // using the token in Live API sessions.
5608
+ * const config: CreateAuthTokenConfig =
5609
+ * uses: 3,
5610
+ * expireTime: '2025-05-01T00:00:00Z',
5611
+ * LiveEphemeralParameters: {
5612
+ * model: 'gemini-2.0-flash-001',
5613
+ * config: {
5614
+ * 'responseModalities': ['AUDIO'],
5615
+ * 'systemInstruction': 'Always answer in English.',
5616
+ * }
5617
+ * },
5618
+ * lockAdditionalFields: ['temperature'],
5619
+ * }
5620
+ * const token = await ai.tokens.create(config);
5621
+ *
5622
+ * // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
5623
+ * // empty array, lock LiveConnectConfig with set fields (e.g.
5624
+ * // responseModalities, systemInstruction in this example) when using the
5625
+ * // token in Live API sessions.
5626
+ * const config: CreateAuthTokenConfig =
5627
+ * uses: 3,
5628
+ * expireTime: '2025-05-01T00:00:00Z',
5629
+ * LiveEphemeralParameters: {
5630
+ * model: 'gemini-2.0-flash-001',
5631
+ * config: {
5632
+ * 'responseModalities': ['AUDIO'],
5633
+ * 'systemInstruction': 'Always answer in English.',
5634
+ * }
5635
+ * },
5636
+ * lockAdditionalFields: [],
5637
+ * }
5638
+ * const token = await ai.tokens.create(config);
5639
+ * ```
5640
+ */
5641
+ create(params: types.CreateAuthTokenParameters): Promise<types.AuthToken>;
5642
+ }
5643
+
5547
5644
  /** Tokens info with a list of tokens and the corresponding list of token ids. */
5548
5645
  export declare interface TokensInfo {
5549
5646
  /** Optional. Optional fields for the role from the corresponding Content. */
@@ -5872,7 +5969,6 @@ declare namespace types {
5872
5969
  TurnCoverage,
5873
5970
  FunctionResponseScheduling,
5874
5971
  Scale,
5875
- MusicGenerationMode,
5876
5972
  LiveMusicPlaybackControl,
5877
5973
  VideoMetadata,
5878
5974
  Blob_2 as Blob,
@@ -6129,8 +6225,10 @@ declare namespace types {
6129
6225
  LiveMusicConnectParameters,
6130
6226
  LiveMusicSetConfigParameters,
6131
6227
  LiveMusicSetWeightedPromptsParameters,
6132
- LiveEphemeralParameters,
6228
+ AuthToken,
6229
+ LiveConnectConstraints,
6133
6230
  CreateAuthTokenConfig,
6231
+ CreateAuthTokenParameters,
6134
6232
  OperationGetParameters,
6135
6233
  BlobImageUnion,
6136
6234
  PartUnion,