@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/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",
@@ -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
  *
@@ -1806,6 +1888,8 @@ export declare interface GroundingChunkRetrievedContext {
1806
1888
 
1807
1889
  /** Chunk from the web. */
1808
1890
  export declare interface GroundingChunkWeb {
1891
+ /** Domain of the (original) URI. */
1892
+ domain?: string;
1809
1893
  /** Title of the chunk. */
1810
1894
  title?: string;
1811
1895
  /** URI reference of the chunk. */
@@ -1838,12 +1922,14 @@ export declare interface GroundingSupport {
1838
1922
  segment?: Segment;
1839
1923
  }
1840
1924
 
1925
+ /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
1841
1926
  export declare enum HarmBlockMethod {
1842
1927
  HARM_BLOCK_METHOD_UNSPECIFIED = "HARM_BLOCK_METHOD_UNSPECIFIED",
1843
1928
  SEVERITY = "SEVERITY",
1844
1929
  PROBABILITY = "PROBABILITY"
1845
1930
  }
1846
1931
 
1932
+ /** Required. The harm block threshold. */
1847
1933
  export declare enum HarmBlockThreshold {
1848
1934
  HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
1849
1935
  BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
@@ -1853,6 +1939,7 @@ export declare enum HarmBlockThreshold {
1853
1939
  OFF = "OFF"
1854
1940
  }
1855
1941
 
1942
+ /** Required. Harm category. */
1856
1943
  export declare enum HarmCategory {
1857
1944
  HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED",
1858
1945
  HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
@@ -1862,6 +1949,7 @@ export declare enum HarmCategory {
1862
1949
  HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
1863
1950
  }
1864
1951
 
1952
+ /** Output only. Harm probability levels in the content. */
1865
1953
  export declare enum HarmProbability {
1866
1954
  HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED",
1867
1955
  NEGLIGIBLE = "NEGLIGIBLE",
@@ -1870,6 +1958,7 @@ export declare enum HarmProbability {
1870
1958
  HIGH = "HIGH"
1871
1959
  }
1872
1960
 
1961
+ /** Output only. Harm severity levels in the content. */
1873
1962
  export declare enum HarmSeverity {
1874
1963
  HARM_SEVERITY_UNSPECIFIED = "HARM_SEVERITY_UNSPECIFIED",
1875
1964
  HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
@@ -1962,6 +2051,7 @@ declare interface Image_2 {
1962
2051
  }
1963
2052
  export { Image_2 as Image }
1964
2053
 
2054
+ /** Enum that specifies the language of the text in the prompt. */
1965
2055
  export declare enum ImagePromptLanguage {
1966
2056
  auto = "auto",
1967
2057
  en = "en",
@@ -1970,6 +2060,7 @@ export declare enum ImagePromptLanguage {
1970
2060
  hi = "hi"
1971
2061
  }
1972
2062
 
2063
+ /** Required. Programming language of the `code`. */
1973
2064
  export declare enum Language {
1974
2065
  LANGUAGE_UNSPECIFIED = "LANGUAGE_UNSPECIFIED",
1975
2066
  PYTHON = "PYTHON"
@@ -2073,9 +2164,21 @@ export declare class Live {
2073
2164
 
2074
2165
  /** Callbacks for the live API. */
2075
2166
  export declare interface LiveCallbacks {
2167
+ /**
2168
+ * Called when the websocket connection is established.
2169
+ */
2076
2170
  onopen?: (() => void) | null;
2171
+ /**
2172
+ * Called when a message is received from the server.
2173
+ */
2077
2174
  onmessage: (e: LiveServerMessage) => void;
2175
+ /**
2176
+ * Called when an error occurs.
2177
+ */
2078
2178
  onerror?: ((e: ErrorEvent) => void) | null;
2179
+ /**
2180
+ * Called when the websocket connection is closed.
2181
+ */
2079
2182
  onclose?: ((e: CloseEvent) => void) | null;
2080
2183
  }
2081
2184
 
@@ -2114,11 +2217,11 @@ export declare interface LiveClientMessage {
2114
2217
 
2115
2218
  /** User input that is sent in real time.
2116
2219
 
2117
- This is different from `ClientContentUpdate` in a few ways:
2220
+ This is different from `LiveClientContent` in a few ways:
2118
2221
 
2119
2222
  - Can be sent continuously without interruption to model generation.
2120
2223
  - If there is a need to mix data interleaved across the
2121
- `ClientContentUpdate` and the `RealtimeUpdate`, server attempts to
2224
+ `LiveClientContent` and the `LiveClientRealtimeInput`, server attempts to
2122
2225
  optimize for best response, but there are no guarantees.
2123
2226
  - End of turn is not explicitly specified, but is rather derived from user
2124
2227
  activity (for example, end of speech).
@@ -2130,6 +2233,10 @@ export declare interface LiveClientMessage {
2130
2233
  export declare interface LiveClientRealtimeInput {
2131
2234
  /** Inlined bytes data for media input. */
2132
2235
  mediaChunks?: Blob_2[];
2236
+ /** Marks the start of user activity. */
2237
+ activityStart?: ActivityStart;
2238
+ /** Marks the end of user activity. */
2239
+ activityEnd?: ActivityEnd;
2133
2240
  }
2134
2241
 
2135
2242
  /** Message contains configuration that will apply for the duration of the streaming session. */
@@ -2140,15 +2247,7 @@ export declare interface LiveClientSetup {
2140
2247
  */
2141
2248
  model?: string;
2142
2249
  /** The generation configuration for the session.
2143
-
2144
- The following fields are supported:
2145
- - `response_logprobs`
2146
- - `response_mime_type`
2147
- - `logprobs`
2148
- - `response_schema`
2149
- - `stop_sequence`
2150
- - `routing_config`
2151
- - `audio_timestamp`
2250
+ Note: only a subset of fields are supported.
2152
2251
  */
2153
2252
  generationConfig?: GenerationConfig;
2154
2253
  /** The user provided system instructions for the model.
@@ -2161,6 +2260,16 @@ export declare interface LiveClientSetup {
2161
2260
  external systems to perform an action, or set of actions, outside of
2162
2261
  knowledge and scope of the model. */
2163
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;
2164
2273
  }
2165
2274
 
2166
2275
  /** Client generated response to a `ToolCall` received from the server.
@@ -2199,6 +2308,16 @@ export declare interface LiveConnectConfig {
2199
2308
  external systems to perform an action, or set of actions, outside of
2200
2309
  knowledge and scope of the model. */
2201
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;
2202
2321
  }
2203
2322
 
2204
2323
  /** Parameters for connecting to the live API. */
@@ -2227,6 +2346,10 @@ export declare interface LiveSendClientContentParameters {
2227
2346
  export declare interface LiveSendRealtimeInputParameters {
2228
2347
  /** Realtime input to send to the session. */
2229
2348
  media: Blob_2;
2349
+ /** Marks the start of user activity. */
2350
+ activityStart?: ActivityStart;
2351
+ /** Marks the end of user activity. */
2352
+ activityEnd?: ActivityEnd;
2230
2353
  }
2231
2354
 
2232
2355
  /** Parameters for sending tool responses to the live API. */
@@ -2247,6 +2370,21 @@ export declare interface LiveServerContent {
2247
2370
  turnComplete?: boolean;
2248
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. */
2249
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;
2250
2388
  }
2251
2389
 
2252
2390
  /** Response message for API call. */
@@ -2259,6 +2397,29 @@ export declare interface LiveServerMessage {
2259
2397
  toolCall?: LiveServerToolCall;
2260
2398
  /** Notification for the client that a previously issued `ToolCallMessage` with the specified `id`s should have been not executed and should be cancelled. */
2261
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;
2262
2423
  }
2263
2424
 
2264
2425
  /** Sent in response to a `LiveGenerateContentSetup` message from the client. */
@@ -2340,6 +2501,7 @@ export declare interface MaskReferenceImage {
2340
2501
  config?: MaskReferenceConfig;
2341
2502
  }
2342
2503
 
2504
+ /** Enum representing the mask mode of a mask reference image. */
2343
2505
  export declare enum MaskReferenceMode {
2344
2506
  MASK_MODE_DEFAULT = "MASK_MODE_DEFAULT",
2345
2507
  MASK_MODE_USER_PROVIDED = "MASK_MODE_USER_PROVIDED",
@@ -2348,6 +2510,7 @@ export declare enum MaskReferenceMode {
2348
2510
  MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
2349
2511
  }
2350
2512
 
2513
+ /** Server content modalities. */
2351
2514
  export declare enum MediaModality {
2352
2515
  MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
2353
2516
  TEXT = "TEXT",
@@ -2357,6 +2520,7 @@ export declare enum MediaModality {
2357
2520
  DOCUMENT = "DOCUMENT"
2358
2521
  }
2359
2522
 
2523
+ /** The media resolution to use. */
2360
2524
  export declare enum MediaResolution {
2361
2525
  MEDIA_RESOLUTION_UNSPECIFIED = "MEDIA_RESOLUTION_UNSPECIFIED",
2362
2526
  MEDIA_RESOLUTION_LOW = "MEDIA_RESOLUTION_LOW",
@@ -2364,6 +2528,7 @@ export declare enum MediaResolution {
2364
2528
  MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
2365
2529
  }
2366
2530
 
2531
+ /** Server content modalities. */
2367
2532
  export declare enum Modality {
2368
2533
  MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
2369
2534
  TEXT = "TEXT",
@@ -2379,11 +2544,40 @@ export declare interface ModalityTokenCount {
2379
2544
  tokenCount?: number;
2380
2545
  }
2381
2546
 
2547
+ /** The mode of the predictor to be used in dynamic retrieval. */
2382
2548
  export declare enum Mode {
2383
2549
  MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
2384
2550
  MODE_DYNAMIC = "MODE_DYNAMIC"
2385
2551
  }
2386
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
+
2387
2581
  export declare class Models extends BaseModule {
2388
2582
  private readonly apiClient;
2389
2583
  constructor(apiClient: ApiClient);
@@ -2534,6 +2728,15 @@ export declare class Models extends BaseModule {
2534
2728
  * ```
2535
2729
  */
2536
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>;
2537
2740
  /**
2538
2741
  * Counts the number of tokens in the given contents. Multimodal input is
2539
2742
  * supported for Gemini models.
@@ -2587,10 +2790,10 @@ export declare class Models extends BaseModule {
2587
2790
  *
2588
2791
  * while (!operation.done) {
2589
2792
  * await new Promise(resolve => setTimeout(resolve, 10000));
2590
- * operation = await ai.operations.get({operation: operation});
2793
+ * operation = await ai.operations.getVideosOperation({operation: operation});
2591
2794
  * }
2592
2795
  *
2593
- * console.log(operation.result?.generatedVideos?.[0]?.video?.uri);
2796
+ * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
2594
2797
  * ```
2595
2798
  */
2596
2799
  generateVideos(params: types.GenerateVideosParameters): Promise<types.GenerateVideosOperation>;
@@ -2610,10 +2813,10 @@ export declare class Operations extends BaseModule {
2610
2813
  /**
2611
2814
  * Gets the status of a long-running operation.
2612
2815
  *
2613
- * @param operation The Operation object returned by a previous API call.
2816
+ * @param parameters The parameters for the get operation request.
2614
2817
  * @return The updated Operation object, with the latest status or result.
2615
2818
  */
2616
- get(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
2819
+ getVideosOperation(parameters: types.OperationGetParameters): Promise<types.GenerateVideosOperation>;
2617
2820
  private getVideosOperationInternal;
2618
2821
  private fetchPredictVideosOperationInternal;
2619
2822
  }
@@ -2623,6 +2826,7 @@ export declare class Operations extends BaseModule {
2623
2826
  * Copyright 2025 Google LLC
2624
2827
  * SPDX-License-Identifier: Apache-2.0
2625
2828
  */
2829
+ /** Required. Outcome of the code execution. */
2626
2830
  export declare enum Outcome {
2627
2831
  OUTCOME_UNSPECIFIED = "OUTCOME_UNSPECIFIED",
2628
2832
  OUTCOME_OK = "OUTCOME_OK",
@@ -2788,6 +2992,7 @@ export declare type PartListUnion = PartUnion[] | PartUnion;
2788
2992
 
2789
2993
  export declare type PartUnion = Part | string;
2790
2994
 
2995
+ /** Enum that controls the generation of people. */
2791
2996
  export declare enum PersonGeneration {
2792
2997
  DONT_ALLOW = "DONT_ALLOW",
2793
2998
  ALLOW_ADULT = "ALLOW_ADULT",
@@ -2816,6 +3021,20 @@ export declare interface RawReferenceImage {
2816
3021
  referenceType?: string;
2817
3022
  }
2818
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
+
2819
3038
  /** Represents a recorded session. */
2820
3039
  export declare interface ReplayFile {
2821
3040
  replayId?: string;
@@ -2873,6 +3092,7 @@ export declare interface SafetyAttributes {
2873
3092
  contentType?: string;
2874
3093
  }
2875
3094
 
3095
+ /** Enum that controls the safety filter level for objectionable content. */
2876
3096
  export declare enum SafetyFilterLevel {
2877
3097
  BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
2878
3098
  BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
@@ -3121,7 +3341,31 @@ export declare class Session {
3121
3341
  close(): void;
3122
3342
  }
3123
3343
 
3124
- declare function setValueByPath(data: Record<string, unknown>, keys: string[], value: unknown): void;
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
+ }
3125
3369
 
3126
3370
  /** The speech generation configuration. */
3127
3371
  export declare interface SpeechConfig {
@@ -3132,10 +3376,11 @@ export declare interface SpeechConfig {
3132
3376
 
3133
3377
  export declare type SpeechConfigUnion = SpeechConfig | string;
3134
3378
 
3135
- export declare enum State {
3136
- STATE_UNSPECIFIED = "STATE_UNSPECIFIED",
3137
- ACTIVE = "ACTIVE",
3138
- ERROR = "ERROR"
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"
3139
3384
  }
3140
3385
 
3141
3386
  /** Configuration for a Style reference image. */
@@ -3190,6 +3435,7 @@ export declare interface SubjectReferenceImage {
3190
3435
  config?: SubjectReferenceConfig;
3191
3436
  }
3192
3437
 
3438
+ /** Enum representing the subject type of a subject reference image. */
3193
3439
  export declare enum SubjectReferenceType {
3194
3440
  SUBJECT_TYPE_DEFAULT = "SUBJECT_TYPE_DEFAULT",
3195
3441
  SUBJECT_TYPE_PERSON = "SUBJECT_TYPE_PERSON",
@@ -3228,6 +3474,9 @@ export declare interface ThinkingConfig {
3228
3474
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
3229
3475
  */
3230
3476
  includeThoughts?: boolean;
3477
+ /** Indicates the thinking budget in tokens.
3478
+ */
3479
+ thinkingBudget?: number;
3231
3480
  }
3232
3481
 
3233
3482
  /** Tokens info with a list of tokens and the corresponding list of token ids. */
@@ -3270,6 +3519,31 @@ export declare interface ToolConfig {
3270
3519
 
3271
3520
  export declare type ToolListUnion = Tool[];
3272
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. */
3273
3547
  export declare enum Type {
3274
3548
  TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
3275
3549
  STRING = "STRING",
@@ -3302,11 +3576,11 @@ declare namespace types {
3302
3576
  HarmProbability,
3303
3577
  HarmSeverity,
3304
3578
  BlockedReason,
3579
+ TrafficType,
3305
3580
  Modality,
3306
- State,
3581
+ MediaResolution,
3307
3582
  DynamicRetrievalConfigMode,
3308
3583
  FunctionCallingConfigMode,
3309
- MediaResolution,
3310
3584
  SafetyFilterLevel,
3311
3585
  PersonGeneration,
3312
3586
  ImagePromptLanguage,
@@ -3316,6 +3590,10 @@ declare namespace types {
3316
3590
  ControlReferenceType,
3317
3591
  SubjectReferenceType,
3318
3592
  MediaModality,
3593
+ StartSensitivity,
3594
+ EndSensitivity,
3595
+ ActivityHandling,
3596
+ TurnCoverage,
3319
3597
  VideoMetadata,
3320
3598
  CodeExecutionResult,
3321
3599
  ExecutableCode,
@@ -3381,6 +3659,11 @@ declare namespace types {
3381
3659
  SafetyAttributes,
3382
3660
  GeneratedImage,
3383
3661
  GenerateImagesResponse,
3662
+ GetModelConfig,
3663
+ GetModelParameters,
3664
+ Endpoint,
3665
+ TunedModelInfo,
3666
+ Model,
3384
3667
  GenerationConfig,
3385
3668
  CountTokensConfig,
3386
3669
  CountTokensParameters,
@@ -3418,6 +3701,7 @@ declare namespace types {
3418
3701
  CreateFileParameters,
3419
3702
  HttpResponse,
3420
3703
  LiveCallbacks,
3704
+ UploadFileParameters,
3421
3705
  CreateFileResponse,
3422
3706
  GetFileConfig,
3423
3707
  GetFileParameters,
@@ -3451,12 +3735,23 @@ declare namespace types {
3451
3735
  LiveServerContent,
3452
3736
  LiveServerToolCall,
3453
3737
  LiveServerToolCallCancellation,
3738
+ UsageMetadata,
3739
+ LiveServerGoAway,
3740
+ LiveServerSessionResumptionUpdate,
3454
3741
  LiveServerMessage,
3742
+ AutomaticActivityDetection,
3743
+ RealtimeInputConfig,
3744
+ SessionResumptionConfig,
3745
+ SlidingWindow,
3746
+ ContextWindowCompressionConfig,
3455
3747
  LiveClientSetup,
3456
3748
  LiveClientContent,
3749
+ ActivityStart,
3750
+ ActivityEnd,
3457
3751
  LiveClientRealtimeInput,
3458
3752
  LiveClientToolResponse,
3459
3753
  LiveClientMessage,
3754
+ AudioTranscriptionConfig,
3460
3755
  LiveConnectConfig,
3461
3756
  LiveConnectParameters,
3462
3757
  CreateChatParameters,
@@ -3530,9 +3825,9 @@ export declare interface UploadFileConfig {
3530
3825
  }
3531
3826
 
3532
3827
  /** Parameters for the upload file method. */
3533
- declare interface UploadFileParameters {
3828
+ export declare interface UploadFileParameters {
3534
3829
  /** The string path to the file to be uploaded or a Blob object. */
3535
- file: string | Blob;
3830
+ file: string | globalThis.Blob;
3536
3831
  /** Configuration that contains optional parameters. */
3537
3832
  config?: UploadFileConfig;
3538
3833
  }
@@ -3568,6 +3863,33 @@ export declare interface UpscaleImageParameters {
3568
3863
  config?: UpscaleImageConfig;
3569
3864
  }
3570
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
+
3571
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 */
3572
3894
  export declare interface VertexAISearch {
3573
3895
  /** Optional. Fully-qualified Vertex AI Search data store resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}` */