@google/genai 0.6.1 → 0.8.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 +554 -48
- package/dist/index.js +1720 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1713 -69
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +4677 -3028
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +554 -48
- package/dist/web/index.mjs +4657 -3013
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +554 -48
- package/package.json +4 -2
package/dist/node/node.d.ts
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
import { GoogleAuthOptions } from 'google-auth-library';
|
|
2
2
|
|
|
3
|
+
/** Marks the end of user activity.
|
|
4
|
+
|
|
5
|
+
This can only be sent if automatic (i.e. server-side) activity detection is
|
|
6
|
+
disabled.
|
|
7
|
+
*/
|
|
8
|
+
export declare interface ActivityEnd {
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** The different ways of handling user activity. */
|
|
12
|
+
export declare enum ActivityHandling {
|
|
13
|
+
ACTIVITY_HANDLING_UNSPECIFIED = "ACTIVITY_HANDLING_UNSPECIFIED",
|
|
14
|
+
START_OF_ACTIVITY_INTERRUPTS = "START_OF_ACTIVITY_INTERRUPTS",
|
|
15
|
+
NO_INTERRUPTION = "NO_INTERRUPTION"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Marks the start of user activity.
|
|
19
|
+
|
|
20
|
+
This can only be sent if automatic (i.e. server-side) activity detection is
|
|
21
|
+
disabled.
|
|
22
|
+
*/
|
|
23
|
+
export declare interface ActivityStart {
|
|
24
|
+
}
|
|
25
|
+
|
|
3
26
|
/**
|
|
4
27
|
* The ApiClient class is used to send requests to the Gemini API or Vertex AI
|
|
5
28
|
* endpoints.
|
|
@@ -20,6 +43,7 @@ declare class ApiClient {
|
|
|
20
43
|
getWebsocketBaseUrl(): string;
|
|
21
44
|
setBaseUrl(url: string): void;
|
|
22
45
|
private constructUrl;
|
|
46
|
+
private shouldPrependVertexProjectPath;
|
|
23
47
|
request(request: HttpRequest): Promise<HttpResponse>;
|
|
24
48
|
private patchHttpOptions;
|
|
25
49
|
requestStream(request: HttpRequest): Promise<any>;
|
|
@@ -97,6 +121,10 @@ declare interface ApiClientInitOptions {
|
|
|
97
121
|
userAgentExtra?: string;
|
|
98
122
|
}
|
|
99
123
|
|
|
124
|
+
/** The audio transcription configuration in Setup. */
|
|
125
|
+
export declare interface AudioTranscriptionConfig {
|
|
126
|
+
}
|
|
127
|
+
|
|
100
128
|
/**
|
|
101
129
|
* @license
|
|
102
130
|
* Copyright 2025 Google LLC
|
|
@@ -114,6 +142,25 @@ declare interface Auth {
|
|
|
114
142
|
addAuthHeaders(headers: Headers): Promise<void>;
|
|
115
143
|
}
|
|
116
144
|
|
|
145
|
+
/** Configures automatic detection of activity. */
|
|
146
|
+
export declare interface AutomaticActivityDetection {
|
|
147
|
+
/** If enabled, detected voice and text input count as activity. If disabled, the client must send activity signals. */
|
|
148
|
+
disabled?: boolean;
|
|
149
|
+
/** Determines how likely speech is to be detected. */
|
|
150
|
+
startOfSpeechSensitivity?: StartSensitivity;
|
|
151
|
+
/** Determines how likely detected speech is ended. */
|
|
152
|
+
endOfSpeechSensitivity?: EndSensitivity;
|
|
153
|
+
/** The required duration of detected speech before start-of-speech is committed. The lower this value the more sensitive the start-of-speech detection is and the shorter speech can be recognized. However, this also increases the probability of false positives. */
|
|
154
|
+
prefixPaddingMs?: number;
|
|
155
|
+
/** The required duration of detected non-speech (e.g. silence) before end-of-speech is committed. The larger this value, the longer speech gaps can be without interrupting the user's activity but this will increase the model's latency. */
|
|
156
|
+
silenceDurationMs?: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @license
|
|
161
|
+
* Copyright 2025 Google LLC
|
|
162
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
163
|
+
*/
|
|
117
164
|
declare class BaseModule {
|
|
118
165
|
}
|
|
119
166
|
|
|
@@ -126,6 +173,7 @@ declare interface Blob_2 {
|
|
|
126
173
|
}
|
|
127
174
|
export { Blob_2 as Blob }
|
|
128
175
|
|
|
176
|
+
/** Output only. Blocked reason. */
|
|
129
177
|
export declare enum BlockedReason {
|
|
130
178
|
BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED",
|
|
131
179
|
SAFETY = "SAFETY",
|
|
@@ -187,6 +235,12 @@ export declare class Caches extends BaseModule {
|
|
|
187
235
|
/**
|
|
188
236
|
* Creates a cached contents resource.
|
|
189
237
|
*
|
|
238
|
+
* @remarks
|
|
239
|
+
* Context caching is only supported for specific models. See [Gemini
|
|
240
|
+
* Developer API reference] (https://ai.google.dev/gemini-api/docs/caching?lang=node/context-cac)
|
|
241
|
+
* and [Vertex AI reference] (https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
|
|
242
|
+
* for more information.
|
|
243
|
+
*
|
|
190
244
|
* @param params - The parameters for the create request.
|
|
191
245
|
* @return The created cached content.
|
|
192
246
|
*
|
|
@@ -194,7 +248,7 @@ export declare class Caches extends BaseModule {
|
|
|
194
248
|
* ```ts
|
|
195
249
|
* const contents = ...; // Initialize the content to cache.
|
|
196
250
|
* const response = await ai.caches.create({
|
|
197
|
-
* model: 'gemini-
|
|
251
|
+
* model: 'gemini-1.5-flash',
|
|
198
252
|
* config: {
|
|
199
253
|
* 'contents': contents,
|
|
200
254
|
* 'displayName': 'test cache',
|
|
@@ -429,16 +483,6 @@ export declare interface CodeExecutionResult {
|
|
|
429
483
|
output?: string;
|
|
430
484
|
}
|
|
431
485
|
|
|
432
|
-
declare namespace common {
|
|
433
|
-
export {
|
|
434
|
-
formatMap,
|
|
435
|
-
setValueByPath,
|
|
436
|
-
getValueByPath,
|
|
437
|
-
BaseModule,
|
|
438
|
-
UploadFileParameters
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
486
|
/** Optional parameters for computing tokens. */
|
|
443
487
|
export declare interface ComputeTokensConfig {
|
|
444
488
|
/** Used to override HTTP request options. */
|
|
@@ -470,7 +514,7 @@ export declare interface Content {
|
|
|
470
514
|
parts?: Part[];
|
|
471
515
|
/** Optional. The producer of the content. Must be either 'user' or
|
|
472
516
|
'model'. Useful to set for multi-turn conversations, otherwise can be
|
|
473
|
-
|
|
517
|
+
empty. If role is not specified, SDK will determine the role. */
|
|
474
518
|
role?: string;
|
|
475
519
|
}
|
|
476
520
|
|
|
@@ -500,6 +544,14 @@ export declare type ContentListUnion = ContentUnion[] | ContentUnion;
|
|
|
500
544
|
|
|
501
545
|
export declare type ContentUnion = Content | PartUnion[] | PartUnion;
|
|
502
546
|
|
|
547
|
+
/** Enables context window compression -- mechanism managing model context window so it does not exceed given length. */
|
|
548
|
+
export declare interface ContextWindowCompressionConfig {
|
|
549
|
+
/** Number of tokens (before running turn) that triggers context window compression mechanism. */
|
|
550
|
+
triggerTokens?: string;
|
|
551
|
+
/** Sliding window compression mechanism. */
|
|
552
|
+
slidingWindow?: SlidingWindow;
|
|
553
|
+
}
|
|
554
|
+
|
|
503
555
|
/** Configuration for a Control reference image. */
|
|
504
556
|
export declare interface ControlReferenceConfig {
|
|
505
557
|
/** The type of control reference image to use. */
|
|
@@ -531,6 +583,7 @@ export declare interface ControlReferenceImage {
|
|
|
531
583
|
config?: ControlReferenceConfig;
|
|
532
584
|
}
|
|
533
585
|
|
|
586
|
+
/** Enum representing the control type of a control reference image. */
|
|
534
587
|
export declare enum ControlReferenceType {
|
|
535
588
|
CONTROL_TYPE_DEFAULT = "CONTROL_TYPE_DEFAULT",
|
|
536
589
|
CONTROL_TYPE_CANNY = "CONTROL_TYPE_CANNY",
|
|
@@ -578,9 +631,9 @@ export declare class CountTokensResponse {
|
|
|
578
631
|
export declare interface CreateCachedContentConfig {
|
|
579
632
|
/** Used to override HTTP request options. */
|
|
580
633
|
httpOptions?: HttpOptions;
|
|
581
|
-
/** The TTL for this resource. The expiration time is computed: now + TTL. */
|
|
634
|
+
/** The TTL for this resource. The expiration time is computed: now + TTL. It is a duration string, with up to nine fractional digits, terminated by 's'. Example: "3.5s". */
|
|
582
635
|
ttl?: string;
|
|
583
|
-
/** Timestamp of when this resource is considered expired. */
|
|
636
|
+
/** Timestamp of when this resource is considered expired. Uses RFC 3339 format, Example: 2014-10-02T15:01:23Z. */
|
|
584
637
|
expireTime?: string;
|
|
585
638
|
/** The user-generated meaningful display name of the cached content.
|
|
586
639
|
*/
|
|
@@ -666,7 +719,7 @@ export declare class CreateFileResponse {
|
|
|
666
719
|
export declare function createModelContent(partOrString: PartListUnion | string): Content;
|
|
667
720
|
|
|
668
721
|
/**
|
|
669
|
-
* Creates a `Part` object from a `base64` `string`.
|
|
722
|
+
* Creates a `Part` object from a `base64` encoded `string`.
|
|
670
723
|
*/
|
|
671
724
|
export declare function createPartFromBase64(data: string, mimeType: string): Part;
|
|
672
725
|
|
|
@@ -757,6 +810,7 @@ export declare interface DynamicRetrievalConfig {
|
|
|
757
810
|
dynamicThreshold?: number;
|
|
758
811
|
}
|
|
759
812
|
|
|
813
|
+
/** Config for the dynamic retrieval config mode. */
|
|
760
814
|
export declare enum DynamicRetrievalConfigMode {
|
|
761
815
|
MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
|
|
762
816
|
MODE_DYNAMIC = "MODE_DYNAMIC"
|
|
@@ -820,6 +874,21 @@ export declare class EmbedContentResponse {
|
|
|
820
874
|
metadata?: EmbedContentMetadata;
|
|
821
875
|
}
|
|
822
876
|
|
|
877
|
+
/** An endpoint where you deploy models. */
|
|
878
|
+
export declare interface Endpoint {
|
|
879
|
+
/** Resource name of the endpoint. */
|
|
880
|
+
name?: string;
|
|
881
|
+
/** ID of the model that's deployed to the endpoint. */
|
|
882
|
+
deployedModelId?: string;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/** End of speech sensitivity. */
|
|
886
|
+
export declare enum EndSensitivity {
|
|
887
|
+
END_SENSITIVITY_UNSPECIFIED = "END_SENSITIVITY_UNSPECIFIED",
|
|
888
|
+
END_SENSITIVITY_HIGH = "END_SENSITIVITY_HIGH",
|
|
889
|
+
END_SENSITIVITY_LOW = "END_SENSITIVITY_LOW"
|
|
890
|
+
}
|
|
891
|
+
|
|
823
892
|
/** Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the [FunctionDeclaration] tool and [FunctionCallingConfig] mode is set to [Mode.CODE]. */
|
|
824
893
|
export declare interface ExecutableCode {
|
|
825
894
|
/** Required. The code to be executed. */
|
|
@@ -828,6 +897,20 @@ export declare interface ExecutableCode {
|
|
|
828
897
|
language?: Language;
|
|
829
898
|
}
|
|
830
899
|
|
|
900
|
+
export declare interface FetchPredictOperationConfig {
|
|
901
|
+
/** Used to override HTTP request options. */
|
|
902
|
+
httpOptions?: HttpOptions;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/** Parameters for the fetchPredictOperation method. */
|
|
906
|
+
export declare interface FetchPredictOperationParameters {
|
|
907
|
+
/** The server-assigned name for the operation. */
|
|
908
|
+
operationName: string;
|
|
909
|
+
resourceName: string;
|
|
910
|
+
/** Used to override the default configuration. */
|
|
911
|
+
config?: FetchPredictOperationConfig;
|
|
912
|
+
}
|
|
913
|
+
|
|
831
914
|
/** A file uploaded to the API. */
|
|
832
915
|
declare interface File_2 {
|
|
833
916
|
/** The `File` resource name. The ID (name excluding the "files/" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456` */
|
|
@@ -837,7 +920,7 @@ declare interface File_2 {
|
|
|
837
920
|
/** Output only. MIME type of the file. */
|
|
838
921
|
mimeType?: string;
|
|
839
922
|
/** Output only. Size of the file in bytes. */
|
|
840
|
-
sizeBytes?:
|
|
923
|
+
sizeBytes?: string;
|
|
841
924
|
/** Output only. The timestamp of when the `File` was created. */
|
|
842
925
|
createTime?: string;
|
|
843
926
|
/** Output only. The timestamp of when the `File` will be deleted. Only set if the `File` is scheduled to expire. */
|
|
@@ -869,7 +952,7 @@ export declare interface FileData {
|
|
|
869
952
|
mimeType?: string;
|
|
870
953
|
}
|
|
871
954
|
|
|
872
|
-
declare class Files extends BaseModule {
|
|
955
|
+
export declare class Files extends BaseModule {
|
|
873
956
|
private readonly apiClient;
|
|
874
957
|
constructor(apiClient: ApiClient);
|
|
875
958
|
/**
|
|
@@ -914,8 +997,9 @@ declare class Files extends BaseModule {
|
|
|
914
997
|
* This section can contain multiple paragraphs and code examples.
|
|
915
998
|
*
|
|
916
999
|
* @param params - Optional parameters specified in the
|
|
917
|
-
* `
|
|
918
|
-
*
|
|
1000
|
+
* `types.UploadFileParameters` interface.
|
|
1001
|
+
* @see {@link types.UploadFileParameters#config} for the optional
|
|
1002
|
+
* config in the parameters.
|
|
919
1003
|
* @return A promise that resolves to a `types.File` object.
|
|
920
1004
|
* @throws An error if called on a Vertex AI client.
|
|
921
1005
|
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
@@ -932,7 +1016,7 @@ declare class Files extends BaseModule {
|
|
|
932
1016
|
* console.log(file.name);
|
|
933
1017
|
* ```
|
|
934
1018
|
*/
|
|
935
|
-
upload(params:
|
|
1019
|
+
upload(params: types.UploadFileParameters): Promise<types.File>;
|
|
936
1020
|
private listInternal;
|
|
937
1021
|
private createInternal;
|
|
938
1022
|
/**
|
|
@@ -967,6 +1051,7 @@ declare class Files extends BaseModule {
|
|
|
967
1051
|
delete(params: types.DeleteFileParameters): Promise<types.DeleteFileResponse>;
|
|
968
1052
|
}
|
|
969
1053
|
|
|
1054
|
+
/** Source of the File. */
|
|
970
1055
|
export declare enum FileSource {
|
|
971
1056
|
SOURCE_UNSPECIFIED = "SOURCE_UNSPECIFIED",
|
|
972
1057
|
UPLOADED = "UPLOADED",
|
|
@@ -990,6 +1075,7 @@ declare interface FileStat {
|
|
|
990
1075
|
type: string | undefined;
|
|
991
1076
|
}
|
|
992
1077
|
|
|
1078
|
+
/** State for the lifecycle of a File. */
|
|
993
1079
|
export declare enum FileState {
|
|
994
1080
|
STATE_UNSPECIFIED = "STATE_UNSPECIFIED",
|
|
995
1081
|
PROCESSING = "PROCESSING",
|
|
@@ -1007,6 +1093,10 @@ export declare interface FileStatus {
|
|
|
1007
1093
|
code?: number;
|
|
1008
1094
|
}
|
|
1009
1095
|
|
|
1096
|
+
/** Output only. The reason why the model stopped generating tokens.
|
|
1097
|
+
|
|
1098
|
+
If empty, the model has not stopped generating the tokens.
|
|
1099
|
+
*/
|
|
1010
1100
|
export declare enum FinishReason {
|
|
1011
1101
|
FINISH_REASON_UNSPECIFIED = "FINISH_REASON_UNSPECIFIED",
|
|
1012
1102
|
STOP = "STOP",
|
|
@@ -1021,8 +1111,6 @@ export declare enum FinishReason {
|
|
|
1021
1111
|
IMAGE_SAFETY = "IMAGE_SAFETY"
|
|
1022
1112
|
}
|
|
1023
1113
|
|
|
1024
|
-
declare function formatMap(templateString: string, valueMap: Record<string, unknown>): string;
|
|
1025
|
-
|
|
1026
1114
|
/** A function call. */
|
|
1027
1115
|
export declare interface FunctionCall {
|
|
1028
1116
|
/** The unique id of the function call. If populated, the client to execute the
|
|
@@ -1042,6 +1130,7 @@ export declare interface FunctionCallingConfig {
|
|
|
1042
1130
|
allowedFunctionNames?: string[];
|
|
1043
1131
|
}
|
|
1044
1132
|
|
|
1133
|
+
/** Config for the function calling config mode. */
|
|
1045
1134
|
export declare enum FunctionCallingConfigMode {
|
|
1046
1135
|
MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
|
|
1047
1136
|
AUTO = "AUTO",
|
|
@@ -1366,6 +1455,8 @@ export declare class GenerateContentResponseUsageMetadata {
|
|
|
1366
1455
|
toolUsePromptTokensDetails?: ModalityTokenCount[];
|
|
1367
1456
|
/** Total token count for prompt, response candidates, and tool-use prompts (if present). */
|
|
1368
1457
|
totalTokenCount?: number;
|
|
1458
|
+
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
1459
|
+
trafficType?: TrafficType;
|
|
1369
1460
|
}
|
|
1370
1461
|
|
|
1371
1462
|
/** An output image. */
|
|
@@ -1387,6 +1478,12 @@ export declare interface GeneratedImage {
|
|
|
1387
1478
|
enhancedPrompt?: string;
|
|
1388
1479
|
}
|
|
1389
1480
|
|
|
1481
|
+
/** A generated video. */
|
|
1482
|
+
export declare interface GeneratedVideo {
|
|
1483
|
+
/** The output video */
|
|
1484
|
+
video?: Video;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1390
1487
|
/** The config for generating an images. */
|
|
1391
1488
|
export declare interface GenerateImagesConfig {
|
|
1392
1489
|
/** Used to override HTTP request options. */
|
|
@@ -1468,6 +1565,72 @@ export declare class GenerateImagesResponse {
|
|
|
1468
1565
|
positivePromptSafetyAttributes?: SafetyAttributes;
|
|
1469
1566
|
}
|
|
1470
1567
|
|
|
1568
|
+
/** Configuration for generating videos. */
|
|
1569
|
+
export declare interface GenerateVideosConfig {
|
|
1570
|
+
/** Used to override HTTP request options. */
|
|
1571
|
+
httpOptions?: HttpOptions;
|
|
1572
|
+
/** Number of output videos. */
|
|
1573
|
+
numberOfVideos?: number;
|
|
1574
|
+
/** The gcs bucket where to save the generated videos. */
|
|
1575
|
+
outputGcsUri?: string;
|
|
1576
|
+
/** Frames per second for video generation. */
|
|
1577
|
+
fps?: number;
|
|
1578
|
+
/** Duration of the clip for video generation in seconds. */
|
|
1579
|
+
durationSeconds?: number;
|
|
1580
|
+
/** The RNG seed. If RNG seed is exactly same for each request with unchanged inputs, the prediction results will be consistent. Otherwise, a random RNG seed will be used each time to produce a different result. */
|
|
1581
|
+
seed?: number;
|
|
1582
|
+
/** The aspect ratio for the generated video. 16:9 (landscape) and 9:16 (portrait) are supported. */
|
|
1583
|
+
aspectRatio?: string;
|
|
1584
|
+
/** The resolution for the generated video. 1280x720, 1920x1080 are supported. */
|
|
1585
|
+
resolution?: string;
|
|
1586
|
+
/** Whether allow to generate person videos, and restrict to specific ages. Supported values are: dont_allow, allow_adult. */
|
|
1587
|
+
personGeneration?: string;
|
|
1588
|
+
/** The pubsub topic where to publish the video generation progress. */
|
|
1589
|
+
pubsubTopic?: string;
|
|
1590
|
+
/** Optional field in addition to the text content. Negative prompts can be explicitly stated here to help generate the video. */
|
|
1591
|
+
negativePrompt?: string;
|
|
1592
|
+
/** Whether to use the prompt rewriting logic. */
|
|
1593
|
+
enhancePrompt?: boolean;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
/** A video generation operation. */
|
|
1597
|
+
export declare interface GenerateVideosOperation {
|
|
1598
|
+
/** 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}`. */
|
|
1599
|
+
name?: string;
|
|
1600
|
+
/** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */
|
|
1601
|
+
metadata?: Record<string, unknown>;
|
|
1602
|
+
/** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */
|
|
1603
|
+
done?: boolean;
|
|
1604
|
+
/** The error result of the operation in case of failure or cancellation. */
|
|
1605
|
+
error?: Record<string, unknown>;
|
|
1606
|
+
/** The generated videos. */
|
|
1607
|
+
response?: GenerateVideosResponse;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/** Class that represents the parameters for generating an image. */
|
|
1611
|
+
export declare interface GenerateVideosParameters {
|
|
1612
|
+
/** ID of the model to use. For a list of models, see `Google models
|
|
1613
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_. */
|
|
1614
|
+
model: string;
|
|
1615
|
+
/** The text prompt for generating the videos. Optional for image to video use cases. */
|
|
1616
|
+
prompt?: string;
|
|
1617
|
+
/** The input image for generating the videos.
|
|
1618
|
+
Optional if prompt is provided. */
|
|
1619
|
+
image?: Image_2;
|
|
1620
|
+
/** Configuration for generating videos. */
|
|
1621
|
+
config?: GenerateVideosConfig;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
/** Response with generated videos. */
|
|
1625
|
+
export declare class GenerateVideosResponse {
|
|
1626
|
+
/** List of the generated videos */
|
|
1627
|
+
generatedVideos?: GeneratedVideo[];
|
|
1628
|
+
/** Returns if any videos were filtered due to RAI policies. */
|
|
1629
|
+
raiMediaFilteredCount?: number;
|
|
1630
|
+
/** Returns rai failure reasons if any. */
|
|
1631
|
+
raiMediaFilteredReasons?: string[];
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1471
1634
|
/** Generation config. */
|
|
1472
1635
|
export declare interface GenerationConfig {
|
|
1473
1636
|
/** Optional. If enabled, audio timestamp will be included in the request to the model. */
|
|
@@ -1480,6 +1643,8 @@ export declare interface GenerationConfig {
|
|
|
1480
1643
|
logprobs?: number;
|
|
1481
1644
|
/** Optional. The maximum number of output tokens to generate per message. */
|
|
1482
1645
|
maxOutputTokens?: number;
|
|
1646
|
+
/** Optional. If specified, the media resolution specified will be used. */
|
|
1647
|
+
mediaResolution?: MediaResolution;
|
|
1483
1648
|
/** Optional. Positive penalties. */
|
|
1484
1649
|
presencePenalty?: number;
|
|
1485
1650
|
/** Optional. If true, export the logprobs results in response. */
|
|
@@ -1552,7 +1717,30 @@ export declare interface GetFileParameters {
|
|
|
1552
1717
|
config?: GetFileConfig;
|
|
1553
1718
|
}
|
|
1554
1719
|
|
|
1555
|
-
|
|
1720
|
+
/** Optional parameters for models.get method. */
|
|
1721
|
+
export declare interface GetModelConfig {
|
|
1722
|
+
/** Used to override HTTP request options. */
|
|
1723
|
+
httpOptions?: HttpOptions;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
export declare interface GetModelParameters {
|
|
1727
|
+
model: string;
|
|
1728
|
+
/** Optional parameters for the request. */
|
|
1729
|
+
config?: GetModelConfig;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
export declare interface GetOperationConfig {
|
|
1733
|
+
/** Used to override HTTP request options. */
|
|
1734
|
+
httpOptions?: HttpOptions;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
/** Parameters for the GET method. */
|
|
1738
|
+
export declare interface GetOperationParameters {
|
|
1739
|
+
/** The server-assigned name for the operation. */
|
|
1740
|
+
operationName: string;
|
|
1741
|
+
/** Used to override the default configuration. */
|
|
1742
|
+
config?: GetOperationConfig;
|
|
1743
|
+
}
|
|
1556
1744
|
|
|
1557
1745
|
/**
|
|
1558
1746
|
* The Google GenAI SDK.
|
|
@@ -1607,6 +1795,7 @@ export declare class GoogleGenAI {
|
|
|
1607
1795
|
readonly chats: Chats;
|
|
1608
1796
|
readonly caches: Caches;
|
|
1609
1797
|
readonly files: Files;
|
|
1798
|
+
readonly operations: Operations;
|
|
1610
1799
|
constructor(options: GoogleGenAIOptions);
|
|
1611
1800
|
}
|
|
1612
1801
|
|
|
@@ -1711,6 +1900,8 @@ export declare interface GroundingChunkRetrievedContext {
|
|
|
1711
1900
|
|
|
1712
1901
|
/** Chunk from the web. */
|
|
1713
1902
|
export declare interface GroundingChunkWeb {
|
|
1903
|
+
/** Domain of the (original) URI. */
|
|
1904
|
+
domain?: string;
|
|
1714
1905
|
/** Title of the chunk. */
|
|
1715
1906
|
title?: string;
|
|
1716
1907
|
/** URI reference of the chunk. */
|
|
@@ -1743,12 +1934,14 @@ export declare interface GroundingSupport {
|
|
|
1743
1934
|
segment?: Segment;
|
|
1744
1935
|
}
|
|
1745
1936
|
|
|
1937
|
+
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
1746
1938
|
export declare enum HarmBlockMethod {
|
|
1747
1939
|
HARM_BLOCK_METHOD_UNSPECIFIED = "HARM_BLOCK_METHOD_UNSPECIFIED",
|
|
1748
1940
|
SEVERITY = "SEVERITY",
|
|
1749
1941
|
PROBABILITY = "PROBABILITY"
|
|
1750
1942
|
}
|
|
1751
1943
|
|
|
1944
|
+
/** Required. The harm block threshold. */
|
|
1752
1945
|
export declare enum HarmBlockThreshold {
|
|
1753
1946
|
HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
1754
1947
|
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
|
|
@@ -1758,6 +1951,7 @@ export declare enum HarmBlockThreshold {
|
|
|
1758
1951
|
OFF = "OFF"
|
|
1759
1952
|
}
|
|
1760
1953
|
|
|
1954
|
+
/** Required. Harm category. */
|
|
1761
1955
|
export declare enum HarmCategory {
|
|
1762
1956
|
HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED",
|
|
1763
1957
|
HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
|
|
@@ -1767,6 +1961,7 @@ export declare enum HarmCategory {
|
|
|
1767
1961
|
HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
1768
1962
|
}
|
|
1769
1963
|
|
|
1964
|
+
/** Output only. Harm probability levels in the content. */
|
|
1770
1965
|
export declare enum HarmProbability {
|
|
1771
1966
|
HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED",
|
|
1772
1967
|
NEGLIGIBLE = "NEGLIGIBLE",
|
|
@@ -1775,6 +1970,7 @@ export declare enum HarmProbability {
|
|
|
1775
1970
|
HIGH = "HIGH"
|
|
1776
1971
|
}
|
|
1777
1972
|
|
|
1973
|
+
/** Output only. Harm severity levels in the content. */
|
|
1778
1974
|
export declare enum HarmSeverity {
|
|
1779
1975
|
HARM_SEVERITY_UNSPECIFIED = "HARM_SEVERITY_UNSPECIFIED",
|
|
1780
1976
|
HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
|
|
@@ -1867,6 +2063,7 @@ declare interface Image_2 {
|
|
|
1867
2063
|
}
|
|
1868
2064
|
export { Image_2 as Image }
|
|
1869
2065
|
|
|
2066
|
+
/** Enum that specifies the language of the text in the prompt. */
|
|
1870
2067
|
export declare enum ImagePromptLanguage {
|
|
1871
2068
|
auto = "auto",
|
|
1872
2069
|
en = "en",
|
|
@@ -1875,6 +2072,7 @@ export declare enum ImagePromptLanguage {
|
|
|
1875
2072
|
hi = "hi"
|
|
1876
2073
|
}
|
|
1877
2074
|
|
|
2075
|
+
/** Required. Programming language of the `code`. */
|
|
1878
2076
|
export declare enum Language {
|
|
1879
2077
|
LANGUAGE_UNSPECIFIED = "LANGUAGE_UNSPECIFIED",
|
|
1880
2078
|
PYTHON = "PYTHON"
|
|
@@ -1978,9 +2176,21 @@ export declare class Live {
|
|
|
1978
2176
|
|
|
1979
2177
|
/** Callbacks for the live API. */
|
|
1980
2178
|
export declare interface LiveCallbacks {
|
|
2179
|
+
/**
|
|
2180
|
+
* Called when the websocket connection is established.
|
|
2181
|
+
*/
|
|
1981
2182
|
onopen?: (() => void) | null;
|
|
2183
|
+
/**
|
|
2184
|
+
* Called when a message is received from the server.
|
|
2185
|
+
*/
|
|
1982
2186
|
onmessage: (e: LiveServerMessage) => void;
|
|
2187
|
+
/**
|
|
2188
|
+
* Called when an error occurs.
|
|
2189
|
+
*/
|
|
1983
2190
|
onerror?: ((e: ErrorEvent) => void) | null;
|
|
2191
|
+
/**
|
|
2192
|
+
* Called when the websocket connection is closed.
|
|
2193
|
+
*/
|
|
1984
2194
|
onclose?: ((e: CloseEvent) => void) | null;
|
|
1985
2195
|
}
|
|
1986
2196
|
|
|
@@ -2019,11 +2229,11 @@ export declare interface LiveClientMessage {
|
|
|
2019
2229
|
|
|
2020
2230
|
/** User input that is sent in real time.
|
|
2021
2231
|
|
|
2022
|
-
This is different from `
|
|
2232
|
+
This is different from `LiveClientContent` in a few ways:
|
|
2023
2233
|
|
|
2024
2234
|
- Can be sent continuously without interruption to model generation.
|
|
2025
2235
|
- If there is a need to mix data interleaved across the
|
|
2026
|
-
`
|
|
2236
|
+
`LiveClientContent` and the `LiveClientRealtimeInput`, server attempts to
|
|
2027
2237
|
optimize for best response, but there are no guarantees.
|
|
2028
2238
|
- End of turn is not explicitly specified, but is rather derived from user
|
|
2029
2239
|
activity (for example, end of speech).
|
|
@@ -2035,6 +2245,10 @@ export declare interface LiveClientMessage {
|
|
|
2035
2245
|
export declare interface LiveClientRealtimeInput {
|
|
2036
2246
|
/** Inlined bytes data for media input. */
|
|
2037
2247
|
mediaChunks?: Blob_2[];
|
|
2248
|
+
/** Marks the start of user activity. */
|
|
2249
|
+
activityStart?: ActivityStart;
|
|
2250
|
+
/** Marks the end of user activity. */
|
|
2251
|
+
activityEnd?: ActivityEnd;
|
|
2038
2252
|
}
|
|
2039
2253
|
|
|
2040
2254
|
/** Message contains configuration that will apply for the duration of the streaming session. */
|
|
@@ -2045,15 +2259,7 @@ export declare interface LiveClientSetup {
|
|
|
2045
2259
|
*/
|
|
2046
2260
|
model?: string;
|
|
2047
2261
|
/** The generation configuration for the session.
|
|
2048
|
-
|
|
2049
|
-
The following fields are supported:
|
|
2050
|
-
- `response_logprobs`
|
|
2051
|
-
- `response_mime_type`
|
|
2052
|
-
- `logprobs`
|
|
2053
|
-
- `response_schema`
|
|
2054
|
-
- `stop_sequence`
|
|
2055
|
-
- `routing_config`
|
|
2056
|
-
- `audio_timestamp`
|
|
2262
|
+
Note: only a subset of fields are supported.
|
|
2057
2263
|
*/
|
|
2058
2264
|
generationConfig?: GenerationConfig;
|
|
2059
2265
|
/** The user provided system instructions for the model.
|
|
@@ -2066,6 +2272,16 @@ export declare interface LiveClientSetup {
|
|
|
2066
2272
|
external systems to perform an action, or set of actions, outside of
|
|
2067
2273
|
knowledge and scope of the model. */
|
|
2068
2274
|
tools?: ToolListUnion;
|
|
2275
|
+
/** Configures the realtime input behavior in BidiGenerateContent. */
|
|
2276
|
+
realtimeInputConfig?: RealtimeInputConfig;
|
|
2277
|
+
/** Configures session resumption mechanism.
|
|
2278
|
+
|
|
2279
|
+
If included server will send SessionResumptionUpdate messages. */
|
|
2280
|
+
sessionResumption?: SessionResumptionConfig;
|
|
2281
|
+
/** Configures context window compression mechanism.
|
|
2282
|
+
|
|
2283
|
+
If included, server will compress context window to fit into given length. */
|
|
2284
|
+
contextWindowCompression?: ContextWindowCompressionConfig;
|
|
2069
2285
|
}
|
|
2070
2286
|
|
|
2071
2287
|
/** Client generated response to a `ToolCall` received from the server.
|
|
@@ -2104,6 +2320,16 @@ export declare interface LiveConnectConfig {
|
|
|
2104
2320
|
external systems to perform an action, or set of actions, outside of
|
|
2105
2321
|
knowledge and scope of the model. */
|
|
2106
2322
|
tools?: ToolListUnion;
|
|
2323
|
+
/** Configures session resumption mechanism.
|
|
2324
|
+
|
|
2325
|
+
If included the server will send SessionResumptionUpdate messages. */
|
|
2326
|
+
sessionResumption?: SessionResumptionConfig;
|
|
2327
|
+
/** Configures the realtime input behavior in BidiGenerateContent. */
|
|
2328
|
+
realtimeInputConfig?: RealtimeInputConfig;
|
|
2329
|
+
/** Configures context window compression mechanism.
|
|
2330
|
+
|
|
2331
|
+
If included, server will compress context window to fit into given length. */
|
|
2332
|
+
contextWindowCompression?: ContextWindowCompressionConfig;
|
|
2107
2333
|
}
|
|
2108
2334
|
|
|
2109
2335
|
/** Parameters for connecting to the live API. */
|
|
@@ -2132,6 +2358,10 @@ export declare interface LiveSendClientContentParameters {
|
|
|
2132
2358
|
export declare interface LiveSendRealtimeInputParameters {
|
|
2133
2359
|
/** Realtime input to send to the session. */
|
|
2134
2360
|
media: Blob_2;
|
|
2361
|
+
/** Marks the start of user activity. */
|
|
2362
|
+
activityStart?: ActivityStart;
|
|
2363
|
+
/** Marks the end of user activity. */
|
|
2364
|
+
activityEnd?: ActivityEnd;
|
|
2135
2365
|
}
|
|
2136
2366
|
|
|
2137
2367
|
/** Parameters for sending tool responses to the live API. */
|
|
@@ -2152,6 +2382,21 @@ export declare interface LiveServerContent {
|
|
|
2152
2382
|
turnComplete?: boolean;
|
|
2153
2383
|
/** If true, indicates that a client message has interrupted current model generation. If the client is playing out the content in realtime, this is a good signal to stop and empty the current queue. */
|
|
2154
2384
|
interrupted?: boolean;
|
|
2385
|
+
/** If true, indicates that the model is done generating. When model is
|
|
2386
|
+
interrupted while generating there will be no generation_complete message
|
|
2387
|
+
in interrupted turn, it will go through interrupted > turn_complete.
|
|
2388
|
+
When model assumes realtime playback there will be delay between
|
|
2389
|
+
generation_complete and turn_complete that is caused by model
|
|
2390
|
+
waiting for playback to finish. If true, indicates that the model
|
|
2391
|
+
has finished generating all content. This is a signal to the client
|
|
2392
|
+
that it can stop sending messages. */
|
|
2393
|
+
generationComplete?: boolean;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
/** Server will not be able to service client soon. */
|
|
2397
|
+
export declare interface LiveServerGoAway {
|
|
2398
|
+
/** The remaining time before the connection will be terminated as ABORTED. The minimal time returned here is specified differently together with the rate limits for a given model. */
|
|
2399
|
+
timeLeft?: string;
|
|
2155
2400
|
}
|
|
2156
2401
|
|
|
2157
2402
|
/** Response message for API call. */
|
|
@@ -2164,6 +2409,29 @@ export declare interface LiveServerMessage {
|
|
|
2164
2409
|
toolCall?: LiveServerToolCall;
|
|
2165
2410
|
/** Notification for the client that a previously issued `ToolCallMessage` with the specified `id`s should have been not executed and should be cancelled. */
|
|
2166
2411
|
toolCallCancellation?: LiveServerToolCallCancellation;
|
|
2412
|
+
/** Usage metadata about model response(s). */
|
|
2413
|
+
usageMetadata?: UsageMetadata;
|
|
2414
|
+
/** Server will disconnect soon. */
|
|
2415
|
+
goAway?: LiveServerGoAway;
|
|
2416
|
+
/** Update of the session resumption state. */
|
|
2417
|
+
sessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
/** Update of the session resumption state.
|
|
2421
|
+
|
|
2422
|
+
Only sent if `session_resumption` was set in the connection config.
|
|
2423
|
+
*/
|
|
2424
|
+
export declare interface LiveServerSessionResumptionUpdate {
|
|
2425
|
+
/** New handle that represents state that can be resumed. Empty if `resumable`=false. */
|
|
2426
|
+
newHandle?: string;
|
|
2427
|
+
/** True if session can be resumed at this point. It might be not possible to resume session at some points. In that case we send update empty new_handle and resumable=false. Example of such case could be model executing function calls or just generating. Resuming session (using previous session token) in such state will result in some data loss. */
|
|
2428
|
+
resumable?: boolean;
|
|
2429
|
+
/** Index of last message sent by client that is included in state represented by this SessionResumptionToken. Only sent when `SessionResumptionConfig.transparent` is set.
|
|
2430
|
+
|
|
2431
|
+
Presence of this index allows users to transparently reconnect and avoid issue of losing some part of realtime audio input/video. If client wishes to temporarily disconnect (for example as result of receiving GoAway) they can do it without losing state by buffering messages sent since last `SessionResmumptionTokenUpdate`. This field will enable them to limit buffering (avoid keeping all requests in RAM).
|
|
2432
|
+
|
|
2433
|
+
Note: This should not be used for when resuming a session at some time later -- in those cases partial audio and video frames arelikely not needed. */
|
|
2434
|
+
lastConsumedClientMessageIndex?: string;
|
|
2167
2435
|
}
|
|
2168
2436
|
|
|
2169
2437
|
/** Sent in response to a `LiveGenerateContentSetup` message from the client. */
|
|
@@ -2245,6 +2513,7 @@ export declare interface MaskReferenceImage {
|
|
|
2245
2513
|
config?: MaskReferenceConfig;
|
|
2246
2514
|
}
|
|
2247
2515
|
|
|
2516
|
+
/** Enum representing the mask mode of a mask reference image. */
|
|
2248
2517
|
export declare enum MaskReferenceMode {
|
|
2249
2518
|
MASK_MODE_DEFAULT = "MASK_MODE_DEFAULT",
|
|
2250
2519
|
MASK_MODE_USER_PROVIDED = "MASK_MODE_USER_PROVIDED",
|
|
@@ -2253,6 +2522,17 @@ export declare enum MaskReferenceMode {
|
|
|
2253
2522
|
MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
|
|
2254
2523
|
}
|
|
2255
2524
|
|
|
2525
|
+
/** Server content modalities. */
|
|
2526
|
+
export declare enum MediaModality {
|
|
2527
|
+
MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
|
|
2528
|
+
TEXT = "TEXT",
|
|
2529
|
+
IMAGE = "IMAGE",
|
|
2530
|
+
VIDEO = "VIDEO",
|
|
2531
|
+
AUDIO = "AUDIO",
|
|
2532
|
+
DOCUMENT = "DOCUMENT"
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
/** The media resolution to use. */
|
|
2256
2536
|
export declare enum MediaResolution {
|
|
2257
2537
|
MEDIA_RESOLUTION_UNSPECIFIED = "MEDIA_RESOLUTION_UNSPECIFIED",
|
|
2258
2538
|
MEDIA_RESOLUTION_LOW = "MEDIA_RESOLUTION_LOW",
|
|
@@ -2260,6 +2540,7 @@ export declare enum MediaResolution {
|
|
|
2260
2540
|
MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
|
|
2261
2541
|
}
|
|
2262
2542
|
|
|
2543
|
+
/** Server content modalities. */
|
|
2263
2544
|
export declare enum Modality {
|
|
2264
2545
|
MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
|
|
2265
2546
|
TEXT = "TEXT",
|
|
@@ -2270,16 +2551,45 @@ export declare enum Modality {
|
|
|
2270
2551
|
/** Represents token counting info for a single modality. */
|
|
2271
2552
|
export declare interface ModalityTokenCount {
|
|
2272
2553
|
/** The modality associated with this token count. */
|
|
2273
|
-
modality?:
|
|
2554
|
+
modality?: MediaModality;
|
|
2274
2555
|
/** Number of tokens. */
|
|
2275
2556
|
tokenCount?: number;
|
|
2276
2557
|
}
|
|
2277
2558
|
|
|
2559
|
+
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
2278
2560
|
export declare enum Mode {
|
|
2279
2561
|
MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
|
|
2280
2562
|
MODE_DYNAMIC = "MODE_DYNAMIC"
|
|
2281
2563
|
}
|
|
2282
2564
|
|
|
2565
|
+
/** A trained machine learning model. */
|
|
2566
|
+
export declare interface Model {
|
|
2567
|
+
/** Resource name of the model. */
|
|
2568
|
+
name?: string;
|
|
2569
|
+
/** Display name of the model. */
|
|
2570
|
+
displayName?: string;
|
|
2571
|
+
/** Description of the model. */
|
|
2572
|
+
description?: string;
|
|
2573
|
+
/** Version ID of the model. A new version is committed when a new
|
|
2574
|
+
model version is uploaded or trained under an existing model ID. The
|
|
2575
|
+
version ID is an auto-incrementing decimal number in string
|
|
2576
|
+
representation. */
|
|
2577
|
+
version?: string;
|
|
2578
|
+
/** List of deployed models created from this base model. Note that a
|
|
2579
|
+
model could have been deployed to endpoints in different locations. */
|
|
2580
|
+
endpoints?: Endpoint[];
|
|
2581
|
+
/** Labels with user-defined metadata to organize your models. */
|
|
2582
|
+
labels?: Record<string, string>;
|
|
2583
|
+
/** Information about the tuned model from the base model. */
|
|
2584
|
+
tunedModelInfo?: TunedModelInfo;
|
|
2585
|
+
/** The maximum number of input tokens that the model can handle. */
|
|
2586
|
+
inputTokenLimit?: number;
|
|
2587
|
+
/** The maximum number of output tokens that the model can generate. */
|
|
2588
|
+
outputTokenLimit?: number;
|
|
2589
|
+
/** List of actions that are supported by the model. */
|
|
2590
|
+
supportedActions?: string[];
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2283
2593
|
export declare class Models extends BaseModule {
|
|
2284
2594
|
private readonly apiClient;
|
|
2285
2595
|
constructor(apiClient: ApiClient);
|
|
@@ -2430,6 +2740,15 @@ export declare class Models extends BaseModule {
|
|
|
2430
2740
|
* ```
|
|
2431
2741
|
*/
|
|
2432
2742
|
private generateImagesInternal;
|
|
2743
|
+
/**
|
|
2744
|
+
* Fetches information about a model by name.
|
|
2745
|
+
*
|
|
2746
|
+
* @example
|
|
2747
|
+
* ```ts
|
|
2748
|
+
* const modelInfo = await ai.models.get({model: 'gemini-2.0-flash'});
|
|
2749
|
+
* ```
|
|
2750
|
+
*/
|
|
2751
|
+
get(params: types.GetModelParameters): Promise<types.Model>;
|
|
2433
2752
|
/**
|
|
2434
2753
|
* Counts the number of tokens in the given contents. Multimodal input is
|
|
2435
2754
|
* supported for Gemini models.
|
|
@@ -2466,6 +2785,52 @@ export declare class Models extends BaseModule {
|
|
|
2466
2785
|
* ```
|
|
2467
2786
|
*/
|
|
2468
2787
|
computeTokens(params: types.ComputeTokensParameters): Promise<types.ComputeTokensResponse>;
|
|
2788
|
+
/**
|
|
2789
|
+
* Generates videos based on a text description and configuration.
|
|
2790
|
+
*
|
|
2791
|
+
* @param params - The parameters for generating videos.
|
|
2792
|
+
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
2793
|
+
*
|
|
2794
|
+
* @example
|
|
2795
|
+
* ```ts
|
|
2796
|
+
* const operation = await ai.models.generateVideos({
|
|
2797
|
+
* model: 'veo-2.0-generate-001',
|
|
2798
|
+
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
2799
|
+
* config: {
|
|
2800
|
+
* numberOfVideos: 1
|
|
2801
|
+
* });
|
|
2802
|
+
*
|
|
2803
|
+
* while (!operation.done) {
|
|
2804
|
+
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
2805
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
2806
|
+
* }
|
|
2807
|
+
*
|
|
2808
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
2809
|
+
* ```
|
|
2810
|
+
*/
|
|
2811
|
+
generateVideos(params: types.GenerateVideosParameters): Promise<types.GenerateVideosOperation>;
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
/** Parameters for the get method of the operations module. */
|
|
2815
|
+
export declare interface OperationGetParameters {
|
|
2816
|
+
/** The operation to be retrieved. */
|
|
2817
|
+
operation: GenerateVideosOperation;
|
|
2818
|
+
/** Used to override the default configuration. */
|
|
2819
|
+
config?: GetOperationConfig;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
export declare class Operations extends BaseModule {
|
|
2823
|
+
private readonly apiClient;
|
|
2824
|
+
constructor(apiClient: ApiClient);
|
|
2825
|
+
/**
|
|
2826
|
+
* Gets the status of a long-running operation.
|
|
2827
|
+
*
|
|
2828
|
+
* @param parameters The parameters for the get operation request.
|
|
2829
|
+
* @return The updated Operation object, with the latest status or result.
|
|
2830
|
+
*/
|
|
2831
|
+
getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
|
|
2832
|
+
private getVideosOperationInternal;
|
|
2833
|
+
private fetchPredictVideosOperationInternal;
|
|
2469
2834
|
}
|
|
2470
2835
|
|
|
2471
2836
|
/**
|
|
@@ -2473,6 +2838,7 @@ export declare class Models extends BaseModule {
|
|
|
2473
2838
|
* Copyright 2025 Google LLC
|
|
2474
2839
|
* SPDX-License-Identifier: Apache-2.0
|
|
2475
2840
|
*/
|
|
2841
|
+
/** Required. Outcome of the code execution. */
|
|
2476
2842
|
export declare enum Outcome {
|
|
2477
2843
|
OUTCOME_UNSPECIFIED = "OUTCOME_UNSPECIFIED",
|
|
2478
2844
|
OUTCOME_OK = "OUTCOME_OK",
|
|
@@ -2488,7 +2854,7 @@ export declare enum Outcome {
|
|
|
2488
2854
|
/**
|
|
2489
2855
|
* Pagers for the GenAI List APIs.
|
|
2490
2856
|
*/
|
|
2491
|
-
declare enum PagedItem {
|
|
2857
|
+
export declare enum PagedItem {
|
|
2492
2858
|
PAGED_ITEM_BATCH_JOBS = "batchJobs",
|
|
2493
2859
|
PAGED_ITEM_MODELS = "models",
|
|
2494
2860
|
PAGED_ITEM_TUNING_JOBS = "tuningJobs",
|
|
@@ -2515,7 +2881,7 @@ declare interface PagedItemResponse<T> {
|
|
|
2515
2881
|
/**
|
|
2516
2882
|
* Pager class for iterating through paginated results.
|
|
2517
2883
|
*/
|
|
2518
|
-
declare class Pager<T> implements AsyncIterable<T> {
|
|
2884
|
+
export declare class Pager<T> implements AsyncIterable<T> {
|
|
2519
2885
|
private nameInternal;
|
|
2520
2886
|
private pageInternal;
|
|
2521
2887
|
private paramsInternal;
|
|
@@ -2638,6 +3004,7 @@ export declare type PartListUnion = PartUnion[] | PartUnion;
|
|
|
2638
3004
|
|
|
2639
3005
|
export declare type PartUnion = Part | string;
|
|
2640
3006
|
|
|
3007
|
+
/** Enum that controls the generation of people. */
|
|
2641
3008
|
export declare enum PersonGeneration {
|
|
2642
3009
|
DONT_ALLOW = "DONT_ALLOW",
|
|
2643
3010
|
ALLOW_ADULT = "ALLOW_ADULT",
|
|
@@ -2666,6 +3033,20 @@ export declare interface RawReferenceImage {
|
|
|
2666
3033
|
referenceType?: string;
|
|
2667
3034
|
}
|
|
2668
3035
|
|
|
3036
|
+
/** Marks the end of user activity.
|
|
3037
|
+
|
|
3038
|
+
This can only be sent if automatic (i.e. server-side) activity detection is
|
|
3039
|
+
disabled.
|
|
3040
|
+
*/
|
|
3041
|
+
export declare interface RealtimeInputConfig {
|
|
3042
|
+
/** If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals. */
|
|
3043
|
+
automaticActivityDetection?: AutomaticActivityDetection;
|
|
3044
|
+
/** Defines what effect activity has. */
|
|
3045
|
+
activityHandling?: ActivityHandling;
|
|
3046
|
+
/** Defines which input is included in the user's turn. */
|
|
3047
|
+
turnCoverage?: TurnCoverage;
|
|
3048
|
+
}
|
|
3049
|
+
|
|
2669
3050
|
/** Represents a recorded session. */
|
|
2670
3051
|
export declare interface ReplayFile {
|
|
2671
3052
|
replayId?: string;
|
|
@@ -2723,6 +3104,7 @@ export declare interface SafetyAttributes {
|
|
|
2723
3104
|
contentType?: string;
|
|
2724
3105
|
}
|
|
2725
3106
|
|
|
3107
|
+
/** Enum that controls the safety filter level for objectionable content. */
|
|
2726
3108
|
export declare enum SafetyFilterLevel {
|
|
2727
3109
|
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
|
|
2728
3110
|
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -2971,7 +3353,31 @@ export declare class Session {
|
|
|
2971
3353
|
close(): void;
|
|
2972
3354
|
}
|
|
2973
3355
|
|
|
2974
|
-
|
|
3356
|
+
/** Configuration of session resumption mechanism.
|
|
3357
|
+
|
|
3358
|
+
Included in `LiveConnectConfig.session_resumption`. If included server
|
|
3359
|
+
will send `LiveServerSessionResumptionUpdate` messages.
|
|
3360
|
+
*/
|
|
3361
|
+
export declare interface SessionResumptionConfig {
|
|
3362
|
+
/** Session resumption handle of previous session (session to restore).
|
|
3363
|
+
|
|
3364
|
+
If not present new session will be started. */
|
|
3365
|
+
handle?: string;
|
|
3366
|
+
/** If set the server will send `last_consumed_client_message_index` in the `session_resumption_update` messages to allow for transparent reconnections. */
|
|
3367
|
+
transparent?: boolean;
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
/** Context window will be truncated by keeping only suffix of it.
|
|
3371
|
+
|
|
3372
|
+
Context window will always be cut at start of USER role turn. System
|
|
3373
|
+
instructions and `BidiGenerateContentSetup.prefix_turns` will not be
|
|
3374
|
+
subject to the sliding window mechanism, they will always stay at the
|
|
3375
|
+
beginning of context window.
|
|
3376
|
+
*/
|
|
3377
|
+
export declare interface SlidingWindow {
|
|
3378
|
+
/** Session reduction target -- how many tokens we should keep. Window shortening operation has some latency costs, so we should avoid running it on every turn. Should be < trigger_tokens. If not set, trigger_tokens/2 is assumed. */
|
|
3379
|
+
targetTokens?: string;
|
|
3380
|
+
}
|
|
2975
3381
|
|
|
2976
3382
|
/** The speech generation configuration. */
|
|
2977
3383
|
export declare interface SpeechConfig {
|
|
@@ -2982,10 +3388,11 @@ export declare interface SpeechConfig {
|
|
|
2982
3388
|
|
|
2983
3389
|
export declare type SpeechConfigUnion = SpeechConfig | string;
|
|
2984
3390
|
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
3391
|
+
/** Start of speech sensitivity. */
|
|
3392
|
+
export declare enum StartSensitivity {
|
|
3393
|
+
START_SENSITIVITY_UNSPECIFIED = "START_SENSITIVITY_UNSPECIFIED",
|
|
3394
|
+
START_SENSITIVITY_HIGH = "START_SENSITIVITY_HIGH",
|
|
3395
|
+
START_SENSITIVITY_LOW = "START_SENSITIVITY_LOW"
|
|
2989
3396
|
}
|
|
2990
3397
|
|
|
2991
3398
|
/** Configuration for a Style reference image. */
|
|
@@ -3040,6 +3447,7 @@ export declare interface SubjectReferenceImage {
|
|
|
3040
3447
|
config?: SubjectReferenceConfig;
|
|
3041
3448
|
}
|
|
3042
3449
|
|
|
3450
|
+
/** Enum representing the subject type of a subject reference image. */
|
|
3043
3451
|
export declare enum SubjectReferenceType {
|
|
3044
3452
|
SUBJECT_TYPE_DEFAULT = "SUBJECT_TYPE_DEFAULT",
|
|
3045
3453
|
SUBJECT_TYPE_PERSON = "SUBJECT_TYPE_PERSON",
|
|
@@ -3078,6 +3486,9 @@ export declare interface ThinkingConfig {
|
|
|
3078
3486
|
/** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
|
|
3079
3487
|
*/
|
|
3080
3488
|
includeThoughts?: boolean;
|
|
3489
|
+
/** Indicates the thinking budget in tokens.
|
|
3490
|
+
*/
|
|
3491
|
+
thinkingBudget?: number;
|
|
3081
3492
|
}
|
|
3082
3493
|
|
|
3083
3494
|
/** Tokens info with a list of tokens and the corresponding list of token ids. */
|
|
@@ -3120,6 +3531,31 @@ export declare interface ToolConfig {
|
|
|
3120
3531
|
|
|
3121
3532
|
export declare type ToolListUnion = Tool[];
|
|
3122
3533
|
|
|
3534
|
+
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
3535
|
+
export declare enum TrafficType {
|
|
3536
|
+
TRAFFIC_TYPE_UNSPECIFIED = "TRAFFIC_TYPE_UNSPECIFIED",
|
|
3537
|
+
ON_DEMAND = "ON_DEMAND",
|
|
3538
|
+
PROVISIONED_THROUGHPUT = "PROVISIONED_THROUGHPUT"
|
|
3539
|
+
}
|
|
3540
|
+
|
|
3541
|
+
/** A tuned machine learning model. */
|
|
3542
|
+
export declare interface TunedModelInfo {
|
|
3543
|
+
/** ID of the base model that you want to tune. */
|
|
3544
|
+
baseModel?: string;
|
|
3545
|
+
/** Date and time when the base model was created. */
|
|
3546
|
+
createTime?: string;
|
|
3547
|
+
/** Date and time when the base model was last updated. */
|
|
3548
|
+
updateTime?: string;
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
/** Options about which input is included in the user's turn. */
|
|
3552
|
+
export declare enum TurnCoverage {
|
|
3553
|
+
TURN_COVERAGE_UNSPECIFIED = "TURN_COVERAGE_UNSPECIFIED",
|
|
3554
|
+
TURN_INCLUDES_ONLY_ACTIVITY = "TURN_INCLUDES_ONLY_ACTIVITY",
|
|
3555
|
+
TURN_INCLUDES_ALL_INPUT = "TURN_INCLUDES_ALL_INPUT"
|
|
3556
|
+
}
|
|
3557
|
+
|
|
3558
|
+
/** Optional. The type of the data. */
|
|
3123
3559
|
export declare enum Type {
|
|
3124
3560
|
TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
|
|
3125
3561
|
STRING = "STRING",
|
|
@@ -3152,11 +3588,11 @@ declare namespace types {
|
|
|
3152
3588
|
HarmProbability,
|
|
3153
3589
|
HarmSeverity,
|
|
3154
3590
|
BlockedReason,
|
|
3591
|
+
TrafficType,
|
|
3155
3592
|
Modality,
|
|
3156
|
-
|
|
3593
|
+
MediaResolution,
|
|
3157
3594
|
DynamicRetrievalConfigMode,
|
|
3158
3595
|
FunctionCallingConfigMode,
|
|
3159
|
-
MediaResolution,
|
|
3160
3596
|
SafetyFilterLevel,
|
|
3161
3597
|
PersonGeneration,
|
|
3162
3598
|
ImagePromptLanguage,
|
|
@@ -3165,6 +3601,11 @@ declare namespace types {
|
|
|
3165
3601
|
MaskReferenceMode,
|
|
3166
3602
|
ControlReferenceType,
|
|
3167
3603
|
SubjectReferenceType,
|
|
3604
|
+
MediaModality,
|
|
3605
|
+
StartSensitivity,
|
|
3606
|
+
EndSensitivity,
|
|
3607
|
+
ActivityHandling,
|
|
3608
|
+
TurnCoverage,
|
|
3168
3609
|
VideoMetadata,
|
|
3169
3610
|
CodeExecutionResult,
|
|
3170
3611
|
ExecutableCode,
|
|
@@ -3230,6 +3671,11 @@ declare namespace types {
|
|
|
3230
3671
|
SafetyAttributes,
|
|
3231
3672
|
GeneratedImage,
|
|
3232
3673
|
GenerateImagesResponse,
|
|
3674
|
+
GetModelConfig,
|
|
3675
|
+
GetModelParameters,
|
|
3676
|
+
Endpoint,
|
|
3677
|
+
TunedModelInfo,
|
|
3678
|
+
Model,
|
|
3233
3679
|
GenerationConfig,
|
|
3234
3680
|
CountTokensConfig,
|
|
3235
3681
|
CountTokensParameters,
|
|
@@ -3238,6 +3684,12 @@ declare namespace types {
|
|
|
3238
3684
|
ComputeTokensParameters,
|
|
3239
3685
|
TokensInfo,
|
|
3240
3686
|
ComputeTokensResponse,
|
|
3687
|
+
GenerateVideosConfig,
|
|
3688
|
+
GenerateVideosParameters,
|
|
3689
|
+
Video,
|
|
3690
|
+
GeneratedVideo,
|
|
3691
|
+
GenerateVideosResponse,
|
|
3692
|
+
GenerateVideosOperation,
|
|
3241
3693
|
CreateCachedContentConfig,
|
|
3242
3694
|
CreateCachedContentParameters,
|
|
3243
3695
|
CachedContentUsageMetadata,
|
|
@@ -3261,12 +3713,17 @@ declare namespace types {
|
|
|
3261
3713
|
CreateFileParameters,
|
|
3262
3714
|
HttpResponse,
|
|
3263
3715
|
LiveCallbacks,
|
|
3716
|
+
UploadFileParameters,
|
|
3264
3717
|
CreateFileResponse,
|
|
3265
3718
|
GetFileConfig,
|
|
3266
3719
|
GetFileParameters,
|
|
3267
3720
|
DeleteFileConfig,
|
|
3268
3721
|
DeleteFileParameters,
|
|
3269
3722
|
DeleteFileResponse,
|
|
3723
|
+
GetOperationConfig,
|
|
3724
|
+
GetOperationParameters,
|
|
3725
|
+
FetchPredictOperationConfig,
|
|
3726
|
+
FetchPredictOperationParameters,
|
|
3270
3727
|
TestTableItem,
|
|
3271
3728
|
TestTableFile,
|
|
3272
3729
|
ReplayRequest,
|
|
@@ -3290,12 +3747,23 @@ declare namespace types {
|
|
|
3290
3747
|
LiveServerContent,
|
|
3291
3748
|
LiveServerToolCall,
|
|
3292
3749
|
LiveServerToolCallCancellation,
|
|
3750
|
+
UsageMetadata,
|
|
3751
|
+
LiveServerGoAway,
|
|
3752
|
+
LiveServerSessionResumptionUpdate,
|
|
3293
3753
|
LiveServerMessage,
|
|
3754
|
+
AutomaticActivityDetection,
|
|
3755
|
+
RealtimeInputConfig,
|
|
3756
|
+
SessionResumptionConfig,
|
|
3757
|
+
SlidingWindow,
|
|
3758
|
+
ContextWindowCompressionConfig,
|
|
3294
3759
|
LiveClientSetup,
|
|
3295
3760
|
LiveClientContent,
|
|
3761
|
+
ActivityStart,
|
|
3762
|
+
ActivityEnd,
|
|
3296
3763
|
LiveClientRealtimeInput,
|
|
3297
3764
|
LiveClientToolResponse,
|
|
3298
3765
|
LiveClientMessage,
|
|
3766
|
+
AudioTranscriptionConfig,
|
|
3299
3767
|
LiveConnectConfig,
|
|
3300
3768
|
LiveConnectParameters,
|
|
3301
3769
|
CreateChatParameters,
|
|
@@ -3303,6 +3771,7 @@ declare namespace types {
|
|
|
3303
3771
|
LiveSendClientContentParameters,
|
|
3304
3772
|
LiveSendRealtimeInputParameters,
|
|
3305
3773
|
LiveSendToolResponseParameters,
|
|
3774
|
+
OperationGetParameters,
|
|
3306
3775
|
PartUnion,
|
|
3307
3776
|
PartListUnion,
|
|
3308
3777
|
ContentUnion,
|
|
@@ -3317,9 +3786,9 @@ declare namespace types {
|
|
|
3317
3786
|
export declare interface UpdateCachedContentConfig {
|
|
3318
3787
|
/** Used to override HTTP request options. */
|
|
3319
3788
|
httpOptions?: HttpOptions;
|
|
3320
|
-
/** The TTL for this resource. The expiration time is computed: now + TTL. */
|
|
3789
|
+
/** The TTL for this resource. The expiration time is computed: now + TTL. It is a duration string, with up to nine fractional digits, terminated by 's'. Example: "3.5s". */
|
|
3321
3790
|
ttl?: string;
|
|
3322
|
-
/** Timestamp of when this resource is considered expired. */
|
|
3791
|
+
/** Timestamp of when this resource is considered expired. Uses RFC 3339 format, Example: 2014-10-02T15:01:23Z. */
|
|
3323
3792
|
expireTime?: string;
|
|
3324
3793
|
}
|
|
3325
3794
|
|
|
@@ -3368,9 +3837,9 @@ export declare interface UploadFileConfig {
|
|
|
3368
3837
|
}
|
|
3369
3838
|
|
|
3370
3839
|
/** Parameters for the upload file method. */
|
|
3371
|
-
declare interface UploadFileParameters {
|
|
3840
|
+
export declare interface UploadFileParameters {
|
|
3372
3841
|
/** The string path to the file to be uploaded or a Blob object. */
|
|
3373
|
-
file: string | Blob;
|
|
3842
|
+
file: string | globalThis.Blob;
|
|
3374
3843
|
/** Configuration that contains optional parameters. */
|
|
3375
3844
|
config?: UploadFileConfig;
|
|
3376
3845
|
}
|
|
@@ -3406,6 +3875,33 @@ export declare interface UpscaleImageParameters {
|
|
|
3406
3875
|
config?: UpscaleImageConfig;
|
|
3407
3876
|
}
|
|
3408
3877
|
|
|
3878
|
+
/** Usage metadata about response(s). */
|
|
3879
|
+
export declare interface UsageMetadata {
|
|
3880
|
+
/** Number of tokens in the prompt. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content. */
|
|
3881
|
+
promptTokenCount?: number;
|
|
3882
|
+
/** Number of tokens in the cached part of the prompt (the cached content). */
|
|
3883
|
+
cachedContentTokenCount?: number;
|
|
3884
|
+
/** Total number of tokens across all the generated response candidates. */
|
|
3885
|
+
responseTokenCount?: number;
|
|
3886
|
+
/** Number of tokens present in tool-use prompt(s). */
|
|
3887
|
+
toolUsePromptTokenCount?: number;
|
|
3888
|
+
/** Number of tokens of thoughts for thinking models. */
|
|
3889
|
+
thoughtsTokenCount?: number;
|
|
3890
|
+
/** Total token count for prompt, response candidates, and tool-use prompts(if present). */
|
|
3891
|
+
totalTokenCount?: number;
|
|
3892
|
+
/** List of modalities that were processed in the request input. */
|
|
3893
|
+
promptTokensDetails?: ModalityTokenCount[];
|
|
3894
|
+
/** List of modalities that were processed in the cache input. */
|
|
3895
|
+
cacheTokensDetails?: ModalityTokenCount[];
|
|
3896
|
+
/** List of modalities that were returned in the response. */
|
|
3897
|
+
responseTokensDetails?: ModalityTokenCount[];
|
|
3898
|
+
/** List of modalities that were processed in the tool-use prompt. */
|
|
3899
|
+
toolUsePromptTokensDetails?: ModalityTokenCount[];
|
|
3900
|
+
/** Traffic type. This shows whether a request consumes Pay-As-You-Go
|
|
3901
|
+
or Provisioned Throughput quota. */
|
|
3902
|
+
trafficType?: TrafficType;
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3409
3905
|
/** Retrieve from Vertex AI Search datastore or engine for grounding. datastore and engine are mutually exclusive. See https://cloud.google.com/products/agent-builder */
|
|
3410
3906
|
export declare interface VertexAISearch {
|
|
3411
3907
|
/** Optional. Fully-qualified Vertex AI Search data store resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}` */
|
|
@@ -3434,6 +3930,16 @@ export declare interface VertexRagStoreRagResource {
|
|
|
3434
3930
|
ragFileIds?: string[];
|
|
3435
3931
|
}
|
|
3436
3932
|
|
|
3933
|
+
/** A generated video. */
|
|
3934
|
+
export declare interface Video {
|
|
3935
|
+
/** Path to another storage. */
|
|
3936
|
+
uri?: string;
|
|
3937
|
+
/** Video bytes. */
|
|
3938
|
+
videoBytes?: string;
|
|
3939
|
+
/** Video encoding, for example "video/mp4". */
|
|
3940
|
+
mimeType?: string;
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3437
3943
|
/** Metadata describes the input video content. */
|
|
3438
3944
|
export declare interface VideoMetadata {
|
|
3439
3945
|
/** Optional. The end offset of the video. */
|