@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/web/web.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.
|
|
@@ -1600,6 +1788,7 @@ export declare class GoogleGenAI {
|
|
|
1600
1788
|
readonly chats: Chats;
|
|
1601
1789
|
readonly caches: Caches;
|
|
1602
1790
|
readonly files: Files;
|
|
1791
|
+
readonly operations: Operations;
|
|
1603
1792
|
constructor(options: GoogleGenAIOptions);
|
|
1604
1793
|
}
|
|
1605
1794
|
|
|
@@ -1704,6 +1893,8 @@ export declare interface GroundingChunkRetrievedContext {
|
|
|
1704
1893
|
|
|
1705
1894
|
/** Chunk from the web. */
|
|
1706
1895
|
export declare interface GroundingChunkWeb {
|
|
1896
|
+
/** Domain of the (original) URI. */
|
|
1897
|
+
domain?: string;
|
|
1707
1898
|
/** Title of the chunk. */
|
|
1708
1899
|
title?: string;
|
|
1709
1900
|
/** URI reference of the chunk. */
|
|
@@ -1736,12 +1927,14 @@ export declare interface GroundingSupport {
|
|
|
1736
1927
|
segment?: Segment;
|
|
1737
1928
|
}
|
|
1738
1929
|
|
|
1930
|
+
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
1739
1931
|
export declare enum HarmBlockMethod {
|
|
1740
1932
|
HARM_BLOCK_METHOD_UNSPECIFIED = "HARM_BLOCK_METHOD_UNSPECIFIED",
|
|
1741
1933
|
SEVERITY = "SEVERITY",
|
|
1742
1934
|
PROBABILITY = "PROBABILITY"
|
|
1743
1935
|
}
|
|
1744
1936
|
|
|
1937
|
+
/** Required. The harm block threshold. */
|
|
1745
1938
|
export declare enum HarmBlockThreshold {
|
|
1746
1939
|
HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
1747
1940
|
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
|
|
@@ -1751,6 +1944,7 @@ export declare enum HarmBlockThreshold {
|
|
|
1751
1944
|
OFF = "OFF"
|
|
1752
1945
|
}
|
|
1753
1946
|
|
|
1947
|
+
/** Required. Harm category. */
|
|
1754
1948
|
export declare enum HarmCategory {
|
|
1755
1949
|
HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED",
|
|
1756
1950
|
HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
|
|
@@ -1760,6 +1954,7 @@ export declare enum HarmCategory {
|
|
|
1760
1954
|
HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
1761
1955
|
}
|
|
1762
1956
|
|
|
1957
|
+
/** Output only. Harm probability levels in the content. */
|
|
1763
1958
|
export declare enum HarmProbability {
|
|
1764
1959
|
HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED",
|
|
1765
1960
|
NEGLIGIBLE = "NEGLIGIBLE",
|
|
@@ -1768,6 +1963,7 @@ export declare enum HarmProbability {
|
|
|
1768
1963
|
HIGH = "HIGH"
|
|
1769
1964
|
}
|
|
1770
1965
|
|
|
1966
|
+
/** Output only. Harm severity levels in the content. */
|
|
1771
1967
|
export declare enum HarmSeverity {
|
|
1772
1968
|
HARM_SEVERITY_UNSPECIFIED = "HARM_SEVERITY_UNSPECIFIED",
|
|
1773
1969
|
HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
|
|
@@ -1860,6 +2056,7 @@ declare interface Image_2 {
|
|
|
1860
2056
|
}
|
|
1861
2057
|
export { Image_2 as Image }
|
|
1862
2058
|
|
|
2059
|
+
/** Enum that specifies the language of the text in the prompt. */
|
|
1863
2060
|
export declare enum ImagePromptLanguage {
|
|
1864
2061
|
auto = "auto",
|
|
1865
2062
|
en = "en",
|
|
@@ -1868,6 +2065,7 @@ export declare enum ImagePromptLanguage {
|
|
|
1868
2065
|
hi = "hi"
|
|
1869
2066
|
}
|
|
1870
2067
|
|
|
2068
|
+
/** Required. Programming language of the `code`. */
|
|
1871
2069
|
export declare enum Language {
|
|
1872
2070
|
LANGUAGE_UNSPECIFIED = "LANGUAGE_UNSPECIFIED",
|
|
1873
2071
|
PYTHON = "PYTHON"
|
|
@@ -1971,9 +2169,21 @@ export declare class Live {
|
|
|
1971
2169
|
|
|
1972
2170
|
/** Callbacks for the live API. */
|
|
1973
2171
|
export declare interface LiveCallbacks {
|
|
2172
|
+
/**
|
|
2173
|
+
* Called when the websocket connection is established.
|
|
2174
|
+
*/
|
|
1974
2175
|
onopen?: (() => void) | null;
|
|
2176
|
+
/**
|
|
2177
|
+
* Called when a message is received from the server.
|
|
2178
|
+
*/
|
|
1975
2179
|
onmessage: (e: LiveServerMessage) => void;
|
|
2180
|
+
/**
|
|
2181
|
+
* Called when an error occurs.
|
|
2182
|
+
*/
|
|
1976
2183
|
onerror?: ((e: ErrorEvent) => void) | null;
|
|
2184
|
+
/**
|
|
2185
|
+
* Called when the websocket connection is closed.
|
|
2186
|
+
*/
|
|
1977
2187
|
onclose?: ((e: CloseEvent) => void) | null;
|
|
1978
2188
|
}
|
|
1979
2189
|
|
|
@@ -2012,11 +2222,11 @@ export declare interface LiveClientMessage {
|
|
|
2012
2222
|
|
|
2013
2223
|
/** User input that is sent in real time.
|
|
2014
2224
|
|
|
2015
|
-
This is different from `
|
|
2225
|
+
This is different from `LiveClientContent` in a few ways:
|
|
2016
2226
|
|
|
2017
2227
|
- Can be sent continuously without interruption to model generation.
|
|
2018
2228
|
- If there is a need to mix data interleaved across the
|
|
2019
|
-
`
|
|
2229
|
+
`LiveClientContent` and the `LiveClientRealtimeInput`, server attempts to
|
|
2020
2230
|
optimize for best response, but there are no guarantees.
|
|
2021
2231
|
- End of turn is not explicitly specified, but is rather derived from user
|
|
2022
2232
|
activity (for example, end of speech).
|
|
@@ -2028,6 +2238,10 @@ export declare interface LiveClientMessage {
|
|
|
2028
2238
|
export declare interface LiveClientRealtimeInput {
|
|
2029
2239
|
/** Inlined bytes data for media input. */
|
|
2030
2240
|
mediaChunks?: Blob_2[];
|
|
2241
|
+
/** Marks the start of user activity. */
|
|
2242
|
+
activityStart?: ActivityStart;
|
|
2243
|
+
/** Marks the end of user activity. */
|
|
2244
|
+
activityEnd?: ActivityEnd;
|
|
2031
2245
|
}
|
|
2032
2246
|
|
|
2033
2247
|
/** Message contains configuration that will apply for the duration of the streaming session. */
|
|
@@ -2038,15 +2252,7 @@ export declare interface LiveClientSetup {
|
|
|
2038
2252
|
*/
|
|
2039
2253
|
model?: string;
|
|
2040
2254
|
/** The generation configuration for the session.
|
|
2041
|
-
|
|
2042
|
-
The following fields are supported:
|
|
2043
|
-
- `response_logprobs`
|
|
2044
|
-
- `response_mime_type`
|
|
2045
|
-
- `logprobs`
|
|
2046
|
-
- `response_schema`
|
|
2047
|
-
- `stop_sequence`
|
|
2048
|
-
- `routing_config`
|
|
2049
|
-
- `audio_timestamp`
|
|
2255
|
+
Note: only a subset of fields are supported.
|
|
2050
2256
|
*/
|
|
2051
2257
|
generationConfig?: GenerationConfig;
|
|
2052
2258
|
/** The user provided system instructions for the model.
|
|
@@ -2059,6 +2265,16 @@ export declare interface LiveClientSetup {
|
|
|
2059
2265
|
external systems to perform an action, or set of actions, outside of
|
|
2060
2266
|
knowledge and scope of the model. */
|
|
2061
2267
|
tools?: ToolListUnion;
|
|
2268
|
+
/** Configures the realtime input behavior in BidiGenerateContent. */
|
|
2269
|
+
realtimeInputConfig?: RealtimeInputConfig;
|
|
2270
|
+
/** Configures session resumption mechanism.
|
|
2271
|
+
|
|
2272
|
+
If included server will send SessionResumptionUpdate messages. */
|
|
2273
|
+
sessionResumption?: SessionResumptionConfig;
|
|
2274
|
+
/** Configures context window compression mechanism.
|
|
2275
|
+
|
|
2276
|
+
If included, server will compress context window to fit into given length. */
|
|
2277
|
+
contextWindowCompression?: ContextWindowCompressionConfig;
|
|
2062
2278
|
}
|
|
2063
2279
|
|
|
2064
2280
|
/** Client generated response to a `ToolCall` received from the server.
|
|
@@ -2097,6 +2313,16 @@ export declare interface LiveConnectConfig {
|
|
|
2097
2313
|
external systems to perform an action, or set of actions, outside of
|
|
2098
2314
|
knowledge and scope of the model. */
|
|
2099
2315
|
tools?: ToolListUnion;
|
|
2316
|
+
/** Configures session resumption mechanism.
|
|
2317
|
+
|
|
2318
|
+
If included the server will send SessionResumptionUpdate messages. */
|
|
2319
|
+
sessionResumption?: SessionResumptionConfig;
|
|
2320
|
+
/** Configures the realtime input behavior in BidiGenerateContent. */
|
|
2321
|
+
realtimeInputConfig?: RealtimeInputConfig;
|
|
2322
|
+
/** Configures context window compression mechanism.
|
|
2323
|
+
|
|
2324
|
+
If included, server will compress context window to fit into given length. */
|
|
2325
|
+
contextWindowCompression?: ContextWindowCompressionConfig;
|
|
2100
2326
|
}
|
|
2101
2327
|
|
|
2102
2328
|
/** Parameters for connecting to the live API. */
|
|
@@ -2125,6 +2351,10 @@ export declare interface LiveSendClientContentParameters {
|
|
|
2125
2351
|
export declare interface LiveSendRealtimeInputParameters {
|
|
2126
2352
|
/** Realtime input to send to the session. */
|
|
2127
2353
|
media: Blob_2;
|
|
2354
|
+
/** Marks the start of user activity. */
|
|
2355
|
+
activityStart?: ActivityStart;
|
|
2356
|
+
/** Marks the end of user activity. */
|
|
2357
|
+
activityEnd?: ActivityEnd;
|
|
2128
2358
|
}
|
|
2129
2359
|
|
|
2130
2360
|
/** Parameters for sending tool responses to the live API. */
|
|
@@ -2145,6 +2375,21 @@ export declare interface LiveServerContent {
|
|
|
2145
2375
|
turnComplete?: boolean;
|
|
2146
2376
|
/** 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. */
|
|
2147
2377
|
interrupted?: boolean;
|
|
2378
|
+
/** If true, indicates that the model is done generating. When model is
|
|
2379
|
+
interrupted while generating there will be no generation_complete message
|
|
2380
|
+
in interrupted turn, it will go through interrupted > turn_complete.
|
|
2381
|
+
When model assumes realtime playback there will be delay between
|
|
2382
|
+
generation_complete and turn_complete that is caused by model
|
|
2383
|
+
waiting for playback to finish. If true, indicates that the model
|
|
2384
|
+
has finished generating all content. This is a signal to the client
|
|
2385
|
+
that it can stop sending messages. */
|
|
2386
|
+
generationComplete?: boolean;
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
/** Server will not be able to service client soon. */
|
|
2390
|
+
export declare interface LiveServerGoAway {
|
|
2391
|
+
/** 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. */
|
|
2392
|
+
timeLeft?: string;
|
|
2148
2393
|
}
|
|
2149
2394
|
|
|
2150
2395
|
/** Response message for API call. */
|
|
@@ -2157,6 +2402,29 @@ export declare interface LiveServerMessage {
|
|
|
2157
2402
|
toolCall?: LiveServerToolCall;
|
|
2158
2403
|
/** Notification for the client that a previously issued `ToolCallMessage` with the specified `id`s should have been not executed and should be cancelled. */
|
|
2159
2404
|
toolCallCancellation?: LiveServerToolCallCancellation;
|
|
2405
|
+
/** Usage metadata about model response(s). */
|
|
2406
|
+
usageMetadata?: UsageMetadata;
|
|
2407
|
+
/** Server will disconnect soon. */
|
|
2408
|
+
goAway?: LiveServerGoAway;
|
|
2409
|
+
/** Update of the session resumption state. */
|
|
2410
|
+
sessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
/** Update of the session resumption state.
|
|
2414
|
+
|
|
2415
|
+
Only sent if `session_resumption` was set in the connection config.
|
|
2416
|
+
*/
|
|
2417
|
+
export declare interface LiveServerSessionResumptionUpdate {
|
|
2418
|
+
/** New handle that represents state that can be resumed. Empty if `resumable`=false. */
|
|
2419
|
+
newHandle?: string;
|
|
2420
|
+
/** 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. */
|
|
2421
|
+
resumable?: boolean;
|
|
2422
|
+
/** Index of last message sent by client that is included in state represented by this SessionResumptionToken. Only sent when `SessionResumptionConfig.transparent` is set.
|
|
2423
|
+
|
|
2424
|
+
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).
|
|
2425
|
+
|
|
2426
|
+
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. */
|
|
2427
|
+
lastConsumedClientMessageIndex?: string;
|
|
2160
2428
|
}
|
|
2161
2429
|
|
|
2162
2430
|
/** Sent in response to a `LiveGenerateContentSetup` message from the client. */
|
|
@@ -2238,6 +2506,7 @@ export declare interface MaskReferenceImage {
|
|
|
2238
2506
|
config?: MaskReferenceConfig;
|
|
2239
2507
|
}
|
|
2240
2508
|
|
|
2509
|
+
/** Enum representing the mask mode of a mask reference image. */
|
|
2241
2510
|
export declare enum MaskReferenceMode {
|
|
2242
2511
|
MASK_MODE_DEFAULT = "MASK_MODE_DEFAULT",
|
|
2243
2512
|
MASK_MODE_USER_PROVIDED = "MASK_MODE_USER_PROVIDED",
|
|
@@ -2246,6 +2515,17 @@ export declare enum MaskReferenceMode {
|
|
|
2246
2515
|
MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
|
|
2247
2516
|
}
|
|
2248
2517
|
|
|
2518
|
+
/** Server content modalities. */
|
|
2519
|
+
export declare enum MediaModality {
|
|
2520
|
+
MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
|
|
2521
|
+
TEXT = "TEXT",
|
|
2522
|
+
IMAGE = "IMAGE",
|
|
2523
|
+
VIDEO = "VIDEO",
|
|
2524
|
+
AUDIO = "AUDIO",
|
|
2525
|
+
DOCUMENT = "DOCUMENT"
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
/** The media resolution to use. */
|
|
2249
2529
|
export declare enum MediaResolution {
|
|
2250
2530
|
MEDIA_RESOLUTION_UNSPECIFIED = "MEDIA_RESOLUTION_UNSPECIFIED",
|
|
2251
2531
|
MEDIA_RESOLUTION_LOW = "MEDIA_RESOLUTION_LOW",
|
|
@@ -2253,6 +2533,7 @@ export declare enum MediaResolution {
|
|
|
2253
2533
|
MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
|
|
2254
2534
|
}
|
|
2255
2535
|
|
|
2536
|
+
/** Server content modalities. */
|
|
2256
2537
|
export declare enum Modality {
|
|
2257
2538
|
MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
|
|
2258
2539
|
TEXT = "TEXT",
|
|
@@ -2263,16 +2544,45 @@ export declare enum Modality {
|
|
|
2263
2544
|
/** Represents token counting info for a single modality. */
|
|
2264
2545
|
export declare interface ModalityTokenCount {
|
|
2265
2546
|
/** The modality associated with this token count. */
|
|
2266
|
-
modality?:
|
|
2547
|
+
modality?: MediaModality;
|
|
2267
2548
|
/** Number of tokens. */
|
|
2268
2549
|
tokenCount?: number;
|
|
2269
2550
|
}
|
|
2270
2551
|
|
|
2552
|
+
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
2271
2553
|
export declare enum Mode {
|
|
2272
2554
|
MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
|
|
2273
2555
|
MODE_DYNAMIC = "MODE_DYNAMIC"
|
|
2274
2556
|
}
|
|
2275
2557
|
|
|
2558
|
+
/** A trained machine learning model. */
|
|
2559
|
+
export declare interface Model {
|
|
2560
|
+
/** Resource name of the model. */
|
|
2561
|
+
name?: string;
|
|
2562
|
+
/** Display name of the model. */
|
|
2563
|
+
displayName?: string;
|
|
2564
|
+
/** Description of the model. */
|
|
2565
|
+
description?: string;
|
|
2566
|
+
/** Version ID of the model. A new version is committed when a new
|
|
2567
|
+
model version is uploaded or trained under an existing model ID. The
|
|
2568
|
+
version ID is an auto-incrementing decimal number in string
|
|
2569
|
+
representation. */
|
|
2570
|
+
version?: string;
|
|
2571
|
+
/** List of deployed models created from this base model. Note that a
|
|
2572
|
+
model could have been deployed to endpoints in different locations. */
|
|
2573
|
+
endpoints?: Endpoint[];
|
|
2574
|
+
/** Labels with user-defined metadata to organize your models. */
|
|
2575
|
+
labels?: Record<string, string>;
|
|
2576
|
+
/** Information about the tuned model from the base model. */
|
|
2577
|
+
tunedModelInfo?: TunedModelInfo;
|
|
2578
|
+
/** The maximum number of input tokens that the model can handle. */
|
|
2579
|
+
inputTokenLimit?: number;
|
|
2580
|
+
/** The maximum number of output tokens that the model can generate. */
|
|
2581
|
+
outputTokenLimit?: number;
|
|
2582
|
+
/** List of actions that are supported by the model. */
|
|
2583
|
+
supportedActions?: string[];
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2276
2586
|
export declare class Models extends BaseModule {
|
|
2277
2587
|
private readonly apiClient;
|
|
2278
2588
|
constructor(apiClient: ApiClient);
|
|
@@ -2423,6 +2733,15 @@ export declare class Models extends BaseModule {
|
|
|
2423
2733
|
* ```
|
|
2424
2734
|
*/
|
|
2425
2735
|
private generateImagesInternal;
|
|
2736
|
+
/**
|
|
2737
|
+
* Fetches information about a model by name.
|
|
2738
|
+
*
|
|
2739
|
+
* @example
|
|
2740
|
+
* ```ts
|
|
2741
|
+
* const modelInfo = await ai.models.get({model: 'gemini-2.0-flash'});
|
|
2742
|
+
* ```
|
|
2743
|
+
*/
|
|
2744
|
+
get(params: types.GetModelParameters): Promise<types.Model>;
|
|
2426
2745
|
/**
|
|
2427
2746
|
* Counts the number of tokens in the given contents. Multimodal input is
|
|
2428
2747
|
* supported for Gemini models.
|
|
@@ -2459,6 +2778,52 @@ export declare class Models extends BaseModule {
|
|
|
2459
2778
|
* ```
|
|
2460
2779
|
*/
|
|
2461
2780
|
computeTokens(params: types.ComputeTokensParameters): Promise<types.ComputeTokensResponse>;
|
|
2781
|
+
/**
|
|
2782
|
+
* Generates videos based on a text description and configuration.
|
|
2783
|
+
*
|
|
2784
|
+
* @param params - The parameters for generating videos.
|
|
2785
|
+
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
2786
|
+
*
|
|
2787
|
+
* @example
|
|
2788
|
+
* ```ts
|
|
2789
|
+
* const operation = await ai.models.generateVideos({
|
|
2790
|
+
* model: 'veo-2.0-generate-001',
|
|
2791
|
+
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
2792
|
+
* config: {
|
|
2793
|
+
* numberOfVideos: 1
|
|
2794
|
+
* });
|
|
2795
|
+
*
|
|
2796
|
+
* while (!operation.done) {
|
|
2797
|
+
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
2798
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
2799
|
+
* }
|
|
2800
|
+
*
|
|
2801
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
2802
|
+
* ```
|
|
2803
|
+
*/
|
|
2804
|
+
generateVideos(params: types.GenerateVideosParameters): Promise<types.GenerateVideosOperation>;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
/** Parameters for the get method of the operations module. */
|
|
2808
|
+
export declare interface OperationGetParameters {
|
|
2809
|
+
/** The operation to be retrieved. */
|
|
2810
|
+
operation: GenerateVideosOperation;
|
|
2811
|
+
/** Used to override the default configuration. */
|
|
2812
|
+
config?: GetOperationConfig;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
export declare class Operations extends BaseModule {
|
|
2816
|
+
private readonly apiClient;
|
|
2817
|
+
constructor(apiClient: ApiClient);
|
|
2818
|
+
/**
|
|
2819
|
+
* Gets the status of a long-running operation.
|
|
2820
|
+
*
|
|
2821
|
+
* @param parameters The parameters for the get operation request.
|
|
2822
|
+
* @return The updated Operation object, with the latest status or result.
|
|
2823
|
+
*/
|
|
2824
|
+
getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
|
|
2825
|
+
private getVideosOperationInternal;
|
|
2826
|
+
private fetchPredictVideosOperationInternal;
|
|
2462
2827
|
}
|
|
2463
2828
|
|
|
2464
2829
|
/**
|
|
@@ -2466,6 +2831,7 @@ export declare class Models extends BaseModule {
|
|
|
2466
2831
|
* Copyright 2025 Google LLC
|
|
2467
2832
|
* SPDX-License-Identifier: Apache-2.0
|
|
2468
2833
|
*/
|
|
2834
|
+
/** Required. Outcome of the code execution. */
|
|
2469
2835
|
export declare enum Outcome {
|
|
2470
2836
|
OUTCOME_UNSPECIFIED = "OUTCOME_UNSPECIFIED",
|
|
2471
2837
|
OUTCOME_OK = "OUTCOME_OK",
|
|
@@ -2481,7 +2847,7 @@ export declare enum Outcome {
|
|
|
2481
2847
|
/**
|
|
2482
2848
|
* Pagers for the GenAI List APIs.
|
|
2483
2849
|
*/
|
|
2484
|
-
declare enum PagedItem {
|
|
2850
|
+
export declare enum PagedItem {
|
|
2485
2851
|
PAGED_ITEM_BATCH_JOBS = "batchJobs",
|
|
2486
2852
|
PAGED_ITEM_MODELS = "models",
|
|
2487
2853
|
PAGED_ITEM_TUNING_JOBS = "tuningJobs",
|
|
@@ -2508,7 +2874,7 @@ declare interface PagedItemResponse<T> {
|
|
|
2508
2874
|
/**
|
|
2509
2875
|
* Pager class for iterating through paginated results.
|
|
2510
2876
|
*/
|
|
2511
|
-
declare class Pager<T> implements AsyncIterable<T> {
|
|
2877
|
+
export declare class Pager<T> implements AsyncIterable<T> {
|
|
2512
2878
|
private nameInternal;
|
|
2513
2879
|
private pageInternal;
|
|
2514
2880
|
private paramsInternal;
|
|
@@ -2631,6 +2997,7 @@ export declare type PartListUnion = PartUnion[] | PartUnion;
|
|
|
2631
2997
|
|
|
2632
2998
|
export declare type PartUnion = Part | string;
|
|
2633
2999
|
|
|
3000
|
+
/** Enum that controls the generation of people. */
|
|
2634
3001
|
export declare enum PersonGeneration {
|
|
2635
3002
|
DONT_ALLOW = "DONT_ALLOW",
|
|
2636
3003
|
ALLOW_ADULT = "ALLOW_ADULT",
|
|
@@ -2659,6 +3026,20 @@ export declare interface RawReferenceImage {
|
|
|
2659
3026
|
referenceType?: string;
|
|
2660
3027
|
}
|
|
2661
3028
|
|
|
3029
|
+
/** Marks the end of user activity.
|
|
3030
|
+
|
|
3031
|
+
This can only be sent if automatic (i.e. server-side) activity detection is
|
|
3032
|
+
disabled.
|
|
3033
|
+
*/
|
|
3034
|
+
export declare interface RealtimeInputConfig {
|
|
3035
|
+
/** If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals. */
|
|
3036
|
+
automaticActivityDetection?: AutomaticActivityDetection;
|
|
3037
|
+
/** Defines what effect activity has. */
|
|
3038
|
+
activityHandling?: ActivityHandling;
|
|
3039
|
+
/** Defines which input is included in the user's turn. */
|
|
3040
|
+
turnCoverage?: TurnCoverage;
|
|
3041
|
+
}
|
|
3042
|
+
|
|
2662
3043
|
/** Represents a recorded session. */
|
|
2663
3044
|
export declare interface ReplayFile {
|
|
2664
3045
|
replayId?: string;
|
|
@@ -2716,6 +3097,7 @@ export declare interface SafetyAttributes {
|
|
|
2716
3097
|
contentType?: string;
|
|
2717
3098
|
}
|
|
2718
3099
|
|
|
3100
|
+
/** Enum that controls the safety filter level for objectionable content. */
|
|
2719
3101
|
export declare enum SafetyFilterLevel {
|
|
2720
3102
|
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
|
|
2721
3103
|
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -2964,7 +3346,31 @@ export declare class Session {
|
|
|
2964
3346
|
close(): void;
|
|
2965
3347
|
}
|
|
2966
3348
|
|
|
2967
|
-
|
|
3349
|
+
/** Configuration of session resumption mechanism.
|
|
3350
|
+
|
|
3351
|
+
Included in `LiveConnectConfig.session_resumption`. If included server
|
|
3352
|
+
will send `LiveServerSessionResumptionUpdate` messages.
|
|
3353
|
+
*/
|
|
3354
|
+
export declare interface SessionResumptionConfig {
|
|
3355
|
+
/** Session resumption handle of previous session (session to restore).
|
|
3356
|
+
|
|
3357
|
+
If not present new session will be started. */
|
|
3358
|
+
handle?: string;
|
|
3359
|
+
/** If set the server will send `last_consumed_client_message_index` in the `session_resumption_update` messages to allow for transparent reconnections. */
|
|
3360
|
+
transparent?: boolean;
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
/** Context window will be truncated by keeping only suffix of it.
|
|
3364
|
+
|
|
3365
|
+
Context window will always be cut at start of USER role turn. System
|
|
3366
|
+
instructions and `BidiGenerateContentSetup.prefix_turns` will not be
|
|
3367
|
+
subject to the sliding window mechanism, they will always stay at the
|
|
3368
|
+
beginning of context window.
|
|
3369
|
+
*/
|
|
3370
|
+
export declare interface SlidingWindow {
|
|
3371
|
+
/** 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. */
|
|
3372
|
+
targetTokens?: string;
|
|
3373
|
+
}
|
|
2968
3374
|
|
|
2969
3375
|
/** The speech generation configuration. */
|
|
2970
3376
|
export declare interface SpeechConfig {
|
|
@@ -2975,10 +3381,11 @@ export declare interface SpeechConfig {
|
|
|
2975
3381
|
|
|
2976
3382
|
export declare type SpeechConfigUnion = SpeechConfig | string;
|
|
2977
3383
|
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
3384
|
+
/** Start of speech sensitivity. */
|
|
3385
|
+
export declare enum StartSensitivity {
|
|
3386
|
+
START_SENSITIVITY_UNSPECIFIED = "START_SENSITIVITY_UNSPECIFIED",
|
|
3387
|
+
START_SENSITIVITY_HIGH = "START_SENSITIVITY_HIGH",
|
|
3388
|
+
START_SENSITIVITY_LOW = "START_SENSITIVITY_LOW"
|
|
2982
3389
|
}
|
|
2983
3390
|
|
|
2984
3391
|
/** Configuration for a Style reference image. */
|
|
@@ -3033,6 +3440,7 @@ export declare interface SubjectReferenceImage {
|
|
|
3033
3440
|
config?: SubjectReferenceConfig;
|
|
3034
3441
|
}
|
|
3035
3442
|
|
|
3443
|
+
/** Enum representing the subject type of a subject reference image. */
|
|
3036
3444
|
export declare enum SubjectReferenceType {
|
|
3037
3445
|
SUBJECT_TYPE_DEFAULT = "SUBJECT_TYPE_DEFAULT",
|
|
3038
3446
|
SUBJECT_TYPE_PERSON = "SUBJECT_TYPE_PERSON",
|
|
@@ -3071,6 +3479,9 @@ export declare interface ThinkingConfig {
|
|
|
3071
3479
|
/** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
|
|
3072
3480
|
*/
|
|
3073
3481
|
includeThoughts?: boolean;
|
|
3482
|
+
/** Indicates the thinking budget in tokens.
|
|
3483
|
+
*/
|
|
3484
|
+
thinkingBudget?: number;
|
|
3074
3485
|
}
|
|
3075
3486
|
|
|
3076
3487
|
/** Tokens info with a list of tokens and the corresponding list of token ids. */
|
|
@@ -3113,6 +3524,31 @@ export declare interface ToolConfig {
|
|
|
3113
3524
|
|
|
3114
3525
|
export declare type ToolListUnion = Tool[];
|
|
3115
3526
|
|
|
3527
|
+
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
3528
|
+
export declare enum TrafficType {
|
|
3529
|
+
TRAFFIC_TYPE_UNSPECIFIED = "TRAFFIC_TYPE_UNSPECIFIED",
|
|
3530
|
+
ON_DEMAND = "ON_DEMAND",
|
|
3531
|
+
PROVISIONED_THROUGHPUT = "PROVISIONED_THROUGHPUT"
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
/** A tuned machine learning model. */
|
|
3535
|
+
export declare interface TunedModelInfo {
|
|
3536
|
+
/** ID of the base model that you want to tune. */
|
|
3537
|
+
baseModel?: string;
|
|
3538
|
+
/** Date and time when the base model was created. */
|
|
3539
|
+
createTime?: string;
|
|
3540
|
+
/** Date and time when the base model was last updated. */
|
|
3541
|
+
updateTime?: string;
|
|
3542
|
+
}
|
|
3543
|
+
|
|
3544
|
+
/** Options about which input is included in the user's turn. */
|
|
3545
|
+
export declare enum TurnCoverage {
|
|
3546
|
+
TURN_COVERAGE_UNSPECIFIED = "TURN_COVERAGE_UNSPECIFIED",
|
|
3547
|
+
TURN_INCLUDES_ONLY_ACTIVITY = "TURN_INCLUDES_ONLY_ACTIVITY",
|
|
3548
|
+
TURN_INCLUDES_ALL_INPUT = "TURN_INCLUDES_ALL_INPUT"
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
/** Optional. The type of the data. */
|
|
3116
3552
|
export declare enum Type {
|
|
3117
3553
|
TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
|
|
3118
3554
|
STRING = "STRING",
|
|
@@ -3145,11 +3581,11 @@ declare namespace types {
|
|
|
3145
3581
|
HarmProbability,
|
|
3146
3582
|
HarmSeverity,
|
|
3147
3583
|
BlockedReason,
|
|
3584
|
+
TrafficType,
|
|
3148
3585
|
Modality,
|
|
3149
|
-
|
|
3586
|
+
MediaResolution,
|
|
3150
3587
|
DynamicRetrievalConfigMode,
|
|
3151
3588
|
FunctionCallingConfigMode,
|
|
3152
|
-
MediaResolution,
|
|
3153
3589
|
SafetyFilterLevel,
|
|
3154
3590
|
PersonGeneration,
|
|
3155
3591
|
ImagePromptLanguage,
|
|
@@ -3158,6 +3594,11 @@ declare namespace types {
|
|
|
3158
3594
|
MaskReferenceMode,
|
|
3159
3595
|
ControlReferenceType,
|
|
3160
3596
|
SubjectReferenceType,
|
|
3597
|
+
MediaModality,
|
|
3598
|
+
StartSensitivity,
|
|
3599
|
+
EndSensitivity,
|
|
3600
|
+
ActivityHandling,
|
|
3601
|
+
TurnCoverage,
|
|
3161
3602
|
VideoMetadata,
|
|
3162
3603
|
CodeExecutionResult,
|
|
3163
3604
|
ExecutableCode,
|
|
@@ -3223,6 +3664,11 @@ declare namespace types {
|
|
|
3223
3664
|
SafetyAttributes,
|
|
3224
3665
|
GeneratedImage,
|
|
3225
3666
|
GenerateImagesResponse,
|
|
3667
|
+
GetModelConfig,
|
|
3668
|
+
GetModelParameters,
|
|
3669
|
+
Endpoint,
|
|
3670
|
+
TunedModelInfo,
|
|
3671
|
+
Model,
|
|
3226
3672
|
GenerationConfig,
|
|
3227
3673
|
CountTokensConfig,
|
|
3228
3674
|
CountTokensParameters,
|
|
@@ -3231,6 +3677,12 @@ declare namespace types {
|
|
|
3231
3677
|
ComputeTokensParameters,
|
|
3232
3678
|
TokensInfo,
|
|
3233
3679
|
ComputeTokensResponse,
|
|
3680
|
+
GenerateVideosConfig,
|
|
3681
|
+
GenerateVideosParameters,
|
|
3682
|
+
Video,
|
|
3683
|
+
GeneratedVideo,
|
|
3684
|
+
GenerateVideosResponse,
|
|
3685
|
+
GenerateVideosOperation,
|
|
3234
3686
|
CreateCachedContentConfig,
|
|
3235
3687
|
CreateCachedContentParameters,
|
|
3236
3688
|
CachedContentUsageMetadata,
|
|
@@ -3254,12 +3706,17 @@ declare namespace types {
|
|
|
3254
3706
|
CreateFileParameters,
|
|
3255
3707
|
HttpResponse,
|
|
3256
3708
|
LiveCallbacks,
|
|
3709
|
+
UploadFileParameters,
|
|
3257
3710
|
CreateFileResponse,
|
|
3258
3711
|
GetFileConfig,
|
|
3259
3712
|
GetFileParameters,
|
|
3260
3713
|
DeleteFileConfig,
|
|
3261
3714
|
DeleteFileParameters,
|
|
3262
3715
|
DeleteFileResponse,
|
|
3716
|
+
GetOperationConfig,
|
|
3717
|
+
GetOperationParameters,
|
|
3718
|
+
FetchPredictOperationConfig,
|
|
3719
|
+
FetchPredictOperationParameters,
|
|
3263
3720
|
TestTableItem,
|
|
3264
3721
|
TestTableFile,
|
|
3265
3722
|
ReplayRequest,
|
|
@@ -3283,12 +3740,23 @@ declare namespace types {
|
|
|
3283
3740
|
LiveServerContent,
|
|
3284
3741
|
LiveServerToolCall,
|
|
3285
3742
|
LiveServerToolCallCancellation,
|
|
3743
|
+
UsageMetadata,
|
|
3744
|
+
LiveServerGoAway,
|
|
3745
|
+
LiveServerSessionResumptionUpdate,
|
|
3286
3746
|
LiveServerMessage,
|
|
3747
|
+
AutomaticActivityDetection,
|
|
3748
|
+
RealtimeInputConfig,
|
|
3749
|
+
SessionResumptionConfig,
|
|
3750
|
+
SlidingWindow,
|
|
3751
|
+
ContextWindowCompressionConfig,
|
|
3287
3752
|
LiveClientSetup,
|
|
3288
3753
|
LiveClientContent,
|
|
3754
|
+
ActivityStart,
|
|
3755
|
+
ActivityEnd,
|
|
3289
3756
|
LiveClientRealtimeInput,
|
|
3290
3757
|
LiveClientToolResponse,
|
|
3291
3758
|
LiveClientMessage,
|
|
3759
|
+
AudioTranscriptionConfig,
|
|
3292
3760
|
LiveConnectConfig,
|
|
3293
3761
|
LiveConnectParameters,
|
|
3294
3762
|
CreateChatParameters,
|
|
@@ -3296,6 +3764,7 @@ declare namespace types {
|
|
|
3296
3764
|
LiveSendClientContentParameters,
|
|
3297
3765
|
LiveSendRealtimeInputParameters,
|
|
3298
3766
|
LiveSendToolResponseParameters,
|
|
3767
|
+
OperationGetParameters,
|
|
3299
3768
|
PartUnion,
|
|
3300
3769
|
PartListUnion,
|
|
3301
3770
|
ContentUnion,
|
|
@@ -3310,9 +3779,9 @@ declare namespace types {
|
|
|
3310
3779
|
export declare interface UpdateCachedContentConfig {
|
|
3311
3780
|
/** Used to override HTTP request options. */
|
|
3312
3781
|
httpOptions?: HttpOptions;
|
|
3313
|
-
/** The TTL for this resource. The expiration time is computed: now + TTL. */
|
|
3782
|
+
/** 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". */
|
|
3314
3783
|
ttl?: string;
|
|
3315
|
-
/** Timestamp of when this resource is considered expired. */
|
|
3784
|
+
/** Timestamp of when this resource is considered expired. Uses RFC 3339 format, Example: 2014-10-02T15:01:23Z. */
|
|
3316
3785
|
expireTime?: string;
|
|
3317
3786
|
}
|
|
3318
3787
|
|
|
@@ -3361,9 +3830,9 @@ export declare interface UploadFileConfig {
|
|
|
3361
3830
|
}
|
|
3362
3831
|
|
|
3363
3832
|
/** Parameters for the upload file method. */
|
|
3364
|
-
declare interface UploadFileParameters {
|
|
3833
|
+
export declare interface UploadFileParameters {
|
|
3365
3834
|
/** The string path to the file to be uploaded or a Blob object. */
|
|
3366
|
-
file: string | Blob;
|
|
3835
|
+
file: string | globalThis.Blob;
|
|
3367
3836
|
/** Configuration that contains optional parameters. */
|
|
3368
3837
|
config?: UploadFileConfig;
|
|
3369
3838
|
}
|
|
@@ -3399,6 +3868,33 @@ export declare interface UpscaleImageParameters {
|
|
|
3399
3868
|
config?: UpscaleImageConfig;
|
|
3400
3869
|
}
|
|
3401
3870
|
|
|
3871
|
+
/** Usage metadata about response(s). */
|
|
3872
|
+
export declare interface UsageMetadata {
|
|
3873
|
+
/** 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. */
|
|
3874
|
+
promptTokenCount?: number;
|
|
3875
|
+
/** Number of tokens in the cached part of the prompt (the cached content). */
|
|
3876
|
+
cachedContentTokenCount?: number;
|
|
3877
|
+
/** Total number of tokens across all the generated response candidates. */
|
|
3878
|
+
responseTokenCount?: number;
|
|
3879
|
+
/** Number of tokens present in tool-use prompt(s). */
|
|
3880
|
+
toolUsePromptTokenCount?: number;
|
|
3881
|
+
/** Number of tokens of thoughts for thinking models. */
|
|
3882
|
+
thoughtsTokenCount?: number;
|
|
3883
|
+
/** Total token count for prompt, response candidates, and tool-use prompts(if present). */
|
|
3884
|
+
totalTokenCount?: number;
|
|
3885
|
+
/** List of modalities that were processed in the request input. */
|
|
3886
|
+
promptTokensDetails?: ModalityTokenCount[];
|
|
3887
|
+
/** List of modalities that were processed in the cache input. */
|
|
3888
|
+
cacheTokensDetails?: ModalityTokenCount[];
|
|
3889
|
+
/** List of modalities that were returned in the response. */
|
|
3890
|
+
responseTokensDetails?: ModalityTokenCount[];
|
|
3891
|
+
/** List of modalities that were processed in the tool-use prompt. */
|
|
3892
|
+
toolUsePromptTokensDetails?: ModalityTokenCount[];
|
|
3893
|
+
/** Traffic type. This shows whether a request consumes Pay-As-You-Go
|
|
3894
|
+
or Provisioned Throughput quota. */
|
|
3895
|
+
trafficType?: TrafficType;
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3402
3898
|
/** Retrieve from Vertex AI Search datastore or engine for grounding. datastore and engine are mutually exclusive. See https://cloud.google.com/products/agent-builder */
|
|
3403
3899
|
export declare interface VertexAISearch {
|
|
3404
3900
|
/** Optional. Fully-qualified Vertex AI Search data store resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}` */
|
|
@@ -3427,6 +3923,16 @@ export declare interface VertexRagStoreRagResource {
|
|
|
3427
3923
|
ragFileIds?: string[];
|
|
3428
3924
|
}
|
|
3429
3925
|
|
|
3926
|
+
/** A generated video. */
|
|
3927
|
+
export declare interface Video {
|
|
3928
|
+
/** Path to another storage. */
|
|
3929
|
+
uri?: string;
|
|
3930
|
+
/** Video bytes. */
|
|
3931
|
+
videoBytes?: string;
|
|
3932
|
+
/** Video encoding, for example "video/mp4". */
|
|
3933
|
+
mimeType?: string;
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3430
3936
|
/** Metadata describes the input video content. */
|
|
3431
3937
|
export declare interface VideoMetadata {
|
|
3432
3938
|
/** Optional. The end offset of the video. */
|