@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/genai.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.
|
|
@@ -1595,6 +1783,7 @@ export declare class GoogleGenAI {
|
|
|
1595
1783
|
readonly chats: Chats;
|
|
1596
1784
|
readonly caches: Caches;
|
|
1597
1785
|
readonly files: Files;
|
|
1786
|
+
readonly operations: Operations;
|
|
1598
1787
|
constructor(options: GoogleGenAIOptions);
|
|
1599
1788
|
}
|
|
1600
1789
|
|
|
@@ -1699,6 +1888,8 @@ export declare interface GroundingChunkRetrievedContext {
|
|
|
1699
1888
|
|
|
1700
1889
|
/** Chunk from the web. */
|
|
1701
1890
|
export declare interface GroundingChunkWeb {
|
|
1891
|
+
/** Domain of the (original) URI. */
|
|
1892
|
+
domain?: string;
|
|
1702
1893
|
/** Title of the chunk. */
|
|
1703
1894
|
title?: string;
|
|
1704
1895
|
/** URI reference of the chunk. */
|
|
@@ -1731,12 +1922,14 @@ export declare interface GroundingSupport {
|
|
|
1731
1922
|
segment?: Segment;
|
|
1732
1923
|
}
|
|
1733
1924
|
|
|
1925
|
+
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
1734
1926
|
export declare enum HarmBlockMethod {
|
|
1735
1927
|
HARM_BLOCK_METHOD_UNSPECIFIED = "HARM_BLOCK_METHOD_UNSPECIFIED",
|
|
1736
1928
|
SEVERITY = "SEVERITY",
|
|
1737
1929
|
PROBABILITY = "PROBABILITY"
|
|
1738
1930
|
}
|
|
1739
1931
|
|
|
1932
|
+
/** Required. The harm block threshold. */
|
|
1740
1933
|
export declare enum HarmBlockThreshold {
|
|
1741
1934
|
HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
1742
1935
|
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
|
|
@@ -1746,6 +1939,7 @@ export declare enum HarmBlockThreshold {
|
|
|
1746
1939
|
OFF = "OFF"
|
|
1747
1940
|
}
|
|
1748
1941
|
|
|
1942
|
+
/** Required. Harm category. */
|
|
1749
1943
|
export declare enum HarmCategory {
|
|
1750
1944
|
HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED",
|
|
1751
1945
|
HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
|
|
@@ -1755,6 +1949,7 @@ export declare enum HarmCategory {
|
|
|
1755
1949
|
HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
1756
1950
|
}
|
|
1757
1951
|
|
|
1952
|
+
/** Output only. Harm probability levels in the content. */
|
|
1758
1953
|
export declare enum HarmProbability {
|
|
1759
1954
|
HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED",
|
|
1760
1955
|
NEGLIGIBLE = "NEGLIGIBLE",
|
|
@@ -1763,6 +1958,7 @@ export declare enum HarmProbability {
|
|
|
1763
1958
|
HIGH = "HIGH"
|
|
1764
1959
|
}
|
|
1765
1960
|
|
|
1961
|
+
/** Output only. Harm severity levels in the content. */
|
|
1766
1962
|
export declare enum HarmSeverity {
|
|
1767
1963
|
HARM_SEVERITY_UNSPECIFIED = "HARM_SEVERITY_UNSPECIFIED",
|
|
1768
1964
|
HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
|
|
@@ -1855,6 +2051,7 @@ declare interface Image_2 {
|
|
|
1855
2051
|
}
|
|
1856
2052
|
export { Image_2 as Image }
|
|
1857
2053
|
|
|
2054
|
+
/** Enum that specifies the language of the text in the prompt. */
|
|
1858
2055
|
export declare enum ImagePromptLanguage {
|
|
1859
2056
|
auto = "auto",
|
|
1860
2057
|
en = "en",
|
|
@@ -1863,6 +2060,7 @@ export declare enum ImagePromptLanguage {
|
|
|
1863
2060
|
hi = "hi"
|
|
1864
2061
|
}
|
|
1865
2062
|
|
|
2063
|
+
/** Required. Programming language of the `code`. */
|
|
1866
2064
|
export declare enum Language {
|
|
1867
2065
|
LANGUAGE_UNSPECIFIED = "LANGUAGE_UNSPECIFIED",
|
|
1868
2066
|
PYTHON = "PYTHON"
|
|
@@ -1966,9 +2164,21 @@ export declare class Live {
|
|
|
1966
2164
|
|
|
1967
2165
|
/** Callbacks for the live API. */
|
|
1968
2166
|
export declare interface LiveCallbacks {
|
|
2167
|
+
/**
|
|
2168
|
+
* Called when the websocket connection is established.
|
|
2169
|
+
*/
|
|
1969
2170
|
onopen?: (() => void) | null;
|
|
2171
|
+
/**
|
|
2172
|
+
* Called when a message is received from the server.
|
|
2173
|
+
*/
|
|
1970
2174
|
onmessage: (e: LiveServerMessage) => void;
|
|
2175
|
+
/**
|
|
2176
|
+
* Called when an error occurs.
|
|
2177
|
+
*/
|
|
1971
2178
|
onerror?: ((e: ErrorEvent) => void) | null;
|
|
2179
|
+
/**
|
|
2180
|
+
* Called when the websocket connection is closed.
|
|
2181
|
+
*/
|
|
1972
2182
|
onclose?: ((e: CloseEvent) => void) | null;
|
|
1973
2183
|
}
|
|
1974
2184
|
|
|
@@ -2007,11 +2217,11 @@ export declare interface LiveClientMessage {
|
|
|
2007
2217
|
|
|
2008
2218
|
/** User input that is sent in real time.
|
|
2009
2219
|
|
|
2010
|
-
This is different from `
|
|
2220
|
+
This is different from `LiveClientContent` in a few ways:
|
|
2011
2221
|
|
|
2012
2222
|
- Can be sent continuously without interruption to model generation.
|
|
2013
2223
|
- If there is a need to mix data interleaved across the
|
|
2014
|
-
`
|
|
2224
|
+
`LiveClientContent` and the `LiveClientRealtimeInput`, server attempts to
|
|
2015
2225
|
optimize for best response, but there are no guarantees.
|
|
2016
2226
|
- End of turn is not explicitly specified, but is rather derived from user
|
|
2017
2227
|
activity (for example, end of speech).
|
|
@@ -2023,6 +2233,10 @@ export declare interface LiveClientMessage {
|
|
|
2023
2233
|
export declare interface LiveClientRealtimeInput {
|
|
2024
2234
|
/** Inlined bytes data for media input. */
|
|
2025
2235
|
mediaChunks?: Blob_2[];
|
|
2236
|
+
/** Marks the start of user activity. */
|
|
2237
|
+
activityStart?: ActivityStart;
|
|
2238
|
+
/** Marks the end of user activity. */
|
|
2239
|
+
activityEnd?: ActivityEnd;
|
|
2026
2240
|
}
|
|
2027
2241
|
|
|
2028
2242
|
/** Message contains configuration that will apply for the duration of the streaming session. */
|
|
@@ -2033,15 +2247,7 @@ export declare interface LiveClientSetup {
|
|
|
2033
2247
|
*/
|
|
2034
2248
|
model?: string;
|
|
2035
2249
|
/** The generation configuration for the session.
|
|
2036
|
-
|
|
2037
|
-
The following fields are supported:
|
|
2038
|
-
- `response_logprobs`
|
|
2039
|
-
- `response_mime_type`
|
|
2040
|
-
- `logprobs`
|
|
2041
|
-
- `response_schema`
|
|
2042
|
-
- `stop_sequence`
|
|
2043
|
-
- `routing_config`
|
|
2044
|
-
- `audio_timestamp`
|
|
2250
|
+
Note: only a subset of fields are supported.
|
|
2045
2251
|
*/
|
|
2046
2252
|
generationConfig?: GenerationConfig;
|
|
2047
2253
|
/** The user provided system instructions for the model.
|
|
@@ -2054,6 +2260,16 @@ export declare interface LiveClientSetup {
|
|
|
2054
2260
|
external systems to perform an action, or set of actions, outside of
|
|
2055
2261
|
knowledge and scope of the model. */
|
|
2056
2262
|
tools?: ToolListUnion;
|
|
2263
|
+
/** Configures the realtime input behavior in BidiGenerateContent. */
|
|
2264
|
+
realtimeInputConfig?: RealtimeInputConfig;
|
|
2265
|
+
/** Configures session resumption mechanism.
|
|
2266
|
+
|
|
2267
|
+
If included server will send SessionResumptionUpdate messages. */
|
|
2268
|
+
sessionResumption?: SessionResumptionConfig;
|
|
2269
|
+
/** Configures context window compression mechanism.
|
|
2270
|
+
|
|
2271
|
+
If included, server will compress context window to fit into given length. */
|
|
2272
|
+
contextWindowCompression?: ContextWindowCompressionConfig;
|
|
2057
2273
|
}
|
|
2058
2274
|
|
|
2059
2275
|
/** Client generated response to a `ToolCall` received from the server.
|
|
@@ -2092,6 +2308,16 @@ export declare interface LiveConnectConfig {
|
|
|
2092
2308
|
external systems to perform an action, or set of actions, outside of
|
|
2093
2309
|
knowledge and scope of the model. */
|
|
2094
2310
|
tools?: ToolListUnion;
|
|
2311
|
+
/** Configures session resumption mechanism.
|
|
2312
|
+
|
|
2313
|
+
If included the server will send SessionResumptionUpdate messages. */
|
|
2314
|
+
sessionResumption?: SessionResumptionConfig;
|
|
2315
|
+
/** Configures the realtime input behavior in BidiGenerateContent. */
|
|
2316
|
+
realtimeInputConfig?: RealtimeInputConfig;
|
|
2317
|
+
/** Configures context window compression mechanism.
|
|
2318
|
+
|
|
2319
|
+
If included, server will compress context window to fit into given length. */
|
|
2320
|
+
contextWindowCompression?: ContextWindowCompressionConfig;
|
|
2095
2321
|
}
|
|
2096
2322
|
|
|
2097
2323
|
/** Parameters for connecting to the live API. */
|
|
@@ -2120,6 +2346,10 @@ export declare interface LiveSendClientContentParameters {
|
|
|
2120
2346
|
export declare interface LiveSendRealtimeInputParameters {
|
|
2121
2347
|
/** Realtime input to send to the session. */
|
|
2122
2348
|
media: Blob_2;
|
|
2349
|
+
/** Marks the start of user activity. */
|
|
2350
|
+
activityStart?: ActivityStart;
|
|
2351
|
+
/** Marks the end of user activity. */
|
|
2352
|
+
activityEnd?: ActivityEnd;
|
|
2123
2353
|
}
|
|
2124
2354
|
|
|
2125
2355
|
/** Parameters for sending tool responses to the live API. */
|
|
@@ -2140,6 +2370,21 @@ export declare interface LiveServerContent {
|
|
|
2140
2370
|
turnComplete?: boolean;
|
|
2141
2371
|
/** 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. */
|
|
2142
2372
|
interrupted?: boolean;
|
|
2373
|
+
/** If true, indicates that the model is done generating. When model is
|
|
2374
|
+
interrupted while generating there will be no generation_complete message
|
|
2375
|
+
in interrupted turn, it will go through interrupted > turn_complete.
|
|
2376
|
+
When model assumes realtime playback there will be delay between
|
|
2377
|
+
generation_complete and turn_complete that is caused by model
|
|
2378
|
+
waiting for playback to finish. If true, indicates that the model
|
|
2379
|
+
has finished generating all content. This is a signal to the client
|
|
2380
|
+
that it can stop sending messages. */
|
|
2381
|
+
generationComplete?: boolean;
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
/** Server will not be able to service client soon. */
|
|
2385
|
+
export declare interface LiveServerGoAway {
|
|
2386
|
+
/** 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. */
|
|
2387
|
+
timeLeft?: string;
|
|
2143
2388
|
}
|
|
2144
2389
|
|
|
2145
2390
|
/** Response message for API call. */
|
|
@@ -2152,6 +2397,29 @@ export declare interface LiveServerMessage {
|
|
|
2152
2397
|
toolCall?: LiveServerToolCall;
|
|
2153
2398
|
/** Notification for the client that a previously issued `ToolCallMessage` with the specified `id`s should have been not executed and should be cancelled. */
|
|
2154
2399
|
toolCallCancellation?: LiveServerToolCallCancellation;
|
|
2400
|
+
/** Usage metadata about model response(s). */
|
|
2401
|
+
usageMetadata?: UsageMetadata;
|
|
2402
|
+
/** Server will disconnect soon. */
|
|
2403
|
+
goAway?: LiveServerGoAway;
|
|
2404
|
+
/** Update of the session resumption state. */
|
|
2405
|
+
sessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
/** Update of the session resumption state.
|
|
2409
|
+
|
|
2410
|
+
Only sent if `session_resumption` was set in the connection config.
|
|
2411
|
+
*/
|
|
2412
|
+
export declare interface LiveServerSessionResumptionUpdate {
|
|
2413
|
+
/** New handle that represents state that can be resumed. Empty if `resumable`=false. */
|
|
2414
|
+
newHandle?: string;
|
|
2415
|
+
/** 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. */
|
|
2416
|
+
resumable?: boolean;
|
|
2417
|
+
/** Index of last message sent by client that is included in state represented by this SessionResumptionToken. Only sent when `SessionResumptionConfig.transparent` is set.
|
|
2418
|
+
|
|
2419
|
+
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).
|
|
2420
|
+
|
|
2421
|
+
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. */
|
|
2422
|
+
lastConsumedClientMessageIndex?: string;
|
|
2155
2423
|
}
|
|
2156
2424
|
|
|
2157
2425
|
/** Sent in response to a `LiveGenerateContentSetup` message from the client. */
|
|
@@ -2233,6 +2501,7 @@ export declare interface MaskReferenceImage {
|
|
|
2233
2501
|
config?: MaskReferenceConfig;
|
|
2234
2502
|
}
|
|
2235
2503
|
|
|
2504
|
+
/** Enum representing the mask mode of a mask reference image. */
|
|
2236
2505
|
export declare enum MaskReferenceMode {
|
|
2237
2506
|
MASK_MODE_DEFAULT = "MASK_MODE_DEFAULT",
|
|
2238
2507
|
MASK_MODE_USER_PROVIDED = "MASK_MODE_USER_PROVIDED",
|
|
@@ -2241,6 +2510,17 @@ export declare enum MaskReferenceMode {
|
|
|
2241
2510
|
MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
|
|
2242
2511
|
}
|
|
2243
2512
|
|
|
2513
|
+
/** Server content modalities. */
|
|
2514
|
+
export declare enum MediaModality {
|
|
2515
|
+
MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
|
|
2516
|
+
TEXT = "TEXT",
|
|
2517
|
+
IMAGE = "IMAGE",
|
|
2518
|
+
VIDEO = "VIDEO",
|
|
2519
|
+
AUDIO = "AUDIO",
|
|
2520
|
+
DOCUMENT = "DOCUMENT"
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
/** The media resolution to use. */
|
|
2244
2524
|
export declare enum MediaResolution {
|
|
2245
2525
|
MEDIA_RESOLUTION_UNSPECIFIED = "MEDIA_RESOLUTION_UNSPECIFIED",
|
|
2246
2526
|
MEDIA_RESOLUTION_LOW = "MEDIA_RESOLUTION_LOW",
|
|
@@ -2248,6 +2528,7 @@ export declare enum MediaResolution {
|
|
|
2248
2528
|
MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
|
|
2249
2529
|
}
|
|
2250
2530
|
|
|
2531
|
+
/** Server content modalities. */
|
|
2251
2532
|
export declare enum Modality {
|
|
2252
2533
|
MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
|
|
2253
2534
|
TEXT = "TEXT",
|
|
@@ -2258,16 +2539,45 @@ export declare enum Modality {
|
|
|
2258
2539
|
/** Represents token counting info for a single modality. */
|
|
2259
2540
|
export declare interface ModalityTokenCount {
|
|
2260
2541
|
/** The modality associated with this token count. */
|
|
2261
|
-
modality?:
|
|
2542
|
+
modality?: MediaModality;
|
|
2262
2543
|
/** Number of tokens. */
|
|
2263
2544
|
tokenCount?: number;
|
|
2264
2545
|
}
|
|
2265
2546
|
|
|
2547
|
+
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
2266
2548
|
export declare enum Mode {
|
|
2267
2549
|
MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
|
|
2268
2550
|
MODE_DYNAMIC = "MODE_DYNAMIC"
|
|
2269
2551
|
}
|
|
2270
2552
|
|
|
2553
|
+
/** A trained machine learning model. */
|
|
2554
|
+
export declare interface Model {
|
|
2555
|
+
/** Resource name of the model. */
|
|
2556
|
+
name?: string;
|
|
2557
|
+
/** Display name of the model. */
|
|
2558
|
+
displayName?: string;
|
|
2559
|
+
/** Description of the model. */
|
|
2560
|
+
description?: string;
|
|
2561
|
+
/** Version ID of the model. A new version is committed when a new
|
|
2562
|
+
model version is uploaded or trained under an existing model ID. The
|
|
2563
|
+
version ID is an auto-incrementing decimal number in string
|
|
2564
|
+
representation. */
|
|
2565
|
+
version?: string;
|
|
2566
|
+
/** List of deployed models created from this base model. Note that a
|
|
2567
|
+
model could have been deployed to endpoints in different locations. */
|
|
2568
|
+
endpoints?: Endpoint[];
|
|
2569
|
+
/** Labels with user-defined metadata to organize your models. */
|
|
2570
|
+
labels?: Record<string, string>;
|
|
2571
|
+
/** Information about the tuned model from the base model. */
|
|
2572
|
+
tunedModelInfo?: TunedModelInfo;
|
|
2573
|
+
/** The maximum number of input tokens that the model can handle. */
|
|
2574
|
+
inputTokenLimit?: number;
|
|
2575
|
+
/** The maximum number of output tokens that the model can generate. */
|
|
2576
|
+
outputTokenLimit?: number;
|
|
2577
|
+
/** List of actions that are supported by the model. */
|
|
2578
|
+
supportedActions?: string[];
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2271
2581
|
export declare class Models extends BaseModule {
|
|
2272
2582
|
private readonly apiClient;
|
|
2273
2583
|
constructor(apiClient: ApiClient);
|
|
@@ -2418,6 +2728,15 @@ export declare class Models extends BaseModule {
|
|
|
2418
2728
|
* ```
|
|
2419
2729
|
*/
|
|
2420
2730
|
private generateImagesInternal;
|
|
2731
|
+
/**
|
|
2732
|
+
* Fetches information about a model by name.
|
|
2733
|
+
*
|
|
2734
|
+
* @example
|
|
2735
|
+
* ```ts
|
|
2736
|
+
* const modelInfo = await ai.models.get({model: 'gemini-2.0-flash'});
|
|
2737
|
+
* ```
|
|
2738
|
+
*/
|
|
2739
|
+
get(params: types.GetModelParameters): Promise<types.Model>;
|
|
2421
2740
|
/**
|
|
2422
2741
|
* Counts the number of tokens in the given contents. Multimodal input is
|
|
2423
2742
|
* supported for Gemini models.
|
|
@@ -2454,6 +2773,52 @@ export declare class Models extends BaseModule {
|
|
|
2454
2773
|
* ```
|
|
2455
2774
|
*/
|
|
2456
2775
|
computeTokens(params: types.ComputeTokensParameters): Promise<types.ComputeTokensResponse>;
|
|
2776
|
+
/**
|
|
2777
|
+
* Generates videos based on a text description and configuration.
|
|
2778
|
+
*
|
|
2779
|
+
* @param params - The parameters for generating videos.
|
|
2780
|
+
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
2781
|
+
*
|
|
2782
|
+
* @example
|
|
2783
|
+
* ```ts
|
|
2784
|
+
* const operation = await ai.models.generateVideos({
|
|
2785
|
+
* model: 'veo-2.0-generate-001',
|
|
2786
|
+
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
2787
|
+
* config: {
|
|
2788
|
+
* numberOfVideos: 1
|
|
2789
|
+
* });
|
|
2790
|
+
*
|
|
2791
|
+
* while (!operation.done) {
|
|
2792
|
+
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
2793
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
2794
|
+
* }
|
|
2795
|
+
*
|
|
2796
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
2797
|
+
* ```
|
|
2798
|
+
*/
|
|
2799
|
+
generateVideos(params: types.GenerateVideosParameters): Promise<types.GenerateVideosOperation>;
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
/** Parameters for the get method of the operations module. */
|
|
2803
|
+
export declare interface OperationGetParameters {
|
|
2804
|
+
/** The operation to be retrieved. */
|
|
2805
|
+
operation: GenerateVideosOperation;
|
|
2806
|
+
/** Used to override the default configuration. */
|
|
2807
|
+
config?: GetOperationConfig;
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
export declare class Operations extends BaseModule {
|
|
2811
|
+
private readonly apiClient;
|
|
2812
|
+
constructor(apiClient: ApiClient);
|
|
2813
|
+
/**
|
|
2814
|
+
* Gets the status of a long-running operation.
|
|
2815
|
+
*
|
|
2816
|
+
* @param parameters The parameters for the get operation request.
|
|
2817
|
+
* @return The updated Operation object, with the latest status or result.
|
|
2818
|
+
*/
|
|
2819
|
+
getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
|
|
2820
|
+
private getVideosOperationInternal;
|
|
2821
|
+
private fetchPredictVideosOperationInternal;
|
|
2457
2822
|
}
|
|
2458
2823
|
|
|
2459
2824
|
/**
|
|
@@ -2461,6 +2826,7 @@ export declare class Models extends BaseModule {
|
|
|
2461
2826
|
* Copyright 2025 Google LLC
|
|
2462
2827
|
* SPDX-License-Identifier: Apache-2.0
|
|
2463
2828
|
*/
|
|
2829
|
+
/** Required. Outcome of the code execution. */
|
|
2464
2830
|
export declare enum Outcome {
|
|
2465
2831
|
OUTCOME_UNSPECIFIED = "OUTCOME_UNSPECIFIED",
|
|
2466
2832
|
OUTCOME_OK = "OUTCOME_OK",
|
|
@@ -2476,7 +2842,7 @@ export declare enum Outcome {
|
|
|
2476
2842
|
/**
|
|
2477
2843
|
* Pagers for the GenAI List APIs.
|
|
2478
2844
|
*/
|
|
2479
|
-
declare enum PagedItem {
|
|
2845
|
+
export declare enum PagedItem {
|
|
2480
2846
|
PAGED_ITEM_BATCH_JOBS = "batchJobs",
|
|
2481
2847
|
PAGED_ITEM_MODELS = "models",
|
|
2482
2848
|
PAGED_ITEM_TUNING_JOBS = "tuningJobs",
|
|
@@ -2503,7 +2869,7 @@ declare interface PagedItemResponse<T> {
|
|
|
2503
2869
|
/**
|
|
2504
2870
|
* Pager class for iterating through paginated results.
|
|
2505
2871
|
*/
|
|
2506
|
-
declare class Pager<T> implements AsyncIterable<T> {
|
|
2872
|
+
export declare class Pager<T> implements AsyncIterable<T> {
|
|
2507
2873
|
private nameInternal;
|
|
2508
2874
|
private pageInternal;
|
|
2509
2875
|
private paramsInternal;
|
|
@@ -2626,6 +2992,7 @@ export declare type PartListUnion = PartUnion[] | PartUnion;
|
|
|
2626
2992
|
|
|
2627
2993
|
export declare type PartUnion = Part | string;
|
|
2628
2994
|
|
|
2995
|
+
/** Enum that controls the generation of people. */
|
|
2629
2996
|
export declare enum PersonGeneration {
|
|
2630
2997
|
DONT_ALLOW = "DONT_ALLOW",
|
|
2631
2998
|
ALLOW_ADULT = "ALLOW_ADULT",
|
|
@@ -2654,6 +3021,20 @@ export declare interface RawReferenceImage {
|
|
|
2654
3021
|
referenceType?: string;
|
|
2655
3022
|
}
|
|
2656
3023
|
|
|
3024
|
+
/** Marks the end of user activity.
|
|
3025
|
+
|
|
3026
|
+
This can only be sent if automatic (i.e. server-side) activity detection is
|
|
3027
|
+
disabled.
|
|
3028
|
+
*/
|
|
3029
|
+
export declare interface RealtimeInputConfig {
|
|
3030
|
+
/** If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals. */
|
|
3031
|
+
automaticActivityDetection?: AutomaticActivityDetection;
|
|
3032
|
+
/** Defines what effect activity has. */
|
|
3033
|
+
activityHandling?: ActivityHandling;
|
|
3034
|
+
/** Defines which input is included in the user's turn. */
|
|
3035
|
+
turnCoverage?: TurnCoverage;
|
|
3036
|
+
}
|
|
3037
|
+
|
|
2657
3038
|
/** Represents a recorded session. */
|
|
2658
3039
|
export declare interface ReplayFile {
|
|
2659
3040
|
replayId?: string;
|
|
@@ -2711,6 +3092,7 @@ export declare interface SafetyAttributes {
|
|
|
2711
3092
|
contentType?: string;
|
|
2712
3093
|
}
|
|
2713
3094
|
|
|
3095
|
+
/** Enum that controls the safety filter level for objectionable content. */
|
|
2714
3096
|
export declare enum SafetyFilterLevel {
|
|
2715
3097
|
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
|
|
2716
3098
|
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -2959,7 +3341,31 @@ export declare class Session {
|
|
|
2959
3341
|
close(): void;
|
|
2960
3342
|
}
|
|
2961
3343
|
|
|
2962
|
-
|
|
3344
|
+
/** Configuration of session resumption mechanism.
|
|
3345
|
+
|
|
3346
|
+
Included in `LiveConnectConfig.session_resumption`. If included server
|
|
3347
|
+
will send `LiveServerSessionResumptionUpdate` messages.
|
|
3348
|
+
*/
|
|
3349
|
+
export declare interface SessionResumptionConfig {
|
|
3350
|
+
/** Session resumption handle of previous session (session to restore).
|
|
3351
|
+
|
|
3352
|
+
If not present new session will be started. */
|
|
3353
|
+
handle?: string;
|
|
3354
|
+
/** If set the server will send `last_consumed_client_message_index` in the `session_resumption_update` messages to allow for transparent reconnections. */
|
|
3355
|
+
transparent?: boolean;
|
|
3356
|
+
}
|
|
3357
|
+
|
|
3358
|
+
/** Context window will be truncated by keeping only suffix of it.
|
|
3359
|
+
|
|
3360
|
+
Context window will always be cut at start of USER role turn. System
|
|
3361
|
+
instructions and `BidiGenerateContentSetup.prefix_turns` will not be
|
|
3362
|
+
subject to the sliding window mechanism, they will always stay at the
|
|
3363
|
+
beginning of context window.
|
|
3364
|
+
*/
|
|
3365
|
+
export declare interface SlidingWindow {
|
|
3366
|
+
/** 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. */
|
|
3367
|
+
targetTokens?: string;
|
|
3368
|
+
}
|
|
2963
3369
|
|
|
2964
3370
|
/** The speech generation configuration. */
|
|
2965
3371
|
export declare interface SpeechConfig {
|
|
@@ -2970,10 +3376,11 @@ export declare interface SpeechConfig {
|
|
|
2970
3376
|
|
|
2971
3377
|
export declare type SpeechConfigUnion = SpeechConfig | string;
|
|
2972
3378
|
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
3379
|
+
/** Start of speech sensitivity. */
|
|
3380
|
+
export declare enum StartSensitivity {
|
|
3381
|
+
START_SENSITIVITY_UNSPECIFIED = "START_SENSITIVITY_UNSPECIFIED",
|
|
3382
|
+
START_SENSITIVITY_HIGH = "START_SENSITIVITY_HIGH",
|
|
3383
|
+
START_SENSITIVITY_LOW = "START_SENSITIVITY_LOW"
|
|
2977
3384
|
}
|
|
2978
3385
|
|
|
2979
3386
|
/** Configuration for a Style reference image. */
|
|
@@ -3028,6 +3435,7 @@ export declare interface SubjectReferenceImage {
|
|
|
3028
3435
|
config?: SubjectReferenceConfig;
|
|
3029
3436
|
}
|
|
3030
3437
|
|
|
3438
|
+
/** Enum representing the subject type of a subject reference image. */
|
|
3031
3439
|
export declare enum SubjectReferenceType {
|
|
3032
3440
|
SUBJECT_TYPE_DEFAULT = "SUBJECT_TYPE_DEFAULT",
|
|
3033
3441
|
SUBJECT_TYPE_PERSON = "SUBJECT_TYPE_PERSON",
|
|
@@ -3066,6 +3474,9 @@ export declare interface ThinkingConfig {
|
|
|
3066
3474
|
/** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
|
|
3067
3475
|
*/
|
|
3068
3476
|
includeThoughts?: boolean;
|
|
3477
|
+
/** Indicates the thinking budget in tokens.
|
|
3478
|
+
*/
|
|
3479
|
+
thinkingBudget?: number;
|
|
3069
3480
|
}
|
|
3070
3481
|
|
|
3071
3482
|
/** Tokens info with a list of tokens and the corresponding list of token ids. */
|
|
@@ -3108,6 +3519,31 @@ export declare interface ToolConfig {
|
|
|
3108
3519
|
|
|
3109
3520
|
export declare type ToolListUnion = Tool[];
|
|
3110
3521
|
|
|
3522
|
+
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
3523
|
+
export declare enum TrafficType {
|
|
3524
|
+
TRAFFIC_TYPE_UNSPECIFIED = "TRAFFIC_TYPE_UNSPECIFIED",
|
|
3525
|
+
ON_DEMAND = "ON_DEMAND",
|
|
3526
|
+
PROVISIONED_THROUGHPUT = "PROVISIONED_THROUGHPUT"
|
|
3527
|
+
}
|
|
3528
|
+
|
|
3529
|
+
/** A tuned machine learning model. */
|
|
3530
|
+
export declare interface TunedModelInfo {
|
|
3531
|
+
/** ID of the base model that you want to tune. */
|
|
3532
|
+
baseModel?: string;
|
|
3533
|
+
/** Date and time when the base model was created. */
|
|
3534
|
+
createTime?: string;
|
|
3535
|
+
/** Date and time when the base model was last updated. */
|
|
3536
|
+
updateTime?: string;
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
/** Options about which input is included in the user's turn. */
|
|
3540
|
+
export declare enum TurnCoverage {
|
|
3541
|
+
TURN_COVERAGE_UNSPECIFIED = "TURN_COVERAGE_UNSPECIFIED",
|
|
3542
|
+
TURN_INCLUDES_ONLY_ACTIVITY = "TURN_INCLUDES_ONLY_ACTIVITY",
|
|
3543
|
+
TURN_INCLUDES_ALL_INPUT = "TURN_INCLUDES_ALL_INPUT"
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
/** Optional. The type of the data. */
|
|
3111
3547
|
export declare enum Type {
|
|
3112
3548
|
TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
|
|
3113
3549
|
STRING = "STRING",
|
|
@@ -3140,11 +3576,11 @@ declare namespace types {
|
|
|
3140
3576
|
HarmProbability,
|
|
3141
3577
|
HarmSeverity,
|
|
3142
3578
|
BlockedReason,
|
|
3579
|
+
TrafficType,
|
|
3143
3580
|
Modality,
|
|
3144
|
-
|
|
3581
|
+
MediaResolution,
|
|
3145
3582
|
DynamicRetrievalConfigMode,
|
|
3146
3583
|
FunctionCallingConfigMode,
|
|
3147
|
-
MediaResolution,
|
|
3148
3584
|
SafetyFilterLevel,
|
|
3149
3585
|
PersonGeneration,
|
|
3150
3586
|
ImagePromptLanguage,
|
|
@@ -3153,6 +3589,11 @@ declare namespace types {
|
|
|
3153
3589
|
MaskReferenceMode,
|
|
3154
3590
|
ControlReferenceType,
|
|
3155
3591
|
SubjectReferenceType,
|
|
3592
|
+
MediaModality,
|
|
3593
|
+
StartSensitivity,
|
|
3594
|
+
EndSensitivity,
|
|
3595
|
+
ActivityHandling,
|
|
3596
|
+
TurnCoverage,
|
|
3156
3597
|
VideoMetadata,
|
|
3157
3598
|
CodeExecutionResult,
|
|
3158
3599
|
ExecutableCode,
|
|
@@ -3218,6 +3659,11 @@ declare namespace types {
|
|
|
3218
3659
|
SafetyAttributes,
|
|
3219
3660
|
GeneratedImage,
|
|
3220
3661
|
GenerateImagesResponse,
|
|
3662
|
+
GetModelConfig,
|
|
3663
|
+
GetModelParameters,
|
|
3664
|
+
Endpoint,
|
|
3665
|
+
TunedModelInfo,
|
|
3666
|
+
Model,
|
|
3221
3667
|
GenerationConfig,
|
|
3222
3668
|
CountTokensConfig,
|
|
3223
3669
|
CountTokensParameters,
|
|
@@ -3226,6 +3672,12 @@ declare namespace types {
|
|
|
3226
3672
|
ComputeTokensParameters,
|
|
3227
3673
|
TokensInfo,
|
|
3228
3674
|
ComputeTokensResponse,
|
|
3675
|
+
GenerateVideosConfig,
|
|
3676
|
+
GenerateVideosParameters,
|
|
3677
|
+
Video,
|
|
3678
|
+
GeneratedVideo,
|
|
3679
|
+
GenerateVideosResponse,
|
|
3680
|
+
GenerateVideosOperation,
|
|
3229
3681
|
CreateCachedContentConfig,
|
|
3230
3682
|
CreateCachedContentParameters,
|
|
3231
3683
|
CachedContentUsageMetadata,
|
|
@@ -3249,12 +3701,17 @@ declare namespace types {
|
|
|
3249
3701
|
CreateFileParameters,
|
|
3250
3702
|
HttpResponse,
|
|
3251
3703
|
LiveCallbacks,
|
|
3704
|
+
UploadFileParameters,
|
|
3252
3705
|
CreateFileResponse,
|
|
3253
3706
|
GetFileConfig,
|
|
3254
3707
|
GetFileParameters,
|
|
3255
3708
|
DeleteFileConfig,
|
|
3256
3709
|
DeleteFileParameters,
|
|
3257
3710
|
DeleteFileResponse,
|
|
3711
|
+
GetOperationConfig,
|
|
3712
|
+
GetOperationParameters,
|
|
3713
|
+
FetchPredictOperationConfig,
|
|
3714
|
+
FetchPredictOperationParameters,
|
|
3258
3715
|
TestTableItem,
|
|
3259
3716
|
TestTableFile,
|
|
3260
3717
|
ReplayRequest,
|
|
@@ -3278,12 +3735,23 @@ declare namespace types {
|
|
|
3278
3735
|
LiveServerContent,
|
|
3279
3736
|
LiveServerToolCall,
|
|
3280
3737
|
LiveServerToolCallCancellation,
|
|
3738
|
+
UsageMetadata,
|
|
3739
|
+
LiveServerGoAway,
|
|
3740
|
+
LiveServerSessionResumptionUpdate,
|
|
3281
3741
|
LiveServerMessage,
|
|
3742
|
+
AutomaticActivityDetection,
|
|
3743
|
+
RealtimeInputConfig,
|
|
3744
|
+
SessionResumptionConfig,
|
|
3745
|
+
SlidingWindow,
|
|
3746
|
+
ContextWindowCompressionConfig,
|
|
3282
3747
|
LiveClientSetup,
|
|
3283
3748
|
LiveClientContent,
|
|
3749
|
+
ActivityStart,
|
|
3750
|
+
ActivityEnd,
|
|
3284
3751
|
LiveClientRealtimeInput,
|
|
3285
3752
|
LiveClientToolResponse,
|
|
3286
3753
|
LiveClientMessage,
|
|
3754
|
+
AudioTranscriptionConfig,
|
|
3287
3755
|
LiveConnectConfig,
|
|
3288
3756
|
LiveConnectParameters,
|
|
3289
3757
|
CreateChatParameters,
|
|
@@ -3291,6 +3759,7 @@ declare namespace types {
|
|
|
3291
3759
|
LiveSendClientContentParameters,
|
|
3292
3760
|
LiveSendRealtimeInputParameters,
|
|
3293
3761
|
LiveSendToolResponseParameters,
|
|
3762
|
+
OperationGetParameters,
|
|
3294
3763
|
PartUnion,
|
|
3295
3764
|
PartListUnion,
|
|
3296
3765
|
ContentUnion,
|
|
@@ -3305,9 +3774,9 @@ declare namespace types {
|
|
|
3305
3774
|
export declare interface UpdateCachedContentConfig {
|
|
3306
3775
|
/** Used to override HTTP request options. */
|
|
3307
3776
|
httpOptions?: HttpOptions;
|
|
3308
|
-
/** The TTL for this resource. The expiration time is computed: now + TTL. */
|
|
3777
|
+
/** 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". */
|
|
3309
3778
|
ttl?: string;
|
|
3310
|
-
/** Timestamp of when this resource is considered expired. */
|
|
3779
|
+
/** Timestamp of when this resource is considered expired. Uses RFC 3339 format, Example: 2014-10-02T15:01:23Z. */
|
|
3311
3780
|
expireTime?: string;
|
|
3312
3781
|
}
|
|
3313
3782
|
|
|
@@ -3356,9 +3825,9 @@ export declare interface UploadFileConfig {
|
|
|
3356
3825
|
}
|
|
3357
3826
|
|
|
3358
3827
|
/** Parameters for the upload file method. */
|
|
3359
|
-
declare interface UploadFileParameters {
|
|
3828
|
+
export declare interface UploadFileParameters {
|
|
3360
3829
|
/** The string path to the file to be uploaded or a Blob object. */
|
|
3361
|
-
file: string | Blob;
|
|
3830
|
+
file: string | globalThis.Blob;
|
|
3362
3831
|
/** Configuration that contains optional parameters. */
|
|
3363
3832
|
config?: UploadFileConfig;
|
|
3364
3833
|
}
|
|
@@ -3394,6 +3863,33 @@ export declare interface UpscaleImageParameters {
|
|
|
3394
3863
|
config?: UpscaleImageConfig;
|
|
3395
3864
|
}
|
|
3396
3865
|
|
|
3866
|
+
/** Usage metadata about response(s). */
|
|
3867
|
+
export declare interface UsageMetadata {
|
|
3868
|
+
/** 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. */
|
|
3869
|
+
promptTokenCount?: number;
|
|
3870
|
+
/** Number of tokens in the cached part of the prompt (the cached content). */
|
|
3871
|
+
cachedContentTokenCount?: number;
|
|
3872
|
+
/** Total number of tokens across all the generated response candidates. */
|
|
3873
|
+
responseTokenCount?: number;
|
|
3874
|
+
/** Number of tokens present in tool-use prompt(s). */
|
|
3875
|
+
toolUsePromptTokenCount?: number;
|
|
3876
|
+
/** Number of tokens of thoughts for thinking models. */
|
|
3877
|
+
thoughtsTokenCount?: number;
|
|
3878
|
+
/** Total token count for prompt, response candidates, and tool-use prompts(if present). */
|
|
3879
|
+
totalTokenCount?: number;
|
|
3880
|
+
/** List of modalities that were processed in the request input. */
|
|
3881
|
+
promptTokensDetails?: ModalityTokenCount[];
|
|
3882
|
+
/** List of modalities that were processed in the cache input. */
|
|
3883
|
+
cacheTokensDetails?: ModalityTokenCount[];
|
|
3884
|
+
/** List of modalities that were returned in the response. */
|
|
3885
|
+
responseTokensDetails?: ModalityTokenCount[];
|
|
3886
|
+
/** List of modalities that were processed in the tool-use prompt. */
|
|
3887
|
+
toolUsePromptTokensDetails?: ModalityTokenCount[];
|
|
3888
|
+
/** Traffic type. This shows whether a request consumes Pay-As-You-Go
|
|
3889
|
+
or Provisioned Throughput quota. */
|
|
3890
|
+
trafficType?: TrafficType;
|
|
3891
|
+
}
|
|
3892
|
+
|
|
3397
3893
|
/** Retrieve from Vertex AI Search datastore or engine for grounding. datastore and engine are mutually exclusive. See https://cloud.google.com/products/agent-builder */
|
|
3398
3894
|
export declare interface VertexAISearch {
|
|
3399
3895
|
/** Optional. Fully-qualified Vertex AI Search data store resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}` */
|
|
@@ -3422,6 +3918,16 @@ export declare interface VertexRagStoreRagResource {
|
|
|
3422
3918
|
ragFileIds?: string[];
|
|
3423
3919
|
}
|
|
3424
3920
|
|
|
3921
|
+
/** A generated video. */
|
|
3922
|
+
export declare interface Video {
|
|
3923
|
+
/** Path to another storage. */
|
|
3924
|
+
uri?: string;
|
|
3925
|
+
/** Video bytes. */
|
|
3926
|
+
videoBytes?: string;
|
|
3927
|
+
/** Video encoding, for example "video/mp4". */
|
|
3928
|
+
mimeType?: string;
|
|
3929
|
+
}
|
|
3930
|
+
|
|
3425
3931
|
/** Metadata describes the input video content. */
|
|
3426
3932
|
export declare interface VideoMetadata {
|
|
3427
3933
|
/** Optional. The end offset of the video. */
|