@google/genai 1.2.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. */
@@ -2672,6 +2688,7 @@ export declare class GoogleGenAI {
2672
2688
  readonly caches: Caches;
2673
2689
  readonly files: Files;
2674
2690
  readonly operations: Operations;
2691
+ readonly authTokens: Tokens;
2675
2692
  readonly tunings: Tunings;
2676
2693
  constructor(options: GoogleGenAIOptions);
2677
2694
  }
@@ -3549,6 +3566,16 @@ export declare interface LiveConnectConfig {
3549
3566
  proactivity?: ProactivityConfig;
3550
3567
  }
3551
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
+
3552
3579
  /** Parameters for connecting to the live API. */
3553
3580
  export declare interface LiveConnectParameters {
3554
3581
  /** ID of the model to use. For a list of models, see `Google models
@@ -3561,16 +3588,6 @@ export declare interface LiveConnectParameters {
3561
3588
  config?: LiveConnectConfig;
3562
3589
  }
3563
3590
 
3564
- /** Config for LiveEphemeralParameters for Auth Token creation. */
3565
- export declare interface LiveEphemeralParameters {
3566
- /** ID of the model to configure in the ephemeral token for Live API.
3567
- For a list of models, see `Gemini models
3568
- <https://ai.google.dev/gemini-api/docs/models>`. */
3569
- model?: string;
3570
- /** Configuration specific to Live API connections created using this token. */
3571
- config?: LiveConnectConfig;
3572
- }
3573
-
3574
3591
  /**
3575
3592
  LiveMusic class encapsulates the configuration for live music
3576
3593
  generation via Lyria Live models.
@@ -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. */
@@ -4559,11 +4576,6 @@ export declare class Operations extends BaseModule {
4559
4576
  private fetchPredictVideosOperationInternal;
4560
4577
  }
4561
4578
 
4562
- /**
4563
- * @license
4564
- * Copyright 2025 Google LLC
4565
- * SPDX-License-Identifier: Apache-2.0
4566
- */
4567
4579
  /** Required. Outcome of the code execution. */
4568
4580
  export declare enum Outcome {
4569
4581
  /**
@@ -4726,6 +4738,8 @@ export declare interface Part {
4726
4738
  inlineData?: Blob_2;
4727
4739
  /** Optional. URI based data. */
4728
4740
  fileData?: FileData;
4741
+ /** An opaque signature for the thought so it can be reused in subsequent requests. */
4742
+ thoughtSignature?: string;
4729
4743
  /** Optional. Result of executing the [ExecutableCode]. */
4730
4744
  codeExecutionResult?: CodeExecutionResult;
4731
4745
  /** Optional. Code generated by the model that is meant to be executed. */
@@ -4851,7 +4865,7 @@ export declare class RawReferenceImage {
4851
4865
  /** The type of the reference image. Only set by the SDK. */
4852
4866
  referenceType?: string;
4853
4867
  /** Internal method to convert to ReferenceImageAPIInternal. */
4854
- toReferenceImageAPI(): any;
4868
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
4855
4869
  }
4856
4870
 
4857
4871
  /** Marks the end of user activity.
@@ -4870,6 +4884,24 @@ export declare interface RealtimeInputConfig {
4870
4884
 
4871
4885
  export declare type ReferenceImage = RawReferenceImage | MaskReferenceImage | ControlReferenceImage | StyleReferenceImage | SubjectReferenceImage;
4872
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
+
4873
4905
  /** Represents a recorded session. */
4874
4906
  export declare interface ReplayFile {
4875
4907
  replayId?: string;
@@ -5362,7 +5394,7 @@ export declare class StyleReferenceImage {
5362
5394
  /** Configuration for the style reference image. */
5363
5395
  config?: StyleReferenceConfig;
5364
5396
  /** Internal method to convert to ReferenceImageAPIInternal. */
5365
- toReferenceImageAPI(): any;
5397
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
5366
5398
  }
5367
5399
 
5368
5400
  /** Configuration for a Subject reference image. */
@@ -5390,7 +5422,7 @@ export declare class SubjectReferenceImage {
5390
5422
  referenceType?: string;
5391
5423
  /** Configuration for the subject reference image. */
5392
5424
  config?: SubjectReferenceConfig;
5393
- toReferenceImageAPI(): any;
5425
+ toReferenceImageAPI(): ReferenceImageAPIInternal;
5394
5426
  }
5395
5427
 
5396
5428
  /** Enum representing the subject type of a subject reference image. */
@@ -5519,6 +5551,89 @@ export declare interface ThinkingConfig {
5519
5551
  thinkingBudget?: number;
5520
5552
  }
5521
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
+
5522
5637
  /** Tokens info with a list of tokens and the corresponding list of token ids. */
5523
5638
  export declare interface TokensInfo {
5524
5639
  /** Optional. Optional fields for the role from the corresponding Content. */
@@ -6103,8 +6218,10 @@ declare namespace types {
6103
6218
  LiveMusicConnectParameters,
6104
6219
  LiveMusicSetConfigParameters,
6105
6220
  LiveMusicSetWeightedPromptsParameters,
6106
- LiveEphemeralParameters,
6221
+ AuthToken,
6222
+ LiveConnectConstraints,
6107
6223
  CreateAuthTokenConfig,
6224
+ CreateAuthTokenParameters,
6108
6225
  OperationGetParameters,
6109
6226
  BlobImageUnion,
6110
6227
  PartUnion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",