@google/genai 0.7.0 → 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/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",
@@ -435,16 +483,6 @@ export declare interface CodeExecutionResult {
435
483
  output?: string;
436
484
  }
437
485
 
438
- declare namespace common {
439
- export {
440
- formatMap,
441
- setValueByPath,
442
- getValueByPath,
443
- BaseModule,
444
- UploadFileParameters
445
- }
446
- }
447
-
448
486
  /** Optional parameters for computing tokens. */
449
487
  export declare interface ComputeTokensConfig {
450
488
  /** Used to override HTTP request options. */
@@ -476,7 +514,7 @@ export declare interface Content {
476
514
  parts?: Part[];
477
515
  /** Optional. The producer of the content. Must be either 'user' or
478
516
  'model'. Useful to set for multi-turn conversations, otherwise can be
479
- left blank or unset. If role is not specified, SDK will determine the role. */
517
+ empty. If role is not specified, SDK will determine the role. */
480
518
  role?: string;
481
519
  }
482
520
 
@@ -506,6 +544,14 @@ export declare type ContentListUnion = ContentUnion[] | ContentUnion;
506
544
 
507
545
  export declare type ContentUnion = Content | PartUnion[] | PartUnion;
508
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
+
509
555
  /** Configuration for a Control reference image. */
510
556
  export declare interface ControlReferenceConfig {
511
557
  /** The type of control reference image to use. */
@@ -537,6 +583,7 @@ export declare interface ControlReferenceImage {
537
583
  config?: ControlReferenceConfig;
538
584
  }
539
585
 
586
+ /** Enum representing the control type of a control reference image. */
540
587
  export declare enum ControlReferenceType {
541
588
  CONTROL_TYPE_DEFAULT = "CONTROL_TYPE_DEFAULT",
542
589
  CONTROL_TYPE_CANNY = "CONTROL_TYPE_CANNY",
@@ -672,7 +719,7 @@ export declare class CreateFileResponse {
672
719
  export declare function createModelContent(partOrString: PartListUnion | string): Content;
673
720
 
674
721
  /**
675
- * Creates a `Part` object from a `base64` `string`.
722
+ * Creates a `Part` object from a `base64` encoded `string`.
676
723
  */
677
724
  export declare function createPartFromBase64(data: string, mimeType: string): Part;
678
725
 
@@ -763,6 +810,7 @@ export declare interface DynamicRetrievalConfig {
763
810
  dynamicThreshold?: number;
764
811
  }
765
812
 
813
+ /** Config for the dynamic retrieval config mode. */
766
814
  export declare enum DynamicRetrievalConfigMode {
767
815
  MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
768
816
  MODE_DYNAMIC = "MODE_DYNAMIC"
@@ -826,6 +874,21 @@ export declare class EmbedContentResponse {
826
874
  metadata?: EmbedContentMetadata;
827
875
  }
828
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
+
829
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]. */
830
893
  export declare interface ExecutableCode {
831
894
  /** Required. The code to be executed. */
@@ -934,7 +997,9 @@ export declare class Files extends BaseModule {
934
997
  * This section can contain multiple paragraphs and code examples.
935
998
  *
936
999
  * @param params - Optional parameters specified in the
937
- * `common.UploadFileParameters` interface.
1000
+ * `types.UploadFileParameters` interface.
1001
+ * @see {@link types.UploadFileParameters#config} for the optional
1002
+ * config in the parameters.
938
1003
  * @return A promise that resolves to a `types.File` object.
939
1004
  * @throws An error if called on a Vertex AI client.
940
1005
  * @throws An error if the `mimeType` is not provided and can not be inferred,
@@ -951,7 +1016,7 @@ export declare class Files extends BaseModule {
951
1016
  * console.log(file.name);
952
1017
  * ```
953
1018
  */
954
- upload(params: common.UploadFileParameters): Promise<types.File>;
1019
+ upload(params: types.UploadFileParameters): Promise<types.File>;
955
1020
  private listInternal;
956
1021
  private createInternal;
957
1022
  /**
@@ -986,6 +1051,7 @@ export declare class Files extends BaseModule {
986
1051
  delete(params: types.DeleteFileParameters): Promise<types.DeleteFileResponse>;
987
1052
  }
988
1053
 
1054
+ /** Source of the File. */
989
1055
  export declare enum FileSource {
990
1056
  SOURCE_UNSPECIFIED = "SOURCE_UNSPECIFIED",
991
1057
  UPLOADED = "UPLOADED",
@@ -1009,6 +1075,7 @@ declare interface FileStat {
1009
1075
  type: string | undefined;
1010
1076
  }
1011
1077
 
1078
+ /** State for the lifecycle of a File. */
1012
1079
  export declare enum FileState {
1013
1080
  STATE_UNSPECIFIED = "STATE_UNSPECIFIED",
1014
1081
  PROCESSING = "PROCESSING",
@@ -1026,6 +1093,10 @@ export declare interface FileStatus {
1026
1093
  code?: number;
1027
1094
  }
1028
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
+ */
1029
1100
  export declare enum FinishReason {
1030
1101
  FINISH_REASON_UNSPECIFIED = "FINISH_REASON_UNSPECIFIED",
1031
1102
  STOP = "STOP",
@@ -1040,8 +1111,6 @@ export declare enum FinishReason {
1040
1111
  IMAGE_SAFETY = "IMAGE_SAFETY"
1041
1112
  }
1042
1113
 
1043
- declare function formatMap(templateString: string, valueMap: Record<string, unknown>): string;
1044
-
1045
1114
  /** A function call. */
1046
1115
  export declare interface FunctionCall {
1047
1116
  /** The unique id of the function call. If populated, the client to execute the
@@ -1061,6 +1130,7 @@ export declare interface FunctionCallingConfig {
1061
1130
  allowedFunctionNames?: string[];
1062
1131
  }
1063
1132
 
1133
+ /** Config for the function calling config mode. */
1064
1134
  export declare enum FunctionCallingConfigMode {
1065
1135
  MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
1066
1136
  AUTO = "AUTO",
@@ -1385,6 +1455,8 @@ export declare class GenerateContentResponseUsageMetadata {
1385
1455
  toolUsePromptTokensDetails?: ModalityTokenCount[];
1386
1456
  /** Total token count for prompt, response candidates, and tool-use prompts (if present). */
1387
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;
1388
1460
  }
1389
1461
 
1390
1462
  /** An output image. */
@@ -1531,10 +1603,8 @@ export declare interface GenerateVideosOperation {
1531
1603
  done?: boolean;
1532
1604
  /** The error result of the operation in case of failure or cancellation. */
1533
1605
  error?: Record<string, unknown>;
1534
- /** The normal response of the operation in case of success. */
1535
- response?: Record<string, unknown>;
1536
1606
  /** The generated videos. */
1537
- result?: GenerateVideosResponse;
1607
+ response?: GenerateVideosResponse;
1538
1608
  }
1539
1609
 
1540
1610
  /** Class that represents the parameters for generating an image. */
@@ -1573,6 +1643,8 @@ export declare interface GenerationConfig {
1573
1643
  logprobs?: number;
1574
1644
  /** Optional. The maximum number of output tokens to generate per message. */
1575
1645
  maxOutputTokens?: number;
1646
+ /** Optional. If specified, the media resolution specified will be used. */
1647
+ mediaResolution?: MediaResolution;
1576
1648
  /** Optional. Positive penalties. */
1577
1649
  presencePenalty?: number;
1578
1650
  /** Optional. If true, export the logprobs results in response. */
@@ -1645,6 +1717,18 @@ export declare interface GetFileParameters {
1645
1717
  config?: GetFileConfig;
1646
1718
  }
1647
1719
 
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
+
1648
1732
  export declare interface GetOperationConfig {
1649
1733
  /** Used to override HTTP request options. */
1650
1734
  httpOptions?: HttpOptions;
@@ -1658,8 +1742,6 @@ export declare interface GetOperationParameters {
1658
1742
  config?: GetOperationConfig;
1659
1743
  }
1660
1744
 
1661
- declare function getValueByPath(data: unknown, keys: string[]): unknown;
1662
-
1663
1745
  /**
1664
1746
  * The Google GenAI SDK.
1665
1747
  *
@@ -1811,6 +1893,8 @@ export declare interface GroundingChunkRetrievedContext {
1811
1893
 
1812
1894
  /** Chunk from the web. */
1813
1895
  export declare interface GroundingChunkWeb {
1896
+ /** Domain of the (original) URI. */
1897
+ domain?: string;
1814
1898
  /** Title of the chunk. */
1815
1899
  title?: string;
1816
1900
  /** URI reference of the chunk. */
@@ -1843,12 +1927,14 @@ export declare interface GroundingSupport {
1843
1927
  segment?: Segment;
1844
1928
  }
1845
1929
 
1930
+ /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
1846
1931
  export declare enum HarmBlockMethod {
1847
1932
  HARM_BLOCK_METHOD_UNSPECIFIED = "HARM_BLOCK_METHOD_UNSPECIFIED",
1848
1933
  SEVERITY = "SEVERITY",
1849
1934
  PROBABILITY = "PROBABILITY"
1850
1935
  }
1851
1936
 
1937
+ /** Required. The harm block threshold. */
1852
1938
  export declare enum HarmBlockThreshold {
1853
1939
  HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
1854
1940
  BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
@@ -1858,6 +1944,7 @@ export declare enum HarmBlockThreshold {
1858
1944
  OFF = "OFF"
1859
1945
  }
1860
1946
 
1947
+ /** Required. Harm category. */
1861
1948
  export declare enum HarmCategory {
1862
1949
  HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED",
1863
1950
  HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
@@ -1867,6 +1954,7 @@ export declare enum HarmCategory {
1867
1954
  HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
1868
1955
  }
1869
1956
 
1957
+ /** Output only. Harm probability levels in the content. */
1870
1958
  export declare enum HarmProbability {
1871
1959
  HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED",
1872
1960
  NEGLIGIBLE = "NEGLIGIBLE",
@@ -1875,6 +1963,7 @@ export declare enum HarmProbability {
1875
1963
  HIGH = "HIGH"
1876
1964
  }
1877
1965
 
1966
+ /** Output only. Harm severity levels in the content. */
1878
1967
  export declare enum HarmSeverity {
1879
1968
  HARM_SEVERITY_UNSPECIFIED = "HARM_SEVERITY_UNSPECIFIED",
1880
1969
  HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
@@ -1967,6 +2056,7 @@ declare interface Image_2 {
1967
2056
  }
1968
2057
  export { Image_2 as Image }
1969
2058
 
2059
+ /** Enum that specifies the language of the text in the prompt. */
1970
2060
  export declare enum ImagePromptLanguage {
1971
2061
  auto = "auto",
1972
2062
  en = "en",
@@ -1975,6 +2065,7 @@ export declare enum ImagePromptLanguage {
1975
2065
  hi = "hi"
1976
2066
  }
1977
2067
 
2068
+ /** Required. Programming language of the `code`. */
1978
2069
  export declare enum Language {
1979
2070
  LANGUAGE_UNSPECIFIED = "LANGUAGE_UNSPECIFIED",
1980
2071
  PYTHON = "PYTHON"
@@ -2078,9 +2169,21 @@ export declare class Live {
2078
2169
 
2079
2170
  /** Callbacks for the live API. */
2080
2171
  export declare interface LiveCallbacks {
2172
+ /**
2173
+ * Called when the websocket connection is established.
2174
+ */
2081
2175
  onopen?: (() => void) | null;
2176
+ /**
2177
+ * Called when a message is received from the server.
2178
+ */
2082
2179
  onmessage: (e: LiveServerMessage) => void;
2180
+ /**
2181
+ * Called when an error occurs.
2182
+ */
2083
2183
  onerror?: ((e: ErrorEvent) => void) | null;
2184
+ /**
2185
+ * Called when the websocket connection is closed.
2186
+ */
2084
2187
  onclose?: ((e: CloseEvent) => void) | null;
2085
2188
  }
2086
2189
 
@@ -2119,11 +2222,11 @@ export declare interface LiveClientMessage {
2119
2222
 
2120
2223
  /** User input that is sent in real time.
2121
2224
 
2122
- This is different from `ClientContentUpdate` in a few ways:
2225
+ This is different from `LiveClientContent` in a few ways:
2123
2226
 
2124
2227
  - Can be sent continuously without interruption to model generation.
2125
2228
  - If there is a need to mix data interleaved across the
2126
- `ClientContentUpdate` and the `RealtimeUpdate`, server attempts to
2229
+ `LiveClientContent` and the `LiveClientRealtimeInput`, server attempts to
2127
2230
  optimize for best response, but there are no guarantees.
2128
2231
  - End of turn is not explicitly specified, but is rather derived from user
2129
2232
  activity (for example, end of speech).
@@ -2135,6 +2238,10 @@ export declare interface LiveClientMessage {
2135
2238
  export declare interface LiveClientRealtimeInput {
2136
2239
  /** Inlined bytes data for media input. */
2137
2240
  mediaChunks?: Blob_2[];
2241
+ /** Marks the start of user activity. */
2242
+ activityStart?: ActivityStart;
2243
+ /** Marks the end of user activity. */
2244
+ activityEnd?: ActivityEnd;
2138
2245
  }
2139
2246
 
2140
2247
  /** Message contains configuration that will apply for the duration of the streaming session. */
@@ -2145,15 +2252,7 @@ export declare interface LiveClientSetup {
2145
2252
  */
2146
2253
  model?: string;
2147
2254
  /** The generation configuration for the session.
2148
-
2149
- The following fields are supported:
2150
- - `response_logprobs`
2151
- - `response_mime_type`
2152
- - `logprobs`
2153
- - `response_schema`
2154
- - `stop_sequence`
2155
- - `routing_config`
2156
- - `audio_timestamp`
2255
+ Note: only a subset of fields are supported.
2157
2256
  */
2158
2257
  generationConfig?: GenerationConfig;
2159
2258
  /** The user provided system instructions for the model.
@@ -2166,6 +2265,16 @@ export declare interface LiveClientSetup {
2166
2265
  external systems to perform an action, or set of actions, outside of
2167
2266
  knowledge and scope of the model. */
2168
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;
2169
2278
  }
2170
2279
 
2171
2280
  /** Client generated response to a `ToolCall` received from the server.
@@ -2204,6 +2313,16 @@ export declare interface LiveConnectConfig {
2204
2313
  external systems to perform an action, or set of actions, outside of
2205
2314
  knowledge and scope of the model. */
2206
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;
2207
2326
  }
2208
2327
 
2209
2328
  /** Parameters for connecting to the live API. */
@@ -2232,6 +2351,10 @@ export declare interface LiveSendClientContentParameters {
2232
2351
  export declare interface LiveSendRealtimeInputParameters {
2233
2352
  /** Realtime input to send to the session. */
2234
2353
  media: Blob_2;
2354
+ /** Marks the start of user activity. */
2355
+ activityStart?: ActivityStart;
2356
+ /** Marks the end of user activity. */
2357
+ activityEnd?: ActivityEnd;
2235
2358
  }
2236
2359
 
2237
2360
  /** Parameters for sending tool responses to the live API. */
@@ -2252,6 +2375,21 @@ export declare interface LiveServerContent {
2252
2375
  turnComplete?: boolean;
2253
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. */
2254
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;
2255
2393
  }
2256
2394
 
2257
2395
  /** Response message for API call. */
@@ -2264,6 +2402,29 @@ export declare interface LiveServerMessage {
2264
2402
  toolCall?: LiveServerToolCall;
2265
2403
  /** Notification for the client that a previously issued `ToolCallMessage` with the specified `id`s should have been not executed and should be cancelled. */
2266
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;
2267
2428
  }
2268
2429
 
2269
2430
  /** Sent in response to a `LiveGenerateContentSetup` message from the client. */
@@ -2345,6 +2506,7 @@ export declare interface MaskReferenceImage {
2345
2506
  config?: MaskReferenceConfig;
2346
2507
  }
2347
2508
 
2509
+ /** Enum representing the mask mode of a mask reference image. */
2348
2510
  export declare enum MaskReferenceMode {
2349
2511
  MASK_MODE_DEFAULT = "MASK_MODE_DEFAULT",
2350
2512
  MASK_MODE_USER_PROVIDED = "MASK_MODE_USER_PROVIDED",
@@ -2353,6 +2515,7 @@ export declare enum MaskReferenceMode {
2353
2515
  MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
2354
2516
  }
2355
2517
 
2518
+ /** Server content modalities. */
2356
2519
  export declare enum MediaModality {
2357
2520
  MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
2358
2521
  TEXT = "TEXT",
@@ -2362,6 +2525,7 @@ export declare enum MediaModality {
2362
2525
  DOCUMENT = "DOCUMENT"
2363
2526
  }
2364
2527
 
2528
+ /** The media resolution to use. */
2365
2529
  export declare enum MediaResolution {
2366
2530
  MEDIA_RESOLUTION_UNSPECIFIED = "MEDIA_RESOLUTION_UNSPECIFIED",
2367
2531
  MEDIA_RESOLUTION_LOW = "MEDIA_RESOLUTION_LOW",
@@ -2369,6 +2533,7 @@ export declare enum MediaResolution {
2369
2533
  MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
2370
2534
  }
2371
2535
 
2536
+ /** Server content modalities. */
2372
2537
  export declare enum Modality {
2373
2538
  MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
2374
2539
  TEXT = "TEXT",
@@ -2384,11 +2549,40 @@ export declare interface ModalityTokenCount {
2384
2549
  tokenCount?: number;
2385
2550
  }
2386
2551
 
2552
+ /** The mode of the predictor to be used in dynamic retrieval. */
2387
2553
  export declare enum Mode {
2388
2554
  MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
2389
2555
  MODE_DYNAMIC = "MODE_DYNAMIC"
2390
2556
  }
2391
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
+
2392
2586
  export declare class Models extends BaseModule {
2393
2587
  private readonly apiClient;
2394
2588
  constructor(apiClient: ApiClient);
@@ -2539,6 +2733,15 @@ export declare class Models extends BaseModule {
2539
2733
  * ```
2540
2734
  */
2541
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>;
2542
2745
  /**
2543
2746
  * Counts the number of tokens in the given contents. Multimodal input is
2544
2747
  * supported for Gemini models.
@@ -2592,10 +2795,10 @@ export declare class Models extends BaseModule {
2592
2795
  *
2593
2796
  * while (!operation.done) {
2594
2797
  * await new Promise(resolve => setTimeout(resolve, 10000));
2595
- * operation = await ai.operations.get({operation: operation});
2798
+ * operation = await ai.operations.getVideosOperation({operation: operation});
2596
2799
  * }
2597
2800
  *
2598
- * console.log(operation.result?.generatedVideos?.[0]?.video?.uri);
2801
+ * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
2599
2802
  * ```
2600
2803
  */
2601
2804
  generateVideos(params: types.GenerateVideosParameters): Promise<types.GenerateVideosOperation>;
@@ -2615,10 +2818,10 @@ export declare class Operations extends BaseModule {
2615
2818
  /**
2616
2819
  * Gets the status of a long-running operation.
2617
2820
  *
2618
- * @param operation The Operation object returned by a previous API call.
2821
+ * @param parameters The parameters for the get operation request.
2619
2822
  * @return The updated Operation object, with the latest status or result.
2620
2823
  */
2621
- get(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
2824
+ getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
2622
2825
  private getVideosOperationInternal;
2623
2826
  private fetchPredictVideosOperationInternal;
2624
2827
  }
@@ -2628,6 +2831,7 @@ export declare class Operations extends BaseModule {
2628
2831
  * Copyright 2025 Google LLC
2629
2832
  * SPDX-License-Identifier: Apache-2.0
2630
2833
  */
2834
+ /** Required. Outcome of the code execution. */
2631
2835
  export declare enum Outcome {
2632
2836
  OUTCOME_UNSPECIFIED = "OUTCOME_UNSPECIFIED",
2633
2837
  OUTCOME_OK = "OUTCOME_OK",
@@ -2793,6 +2997,7 @@ export declare type PartListUnion = PartUnion[] | PartUnion;
2793
2997
 
2794
2998
  export declare type PartUnion = Part | string;
2795
2999
 
3000
+ /** Enum that controls the generation of people. */
2796
3001
  export declare enum PersonGeneration {
2797
3002
  DONT_ALLOW = "DONT_ALLOW",
2798
3003
  ALLOW_ADULT = "ALLOW_ADULT",
@@ -2821,6 +3026,20 @@ export declare interface RawReferenceImage {
2821
3026
  referenceType?: string;
2822
3027
  }
2823
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
+
2824
3043
  /** Represents a recorded session. */
2825
3044
  export declare interface ReplayFile {
2826
3045
  replayId?: string;
@@ -2878,6 +3097,7 @@ export declare interface SafetyAttributes {
2878
3097
  contentType?: string;
2879
3098
  }
2880
3099
 
3100
+ /** Enum that controls the safety filter level for objectionable content. */
2881
3101
  export declare enum SafetyFilterLevel {
2882
3102
  BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
2883
3103
  BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
@@ -3126,7 +3346,31 @@ export declare class Session {
3126
3346
  close(): void;
3127
3347
  }
3128
3348
 
3129
- declare function setValueByPath(data: Record<string, unknown>, keys: string[], value: unknown): void;
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
+ }
3130
3374
 
3131
3375
  /** The speech generation configuration. */
3132
3376
  export declare interface SpeechConfig {
@@ -3137,10 +3381,11 @@ export declare interface SpeechConfig {
3137
3381
 
3138
3382
  export declare type SpeechConfigUnion = SpeechConfig | string;
3139
3383
 
3140
- export declare enum State {
3141
- STATE_UNSPECIFIED = "STATE_UNSPECIFIED",
3142
- ACTIVE = "ACTIVE",
3143
- ERROR = "ERROR"
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"
3144
3389
  }
3145
3390
 
3146
3391
  /** Configuration for a Style reference image. */
@@ -3195,6 +3440,7 @@ export declare interface SubjectReferenceImage {
3195
3440
  config?: SubjectReferenceConfig;
3196
3441
  }
3197
3442
 
3443
+ /** Enum representing the subject type of a subject reference image. */
3198
3444
  export declare enum SubjectReferenceType {
3199
3445
  SUBJECT_TYPE_DEFAULT = "SUBJECT_TYPE_DEFAULT",
3200
3446
  SUBJECT_TYPE_PERSON = "SUBJECT_TYPE_PERSON",
@@ -3233,6 +3479,9 @@ export declare interface ThinkingConfig {
3233
3479
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
3234
3480
  */
3235
3481
  includeThoughts?: boolean;
3482
+ /** Indicates the thinking budget in tokens.
3483
+ */
3484
+ thinkingBudget?: number;
3236
3485
  }
3237
3486
 
3238
3487
  /** Tokens info with a list of tokens and the corresponding list of token ids. */
@@ -3275,6 +3524,31 @@ export declare interface ToolConfig {
3275
3524
 
3276
3525
  export declare type ToolListUnion = Tool[];
3277
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. */
3278
3552
  export declare enum Type {
3279
3553
  TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
3280
3554
  STRING = "STRING",
@@ -3307,11 +3581,11 @@ declare namespace types {
3307
3581
  HarmProbability,
3308
3582
  HarmSeverity,
3309
3583
  BlockedReason,
3584
+ TrafficType,
3310
3585
  Modality,
3311
- State,
3586
+ MediaResolution,
3312
3587
  DynamicRetrievalConfigMode,
3313
3588
  FunctionCallingConfigMode,
3314
- MediaResolution,
3315
3589
  SafetyFilterLevel,
3316
3590
  PersonGeneration,
3317
3591
  ImagePromptLanguage,
@@ -3321,6 +3595,10 @@ declare namespace types {
3321
3595
  ControlReferenceType,
3322
3596
  SubjectReferenceType,
3323
3597
  MediaModality,
3598
+ StartSensitivity,
3599
+ EndSensitivity,
3600
+ ActivityHandling,
3601
+ TurnCoverage,
3324
3602
  VideoMetadata,
3325
3603
  CodeExecutionResult,
3326
3604
  ExecutableCode,
@@ -3386,6 +3664,11 @@ declare namespace types {
3386
3664
  SafetyAttributes,
3387
3665
  GeneratedImage,
3388
3666
  GenerateImagesResponse,
3667
+ GetModelConfig,
3668
+ GetModelParameters,
3669
+ Endpoint,
3670
+ TunedModelInfo,
3671
+ Model,
3389
3672
  GenerationConfig,
3390
3673
  CountTokensConfig,
3391
3674
  CountTokensParameters,
@@ -3423,6 +3706,7 @@ declare namespace types {
3423
3706
  CreateFileParameters,
3424
3707
  HttpResponse,
3425
3708
  LiveCallbacks,
3709
+ UploadFileParameters,
3426
3710
  CreateFileResponse,
3427
3711
  GetFileConfig,
3428
3712
  GetFileParameters,
@@ -3456,12 +3740,23 @@ declare namespace types {
3456
3740
  LiveServerContent,
3457
3741
  LiveServerToolCall,
3458
3742
  LiveServerToolCallCancellation,
3743
+ UsageMetadata,
3744
+ LiveServerGoAway,
3745
+ LiveServerSessionResumptionUpdate,
3459
3746
  LiveServerMessage,
3747
+ AutomaticActivityDetection,
3748
+ RealtimeInputConfig,
3749
+ SessionResumptionConfig,
3750
+ SlidingWindow,
3751
+ ContextWindowCompressionConfig,
3460
3752
  LiveClientSetup,
3461
3753
  LiveClientContent,
3754
+ ActivityStart,
3755
+ ActivityEnd,
3462
3756
  LiveClientRealtimeInput,
3463
3757
  LiveClientToolResponse,
3464
3758
  LiveClientMessage,
3759
+ AudioTranscriptionConfig,
3465
3760
  LiveConnectConfig,
3466
3761
  LiveConnectParameters,
3467
3762
  CreateChatParameters,
@@ -3535,9 +3830,9 @@ export declare interface UploadFileConfig {
3535
3830
  }
3536
3831
 
3537
3832
  /** Parameters for the upload file method. */
3538
- declare interface UploadFileParameters {
3833
+ export declare interface UploadFileParameters {
3539
3834
  /** The string path to the file to be uploaded or a Blob object. */
3540
- file: string | Blob;
3835
+ file: string | globalThis.Blob;
3541
3836
  /** Configuration that contains optional parameters. */
3542
3837
  config?: UploadFileConfig;
3543
3838
  }
@@ -3573,6 +3868,33 @@ export declare interface UpscaleImageParameters {
3573
3868
  config?: UpscaleImageConfig;
3574
3869
  }
3575
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
+
3576
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 */
3577
3899
  export declare interface VertexAISearch {
3578
3900
  /** Optional. Fully-qualified Vertex AI Search data store resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}` */