@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.
@@ -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
  *
@@ -1818,6 +1900,8 @@ export declare interface GroundingChunkRetrievedContext {
1818
1900
 
1819
1901
  /** Chunk from the web. */
1820
1902
  export declare interface GroundingChunkWeb {
1903
+ /** Domain of the (original) URI. */
1904
+ domain?: string;
1821
1905
  /** Title of the chunk. */
1822
1906
  title?: string;
1823
1907
  /** URI reference of the chunk. */
@@ -1850,12 +1934,14 @@ export declare interface GroundingSupport {
1850
1934
  segment?: Segment;
1851
1935
  }
1852
1936
 
1937
+ /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
1853
1938
  export declare enum HarmBlockMethod {
1854
1939
  HARM_BLOCK_METHOD_UNSPECIFIED = "HARM_BLOCK_METHOD_UNSPECIFIED",
1855
1940
  SEVERITY = "SEVERITY",
1856
1941
  PROBABILITY = "PROBABILITY"
1857
1942
  }
1858
1943
 
1944
+ /** Required. The harm block threshold. */
1859
1945
  export declare enum HarmBlockThreshold {
1860
1946
  HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
1861
1947
  BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
@@ -1865,6 +1951,7 @@ export declare enum HarmBlockThreshold {
1865
1951
  OFF = "OFF"
1866
1952
  }
1867
1953
 
1954
+ /** Required. Harm category. */
1868
1955
  export declare enum HarmCategory {
1869
1956
  HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED",
1870
1957
  HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
@@ -1874,6 +1961,7 @@ export declare enum HarmCategory {
1874
1961
  HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
1875
1962
  }
1876
1963
 
1964
+ /** Output only. Harm probability levels in the content. */
1877
1965
  export declare enum HarmProbability {
1878
1966
  HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED",
1879
1967
  NEGLIGIBLE = "NEGLIGIBLE",
@@ -1882,6 +1970,7 @@ export declare enum HarmProbability {
1882
1970
  HIGH = "HIGH"
1883
1971
  }
1884
1972
 
1973
+ /** Output only. Harm severity levels in the content. */
1885
1974
  export declare enum HarmSeverity {
1886
1975
  HARM_SEVERITY_UNSPECIFIED = "HARM_SEVERITY_UNSPECIFIED",
1887
1976
  HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
@@ -1974,6 +2063,7 @@ declare interface Image_2 {
1974
2063
  }
1975
2064
  export { Image_2 as Image }
1976
2065
 
2066
+ /** Enum that specifies the language of the text in the prompt. */
1977
2067
  export declare enum ImagePromptLanguage {
1978
2068
  auto = "auto",
1979
2069
  en = "en",
@@ -1982,6 +2072,7 @@ export declare enum ImagePromptLanguage {
1982
2072
  hi = "hi"
1983
2073
  }
1984
2074
 
2075
+ /** Required. Programming language of the `code`. */
1985
2076
  export declare enum Language {
1986
2077
  LANGUAGE_UNSPECIFIED = "LANGUAGE_UNSPECIFIED",
1987
2078
  PYTHON = "PYTHON"
@@ -2085,9 +2176,21 @@ export declare class Live {
2085
2176
 
2086
2177
  /** Callbacks for the live API. */
2087
2178
  export declare interface LiveCallbacks {
2179
+ /**
2180
+ * Called when the websocket connection is established.
2181
+ */
2088
2182
  onopen?: (() => void) | null;
2183
+ /**
2184
+ * Called when a message is received from the server.
2185
+ */
2089
2186
  onmessage: (e: LiveServerMessage) => void;
2187
+ /**
2188
+ * Called when an error occurs.
2189
+ */
2090
2190
  onerror?: ((e: ErrorEvent) => void) | null;
2191
+ /**
2192
+ * Called when the websocket connection is closed.
2193
+ */
2091
2194
  onclose?: ((e: CloseEvent) => void) | null;
2092
2195
  }
2093
2196
 
@@ -2126,11 +2229,11 @@ export declare interface LiveClientMessage {
2126
2229
 
2127
2230
  /** User input that is sent in real time.
2128
2231
 
2129
- This is different from `ClientContentUpdate` in a few ways:
2232
+ This is different from `LiveClientContent` in a few ways:
2130
2233
 
2131
2234
  - Can be sent continuously without interruption to model generation.
2132
2235
  - If there is a need to mix data interleaved across the
2133
- `ClientContentUpdate` and the `RealtimeUpdate`, server attempts to
2236
+ `LiveClientContent` and the `LiveClientRealtimeInput`, server attempts to
2134
2237
  optimize for best response, but there are no guarantees.
2135
2238
  - End of turn is not explicitly specified, but is rather derived from user
2136
2239
  activity (for example, end of speech).
@@ -2142,6 +2245,10 @@ export declare interface LiveClientMessage {
2142
2245
  export declare interface LiveClientRealtimeInput {
2143
2246
  /** Inlined bytes data for media input. */
2144
2247
  mediaChunks?: Blob_2[];
2248
+ /** Marks the start of user activity. */
2249
+ activityStart?: ActivityStart;
2250
+ /** Marks the end of user activity. */
2251
+ activityEnd?: ActivityEnd;
2145
2252
  }
2146
2253
 
2147
2254
  /** Message contains configuration that will apply for the duration of the streaming session. */
@@ -2152,15 +2259,7 @@ export declare interface LiveClientSetup {
2152
2259
  */
2153
2260
  model?: string;
2154
2261
  /** The generation configuration for the session.
2155
-
2156
- The following fields are supported:
2157
- - `response_logprobs`
2158
- - `response_mime_type`
2159
- - `logprobs`
2160
- - `response_schema`
2161
- - `stop_sequence`
2162
- - `routing_config`
2163
- - `audio_timestamp`
2262
+ Note: only a subset of fields are supported.
2164
2263
  */
2165
2264
  generationConfig?: GenerationConfig;
2166
2265
  /** The user provided system instructions for the model.
@@ -2173,6 +2272,16 @@ export declare interface LiveClientSetup {
2173
2272
  external systems to perform an action, or set of actions, outside of
2174
2273
  knowledge and scope of the model. */
2175
2274
  tools?: ToolListUnion;
2275
+ /** Configures the realtime input behavior in BidiGenerateContent. */
2276
+ realtimeInputConfig?: RealtimeInputConfig;
2277
+ /** Configures session resumption mechanism.
2278
+
2279
+ If included server will send SessionResumptionUpdate messages. */
2280
+ sessionResumption?: SessionResumptionConfig;
2281
+ /** Configures context window compression mechanism.
2282
+
2283
+ If included, server will compress context window to fit into given length. */
2284
+ contextWindowCompression?: ContextWindowCompressionConfig;
2176
2285
  }
2177
2286
 
2178
2287
  /** Client generated response to a `ToolCall` received from the server.
@@ -2211,6 +2320,16 @@ export declare interface LiveConnectConfig {
2211
2320
  external systems to perform an action, or set of actions, outside of
2212
2321
  knowledge and scope of the model. */
2213
2322
  tools?: ToolListUnion;
2323
+ /** Configures session resumption mechanism.
2324
+
2325
+ If included the server will send SessionResumptionUpdate messages. */
2326
+ sessionResumption?: SessionResumptionConfig;
2327
+ /** Configures the realtime input behavior in BidiGenerateContent. */
2328
+ realtimeInputConfig?: RealtimeInputConfig;
2329
+ /** Configures context window compression mechanism.
2330
+
2331
+ If included, server will compress context window to fit into given length. */
2332
+ contextWindowCompression?: ContextWindowCompressionConfig;
2214
2333
  }
2215
2334
 
2216
2335
  /** Parameters for connecting to the live API. */
@@ -2239,6 +2358,10 @@ export declare interface LiveSendClientContentParameters {
2239
2358
  export declare interface LiveSendRealtimeInputParameters {
2240
2359
  /** Realtime input to send to the session. */
2241
2360
  media: Blob_2;
2361
+ /** Marks the start of user activity. */
2362
+ activityStart?: ActivityStart;
2363
+ /** Marks the end of user activity. */
2364
+ activityEnd?: ActivityEnd;
2242
2365
  }
2243
2366
 
2244
2367
  /** Parameters for sending tool responses to the live API. */
@@ -2259,6 +2382,21 @@ export declare interface LiveServerContent {
2259
2382
  turnComplete?: boolean;
2260
2383
  /** If true, indicates that a client message has interrupted current model generation. If the client is playing out the content in realtime, this is a good signal to stop and empty the current queue. */
2261
2384
  interrupted?: boolean;
2385
+ /** If true, indicates that the model is done generating. When model is
2386
+ interrupted while generating there will be no generation_complete message
2387
+ in interrupted turn, it will go through interrupted > turn_complete.
2388
+ When model assumes realtime playback there will be delay between
2389
+ generation_complete and turn_complete that is caused by model
2390
+ waiting for playback to finish. If true, indicates that the model
2391
+ has finished generating all content. This is a signal to the client
2392
+ that it can stop sending messages. */
2393
+ generationComplete?: boolean;
2394
+ }
2395
+
2396
+ /** Server will not be able to service client soon. */
2397
+ export declare interface LiveServerGoAway {
2398
+ /** The remaining time before the connection will be terminated as ABORTED. The minimal time returned here is specified differently together with the rate limits for a given model. */
2399
+ timeLeft?: string;
2262
2400
  }
2263
2401
 
2264
2402
  /** Response message for API call. */
@@ -2271,6 +2409,29 @@ export declare interface LiveServerMessage {
2271
2409
  toolCall?: LiveServerToolCall;
2272
2410
  /** Notification for the client that a previously issued `ToolCallMessage` with the specified `id`s should have been not executed and should be cancelled. */
2273
2411
  toolCallCancellation?: LiveServerToolCallCancellation;
2412
+ /** Usage metadata about model response(s). */
2413
+ usageMetadata?: UsageMetadata;
2414
+ /** Server will disconnect soon. */
2415
+ goAway?: LiveServerGoAway;
2416
+ /** Update of the session resumption state. */
2417
+ sessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
2418
+ }
2419
+
2420
+ /** Update of the session resumption state.
2421
+
2422
+ Only sent if `session_resumption` was set in the connection config.
2423
+ */
2424
+ export declare interface LiveServerSessionResumptionUpdate {
2425
+ /** New handle that represents state that can be resumed. Empty if `resumable`=false. */
2426
+ newHandle?: string;
2427
+ /** True if session can be resumed at this point. It might be not possible to resume session at some points. In that case we send update empty new_handle and resumable=false. Example of such case could be model executing function calls or just generating. Resuming session (using previous session token) in such state will result in some data loss. */
2428
+ resumable?: boolean;
2429
+ /** Index of last message sent by client that is included in state represented by this SessionResumptionToken. Only sent when `SessionResumptionConfig.transparent` is set.
2430
+
2431
+ Presence of this index allows users to transparently reconnect and avoid issue of losing some part of realtime audio input/video. If client wishes to temporarily disconnect (for example as result of receiving GoAway) they can do it without losing state by buffering messages sent since last `SessionResmumptionTokenUpdate`. This field will enable them to limit buffering (avoid keeping all requests in RAM).
2432
+
2433
+ Note: This should not be used for when resuming a session at some time later -- in those cases partial audio and video frames arelikely not needed. */
2434
+ lastConsumedClientMessageIndex?: string;
2274
2435
  }
2275
2436
 
2276
2437
  /** Sent in response to a `LiveGenerateContentSetup` message from the client. */
@@ -2352,6 +2513,7 @@ export declare interface MaskReferenceImage {
2352
2513
  config?: MaskReferenceConfig;
2353
2514
  }
2354
2515
 
2516
+ /** Enum representing the mask mode of a mask reference image. */
2355
2517
  export declare enum MaskReferenceMode {
2356
2518
  MASK_MODE_DEFAULT = "MASK_MODE_DEFAULT",
2357
2519
  MASK_MODE_USER_PROVIDED = "MASK_MODE_USER_PROVIDED",
@@ -2360,6 +2522,7 @@ export declare enum MaskReferenceMode {
2360
2522
  MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
2361
2523
  }
2362
2524
 
2525
+ /** Server content modalities. */
2363
2526
  export declare enum MediaModality {
2364
2527
  MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
2365
2528
  TEXT = "TEXT",
@@ -2369,6 +2532,7 @@ export declare enum MediaModality {
2369
2532
  DOCUMENT = "DOCUMENT"
2370
2533
  }
2371
2534
 
2535
+ /** The media resolution to use. */
2372
2536
  export declare enum MediaResolution {
2373
2537
  MEDIA_RESOLUTION_UNSPECIFIED = "MEDIA_RESOLUTION_UNSPECIFIED",
2374
2538
  MEDIA_RESOLUTION_LOW = "MEDIA_RESOLUTION_LOW",
@@ -2376,6 +2540,7 @@ export declare enum MediaResolution {
2376
2540
  MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
2377
2541
  }
2378
2542
 
2543
+ /** Server content modalities. */
2379
2544
  export declare enum Modality {
2380
2545
  MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
2381
2546
  TEXT = "TEXT",
@@ -2391,11 +2556,40 @@ export declare interface ModalityTokenCount {
2391
2556
  tokenCount?: number;
2392
2557
  }
2393
2558
 
2559
+ /** The mode of the predictor to be used in dynamic retrieval. */
2394
2560
  export declare enum Mode {
2395
2561
  MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
2396
2562
  MODE_DYNAMIC = "MODE_DYNAMIC"
2397
2563
  }
2398
2564
 
2565
+ /** A trained machine learning model. */
2566
+ export declare interface Model {
2567
+ /** Resource name of the model. */
2568
+ name?: string;
2569
+ /** Display name of the model. */
2570
+ displayName?: string;
2571
+ /** Description of the model. */
2572
+ description?: string;
2573
+ /** Version ID of the model. A new version is committed when a new
2574
+ model version is uploaded or trained under an existing model ID. The
2575
+ version ID is an auto-incrementing decimal number in string
2576
+ representation. */
2577
+ version?: string;
2578
+ /** List of deployed models created from this base model. Note that a
2579
+ model could have been deployed to endpoints in different locations. */
2580
+ endpoints?: Endpoint[];
2581
+ /** Labels with user-defined metadata to organize your models. */
2582
+ labels?: Record<string, string>;
2583
+ /** Information about the tuned model from the base model. */
2584
+ tunedModelInfo?: TunedModelInfo;
2585
+ /** The maximum number of input tokens that the model can handle. */
2586
+ inputTokenLimit?: number;
2587
+ /** The maximum number of output tokens that the model can generate. */
2588
+ outputTokenLimit?: number;
2589
+ /** List of actions that are supported by the model. */
2590
+ supportedActions?: string[];
2591
+ }
2592
+
2399
2593
  export declare class Models extends BaseModule {
2400
2594
  private readonly apiClient;
2401
2595
  constructor(apiClient: ApiClient);
@@ -2546,6 +2740,15 @@ export declare class Models extends BaseModule {
2546
2740
  * ```
2547
2741
  */
2548
2742
  private generateImagesInternal;
2743
+ /**
2744
+ * Fetches information about a model by name.
2745
+ *
2746
+ * @example
2747
+ * ```ts
2748
+ * const modelInfo = await ai.models.get({model: 'gemini-2.0-flash'});
2749
+ * ```
2750
+ */
2751
+ get(params: types.GetModelParameters): Promise<types.Model>;
2549
2752
  /**
2550
2753
  * Counts the number of tokens in the given contents. Multimodal input is
2551
2754
  * supported for Gemini models.
@@ -2599,10 +2802,10 @@ export declare class Models extends BaseModule {
2599
2802
  *
2600
2803
  * while (!operation.done) {
2601
2804
  * await new Promise(resolve => setTimeout(resolve, 10000));
2602
- * operation = await ai.operations.get({operation: operation});
2805
+ * operation = await ai.operations.getVideosOperation({operation: operation});
2603
2806
  * }
2604
2807
  *
2605
- * console.log(operation.result?.generatedVideos?.[0]?.video?.uri);
2808
+ * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
2606
2809
  * ```
2607
2810
  */
2608
2811
  generateVideos(params: types.GenerateVideosParameters): Promise<types.GenerateVideosOperation>;
@@ -2622,10 +2825,10 @@ export declare class Operations extends BaseModule {
2622
2825
  /**
2623
2826
  * Gets the status of a long-running operation.
2624
2827
  *
2625
- * @param operation The Operation object returned by a previous API call.
2828
+ * @param parameters The parameters for the get operation request.
2626
2829
  * @return The updated Operation object, with the latest status or result.
2627
2830
  */
2628
- get(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
2831
+ getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
2629
2832
  private getVideosOperationInternal;
2630
2833
  private fetchPredictVideosOperationInternal;
2631
2834
  }
@@ -2635,6 +2838,7 @@ export declare class Operations extends BaseModule {
2635
2838
  * Copyright 2025 Google LLC
2636
2839
  * SPDX-License-Identifier: Apache-2.0
2637
2840
  */
2841
+ /** Required. Outcome of the code execution. */
2638
2842
  export declare enum Outcome {
2639
2843
  OUTCOME_UNSPECIFIED = "OUTCOME_UNSPECIFIED",
2640
2844
  OUTCOME_OK = "OUTCOME_OK",
@@ -2800,6 +3004,7 @@ export declare type PartListUnion = PartUnion[] | PartUnion;
2800
3004
 
2801
3005
  export declare type PartUnion = Part | string;
2802
3006
 
3007
+ /** Enum that controls the generation of people. */
2803
3008
  export declare enum PersonGeneration {
2804
3009
  DONT_ALLOW = "DONT_ALLOW",
2805
3010
  ALLOW_ADULT = "ALLOW_ADULT",
@@ -2828,6 +3033,20 @@ export declare interface RawReferenceImage {
2828
3033
  referenceType?: string;
2829
3034
  }
2830
3035
 
3036
+ /** Marks the end of user activity.
3037
+
3038
+ This can only be sent if automatic (i.e. server-side) activity detection is
3039
+ disabled.
3040
+ */
3041
+ export declare interface RealtimeInputConfig {
3042
+ /** If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals. */
3043
+ automaticActivityDetection?: AutomaticActivityDetection;
3044
+ /** Defines what effect activity has. */
3045
+ activityHandling?: ActivityHandling;
3046
+ /** Defines which input is included in the user's turn. */
3047
+ turnCoverage?: TurnCoverage;
3048
+ }
3049
+
2831
3050
  /** Represents a recorded session. */
2832
3051
  export declare interface ReplayFile {
2833
3052
  replayId?: string;
@@ -2885,6 +3104,7 @@ export declare interface SafetyAttributes {
2885
3104
  contentType?: string;
2886
3105
  }
2887
3106
 
3107
+ /** Enum that controls the safety filter level for objectionable content. */
2888
3108
  export declare enum SafetyFilterLevel {
2889
3109
  BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
2890
3110
  BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
@@ -3133,7 +3353,31 @@ export declare class Session {
3133
3353
  close(): void;
3134
3354
  }
3135
3355
 
3136
- declare function setValueByPath(data: Record<string, unknown>, keys: string[], value: unknown): void;
3356
+ /** Configuration of session resumption mechanism.
3357
+
3358
+ Included in `LiveConnectConfig.session_resumption`. If included server
3359
+ will send `LiveServerSessionResumptionUpdate` messages.
3360
+ */
3361
+ export declare interface SessionResumptionConfig {
3362
+ /** Session resumption handle of previous session (session to restore).
3363
+
3364
+ If not present new session will be started. */
3365
+ handle?: string;
3366
+ /** If set the server will send `last_consumed_client_message_index` in the `session_resumption_update` messages to allow for transparent reconnections. */
3367
+ transparent?: boolean;
3368
+ }
3369
+
3370
+ /** Context window will be truncated by keeping only suffix of it.
3371
+
3372
+ Context window will always be cut at start of USER role turn. System
3373
+ instructions and `BidiGenerateContentSetup.prefix_turns` will not be
3374
+ subject to the sliding window mechanism, they will always stay at the
3375
+ beginning of context window.
3376
+ */
3377
+ export declare interface SlidingWindow {
3378
+ /** Session reduction target -- how many tokens we should keep. Window shortening operation has some latency costs, so we should avoid running it on every turn. Should be < trigger_tokens. If not set, trigger_tokens/2 is assumed. */
3379
+ targetTokens?: string;
3380
+ }
3137
3381
 
3138
3382
  /** The speech generation configuration. */
3139
3383
  export declare interface SpeechConfig {
@@ -3144,10 +3388,11 @@ export declare interface SpeechConfig {
3144
3388
 
3145
3389
  export declare type SpeechConfigUnion = SpeechConfig | string;
3146
3390
 
3147
- export declare enum State {
3148
- STATE_UNSPECIFIED = "STATE_UNSPECIFIED",
3149
- ACTIVE = "ACTIVE",
3150
- ERROR = "ERROR"
3391
+ /** Start of speech sensitivity. */
3392
+ export declare enum StartSensitivity {
3393
+ START_SENSITIVITY_UNSPECIFIED = "START_SENSITIVITY_UNSPECIFIED",
3394
+ START_SENSITIVITY_HIGH = "START_SENSITIVITY_HIGH",
3395
+ START_SENSITIVITY_LOW = "START_SENSITIVITY_LOW"
3151
3396
  }
3152
3397
 
3153
3398
  /** Configuration for a Style reference image. */
@@ -3202,6 +3447,7 @@ export declare interface SubjectReferenceImage {
3202
3447
  config?: SubjectReferenceConfig;
3203
3448
  }
3204
3449
 
3450
+ /** Enum representing the subject type of a subject reference image. */
3205
3451
  export declare enum SubjectReferenceType {
3206
3452
  SUBJECT_TYPE_DEFAULT = "SUBJECT_TYPE_DEFAULT",
3207
3453
  SUBJECT_TYPE_PERSON = "SUBJECT_TYPE_PERSON",
@@ -3240,6 +3486,9 @@ export declare interface ThinkingConfig {
3240
3486
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
3241
3487
  */
3242
3488
  includeThoughts?: boolean;
3489
+ /** Indicates the thinking budget in tokens.
3490
+ */
3491
+ thinkingBudget?: number;
3243
3492
  }
3244
3493
 
3245
3494
  /** Tokens info with a list of tokens and the corresponding list of token ids. */
@@ -3282,6 +3531,31 @@ export declare interface ToolConfig {
3282
3531
 
3283
3532
  export declare type ToolListUnion = Tool[];
3284
3533
 
3534
+ /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
3535
+ export declare enum TrafficType {
3536
+ TRAFFIC_TYPE_UNSPECIFIED = "TRAFFIC_TYPE_UNSPECIFIED",
3537
+ ON_DEMAND = "ON_DEMAND",
3538
+ PROVISIONED_THROUGHPUT = "PROVISIONED_THROUGHPUT"
3539
+ }
3540
+
3541
+ /** A tuned machine learning model. */
3542
+ export declare interface TunedModelInfo {
3543
+ /** ID of the base model that you want to tune. */
3544
+ baseModel?: string;
3545
+ /** Date and time when the base model was created. */
3546
+ createTime?: string;
3547
+ /** Date and time when the base model was last updated. */
3548
+ updateTime?: string;
3549
+ }
3550
+
3551
+ /** Options about which input is included in the user's turn. */
3552
+ export declare enum TurnCoverage {
3553
+ TURN_COVERAGE_UNSPECIFIED = "TURN_COVERAGE_UNSPECIFIED",
3554
+ TURN_INCLUDES_ONLY_ACTIVITY = "TURN_INCLUDES_ONLY_ACTIVITY",
3555
+ TURN_INCLUDES_ALL_INPUT = "TURN_INCLUDES_ALL_INPUT"
3556
+ }
3557
+
3558
+ /** Optional. The type of the data. */
3285
3559
  export declare enum Type {
3286
3560
  TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
3287
3561
  STRING = "STRING",
@@ -3314,11 +3588,11 @@ declare namespace types {
3314
3588
  HarmProbability,
3315
3589
  HarmSeverity,
3316
3590
  BlockedReason,
3591
+ TrafficType,
3317
3592
  Modality,
3318
- State,
3593
+ MediaResolution,
3319
3594
  DynamicRetrievalConfigMode,
3320
3595
  FunctionCallingConfigMode,
3321
- MediaResolution,
3322
3596
  SafetyFilterLevel,
3323
3597
  PersonGeneration,
3324
3598
  ImagePromptLanguage,
@@ -3328,6 +3602,10 @@ declare namespace types {
3328
3602
  ControlReferenceType,
3329
3603
  SubjectReferenceType,
3330
3604
  MediaModality,
3605
+ StartSensitivity,
3606
+ EndSensitivity,
3607
+ ActivityHandling,
3608
+ TurnCoverage,
3331
3609
  VideoMetadata,
3332
3610
  CodeExecutionResult,
3333
3611
  ExecutableCode,
@@ -3393,6 +3671,11 @@ declare namespace types {
3393
3671
  SafetyAttributes,
3394
3672
  GeneratedImage,
3395
3673
  GenerateImagesResponse,
3674
+ GetModelConfig,
3675
+ GetModelParameters,
3676
+ Endpoint,
3677
+ TunedModelInfo,
3678
+ Model,
3396
3679
  GenerationConfig,
3397
3680
  CountTokensConfig,
3398
3681
  CountTokensParameters,
@@ -3430,6 +3713,7 @@ declare namespace types {
3430
3713
  CreateFileParameters,
3431
3714
  HttpResponse,
3432
3715
  LiveCallbacks,
3716
+ UploadFileParameters,
3433
3717
  CreateFileResponse,
3434
3718
  GetFileConfig,
3435
3719
  GetFileParameters,
@@ -3463,12 +3747,23 @@ declare namespace types {
3463
3747
  LiveServerContent,
3464
3748
  LiveServerToolCall,
3465
3749
  LiveServerToolCallCancellation,
3750
+ UsageMetadata,
3751
+ LiveServerGoAway,
3752
+ LiveServerSessionResumptionUpdate,
3466
3753
  LiveServerMessage,
3754
+ AutomaticActivityDetection,
3755
+ RealtimeInputConfig,
3756
+ SessionResumptionConfig,
3757
+ SlidingWindow,
3758
+ ContextWindowCompressionConfig,
3467
3759
  LiveClientSetup,
3468
3760
  LiveClientContent,
3761
+ ActivityStart,
3762
+ ActivityEnd,
3469
3763
  LiveClientRealtimeInput,
3470
3764
  LiveClientToolResponse,
3471
3765
  LiveClientMessage,
3766
+ AudioTranscriptionConfig,
3472
3767
  LiveConnectConfig,
3473
3768
  LiveConnectParameters,
3474
3769
  CreateChatParameters,
@@ -3542,9 +3837,9 @@ export declare interface UploadFileConfig {
3542
3837
  }
3543
3838
 
3544
3839
  /** Parameters for the upload file method. */
3545
- declare interface UploadFileParameters {
3840
+ export declare interface UploadFileParameters {
3546
3841
  /** The string path to the file to be uploaded or a Blob object. */
3547
- file: string | Blob;
3842
+ file: string | globalThis.Blob;
3548
3843
  /** Configuration that contains optional parameters. */
3549
3844
  config?: UploadFileConfig;
3550
3845
  }
@@ -3580,6 +3875,33 @@ export declare interface UpscaleImageParameters {
3580
3875
  config?: UpscaleImageConfig;
3581
3876
  }
3582
3877
 
3878
+ /** Usage metadata about response(s). */
3879
+ export declare interface UsageMetadata {
3880
+ /** Number of tokens in the prompt. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content. */
3881
+ promptTokenCount?: number;
3882
+ /** Number of tokens in the cached part of the prompt (the cached content). */
3883
+ cachedContentTokenCount?: number;
3884
+ /** Total number of tokens across all the generated response candidates. */
3885
+ responseTokenCount?: number;
3886
+ /** Number of tokens present in tool-use prompt(s). */
3887
+ toolUsePromptTokenCount?: number;
3888
+ /** Number of tokens of thoughts for thinking models. */
3889
+ thoughtsTokenCount?: number;
3890
+ /** Total token count for prompt, response candidates, and tool-use prompts(if present). */
3891
+ totalTokenCount?: number;
3892
+ /** List of modalities that were processed in the request input. */
3893
+ promptTokensDetails?: ModalityTokenCount[];
3894
+ /** List of modalities that were processed in the cache input. */
3895
+ cacheTokensDetails?: ModalityTokenCount[];
3896
+ /** List of modalities that were returned in the response. */
3897
+ responseTokensDetails?: ModalityTokenCount[];
3898
+ /** List of modalities that were processed in the tool-use prompt. */
3899
+ toolUsePromptTokensDetails?: ModalityTokenCount[];
3900
+ /** Traffic type. This shows whether a request consumes Pay-As-You-Go
3901
+ or Provisioned Throughput quota. */
3902
+ trafficType?: TrafficType;
3903
+ }
3904
+
3583
3905
  /** Retrieve from Vertex AI Search datastore or engine for grounding. datastore and engine are mutually exclusive. See https://cloud.google.com/products/agent-builder */
3584
3906
  export declare interface VertexAISearch {
3585
3907
  /** Optional. Fully-qualified Vertex AI Search data store resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}` */