@google/genai 0.15.0 → 1.0.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
@@ -909,6 +909,40 @@ export declare class CountTokensResponse {
909
909
  cachedContentTokenCount?: number;
910
910
  }
911
911
 
912
+ /** Optional parameters. */
913
+ export declare interface CreateAuthTokenConfig {
914
+ /** Used to override HTTP request options. */
915
+ httpOptions?: HttpOptions;
916
+ /** Abort signal which can be used to cancel the request.
917
+
918
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
919
+ operation will not cancel the request in the service. You will still
920
+ be charged usage for any applicable operations.
921
+ */
922
+ abortSignal?: AbortSignal;
923
+ /** An optional time after which, when using the resulting token,
924
+ messages in Live API sessions will be rejected. (Gemini may
925
+ preemptively close the session after this time.)
926
+
927
+ If not set then this defaults to 30 minutes in the future. If set, this
928
+ value must be less than 20 hours in the future. */
929
+ expireTime?: string;
930
+ /** The time after which new Live API sessions using the token
931
+ resulting from this request will be rejected.
932
+
933
+ If not set this defaults to 60 seconds in the future. If set, this value
934
+ must be less than 20 hours in the future. */
935
+ newSessionExpireTime?: string;
936
+ /** The number of times the token can be used. If this value is zero
937
+ then no limit is applied. Default is 1. Resuming a Live API session does
938
+ not count as a use. */
939
+ uses?: number;
940
+ /** Configuration specific to Live API connections created using this token. */
941
+ liveEphemeralParameters?: LiveEphemeralParameters;
942
+ /** Additional fields to lock in the effective LiveConnectParameters. */
943
+ lockAdditionalFields?: string[];
944
+ }
945
+
912
946
  /** Optional configuration for cached content creation. */
913
947
  export declare interface CreateCachedContentConfig {
914
948
  /** Used to override HTTP request options. */
@@ -3217,7 +3251,7 @@ export declare class Live {
3217
3251
  Establishes a connection to the specified model with the given
3218
3252
  configuration and returns a Session object representing that connection.
3219
3253
 
3220
- @experimental Built-in MCP support is a preview feature, may change in
3254
+ @experimental Built-in MCP support is an experimental feature, may change in
3221
3255
  future versions.
3222
3256
 
3223
3257
  @remarks
@@ -3412,6 +3446,15 @@ export declare class LiveClientToolResponse {
3412
3446
 
3413
3447
  /** Session config for the API connection. */
3414
3448
  export declare interface LiveConnectConfig {
3449
+ /** Used to override HTTP request options. */
3450
+ httpOptions?: HttpOptions;
3451
+ /** Abort signal which can be used to cancel the request.
3452
+
3453
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
3454
+ operation will not cancel the request in the service. You will still
3455
+ be charged usage for any applicable operations.
3456
+ */
3457
+ abortSignal?: AbortSignal;
3415
3458
  /** The generation configuration for the session. */
3416
3459
  generationConfig?: GenerationConfig;
3417
3460
  /** The requested modalities of the response. Represents the set of
@@ -3496,6 +3539,16 @@ export declare interface LiveConnectParameters {
3496
3539
  config?: LiveConnectConfig;
3497
3540
  }
3498
3541
 
3542
+ /** Config for LiveEphemeralParameters for Auth Token creation. */
3543
+ export declare interface LiveEphemeralParameters {
3544
+ /** ID of the model to configure in the ephemeral token for Live API.
3545
+ For a list of models, see `Gemini models
3546
+ <https://ai.google.dev/gemini-api/docs/models>`. */
3547
+ model?: string;
3548
+ /** Configuration specific to Live API connections created using this token. */
3549
+ config?: LiveConnectConfig;
3550
+ }
3551
+
3499
3552
  /**
3500
3553
  LiveMusic class encapsulates the configuration for live music
3501
3554
  generation via Lyria Live models.
@@ -3694,7 +3747,7 @@ export declare interface LiveMusicServerSetupComplete {
3694
3747
 
3695
3748
  @experimental
3696
3749
  */
3697
- declare class LiveMusicSession {
3750
+ export declare class LiveMusicSession {
3698
3751
  readonly conn: WebSocket_2;
3699
3752
  private readonly apiClient;
3700
3753
  constructor(conn: WebSocket_2, apiClient: ApiClient);
@@ -3709,7 +3762,7 @@ declare class LiveMusicSession {
3709
3762
 
3710
3763
  @experimental
3711
3764
  */
3712
- setClientContent(params: types.LiveMusicSetClientContentParameters): Promise<void>;
3765
+ setWeightedPrompts(params: types.LiveMusicSetWeightedPromptsParameters): Promise<void>;
3713
3766
  /**
3714
3767
  Sets a configuration to the model. Updates the session's current
3715
3768
  music generation config.
@@ -3758,18 +3811,18 @@ declare class LiveMusicSession {
3758
3811
  close(): void;
3759
3812
  }
3760
3813
 
3761
- /** Parameters for setting client content for the live API. */
3762
- export declare interface LiveMusicSetClientContentParameters {
3763
- /** A map of text prompts to weights to use for the generation request. */
3764
- weightedPrompts: WeightedPrompt[];
3765
- }
3766
-
3767
- /** Parameters for setting config for the live API. */
3814
+ /** Parameters for setting config for the live music API. */
3768
3815
  export declare interface LiveMusicSetConfigParameters {
3769
3816
  /** Configuration for music generation. */
3770
3817
  musicGenerationConfig: LiveMusicGenerationConfig;
3771
3818
  }
3772
3819
 
3820
+ /** Parameters for setting weighted prompts for the live music API. */
3821
+ export declare interface LiveMusicSetWeightedPromptsParameters {
3822
+ /** A map of text prompts to weights to use for the generation request. */
3823
+ weightedPrompts: WeightedPrompt[];
3824
+ }
3825
+
3773
3826
  /** Prompts and config used for generating this audio chunk. */
3774
3827
  export declare interface LiveMusicSourceMetadata {
3775
3828
  /** Weighted prompts for generating this audio chunk. */
@@ -4010,7 +4063,7 @@ export declare enum MaskReferenceMode {
4010
4063
  * arguments. (often for automatic function calling).
4011
4064
  * Use the config to modify tool parameters such as behavior.
4012
4065
  *
4013
- * @experimental Built-in MCP support is a preview feature, may change in future
4066
+ * @experimental Built-in MCP support is an experimental feature, may change in future
4014
4067
  * versions.
4015
4068
  */
4016
4069
  export declare function mcpToTool(...args: [...Client[], CallableToolConfig | Client]): CallableTool;
@@ -4223,9 +4276,10 @@ export declare class Models extends BaseModule {
4223
4276
  /**
4224
4277
  * Transforms the CallableTools in the parameters to be simply Tools, it
4225
4278
  * copies the params into a new object and replaces the tools, it does not
4226
- * modify the original params.
4279
+ * modify the original params. Also sets the MCP usage header if there are
4280
+ * MCP tools in the parameters.
4227
4281
  */
4228
- private transformCallableTools;
4282
+ private processParamsForMcpUsage;
4229
4283
  private initAfcToolsMap;
4230
4284
  private processAfcStream;
4231
4285
  /**
@@ -6013,7 +6067,9 @@ declare namespace types {
6013
6067
  CallableToolConfig,
6014
6068
  LiveMusicConnectParameters,
6015
6069
  LiveMusicSetConfigParameters,
6016
- LiveMusicSetClientContentParameters,
6070
+ LiveMusicSetWeightedPromptsParameters,
6071
+ LiveEphemeralParameters,
6072
+ CreateAuthTokenConfig,
6017
6073
  OperationGetParameters,
6018
6074
  BlobImageUnion,
6019
6075
  PartUnion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "0.15.0",
3
+ "version": "1.0.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.js",
@@ -46,8 +46,8 @@
46
46
  "test-server-tests": "tsc && GOOGLE_CLOUD_PROJECT=googcloudproj GOOGLE_CLOUD_LOCATION=googcloudloc jasmine dist/test/system/node/*_test.js !dist/test/system/node/live_test.js -- --test-server",
47
47
  "test-server-tests:record": "tsc && jasmine --fail-fast dist/test/system/node/*_test.js !dist/test/system/node/live_test.js -- --test-server --record",
48
48
  "docs": "typedoc && ts-node scripts/add_docsite_license_headers.ts",
49
- "pages-main": "ts-node scripts/generate_pages.ts main",
50
- "pages-release": "ts-node scripts/generate_pages.ts release",
49
+ "pages-main": "node --loader ts-node/esm scripts/generate_pages.ts main",
50
+ "pages-release": "node --loader ts-node/esm scripts/generate_pages.ts release",
51
51
  "format": "prettier '**/*.ts' '**/*.mjs' '**/*.json' --write",
52
52
  "lint": "eslint '**/*.ts'",
53
53
  "lint-fix": "eslint --fix '**/*.ts'"