@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/genai.d.ts +141 -24
- package/dist/index.cjs +1080 -174
- package/dist/index.mjs +1080 -175
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +1040 -138
- package/dist/node/index.mjs +1040 -139
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +141 -24
- package/dist/web/index.mjs +1080 -175
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +141 -24
- package/package.json +1 -1
package/dist/node/node.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():
|
|
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
|
-
|
|
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. */
|
|
@@ -2679,6 +2695,7 @@ export declare class GoogleGenAI {
|
|
|
2679
2695
|
readonly caches: Caches;
|
|
2680
2696
|
readonly files: Files;
|
|
2681
2697
|
readonly operations: Operations;
|
|
2698
|
+
readonly authTokens: Tokens;
|
|
2682
2699
|
readonly tunings: Tunings;
|
|
2683
2700
|
constructor(options: GoogleGenAIOptions);
|
|
2684
2701
|
}
|
|
@@ -3556,6 +3573,16 @@ export declare interface LiveConnectConfig {
|
|
|
3556
3573
|
proactivity?: ProactivityConfig;
|
|
3557
3574
|
}
|
|
3558
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
|
+
|
|
3559
3586
|
/** Parameters for connecting to the live API. */
|
|
3560
3587
|
export declare interface LiveConnectParameters {
|
|
3561
3588
|
/** ID of the model to use. For a list of models, see `Google models
|
|
@@ -3568,16 +3595,6 @@ export declare interface LiveConnectParameters {
|
|
|
3568
3595
|
config?: LiveConnectConfig;
|
|
3569
3596
|
}
|
|
3570
3597
|
|
|
3571
|
-
/** Config for LiveEphemeralParameters for Auth Token creation. */
|
|
3572
|
-
export declare interface LiveEphemeralParameters {
|
|
3573
|
-
/** ID of the model to configure in the ephemeral token for Live API.
|
|
3574
|
-
For a list of models, see `Gemini models
|
|
3575
|
-
<https://ai.google.dev/gemini-api/docs/models>`. */
|
|
3576
|
-
model?: string;
|
|
3577
|
-
/** Configuration specific to Live API connections created using this token. */
|
|
3578
|
-
config?: LiveConnectConfig;
|
|
3579
|
-
}
|
|
3580
|
-
|
|
3581
3598
|
/**
|
|
3582
3599
|
LiveMusic class encapsulates the configuration for live music
|
|
3583
3600
|
generation via Lyria Live models.
|
|
@@ -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():
|
|
4091
|
+
toReferenceImageAPI(): ReferenceImageAPIInternal;
|
|
4075
4092
|
}
|
|
4076
4093
|
|
|
4077
4094
|
/** Enum representing the mask mode of a mask reference image. */
|
|
@@ -4566,11 +4583,6 @@ export declare class Operations extends BaseModule {
|
|
|
4566
4583
|
private fetchPredictVideosOperationInternal;
|
|
4567
4584
|
}
|
|
4568
4585
|
|
|
4569
|
-
/**
|
|
4570
|
-
* @license
|
|
4571
|
-
* Copyright 2025 Google LLC
|
|
4572
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4573
|
-
*/
|
|
4574
4586
|
/** Required. Outcome of the code execution. */
|
|
4575
4587
|
export declare enum Outcome {
|
|
4576
4588
|
/**
|
|
@@ -4733,6 +4745,8 @@ export declare interface Part {
|
|
|
4733
4745
|
inlineData?: Blob_2;
|
|
4734
4746
|
/** Optional. URI based data. */
|
|
4735
4747
|
fileData?: FileData;
|
|
4748
|
+
/** An opaque signature for the thought so it can be reused in subsequent requests. */
|
|
4749
|
+
thoughtSignature?: string;
|
|
4736
4750
|
/** Optional. Result of executing the [ExecutableCode]. */
|
|
4737
4751
|
codeExecutionResult?: CodeExecutionResult;
|
|
4738
4752
|
/** Optional. Code generated by the model that is meant to be executed. */
|
|
@@ -4858,7 +4872,7 @@ export declare class RawReferenceImage {
|
|
|
4858
4872
|
/** The type of the reference image. Only set by the SDK. */
|
|
4859
4873
|
referenceType?: string;
|
|
4860
4874
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
4861
|
-
toReferenceImageAPI():
|
|
4875
|
+
toReferenceImageAPI(): ReferenceImageAPIInternal;
|
|
4862
4876
|
}
|
|
4863
4877
|
|
|
4864
4878
|
/** Marks the end of user activity.
|
|
@@ -4877,6 +4891,24 @@ export declare interface RealtimeInputConfig {
|
|
|
4877
4891
|
|
|
4878
4892
|
export declare type ReferenceImage = RawReferenceImage | MaskReferenceImage | ControlReferenceImage | StyleReferenceImage | SubjectReferenceImage;
|
|
4879
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
|
+
|
|
4880
4912
|
/** Represents a recorded session. */
|
|
4881
4913
|
export declare interface ReplayFile {
|
|
4882
4914
|
replayId?: string;
|
|
@@ -5369,7 +5401,7 @@ export declare class StyleReferenceImage {
|
|
|
5369
5401
|
/** Configuration for the style reference image. */
|
|
5370
5402
|
config?: StyleReferenceConfig;
|
|
5371
5403
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
5372
|
-
toReferenceImageAPI():
|
|
5404
|
+
toReferenceImageAPI(): ReferenceImageAPIInternal;
|
|
5373
5405
|
}
|
|
5374
5406
|
|
|
5375
5407
|
/** Configuration for a Subject reference image. */
|
|
@@ -5397,7 +5429,7 @@ export declare class SubjectReferenceImage {
|
|
|
5397
5429
|
referenceType?: string;
|
|
5398
5430
|
/** Configuration for the subject reference image. */
|
|
5399
5431
|
config?: SubjectReferenceConfig;
|
|
5400
|
-
toReferenceImageAPI():
|
|
5432
|
+
toReferenceImageAPI(): ReferenceImageAPIInternal;
|
|
5401
5433
|
}
|
|
5402
5434
|
|
|
5403
5435
|
/** Enum representing the subject type of a subject reference image. */
|
|
@@ -5526,6 +5558,89 @@ export declare interface ThinkingConfig {
|
|
|
5526
5558
|
thinkingBudget?: number;
|
|
5527
5559
|
}
|
|
5528
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
|
+
|
|
5529
5644
|
/** Tokens info with a list of tokens and the corresponding list of token ids. */
|
|
5530
5645
|
export declare interface TokensInfo {
|
|
5531
5646
|
/** Optional. Optional fields for the role from the corresponding Content. */
|
|
@@ -6110,8 +6225,10 @@ declare namespace types {
|
|
|
6110
6225
|
LiveMusicConnectParameters,
|
|
6111
6226
|
LiveMusicSetConfigParameters,
|
|
6112
6227
|
LiveMusicSetWeightedPromptsParameters,
|
|
6113
|
-
|
|
6228
|
+
AuthToken,
|
|
6229
|
+
LiveConnectConstraints,
|
|
6114
6230
|
CreateAuthTokenConfig,
|
|
6231
|
+
CreateAuthTokenParameters,
|
|
6115
6232
|
OperationGetParameters,
|
|
6116
6233
|
BlobImageUnion,
|
|
6117
6234
|
PartUnion,
|