@google/genai 1.32.0 → 1.33.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,8 @@
1
+ /// <reference types="node" />
2
+
1
3
  import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
4
  import { GoogleAuthOptions } from 'google-auth-library';
5
+ import { ReadableStream as ReadableStream_2 } from 'stream/web';
3
6
 
4
7
  /** Marks the end of user activity.
5
8
 
@@ -63,6 +66,41 @@ export declare enum AdapterSize {
63
66
  ADAPTER_SIZE_THIRTY_TWO = "ADAPTER_SIZE_THIRTY_TWO"
64
67
  }
65
68
 
69
+ /**
70
+ * The configuration for allowed tools.
71
+ */
72
+ declare interface AllowedTools {
73
+ /**
74
+ * The mode of the tool choice.
75
+ */
76
+ mode?: ToolChoiceType;
77
+ /**
78
+ * The names of the allowed tools.
79
+ */
80
+ tools?: Array<string>;
81
+ }
82
+
83
+ /**
84
+ * Citation information for model-generated content.
85
+ */
86
+ declare interface Annotation {
87
+ /**
88
+ * End of the attributed segment, exclusive.
89
+ */
90
+ end_index?: number;
91
+ /**
92
+ * Source attributed for a portion of the text. Could be a URL, title, or
93
+ * other identifier.
94
+ */
95
+ source?: string;
96
+ /**
97
+ * Start of segment of the response that is attributed to this source.
98
+ *
99
+ * Index indicates the start of the segment, measured in bytes.
100
+ */
101
+ start_index?: number;
102
+ }
103
+
66
104
  /** The generic reusable api auth config. Deprecated. Please use AuthConfig (google/cloud/aiplatform/master/auth.proto) instead. This data type is not supported in Gemini API. */
67
105
  export declare interface ApiAuth {
68
106
  /** The API secret. */
@@ -217,6 +255,31 @@ declare interface ApiClientInitOptions {
217
255
  userAgentExtra?: string;
218
256
  }
219
257
 
258
+ declare class APIConnectionError extends APIError<undefined, undefined, undefined> {
259
+ constructor({ message, cause }: {
260
+ message?: string | undefined;
261
+ cause?: Error | undefined;
262
+ });
263
+ }
264
+
265
+ declare class APIConnectionTimeoutError extends APIConnectionError {
266
+ constructor({ message }?: {
267
+ message?: string;
268
+ });
269
+ }
270
+
271
+ declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends GeminiNextGenAPIClientError {
272
+ /** HTTP status for the response that caused the error */
273
+ readonly status: TStatus;
274
+ /** HTTP headers for the response that caused the error */
275
+ readonly headers: THeaders;
276
+ /** JSON body of the response that caused the error */
277
+ readonly error: TError;
278
+ constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders);
279
+ private static makeMessage;
280
+ static generate(status: number | undefined, errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined): APIError;
281
+ }
282
+
220
283
  /**
221
284
  * API errors raised by the GenAI API.
222
285
  */
@@ -253,6 +316,68 @@ export declare interface ApiKeyConfig {
253
316
  name?: string;
254
317
  }
255
318
 
319
+ /**
320
+ * A subclass of `Promise` providing additional helper methods
321
+ * for interacting with the SDK.
322
+ */
323
+ declare class APIPromise<T> extends Promise<T> {
324
+ private responsePromise;
325
+ private parseResponse;
326
+ private parsedPromise;
327
+ private client;
328
+ constructor(client: BaseGeminiNextGenAPIClient, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: BaseGeminiNextGenAPIClient, props: APIResponseProps) => PromiseOrValue<T>);
329
+ _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
330
+ /**
331
+ * Gets the raw `Response` instance instead of parsing the response
332
+ * data.
333
+ *
334
+ * If you want to parse the response body but still get the `Response`
335
+ * instance, you can use {@link withResponse()}.
336
+ *
337
+ * 👋 Getting the wrong TypeScript type for `Response`?
338
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
339
+ * to your `tsconfig.json`.
340
+ */
341
+ asResponse(): Promise<Response>;
342
+ /**
343
+ * Gets the parsed response data and the raw `Response` instance.
344
+ *
345
+ * If you just want to get the raw `Response` instance without parsing it,
346
+ * you can use {@link asResponse()}.
347
+ *
348
+ * 👋 Getting the wrong TypeScript type for `Response`?
349
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
350
+ * to your `tsconfig.json`.
351
+ */
352
+ withResponse(): Promise<{
353
+ data: T;
354
+ response: Response;
355
+ }>;
356
+ private parse;
357
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
358
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
359
+ finally(onfinally?: (() => void) | undefined | null): Promise<T>;
360
+ }
361
+
362
+ declare abstract class APIResource {
363
+ /**
364
+ * The key path from the client. For example, a resource accessible as `client.resource.subresource` would
365
+ * have a property `static override readonly _key = Object.freeze(['resource', 'subresource'] as const);`.
366
+ */
367
+ static readonly _key: readonly string[];
368
+ protected _client: BaseGeminiNextGenAPIClient;
369
+ constructor(client: BaseGeminiNextGenAPIClient);
370
+ }
371
+
372
+ declare type APIResponseProps = {
373
+ response: Response;
374
+ options: FinalRequestOptions;
375
+ controller: AbortController;
376
+ requestLogID: string;
377
+ retryOfRequestLogID: string | undefined;
378
+ startTime: number;
379
+ };
380
+
256
381
  /** The API spec that the external API implements. This enum is not supported in Gemini API. */
257
382
  export declare enum ApiSpec {
258
383
  /**
@@ -269,6 +394,12 @@ export declare enum ApiSpec {
269
394
  ELASTIC_SEARCH = "ELASTIC_SEARCH"
270
395
  }
271
396
 
397
+ declare class APIUserAbortError extends APIError<undefined, undefined, undefined> {
398
+ constructor({ message }?: {
399
+ message?: string;
400
+ });
401
+ }
402
+
272
403
  /** Representation of an audio chunk. */
273
404
  export declare interface AudioChunk {
274
405
  /** Raw bytes of audio data.
@@ -280,6 +411,27 @@ export declare interface AudioChunk {
280
411
  sourceMetadata?: LiveMusicSourceMetadata;
281
412
  }
282
413
 
414
+ /**
415
+ * An audio content block.
416
+ */
417
+ declare interface AudioContent {
418
+ /**
419
+ * Used as the OpenAPI type discriminator for the content oneof.
420
+ */
421
+ type: 'audio';
422
+ data?: string;
423
+ /**
424
+ * The mime type of the audio.
425
+ */
426
+ mime_type?: AudioMimeType;
427
+ uri?: string;
428
+ }
429
+
430
+ /**
431
+ * The mime type of the audio.
432
+ */
433
+ declare type AudioMimeType = 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | (string & {});
434
+
283
435
  /** The audio transcription configuration in Setup. */
284
436
  export declare interface AudioTranscriptionConfig {
285
437
  }
@@ -346,6 +498,9 @@ export declare interface AuthConfigOidcConfig {
346
498
  serviceAccount?: string;
347
499
  }
348
500
 
501
+ declare class AuthenticationError extends APIError<401, Headers> {
502
+ }
503
+
349
504
  /** Config for auth_tokens.create parameters. */
350
505
  export declare interface AuthToken {
351
506
  /** The name of the auth token. */
@@ -417,6 +572,257 @@ export declare interface AutomaticFunctionCallingConfig {
417
572
  ignoreCallHistory?: boolean;
418
573
  }
419
574
 
575
+ declare class BadRequestError extends APIError<400, Headers> {
576
+ }
577
+
578
+ declare interface BaseCreateAgentInteractionParams {
579
+ /**
580
+ * Body param: The name of the `Agent` used for generating the interaction.
581
+ */
582
+ agent: (string & {}) | 'deep-research-pro-preview-12-2025';
583
+ /**
584
+ * Body param: The inputs for the interaction.
585
+ */
586
+ input: string | Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent> | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent;
587
+ /**
588
+ * Path param: Which version of the API to use.
589
+ */
590
+ api_version?: string;
591
+ /**
592
+ * Body param: Configuration for the agent.
593
+ */
594
+ agent_config?: DynamicAgentConfig | DeepResearchAgentConfig;
595
+ /**
596
+ * Body param: Whether to run the model interaction in the background.
597
+ */
598
+ background?: boolean;
599
+ /**
600
+ * Body param: The ID of the previous interaction, if any.
601
+ */
602
+ previous_interaction_id?: string;
603
+ /**
604
+ * Body param: Enforces that the generated response is a JSON object that complies with
605
+ * the JSON schema specified in this field.
606
+ */
607
+ response_format?: unknown;
608
+ /**
609
+ * Body param: The mime type of the response. This is required if response_format is set.
610
+ */
611
+ response_mime_type?: string;
612
+ /**
613
+ * Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
614
+ */
615
+ response_modalities?: Array<'text' | 'image' | 'audio'>;
616
+ /**
617
+ * Body param: Input only. Whether to store the response and request for later retrieval.
618
+ */
619
+ store?: boolean;
620
+ /**
621
+ * Body param: Input only. Whether the interaction will be streamed.
622
+ */
623
+ stream?: boolean;
624
+ /**
625
+ * Body param: System instruction for the interaction.
626
+ */
627
+ system_instruction?: string;
628
+ /**
629
+ * Body param: A list of tool declarations the model may call during interaction.
630
+ */
631
+ tools?: Array<Tool_2>;
632
+ }
633
+
634
+ declare interface BaseCreateModelInteractionParams {
635
+ /**
636
+ * Body param: The inputs for the interaction.
637
+ */
638
+ input: string | Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent> | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent;
639
+ /**
640
+ * Body param: The name of the `Model` used for generating the interaction.
641
+ */
642
+ model: Model_2;
643
+ /**
644
+ * Path param: Which version of the API to use.
645
+ */
646
+ api_version?: string;
647
+ /**
648
+ * Body param: Whether to run the model interaction in the background.
649
+ */
650
+ background?: boolean;
651
+ /**
652
+ * Body param: Input only. Configuration parameters for the model interaction.
653
+ */
654
+ generation_config?: GenerationConfig_2;
655
+ /**
656
+ * Body param: The ID of the previous interaction, if any.
657
+ */
658
+ previous_interaction_id?: string;
659
+ /**
660
+ * Body param: Enforces that the generated response is a JSON object that complies with
661
+ * the JSON schema specified in this field.
662
+ */
663
+ response_format?: unknown;
664
+ /**
665
+ * Body param: The mime type of the response. This is required if response_format is set.
666
+ */
667
+ response_mime_type?: string;
668
+ /**
669
+ * Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
670
+ */
671
+ response_modalities?: Array<'text' | 'image' | 'audio'>;
672
+ /**
673
+ * Body param: Input only. Whether to store the response and request for later retrieval.
674
+ */
675
+ store?: boolean;
676
+ /**
677
+ * Body param: Input only. Whether the interaction will be streamed.
678
+ */
679
+ stream?: boolean;
680
+ /**
681
+ * Body param: System instruction for the interaction.
682
+ */
683
+ system_instruction?: string;
684
+ /**
685
+ * Body param: A list of tool declarations the model may call during interaction.
686
+ */
687
+ tools?: Array<Tool_2>;
688
+ }
689
+
690
+ /**
691
+ * Base class for Gemini Next Gen API API clients.
692
+ */
693
+ declare class BaseGeminiNextGenAPIClient {
694
+ apiKey: string | null;
695
+ apiVersion: string;
696
+ baseURL: string;
697
+ maxRetries: number;
698
+ timeout: number;
699
+ logger: Logger;
700
+ logLevel: LogLevel | undefined;
701
+ fetchOptions: MergedRequestInit | undefined;
702
+ private fetch;
703
+ private encoder;
704
+ protected idempotencyHeader?: string;
705
+ private _options;
706
+ /**
707
+ * API Client for interfacing with the Gemini Next Gen API API.
708
+ *
709
+ * @param {string | null | undefined} [opts.apiKey=process.env['GEMINI_API_KEY'] ?? null]
710
+ * @param {string | undefined} [opts.apiVersion=v1beta]
711
+ * @param {string} [opts.baseURL=process.env['GEMINI_NEXT_GEN_API_BASE_URL'] ?? https://generativelanguage.googleapis.com] - Override the default base URL for the API.
712
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
713
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
714
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
715
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
716
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
717
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
718
+ */
719
+ constructor({ baseURL, apiKey, apiVersion, ...opts }?: ClientOptions);
720
+ /**
721
+ * Create a new client instance re-using the same options given to the current client with optional overriding.
722
+ */
723
+ withOptions(options: Partial<ClientOptions>): this;
724
+ /**
725
+ * Check whether the base URL is set to its default.
726
+ */
727
+ private baseURLOverridden;
728
+ protected defaultQuery(): Record<string, string | undefined> | undefined;
729
+ protected validateHeaders({ values, nulls }: NullableHeaders): void;
730
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
731
+ /**
732
+ * Basic re-implementation of `qs.stringify` for primitive types.
733
+ */
734
+ protected stringifyQuery(query: Record<string, unknown>): string;
735
+ private getUserAgent;
736
+ protected defaultIdempotencyKey(): string;
737
+ protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
738
+ buildURL(path: string, query: Record<string, unknown> | null | undefined, defaultBaseURL?: string | undefined): string;
739
+ /**
740
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
741
+ */
742
+ protected prepareOptions(options: FinalRequestOptions): Promise<void>;
743
+ /**
744
+ * Used as a callback for mutating the given `RequestInit` object.
745
+ *
746
+ * This is useful for cases where you want to add certain headers based off of
747
+ * the request properties, e.g. `method` or `url`.
748
+ */
749
+ protected prepareRequest(request: _RequestInit, { url, options }: {
750
+ url: string;
751
+ options: FinalRequestOptions;
752
+ }): Promise<void>;
753
+ get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
754
+ post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
755
+ patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
756
+ put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
757
+ delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
758
+ private methodRequest;
759
+ request<Rsp>(options: PromiseOrValue<FinalRequestOptions>, remainingRetries?: number | null): APIPromise<Rsp>;
760
+ private makeRequest;
761
+ fetchWithTimeout(url: _RequestInfo, init: _RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
762
+ private shouldRetry;
763
+ private retryRequest;
764
+ private calculateDefaultRetryTimeoutMillis;
765
+ buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
766
+ retryCount?: number;
767
+ }): Promise<{
768
+ req: FinalizedRequestInit;
769
+ url: string;
770
+ timeout: number;
771
+ }>;
772
+ private buildHeaders;
773
+ private buildBody;
774
+ static DEFAULT_TIMEOUT: number;
775
+ }
776
+
777
+ declare class BaseInteractions extends APIResource {
778
+ static readonly _key: readonly ['interactions'];
779
+ /**
780
+ * Creates a new interaction.
781
+ *
782
+ * @example
783
+ * ```ts
784
+ * const interaction = await client.interactions.create({
785
+ * input: 'string',
786
+ * model: 'gemini-2.5-pro',
787
+ * });
788
+ * ```
789
+ */
790
+ create(params: CreateModelInteractionParamsNonStreaming, options?: RequestOptions): APIPromise<Interaction>;
791
+ create(params: CreateModelInteractionParamsStreaming, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent>>;
792
+ create(params: CreateAgentInteractionParamsNonStreaming, options?: RequestOptions): APIPromise<Interaction>;
793
+ create(params: CreateAgentInteractionParamsStreaming, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent>>;
794
+ create(params: BaseCreateModelInteractionParams | BaseCreateAgentInteractionParams, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent> | Interaction>;
795
+ /**
796
+ * Deletes the interaction by id.
797
+ *
798
+ * @example
799
+ * ```ts
800
+ * const interaction = await client.interactions.delete('id');
801
+ * ```
802
+ */
803
+ delete(id: string, params?: InteractionDeleteParams | null | undefined, options?: RequestOptions): APIPromise<unknown>;
804
+ /**
805
+ * Cancels an interaction by id. This only applies to background interactions that are still running.
806
+ *
807
+ * @example
808
+ * ```ts
809
+ * const interaction = await client.interactions.cancel('id');
810
+ * ```
811
+ */
812
+ cancel(id: string, params?: InteractionCancelParams | null | undefined, options?: RequestOptions): APIPromise<Interaction>;
813
+ /**
814
+ * Retrieves the full details of a single interaction based on its `Interaction.id`.
815
+ *
816
+ * @example
817
+ * ```ts
818
+ * const interaction = await client.interactions.get('id');
819
+ * ```
820
+ */
821
+ get(id: string, params?: InteractionGetParamsNonStreaming, options?: RequestOptions): APIPromise<Interaction>;
822
+ get(id: string, params: InteractionGetParamsStreaming, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent>>;
823
+ get(id: string, params?: InteractionGetParamsBase | undefined, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent> | Interaction>;
824
+ }
825
+
420
826
  /**
421
827
  * @license
422
828
  * Copyright 2025 Google LLC
@@ -705,6 +1111,11 @@ export declare enum BlockedReason {
705
1111
  JAILBREAK = "JAILBREAK"
706
1112
  }
707
1113
 
1114
+ declare const brand_privateNullableHeaders: unique symbol;
1115
+
1116
+ /** @ts-ignore For users with \@types/bun */
1117
+ declare type BunRequestInit = globalThis.FetchRequestInit;
1118
+
708
1119
  /** A resource used in LLM queries for users to explicitly specify what to cache. */
709
1120
  export declare interface CachedContent {
710
1121
  /** The server-generated resource name of the cached content. */
@@ -1101,6 +1512,106 @@ export declare interface CitationMetadata {
1101
1512
  citations?: Citation[];
1102
1513
  }
1103
1514
 
1515
+ declare interface ClientOptions {
1516
+ /**
1517
+ * Defaults to process.env['GEMINI_API_KEY'].
1518
+ */
1519
+ apiKey?: string | null | undefined;
1520
+ apiVersion?: string | undefined;
1521
+ /**
1522
+ * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
1523
+ *
1524
+ * Defaults to process.env['GEMINI_NEXT_GEN_API_BASE_URL'].
1525
+ */
1526
+ baseURL?: string | null | undefined;
1527
+ /**
1528
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
1529
+ * from the server before timing out a single request.
1530
+ *
1531
+ * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
1532
+ * much longer than this timeout before the promise succeeds or fails.
1533
+ *
1534
+ * @unit milliseconds
1535
+ */
1536
+ timeout?: number | undefined;
1537
+ /**
1538
+ * Additional `RequestInit` options to be passed to `fetch` calls.
1539
+ * Properties will be overridden by per-request `fetchOptions`.
1540
+ */
1541
+ fetchOptions?: MergedRequestInit | undefined;
1542
+ /**
1543
+ * Specify a custom `fetch` function implementation.
1544
+ *
1545
+ * If not provided, we expect that `fetch` is defined globally.
1546
+ */
1547
+ fetch?: Fetch | undefined;
1548
+ /**
1549
+ * The maximum number of times that the client will retry a request in case of a
1550
+ * temporary failure, like a network error or a 5XX error from the server.
1551
+ *
1552
+ * @default 2
1553
+ */
1554
+ maxRetries?: number | undefined;
1555
+ /**
1556
+ * Default headers to include with every request to the API.
1557
+ *
1558
+ * These can be removed in individual requests by explicitly setting the
1559
+ * header to `null` in request options.
1560
+ */
1561
+ defaultHeaders?: HeadersLike | undefined;
1562
+ /**
1563
+ * Default query parameters to include with every request to the API.
1564
+ *
1565
+ * These can be removed in individual requests by explicitly setting the
1566
+ * param to `undefined` in request options.
1567
+ */
1568
+ defaultQuery?: Record<string, string | undefined> | undefined;
1569
+ /**
1570
+ * Set the log level.
1571
+ *
1572
+ * Defaults to process.env['GEMINI_NEXT_GEN_API_LOG'] or 'warn' if it isn't set.
1573
+ */
1574
+ logLevel?: LogLevel | undefined;
1575
+ /**
1576
+ * Set the logger.
1577
+ *
1578
+ * Defaults to globalThis.console.
1579
+ */
1580
+ logger?: Logger | undefined;
1581
+ }
1582
+
1583
+ /**
1584
+ * The arguments to pass to the code execution.
1585
+ */
1586
+ declare interface CodeExecutionCallArguments {
1587
+ /**
1588
+ * The code to be executed.
1589
+ */
1590
+ code?: string;
1591
+ /**
1592
+ * Programming language of the `code`.
1593
+ */
1594
+ language?: 'python';
1595
+ }
1596
+
1597
+ /**
1598
+ * Code execution content.
1599
+ */
1600
+ declare interface CodeExecutionCallContent {
1601
+ /**
1602
+ * Used as the OpenAPI type discriminator for the content oneof.
1603
+ */
1604
+ type: 'code_execution_call';
1605
+ /**
1606
+ * A unique ID for this specific tool call.
1607
+ */
1608
+ id?: string;
1609
+ /**
1610
+ * The arguments to pass to the code execution.
1611
+ */
1612
+ arguments?: CodeExecutionCallArguments;
1613
+ }
1614
+
1104
1615
  /** Result of executing the [ExecutableCode]. Only generated when using the [CodeExecution] tool, and always follows a `part` containing the [ExecutableCode]. */
1105
1616
  export declare interface CodeExecutionResult {
1106
1617
  /** Required. Outcome of the code execution. */
@@ -1109,6 +1620,32 @@ export declare interface CodeExecutionResult {
1109
1620
  output?: string;
1110
1621
  }
1111
1622
 
1623
+ /**
1624
+ * Code execution result content.
1625
+ */
1626
+ declare interface CodeExecutionResultContent {
1627
+ /**
1628
+ * Used as the OpenAPI type discriminator for the content oneof.
1629
+ */
1630
+ type: 'code_execution_result';
1631
+ /**
1632
+ * ID to match the ID from the code execution call block.
1633
+ */
1634
+ call_id?: string;
1635
+ /**
1636
+ * Whether the code execution resulted in an error.
1637
+ */
1638
+ is_error?: boolean;
1639
+ /**
1640
+ * The output of the code execution.
1641
+ */
1642
+ result?: string;
1643
+ /**
1644
+ * A signature hash for backend validation.
1645
+ */
1646
+ signature?: string;
1647
+ }
1648
+
1112
1649
  /** Success and error statistics of processing multiple entities (for example, DataItems or structured data rows) in batch. This data type is not supported in Gemini API. */
1113
1650
  export declare interface CompletionStats {
1114
1651
  /** Output only. The number of entities for which any error was encountered. */
@@ -1166,6 +1703,13 @@ export declare class ComputeTokensResponse {
1166
1703
  tokensInfo?: TokensInfo[];
1167
1704
  }
1168
1705
 
1706
+ declare type _ConditionalNodeReadableStream<R = any> = typeof globalThis extends {
1707
+ ReadableStream: any;
1708
+ } ? never : _NodeReadableStream<R>;
1709
+
1710
+ declare class ConflictError extends APIError<409, Headers> {
1711
+ }
1712
+
1169
1713
  /** Contains the multi-part content of a message. */
1170
1714
  export declare interface Content {
1171
1715
  /** List of parts that constitute a single message. Each part may have
@@ -1175,6 +1719,282 @@ export declare interface Content {
1175
1719
  role?: string;
1176
1720
  }
1177
1721
 
1722
+ declare interface ContentDelta {
1723
+ delta?: ContentDelta.TextDelta | ContentDelta.ImageDelta | ContentDelta.AudioDelta | ContentDelta.DocumentDelta | ContentDelta.VideoDelta | ContentDelta.ThoughtSummaryDelta | ContentDelta.ThoughtSignatureDelta | ContentDelta.FunctionCallDelta | ContentDelta.FunctionResultDelta | ContentDelta.CodeExecutionCallDelta | ContentDelta.CodeExecutionResultDelta | ContentDelta.URLContextCallDelta | ContentDelta.URLContextResultDelta | ContentDelta.GoogleSearchCallDelta | ContentDelta.GoogleSearchResultDelta | ContentDelta.MCPServerToolCallDelta | ContentDelta.MCPServerToolResultDelta | ContentDelta.FileSearchResultDelta;
1724
+ /**
1725
+ * The event_id token to be used to resume the interaction stream, from
1726
+ * this event.
1727
+ */
1728
+ event_id?: string;
1729
+ event_type?: 'content.delta';
1730
+ index?: number;
1731
+ }
1732
+
1733
+ declare namespace ContentDelta {
1734
+ interface TextDelta {
1735
+ /**
1736
+ * Used as the OpenAPI type discriminator for the content oneof.
1737
+ */
1738
+ type: 'text';
1739
+ /**
1740
+ * Citation information for model-generated content.
1741
+ */
1742
+ annotations?: Array<InteractionsAPI.Annotation>;
1743
+ text?: string;
1744
+ }
1745
+ interface ImageDelta {
1746
+ /**
1747
+ * Used as the OpenAPI type discriminator for the content oneof.
1748
+ */
1749
+ type: 'image';
1750
+ data?: string;
1751
+ /**
1752
+ * The mime type of the image.
1753
+ */
1754
+ mime_type?: InteractionsAPI.ImageMimeType;
1755
+ /**
1756
+ * The resolution of the media.
1757
+ */
1758
+ resolution?: 'low' | 'medium' | 'high';
1759
+ uri?: string;
1760
+ }
1761
+ interface AudioDelta {
1762
+ /**
1763
+ * Used as the OpenAPI type discriminator for the content oneof.
1764
+ */
1765
+ type: 'audio';
1766
+ data?: string;
1767
+ /**
1768
+ * The mime type of the audio.
1769
+ */
1770
+ mime_type?: InteractionsAPI.AudioMimeType;
1771
+ uri?: string;
1772
+ }
1773
+ interface DocumentDelta {
1774
+ /**
1775
+ * Used as the OpenAPI type discriminator for the content oneof.
1776
+ */
1777
+ type: 'document';
1778
+ data?: string;
1779
+ mime_type?: string;
1780
+ uri?: string;
1781
+ }
1782
+ interface VideoDelta {
1783
+ /**
1784
+ * Used as the OpenAPI type discriminator for the content oneof.
1785
+ */
1786
+ type: 'video';
1787
+ data?: string;
1788
+ /**
1789
+ * The mime type of the video.
1790
+ */
1791
+ mime_type?: InteractionsAPI.VideoMimeType;
1792
+ /**
1793
+ * The resolution of the media.
1794
+ */
1795
+ resolution?: 'low' | 'medium' | 'high';
1796
+ uri?: string;
1797
+ }
1798
+ interface ThoughtSummaryDelta {
1799
+ /**
1800
+ * Used as the OpenAPI type discriminator for the content oneof.
1801
+ */
1802
+ type: 'thought_summary';
1803
+ /**
1804
+ * A text content block.
1805
+ */
1806
+ content?: InteractionsAPI.TextContent | InteractionsAPI.ImageContent;
1807
+ }
1808
+ interface ThoughtSignatureDelta {
1809
+ /**
1810
+ * Used as the OpenAPI type discriminator for the content oneof.
1811
+ */
1812
+ type: 'thought_signature';
1813
+ /**
1814
+ * Signature to match the backend source to be part of the generation.
1815
+ */
1816
+ signature?: string;
1817
+ }
1818
+ interface FunctionCallDelta {
1819
+ /**
1820
+ * Used as the OpenAPI type discriminator for the content oneof.
1821
+ */
1822
+ type: 'function_call';
1823
+ /**
1824
+ * A unique ID for this specific tool call.
1825
+ */
1826
+ id?: string;
1827
+ arguments?: {
1828
+ [key: string]: unknown;
1829
+ };
1830
+ name?: string;
1831
+ }
1832
+ interface FunctionResultDelta {
1833
+ /**
1834
+ * Used as the OpenAPI type discriminator for the content oneof.
1835
+ */
1836
+ type: 'function_result';
1837
+ /**
1838
+ * ID to match the ID from the function call block.
1839
+ */
1840
+ call_id?: string;
1841
+ is_error?: boolean;
1842
+ name?: string;
1843
+ /**
1844
+ * Tool call result delta.
1845
+ */
1846
+ result?: FunctionResultDelta.Items | string;
1847
+ }
1848
+ namespace FunctionResultDelta {
1849
+ interface Items {
1850
+ items?: Array<string | InteractionsAPI.ImageContent>;
1851
+ }
1852
+ }
1853
+ interface CodeExecutionCallDelta {
1854
+ /**
1855
+ * Used as the OpenAPI type discriminator for the content oneof.
1856
+ */
1857
+ type: 'code_execution_call';
1858
+ /**
1859
+ * A unique ID for this specific tool call.
1860
+ */
1861
+ id?: string;
1862
+ /**
1863
+ * The arguments to pass to the code execution.
1864
+ */
1865
+ arguments?: InteractionsAPI.CodeExecutionCallArguments;
1866
+ }
1867
+ interface CodeExecutionResultDelta {
1868
+ /**
1869
+ * Used as the OpenAPI type discriminator for the content oneof.
1870
+ */
1871
+ type: 'code_execution_result';
1872
+ /**
1873
+ * ID to match the ID from the function call block.
1874
+ */
1875
+ call_id?: string;
1876
+ is_error?: boolean;
1877
+ result?: string;
1878
+ signature?: string;
1879
+ }
1880
+ interface URLContextCallDelta {
1881
+ /**
1882
+ * Used as the OpenAPI type discriminator for the content oneof.
1883
+ */
1884
+ type: 'url_context_call';
1885
+ /**
1886
+ * A unique ID for this specific tool call.
1887
+ */
1888
+ id?: string;
1889
+ /**
1890
+ * The arguments to pass to the URL context.
1891
+ */
1892
+ arguments?: InteractionsAPI.URLContextCallArguments;
1893
+ }
1894
+ interface URLContextResultDelta {
1895
+ /**
1896
+ * Used as the OpenAPI type discriminator for the content oneof.
1897
+ */
1898
+ type: 'url_context_result';
1899
+ /**
1900
+ * ID to match the ID from the function call block.
1901
+ */
1902
+ call_id?: string;
1903
+ is_error?: boolean;
1904
+ result?: Array<InteractionsAPI.URLContextResult>;
1905
+ signature?: string;
1906
+ }
1907
+ interface GoogleSearchCallDelta {
1908
+ /**
1909
+ * Used as the OpenAPI type discriminator for the content oneof.
1910
+ */
1911
+ type: 'google_search_call';
1912
+ /**
1913
+ * A unique ID for this specific tool call.
1914
+ */
1915
+ id?: string;
1916
+ /**
1917
+ * The arguments to pass to Google Search.
1918
+ */
1919
+ arguments?: InteractionsAPI.GoogleSearchCallArguments;
1920
+ }
1921
+ interface GoogleSearchResultDelta {
1922
+ /**
1923
+ * Used as the OpenAPI type discriminator for the content oneof.
1924
+ */
1925
+ type: 'google_search_result';
1926
+ /**
1927
+ * ID to match the ID from the function call block.
1928
+ */
1929
+ call_id?: string;
1930
+ is_error?: boolean;
1931
+ result?: Array<InteractionsAPI.GoogleSearchResult>;
1932
+ signature?: string;
1933
+ }
1934
+ interface MCPServerToolCallDelta {
1935
+ /**
1936
+ * Used as the OpenAPI type discriminator for the content oneof.
1937
+ */
1938
+ type: 'mcp_server_tool_call';
1939
+ /**
1940
+ * A unique ID for this specific tool call.
1941
+ */
1942
+ id?: string;
1943
+ arguments?: {
1944
+ [key: string]: unknown;
1945
+ };
1946
+ name?: string;
1947
+ server_name?: string;
1948
+ }
1949
+ interface MCPServerToolResultDelta {
1950
+ /**
1951
+ * Used as the OpenAPI type discriminator for the content oneof.
1952
+ */
1953
+ type: 'mcp_server_tool_result';
1954
+ /**
1955
+ * ID to match the ID from the function call block.
1956
+ */
1957
+ call_id?: string;
1958
+ name?: string;
1959
+ /**
1960
+ * Tool call result delta.
1961
+ */
1962
+ result?: MCPServerToolResultDelta.Items | string;
1963
+ server_name?: string;
1964
+ }
1965
+ namespace MCPServerToolResultDelta {
1966
+ interface Items {
1967
+ items?: Array<string | InteractionsAPI.ImageContent>;
1968
+ }
1969
+ }
1970
+ interface FileSearchResultDelta {
1971
+ /**
1972
+ * Used as the OpenAPI type discriminator for the content oneof.
1973
+ */
1974
+ type: 'file_search_result';
1975
+ result?: Array<FileSearchResultDelta.Result>;
1976
+ }
1977
+ namespace FileSearchResultDelta {
1978
+ /**
1979
+ * The result of the File Search.
1980
+ */
1981
+ interface Result {
1982
+ /**
1983
+ * The name of the file search store.
1984
+ */
1985
+ file_search_store?: string;
1986
+ /**
1987
+ * The text of the search result.
1988
+ */
1989
+ text?: string;
1990
+ /**
1991
+ * The title of the search result.
1992
+ */
1993
+ title?: string;
1994
+ }
1995
+ }
1996
+ }
1997
+
1178
1998
  /** The embedding generated from an input content. */
1179
1999
  export declare interface ContentEmbedding {
1180
2000
  /** A list of floats representing an embedding.
@@ -1215,6 +2035,30 @@ export declare class ContentReferenceImage {
1215
2035
  toReferenceImageAPI(): ReferenceImageAPIInternal;
1216
2036
  }
1217
2037
 
2038
+ declare interface ContentStart {
2039
+ /**
2040
+ * The content of the response.
2041
+ */
2042
+ content?: TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent;
2043
+ /**
2044
+ * The event_id token to be used to resume the interaction stream, from
2045
+ * this event.
2046
+ */
2047
+ event_id?: string;
2048
+ event_type?: 'content.start';
2049
+ index?: number;
2050
+ }
2051
+
2052
+ declare interface ContentStop {
2053
+ /**
2054
+ * The event_id token to be used to resume the interaction stream, from
2055
+ * this event.
2056
+ */
2057
+ event_id?: string;
2058
+ event_type?: 'content.stop';
2059
+ index?: number;
2060
+ }
2061
+
1218
2062
  export declare type ContentUnion = Content | PartUnion[] | PartUnion;
1219
2063
 
1220
2064
  /** Enables context window compression -- mechanism managing model context window so it does not exceed given length. */
@@ -1310,6 +2154,20 @@ export declare class CountTokensResponse {
1310
2154
  cachedContentTokenCount?: number;
1311
2155
  }
1312
2156
 
2157
+ declare interface CreateAgentInteractionParamsNonStreaming extends BaseCreateAgentInteractionParams {
2158
+ /**
2159
+ * Body param: Input only. Whether the interaction will be streamed.
2160
+ */
2161
+ stream?: false;
2162
+ }
2163
+
2164
+ declare interface CreateAgentInteractionParamsStreaming extends BaseCreateAgentInteractionParams {
2165
+ /**
2166
+ * Body param: Input only. Whether the interaction will be streamed.
2167
+ */
2168
+ stream: true;
2169
+ }
2170
+
1313
2171
  /** Optional parameters. */
1314
2172
  export declare interface CreateAuthTokenConfig {
1315
2173
  /** Used to override HTTP request options. */
@@ -1560,6 +2418,20 @@ export declare function createFunctionResponsePartFromUri(uri: string, mimeType:
1560
2418
  */
1561
2419
  export declare function createModelContent(partOrString: PartListUnion | string): Content;
1562
2420
 
2421
+ declare interface CreateModelInteractionParamsNonStreaming extends BaseCreateModelInteractionParams {
2422
+ /**
2423
+ * Body param: Input only. Whether the interaction will be streamed.
2424
+ */
2425
+ stream?: false;
2426
+ }
2427
+
2428
+ declare interface CreateModelInteractionParamsStreaming extends BaseCreateModelInteractionParams {
2429
+ /**
2430
+ * Body param: Input only. Whether the interaction will be streamed.
2431
+ */
2432
+ stream: true;
2433
+ }
2434
+
1563
2435
  /**
1564
2436
  * Creates a `Part` object from a `base64` encoded `string`.
1565
2437
  */
@@ -1723,6 +2595,20 @@ export declare interface DatasetStats {
1723
2595
  userOutputTokenDistribution?: DatasetDistribution;
1724
2596
  }
1725
2597
 
2598
+ /**
2599
+ * Configuration for the Deep Research agent.
2600
+ */
2601
+ declare interface DeepResearchAgentConfig {
2602
+ /**
2603
+ * Whether to include thought summaries in the response.
2604
+ */
2605
+ thinking_summaries?: 'auto' | 'none';
2606
+ /**
2607
+ * Used as the OpenAPI type discriminator for the content oneof.
2608
+ */
2609
+ type?: 'deep-research';
2610
+ }
2611
+
1726
2612
  /** Optional parameters for models.get method. */
1727
2613
  export declare interface DeleteBatchJobConfig {
1728
2614
  /** Used to override HTTP request options. */
@@ -1917,6 +2803,19 @@ declare interface Document_2 {
1917
2803
  }
1918
2804
  export { Document_2 as Document }
1919
2805
 
2806
+ /**
2807
+ * A document content block.
2808
+ */
2809
+ declare interface DocumentContent {
2810
+ /**
2811
+ * Used as the OpenAPI type discriminator for the content oneof.
2812
+ */
2813
+ type: 'document';
2814
+ data?: string;
2815
+ mime_type?: string;
2816
+ uri?: string;
2817
+ }
2818
+
1920
2819
  declare class Documents extends BaseModule {
1921
2820
  private readonly apiClient;
1922
2821
  constructor(apiClient: ApiClient);
@@ -1959,6 +2858,9 @@ export declare enum DocumentState {
1959
2858
  STATE_FAILED = "STATE_FAILED"
1960
2859
  }
1961
2860
 
2861
+ /** @ts-ignore */
2862
+ declare type _DOMReadableStream<R = any> = globalThis.ReadableStream<R>;
2863
+
1962
2864
  export declare type DownloadableFileUnion = string | File_2 | GeneratedVideo | Video;
1963
2865
 
1964
2866
  declare interface Downloader {
@@ -1995,6 +2897,17 @@ export declare interface DownloadFileParameters {
1995
2897
  config?: DownloadFileConfig;
1996
2898
  }
1997
2899
 
2900
+ /**
2901
+ * Configuration for dynamic agents.
2902
+ */
2903
+ declare interface DynamicAgentConfig {
2904
+ /**
2905
+ * Used as the OpenAPI type discriminator for the content oneof.
2906
+ */
2907
+ type?: 'dynamic';
2908
+ [k: string]: unknown;
2909
+ }
2910
+
1998
2911
  /** Describes the options to customize dynamic retrieval. */
1999
2912
  export declare interface DynamicRetrievalConfig {
2000
2913
  /** The mode of the predictor to be used in dynamic retrieval. */
@@ -2248,6 +3161,53 @@ export declare enum Environment {
2248
3161
  ENVIRONMENT_BROWSER = "ENVIRONMENT_BROWSER"
2249
3162
  }
2250
3163
 
3164
+ declare interface ErrorEvent_2 {
3165
+ /**
3166
+ * Error message from an interaction.
3167
+ */
3168
+ error?: ErrorEvent_2.Error;
3169
+ /**
3170
+ * The event_id token to be used to resume the interaction stream, from
3171
+ * this event.
3172
+ */
3173
+ event_id?: string;
3174
+ event_type?: 'error';
3175
+ }
3176
+
3177
+ declare namespace ErrorEvent_2 {
3178
+ /**
3179
+ * Error message from an interaction.
3180
+ */
3181
+ interface Error {
3182
+ /**
3183
+ * A URI that identifies the error type.
3184
+ */
3185
+ code?: string;
3186
+ /**
3187
+ * A human-readable error message.
3188
+ */
3189
+ message?: string;
3190
+ }
3191
+ }
3192
+
3193
+ declare namespace Errors {
3194
+ export {
3195
+ GeminiNextGenAPIClientError,
3196
+ APIError,
3197
+ APIUserAbortError,
3198
+ APIConnectionError,
3199
+ APIConnectionTimeoutError,
3200
+ BadRequestError,
3201
+ AuthenticationError,
3202
+ PermissionDeniedError,
3203
+ NotFoundError,
3204
+ ConflictError,
3205
+ UnprocessableEntityError,
3206
+ RateLimitError,
3207
+ InternalServerError
3208
+ }
3209
+ }
3210
+
2251
3211
  /** Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the [CodeExecution] tool, in which the code will be automatically executed, and a corresponding [CodeExecutionResult] will also be generated. */
2252
3212
  export declare interface ExecutableCode {
2253
3213
  /** Required. The code to be executed. */
@@ -2294,6 +3254,13 @@ export declare enum FeatureSelectionPreference {
2294
3254
  PRIORITIZE_COST = "PRIORITIZE_COST"
2295
3255
  }
2296
3256
 
3257
+ /**
3258
+ * @license
3259
+ * Copyright 2025 Google LLC
3260
+ * SPDX-License-Identifier: Apache-2.0
3261
+ */
3262
+ declare type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
3263
+
2297
3264
  export declare interface FetchPredictOperationConfig {
2298
3265
  /** Used to override HTTP request options. */
2299
3266
  httpOptions?: HttpOptions;
@@ -2315,6 +3282,9 @@ export declare interface FetchPredictOperationParameters {
2315
3282
  config?: FetchPredictOperationConfig;
2316
3283
  }
2317
3284
 
3285
+ /** @ts-ignore For users who use Deno */
3286
+ declare type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
3287
+
2318
3288
  /** A file uploaded to the API. */
2319
3289
  declare interface File_2 {
2320
3290
  /** The `File` resource name. The ID (name excluding the "files/" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456` */
@@ -2482,6 +3452,40 @@ export declare interface FileSearch {
2482
3452
  metadataFilter?: string;
2483
3453
  }
2484
3454
 
3455
+ /**
3456
+ * File Search result content.
3457
+ */
3458
+ declare interface FileSearchResultContent {
3459
+ /**
3460
+ * Used as the OpenAPI type discriminator for the content oneof.
3461
+ */
3462
+ type: 'file_search_result';
3463
+ /**
3464
+ * The results of the File Search.
3465
+ */
3466
+ result?: Array<FileSearchResultContent.Result>;
3467
+ }
3468
+
3469
+ declare namespace FileSearchResultContent {
3470
+ /**
3471
+ * The result of the File Search.
3472
+ */
3473
+ interface Result {
3474
+ /**
3475
+ * The name of the file search store.
3476
+ */
3477
+ file_search_store?: string;
3478
+ /**
3479
+ * The text of the search result.
3480
+ */
3481
+ text?: string;
3482
+ /**
3483
+ * The title of the search result.
3484
+ */
3485
+ title?: string;
3486
+ }
3487
+ }
3488
+
2485
3489
  /** A collection of Documents. */
2486
3490
  export declare interface FileSearchStore {
2487
3491
  /** The resource name of the FileSearchStore. Example: `fileSearchStores/my-file-search-store-123` */
@@ -2634,6 +3638,15 @@ export declare interface FileStatus {
2634
3638
  code?: number;
2635
3639
  }
2636
3640
 
3641
+ declare type FinalizedRequestInit = RequestInit & {
3642
+ headers: Headers;
3643
+ };
3644
+
3645
+ declare type FinalRequestOptions = RequestOptions & {
3646
+ method: HTTPMethod;
3647
+ path: string;
3648
+ };
3649
+
2637
3650
  /** Output only. The reason why the model stopped generating tokens.
2638
3651
 
2639
3652
  If empty, the model has not stopped generating the tokens. */
@@ -2687,17 +3700,44 @@ export declare enum FinishReason {
2687
3700
  */
2688
3701
  IMAGE_SAFETY = "IMAGE_SAFETY",
2689
3702
  /**
2690
- * The tool call generated by the model is invalid.
3703
+ * The tool call generated by the model is invalid.
3704
+ */
3705
+ UNEXPECTED_TOOL_CALL = "UNEXPECTED_TOOL_CALL",
3706
+ /**
3707
+ * Image generation stopped because the generated images have prohibited content.
3708
+ */
3709
+ IMAGE_PROHIBITED_CONTENT = "IMAGE_PROHIBITED_CONTENT",
3710
+ /**
3711
+ * The model was expected to generate an image, but none was generated.
3712
+ */
3713
+ NO_IMAGE = "NO_IMAGE",
3714
+ /**
3715
+ * Image generation stopped because the generated image may be a recitation from a source.
3716
+ */
3717
+ IMAGE_RECITATION = "IMAGE_RECITATION",
3718
+ /**
3719
+ * Image generation stopped for a reason not otherwise specified.
3720
+ */
3721
+ IMAGE_OTHER = "IMAGE_OTHER"
3722
+ }
3723
+
3724
+ /**
3725
+ * A tool that can be used by the model.
3726
+ */
3727
+ declare interface Function_2 {
3728
+ type: 'function';
3729
+ /**
3730
+ * A description of the function.
2691
3731
  */
2692
- UNEXPECTED_TOOL_CALL = "UNEXPECTED_TOOL_CALL",
3732
+ description?: string;
2693
3733
  /**
2694
- * Image generation stopped because the generated images have prohibited content.
3734
+ * The name of the function.
2695
3735
  */
2696
- IMAGE_PROHIBITED_CONTENT = "IMAGE_PROHIBITED_CONTENT",
3736
+ name?: string;
2697
3737
  /**
2698
- * The model was expected to generate an image, but none was generated.
3738
+ * The JSON Schema for the function's parameters.
2699
3739
  */
2700
- NO_IMAGE = "NO_IMAGE"
3740
+ parameters?: unknown;
2701
3741
  }
2702
3742
 
2703
3743
  /** A function call. */
@@ -2715,6 +3755,30 @@ export declare interface FunctionCall {
2715
3755
  willContinue?: boolean;
2716
3756
  }
2717
3757
 
3758
+ /**
3759
+ * A function tool call content block.
3760
+ */
3761
+ declare interface FunctionCallContent {
3762
+ /**
3763
+ * A unique ID for this specific tool call.
3764
+ */
3765
+ id: string;
3766
+ /**
3767
+ * The arguments to pass to the function.
3768
+ */
3769
+ arguments: {
3770
+ [key: string]: unknown;
3771
+ };
3772
+ /**
3773
+ * The name of the tool to call.
3774
+ */
3775
+ name: string;
3776
+ /**
3777
+ * Used as the OpenAPI type discriminator for the content oneof.
3778
+ */
3779
+ type: 'function_call';
3780
+ }
3781
+
2718
3782
  /** Function calling config. */
2719
3783
  export declare interface FunctionCallingConfig {
2720
3784
  /** Optional. Function calling mode. */
@@ -2849,6 +3913,46 @@ export declare enum FunctionResponseScheduling {
2849
3913
  INTERRUPT = "INTERRUPT"
2850
3914
  }
2851
3915
 
3916
+ /**
3917
+ * A function tool result content block.
3918
+ */
3919
+ declare interface FunctionResultContent {
3920
+ /**
3921
+ * ID to match the ID from the function call block.
3922
+ */
3923
+ call_id: string;
3924
+ /**
3925
+ * The result of the tool call.
3926
+ */
3927
+ result: FunctionResultContent.Items | unknown | string;
3928
+ /**
3929
+ * Used as the OpenAPI type discriminator for the content oneof.
3930
+ */
3931
+ type: 'function_result';
3932
+ /**
3933
+ * Whether the tool call resulted in an error.
3934
+ */
3935
+ is_error?: boolean;
3936
+ /**
3937
+ * The name of the tool that was called.
3938
+ */
3939
+ name?: string;
3940
+ }
3941
+
3942
+ declare namespace FunctionResultContent {
3943
+ interface Items {
3944
+ items?: Array<string | InteractionsAPI.ImageContent>;
3945
+ }
3946
+ }
3947
+
3948
+ /**
3949
+ * @license
3950
+ * Copyright 2025 Google LLC
3951
+ * SPDX-License-Identifier: Apache-2.0
3952
+ */
3953
+ declare class GeminiNextGenAPIClientError extends Error {
3954
+ }
3955
+
2852
3956
  /** Input example for preference optimization. This data type is not supported in Gemini API. */
2853
3957
  export declare interface GeminiPreferenceExample {
2854
3958
  /** List of completions for a given prompt. */
@@ -3504,6 +4608,48 @@ export declare interface GenerationConfig {
3504
4608
  enableEnhancedCivicAnswers?: boolean;
3505
4609
  }
3506
4610
 
4611
+ /**
4612
+ * Configuration parameters for model interactions.
4613
+ */
4614
+ declare interface GenerationConfig_2 {
4615
+ /**
4616
+ * The maximum number of tokens to include in the response.
4617
+ */
4618
+ max_output_tokens?: number;
4619
+ /**
4620
+ * Seed used in decoding for reproducibility.
4621
+ */
4622
+ seed?: number;
4623
+ /**
4624
+ * Configuration for speech interaction.
4625
+ */
4626
+ speech_config?: Array<SpeechConfig_2>;
4627
+ /**
4628
+ * A list of character sequences that will stop output interaction.
4629
+ */
4630
+ stop_sequences?: Array<string>;
4631
+ /**
4632
+ * Controls the randomness of the output.
4633
+ */
4634
+ temperature?: number;
4635
+ /**
4636
+ * The level of thought tokens that the model should generate.
4637
+ */
4638
+ thinking_level?: ThinkingLevel_2;
4639
+ /**
4640
+ * Whether to include thought summaries in the response.
4641
+ */
4642
+ thinking_summaries?: 'auto' | 'none';
4643
+ /**
4644
+ * The tool choice for the interaction.
4645
+ */
4646
+ tool_choice?: ToolChoice;
4647
+ /**
4648
+ * The maximum cumulative probability of tokens to consider when sampling.
4649
+ */
4650
+ top_p?: number;
4651
+ }
4652
+
3507
4653
  /** The configuration for routing the request to a specific model. This data type is not supported in Gemini API. */
3508
4654
  export declare interface GenerationConfigRoutingConfig {
3509
4655
  /** Automated routing. */
@@ -3761,6 +4907,8 @@ export declare class GoogleGenAI {
3761
4907
  readonly authTokens: Tokens;
3762
4908
  readonly tunings: Tunings;
3763
4909
  readonly fileSearchStores: FileSearchStores;
4910
+ private _interactions;
4911
+ get interactions(): Interactions;
3764
4912
  constructor(options: GoogleGenAIOptions);
3765
4913
  }
3766
4914
 
@@ -3855,6 +5003,78 @@ export declare interface GoogleSearch {
3855
5003
  timeRangeFilter?: Interval;
3856
5004
  }
3857
5005
 
5006
+ /**
5007
+ * The arguments to pass to Google Search.
5008
+ */
5009
+ declare interface GoogleSearchCallArguments {
5010
+ /**
5011
+ * Web search queries for the following-up web search.
5012
+ */
5013
+ queries?: Array<string>;
5014
+ }
5015
+
5016
+ /**
5017
+ * Google Search content.
5018
+ */
5019
+ declare interface GoogleSearchCallContent {
5020
+ /**
5021
+ * Used as the OpenAPI type discriminator for the content oneof.
5022
+ */
5023
+ type: 'google_search_call';
5024
+ /**
5025
+ * A unique ID for this specific tool call.
5026
+ */
5027
+ id?: string;
5028
+ /**
5029
+ * The arguments to pass to Google Search.
5030
+ */
5031
+ arguments?: GoogleSearchCallArguments;
5032
+ }
5033
+
5034
+ /**
5035
+ * The result of the Google Search.
5036
+ */
5037
+ declare interface GoogleSearchResult {
5038
+ /**
5039
+ * Web content snippet that can be embedded in a web page or an app webview.
5040
+ */
5041
+ rendered_content?: string;
5042
+ /**
5043
+ * Title of the search result.
5044
+ */
5045
+ title?: string;
5046
+ /**
5047
+ * URI reference of the search result.
5048
+ */
5049
+ url?: string;
5050
+ }
5051
+
5052
+ /**
5053
+ * Google Search result content.
5054
+ */
5055
+ declare interface GoogleSearchResultContent {
5056
+ /**
5057
+ * Used as the OpenAPI type discriminator for the content oneof.
5058
+ */
5059
+ type: 'google_search_result';
5060
+ /**
5061
+ * ID to match the ID from the google search call block.
5062
+ */
5063
+ call_id?: string;
5064
+ /**
5065
+ * Whether the Google Search resulted in an error.
5066
+ */
5067
+ is_error?: boolean;
5068
+ /**
5069
+ * The results of the Google Search.
5070
+ */
5071
+ result?: Array<GoogleSearchResult>;
5072
+ /**
5073
+ * The signature of the Google Search result.
5074
+ */
5075
+ signature?: string;
5076
+ }
5077
+
3858
5078
  /** Tool to retrieve public web data for grounding, powered by Google. */
3859
5079
  export declare interface GoogleSearchRetrieval {
3860
5080
  /** Specifies the dynamic retrieval configuration for the given source. */
@@ -4133,6 +5353,15 @@ export declare enum HarmSeverity {
4133
5353
  HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH"
4134
5354
  }
4135
5355
 
5356
+ declare type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | NullableHeaders;
5357
+
5358
+ /**
5359
+ * @license
5360
+ * Copyright 2025 Google LLC
5361
+ * SPDX-License-Identifier: Apache-2.0
5362
+ */
5363
+ declare type HeaderValue = string | undefined | null;
5364
+
4136
5365
  /** The location of the API key. This enum is not supported in Gemini API. */
4137
5366
  export declare enum HttpElementLocation {
4138
5367
  HTTP_IN_UNSPECIFIED = "HTTP_IN_UNSPECIFIED",
@@ -4158,6 +5387,8 @@ export declare enum HttpElementLocation {
4158
5387
  HTTP_IN_COOKIE = "HTTP_IN_COOKIE"
4159
5388
  }
4160
5389
 
5390
+ declare type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
5391
+
4161
5392
  /** HTTP options to be used in each of the requests. */
4162
5393
  export declare interface HttpOptions {
4163
5394
  /** The base URL for the AI platform service endpoint. */
@@ -4267,6 +5498,31 @@ export declare interface ImageConfig {
4267
5498
  outputCompressionQuality?: number;
4268
5499
  }
4269
5500
 
5501
+ /**
5502
+ * An image content block.
5503
+ */
5504
+ declare interface ImageContent {
5505
+ /**
5506
+ * Used as the OpenAPI type discriminator for the content oneof.
5507
+ */
5508
+ type: 'image';
5509
+ data?: string;
5510
+ /**
5511
+ * The mime type of the image.
5512
+ */
5513
+ mime_type?: ImageMimeType;
5514
+ /**
5515
+ * The resolution of the media.
5516
+ */
5517
+ resolution?: 'low' | 'medium' | 'high';
5518
+ uri?: string;
5519
+ }
5520
+
5521
+ /**
5522
+ * The mime type of the image.
5523
+ */
5524
+ declare type ImageMimeType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/heic' | 'image/heif' | (string & {});
5525
+
4270
5526
  /** Enum that specifies the language of the text in the prompt. */
4271
5527
  export declare enum ImagePromptLanguage {
4272
5528
  /**
@@ -4396,6 +5652,217 @@ export declare class InlinedResponse {
4396
5652
  error?: JobError;
4397
5653
  }
4398
5654
 
5655
+ /**
5656
+ * The Interaction resource.
5657
+ */
5658
+ declare interface Interaction {
5659
+ /**
5660
+ * Output only. A unique identifier for the interaction completion.
5661
+ */
5662
+ id: string;
5663
+ /**
5664
+ * Output only. The status of the interaction.
5665
+ */
5666
+ status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5667
+ /**
5668
+ * The name of the `Agent` used for generating the interaction.
5669
+ */
5670
+ agent?: (string & {}) | 'deep-research-pro-preview-12-2025';
5671
+ /**
5672
+ * Output only. The time at which the response was created in ISO 8601 format
5673
+ * (YYYY-MM-DDThh:mm:ssZ).
5674
+ */
5675
+ created?: string;
5676
+ /**
5677
+ * The name of the `Model` used for generating the interaction.
5678
+ */
5679
+ model?: Model_2;
5680
+ /**
5681
+ * Output only. The object type of the interaction. Always set to `interaction`.
5682
+ */
5683
+ object?: 'interaction';
5684
+ /**
5685
+ * Output only. Responses from the model.
5686
+ */
5687
+ outputs?: Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
5688
+ /**
5689
+ * The ID of the previous interaction, if any.
5690
+ */
5691
+ previous_interaction_id?: string;
5692
+ /**
5693
+ * Output only. The role of the interaction.
5694
+ */
5695
+ role?: string;
5696
+ /**
5697
+ * Output only. The time at which the response was last updated in ISO 8601 format
5698
+ * (YYYY-MM-DDThh:mm:ssZ).
5699
+ */
5700
+ updated?: string;
5701
+ /**
5702
+ * Output only. Statistics on the interaction request's token usage.
5703
+ */
5704
+ usage?: Usage;
5705
+ }
5706
+
5707
+ declare interface InteractionCancelParams {
5708
+ /**
5709
+ * Which version of the API to use.
5710
+ */
5711
+ api_version?: string;
5712
+ }
5713
+
5714
+ declare type InteractionCreateParams = CreateModelInteractionParamsNonStreaming | CreateModelInteractionParamsStreaming | CreateAgentInteractionParamsNonStreaming | CreateAgentInteractionParamsStreaming;
5715
+
5716
+ declare interface InteractionDeleteParams {
5717
+ /**
5718
+ * Which version of the API to use.
5719
+ */
5720
+ api_version?: string;
5721
+ }
5722
+
5723
+ declare type InteractionDeleteResponse = unknown;
5724
+
5725
+ declare interface InteractionEvent {
5726
+ /**
5727
+ * The event_id token to be used to resume the interaction stream, from
5728
+ * this event.
5729
+ */
5730
+ event_id?: string;
5731
+ event_type?: 'interaction.start' | 'interaction.complete';
5732
+ /**
5733
+ * The Interaction resource.
5734
+ */
5735
+ interaction?: Interaction;
5736
+ }
5737
+
5738
+ declare type InteractionGetParams = InteractionGetParamsNonStreaming | InteractionGetParamsStreaming;
5739
+
5740
+ declare namespace InteractionGetParams {
5741
+ type InteractionGetParamsNonStreaming = InteractionsAPI.InteractionGetParamsNonStreaming;
5742
+ type InteractionGetParamsStreaming = InteractionsAPI.InteractionGetParamsStreaming;
5743
+ }
5744
+
5745
+ declare interface InteractionGetParamsBase {
5746
+ /**
5747
+ * Path param: Which version of the API to use.
5748
+ */
5749
+ api_version?: string;
5750
+ /**
5751
+ * Query param: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
5752
+ */
5753
+ last_event_id?: string;
5754
+ /**
5755
+ * Query param: If set to true, the generated content will be streamed incrementally.
5756
+ */
5757
+ stream?: boolean;
5758
+ }
5759
+
5760
+ declare interface InteractionGetParamsNonStreaming extends InteractionGetParamsBase {
5761
+ /**
5762
+ * Query param: If set to true, the generated content will be streamed incrementally.
5763
+ */
5764
+ stream?: false;
5765
+ }
5766
+
5767
+ declare interface InteractionGetParamsStreaming extends InteractionGetParamsBase {
5768
+ /**
5769
+ * Query param: If set to true, the generated content will be streamed incrementally.
5770
+ */
5771
+ stream: true;
5772
+ }
5773
+
5774
+ export declare class Interactions extends BaseInteractions {
5775
+ }
5776
+
5777
+ export declare namespace Interactions {
5778
+ export { type AllowedTools as AllowedTools, type Annotation as Annotation, type AudioContent as AudioContent, type AudioMimeType as AudioMimeType, type CodeExecutionCallArguments as CodeExecutionCallArguments, type CodeExecutionCallContent as CodeExecutionCallContent, type CodeExecutionResultContent as CodeExecutionResultContent, type ContentDelta as ContentDelta, type ContentStart as ContentStart, type ContentStop as ContentStop, type DeepResearchAgentConfig as DeepResearchAgentConfig, type DocumentContent as DocumentContent, type DynamicAgentConfig as DynamicAgentConfig, type ErrorEvent_2 as ErrorEvent, type FileSearchResultContent as FileSearchResultContent, type Function_2 as Function, type FunctionCallContent as FunctionCallContent, type FunctionResultContent as FunctionResultContent, type GenerationConfig_2 as GenerationConfig, type GoogleSearchCallArguments as GoogleSearchCallArguments, type GoogleSearchCallContent as GoogleSearchCallContent, type GoogleSearchResult as GoogleSearchResult, type GoogleSearchResultContent as GoogleSearchResultContent, type ImageContent as ImageContent, type ImageMimeType as ImageMimeType, type Interaction as Interaction, type InteractionEvent as InteractionEvent, type InteractionSSEEvent as InteractionSSEEvent, type InteractionStatusUpdate as InteractionStatusUpdate, type MCPServerToolCallContent as MCPServerToolCallContent, type MCPServerToolResultContent as MCPServerToolResultContent, type Model_2 as Model, type SpeechConfig_2 as SpeechConfig, type TextContent as TextContent, type ThinkingLevel_2 as ThinkingLevel, type ThoughtContent as ThoughtContent, type Tool_2 as Tool, type ToolChoice as ToolChoice, type ToolChoiceConfig as ToolChoiceConfig, type ToolChoiceType as ToolChoiceType, type Turn as Turn, type URLContextCallArguments as URLContextCallArguments, type URLContextCallContent as URLContextCallContent, type URLContextResult as URLContextResult, type URLContextResultContent as URLContextResultContent, type Usage as Usage, type VideoContent as VideoContent, type VideoMimeType as VideoMimeType, type InteractionDeleteResponse as InteractionDeleteResponse, type InteractionCreateParams as InteractionCreateParams, type CreateModelInteractionParamsNonStreaming as CreateModelInteractionParamsNonStreaming, type CreateModelInteractionParamsStreaming as CreateModelInteractionParamsStreaming, type CreateAgentInteractionParamsNonStreaming as CreateAgentInteractionParamsNonStreaming, type CreateAgentInteractionParamsStreaming as CreateAgentInteractionParamsStreaming, type InteractionDeleteParams as InteractionDeleteParams, type InteractionCancelParams as InteractionCancelParams, type InteractionGetParams as InteractionGetParams, type InteractionGetParamsNonStreaming as InteractionGetParamsNonStreaming, type InteractionGetParamsStreaming as InteractionGetParamsStreaming, };
5779
+ }
5780
+
5781
+ declare namespace InteractionsAPI {
5782
+ export {
5783
+ BaseInteractions,
5784
+ Interactions,
5785
+ AllowedTools,
5786
+ Annotation,
5787
+ AudioContent,
5788
+ AudioMimeType,
5789
+ CodeExecutionCallArguments,
5790
+ CodeExecutionCallContent,
5791
+ CodeExecutionResultContent,
5792
+ ContentDelta,
5793
+ ContentStart,
5794
+ ContentStop,
5795
+ DeepResearchAgentConfig,
5796
+ DocumentContent,
5797
+ DynamicAgentConfig,
5798
+ ErrorEvent_2 as ErrorEvent,
5799
+ FileSearchResultContent,
5800
+ Function_2 as Function,
5801
+ FunctionCallContent,
5802
+ FunctionResultContent,
5803
+ GenerationConfig_2 as GenerationConfig,
5804
+ GoogleSearchCallArguments,
5805
+ GoogleSearchCallContent,
5806
+ GoogleSearchResult,
5807
+ GoogleSearchResultContent,
5808
+ ImageContent,
5809
+ ImageMimeType,
5810
+ Interaction,
5811
+ InteractionEvent,
5812
+ InteractionSSEEvent,
5813
+ InteractionStatusUpdate,
5814
+ MCPServerToolCallContent,
5815
+ MCPServerToolResultContent,
5816
+ Model_2 as Model,
5817
+ SpeechConfig_2 as SpeechConfig,
5818
+ TextContent,
5819
+ ThinkingLevel_2 as ThinkingLevel,
5820
+ ThoughtContent,
5821
+ Tool_2 as Tool,
5822
+ ToolChoice,
5823
+ ToolChoiceConfig,
5824
+ ToolChoiceType,
5825
+ Turn,
5826
+ URLContextCallArguments,
5827
+ URLContextCallContent,
5828
+ URLContextResult,
5829
+ URLContextResultContent,
5830
+ Usage,
5831
+ VideoContent,
5832
+ VideoMimeType,
5833
+ InteractionDeleteResponse,
5834
+ InteractionCreateParams,
5835
+ BaseCreateModelInteractionParams,
5836
+ BaseCreateAgentInteractionParams,
5837
+ CreateModelInteractionParamsNonStreaming,
5838
+ CreateModelInteractionParamsStreaming,
5839
+ CreateAgentInteractionParamsNonStreaming,
5840
+ CreateAgentInteractionParamsStreaming,
5841
+ InteractionDeleteParams,
5842
+ InteractionCancelParams,
5843
+ InteractionGetParams,
5844
+ InteractionGetParamsBase,
5845
+ InteractionGetParamsNonStreaming,
5846
+ InteractionGetParamsStreaming
5847
+ }
5848
+ }
5849
+
5850
+ declare type InteractionSSEEvent = InteractionEvent | InteractionStatusUpdate | ContentStart | ContentDelta | ContentStop | ErrorEvent_2;
5851
+
5852
+ declare interface InteractionStatusUpdate {
5853
+ /**
5854
+ * The event_id token to be used to resume the interaction stream, from
5855
+ * this event.
5856
+ */
5857
+ event_id?: string;
5858
+ event_type?: 'interaction.status_update';
5859
+ interaction_id?: string;
5860
+ status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5861
+ }
5862
+
5863
+ declare class InternalServerError extends APIError<number, Headers> {
5864
+ }
5865
+
4399
5866
  /** Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive). The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time. */
4400
5867
  export declare interface Interval {
4401
5868
  /** Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. */
@@ -4892,6 +6359,10 @@ export declare interface LiveClientSetup {
4892
6359
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4893
6360
  the input and to ignore irrelevant input. */
4894
6361
  proactivity?: ProactivityConfig;
6362
+ /** Configures the explicit VAD signal. If enabled, the client will send
6363
+ vad_signal to indicate the start and end of speech. This allows the server
6364
+ to process the audio more efficiently. */
6365
+ explicitVadSignal?: boolean;
4895
6366
  }
4896
6367
 
4897
6368
  /** Client generated response to a `ToolCall` received from the server.
@@ -4994,6 +6465,10 @@ export declare interface LiveConnectConfig {
4994
6465
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4995
6466
  the input and to ignore irrelevant input. */
4996
6467
  proactivity?: ProactivityConfig;
6468
+ /** Configures the explicit VAD signal. If enabled, the client will send
6469
+ vad_signal to indicate the start and end of speech. This allows the server
6470
+ to process the audio more efficiently. */
6471
+ explicitVadSignal?: boolean;
4997
6472
  }
4998
6473
 
4999
6474
  /** Config for LiveConnectConstraints for Auth Token creation. */
@@ -5404,6 +6879,8 @@ export declare class LiveServerMessage {
5404
6879
  goAway?: LiveServerGoAway;
5405
6880
  /** Update of the session resumption state. */
5406
6881
  sessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
6882
+ /** Voice activity detection signal. */
6883
+ voiceActivityDetectionSignal?: VoiceActivityDetectionSignal;
5407
6884
  /**
5408
6885
  * Returns the concatenation of all text parts from the server content if present.
5409
6886
  *
@@ -5461,6 +6938,17 @@ export declare interface LiveServerToolCallCancellation {
5461
6938
  ids?: string[];
5462
6939
  }
5463
6940
 
6941
+ declare type LogFn = (message: string, ...rest: unknown[]) => void;
6942
+
6943
+ declare type Logger = {
6944
+ error: LogFn;
6945
+ warn: LogFn;
6946
+ info: LogFn;
6947
+ debug: LogFn;
6948
+ };
6949
+
6950
+ declare type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
6951
+
5464
6952
  /** Logprobs Result */
5465
6953
  export declare interface LogprobsResult {
5466
6954
  /** Length = total number of decoding steps. The chosen candidates may or may not be in top_candidates. */
@@ -5529,6 +7017,66 @@ export declare enum MaskReferenceMode {
5529
7017
  MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
5530
7018
  }
5531
7019
 
7020
+ /**
7021
+ * MCPServer tool call content.
7022
+ */
7023
+ declare interface MCPServerToolCallContent {
7024
+ /**
7025
+ * A unique ID for this specific tool call.
7026
+ */
7027
+ id: string;
7028
+ /**
7029
+ * The JSON object of arguments for the function.
7030
+ */
7031
+ arguments: {
7032
+ [key: string]: unknown;
7033
+ };
7034
+ /**
7035
+ * The name of the tool which was called.
7036
+ */
7037
+ name: string;
7038
+ /**
7039
+ * The name of the used MCP server.
7040
+ */
7041
+ server_name: string;
7042
+ /**
7043
+ * Used as the OpenAPI type discriminator for the content oneof.
7044
+ */
7045
+ type: 'mcp_server_tool_call';
7046
+ }
7047
+
7048
+ /**
7049
+ * MCPServer tool result content.
7050
+ */
7051
+ declare interface MCPServerToolResultContent {
7052
+ /**
7053
+ * ID to match the ID from the MCP server tool call block.
7054
+ */
7055
+ call_id: string;
7056
+ /**
7057
+ * The result of the tool call.
7058
+ */
7059
+ result: MCPServerToolResultContent.Items | unknown | string;
7060
+ /**
7061
+ * Used as the OpenAPI type discriminator for the content oneof.
7062
+ */
7063
+ type: 'mcp_server_tool_result';
7064
+ /**
7065
+ * Name of the tool which is called for this specific tool call.
7066
+ */
7067
+ name?: string;
7068
+ /**
7069
+ * The name of the used MCP server.
7070
+ */
7071
+ server_name?: string;
7072
+ }
7073
+
7074
+ declare namespace MCPServerToolResultContent {
7075
+ interface Items {
7076
+ items?: Array<string | InteractionsAPI.ImageContent>;
7077
+ }
7078
+ }
7079
+
5532
7080
  /**
5533
7081
  * Creates a McpCallableTool from MCP clients and an optional config.
5534
7082
  *
@@ -5589,6 +7137,14 @@ export declare enum MediaResolution {
5589
7137
  MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
5590
7138
  }
5591
7139
 
7140
+ /**
7141
+ * This type contains `RequestInit` options that may be available on the current runtime,
7142
+ * including per-platform extensions like `dispatcher`, `agent`, `client`, etc.
7143
+ */
7144
+ declare type MergedRequestInit = RequestInits &
7145
+ /** We don't include these in the types as they'll be overridden for every request. */
7146
+ Partial<Record<'body' | 'headers' | 'method' | 'signal', never>>;
7147
+
5592
7148
  /** Server content modalities. */
5593
7149
  export declare enum Modality {
5594
7150
  /**
@@ -5684,6 +7240,11 @@ export declare interface Model {
5684
7240
  thinking?: boolean;
5685
7241
  }
5686
7242
 
7243
+ /**
7244
+ * The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7245
+ */
7246
+ declare type Model_2 = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-native-audio-dialog' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-pro-preview' | (string & {});
7247
+
5687
7248
  export declare class Models extends BaseModule {
5688
7249
  private readonly apiClient;
5689
7250
  constructor(apiClient: ApiClient);
@@ -6087,6 +7648,48 @@ export declare enum MusicGenerationMode {
6087
7648
  VOCALIZATION = "VOCALIZATION"
6088
7649
  }
6089
7650
 
7651
+ /**
7652
+ * @license
7653
+ * Copyright 2025 Google LLC
7654
+ * SPDX-License-Identifier: Apache-2.0
7655
+ */
7656
+ /// <reference types="node" />
7657
+ /**
7658
+ * Shims for types that we can't always rely on being available globally.
7659
+ *
7660
+ * Note: these only exist at the type-level, there is no corresponding runtime
7661
+ * version for any of these symbols.
7662
+ */
7663
+ declare type NeverToAny<T> = T extends never ? any : T;
7664
+
7665
+ /** @ts-ignore For users with node-fetch@2 */
7666
+ declare type NodeFetch2RequestInit = NotAny<import('../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
7667
+
7668
+ /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
7669
+ declare type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
7670
+
7671
+ /** @ts-ignore */
7672
+ declare type _NodeReadableStream<R = any> = ReadableStream_2<R>;
7673
+
7674
+ declare type NotAny<T> = [0] extends [1 & T] ? never : T;
7675
+
7676
+ declare class NotFoundError extends APIError<404, Headers> {
7677
+ }
7678
+
7679
+ /**
7680
+ * @internal
7681
+ * Users can pass explicit nulls to unset default headers. When we parse them
7682
+ * into a standard headers type we need to preserve that information.
7683
+ */
7684
+ declare type NullableHeaders = {
7685
+ /** Brand check, prevent users from creating a NullableHeaders. */
7686
+ [brand_privateNullableHeaders]: true;
7687
+ /** Parsed headers. */
7688
+ values: Headers;
7689
+ /** Set of lowercase header names explicitly set to null. */
7690
+ nulls: Set<string>;
7691
+ };
7692
+
6090
7693
  /** A long-running operation. */
6091
7694
  export declare interface Operation<T> {
6092
7695
  /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
@@ -6163,6 +7766,23 @@ export declare enum Outcome {
6163
7766
  OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
6164
7767
  }
6165
7768
 
7769
+ /**
7770
+ * Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
7771
+ */
7772
+ declare type OverloadedParameters<T> = T extends ({
7773
+ (...args: infer A): unknown;
7774
+ (...args: infer B): unknown;
7775
+ (...args: infer C): unknown;
7776
+ (...args: infer D): unknown;
7777
+ }) ? A | B | C | D : T extends ({
7778
+ (...args: infer A): unknown;
7779
+ (...args: infer B): unknown;
7780
+ (...args: infer C): unknown;
7781
+ }) ? A | B | C : T extends ({
7782
+ (...args: infer A): unknown;
7783
+ (...args: infer B): unknown;
7784
+ }) ? A | B : T extends (...args: infer A) => unknown ? A : never;
7785
+
6166
7786
  export declare enum PagedItem {
6167
7787
  PAGED_ITEM_BATCH_JOBS = "batchJobs",
6168
7788
  PAGED_ITEM_MODELS = "models",
@@ -6385,6 +8005,9 @@ export declare interface PartnerModelTuningSpec {
6385
8005
 
6386
8006
  export declare type PartUnion = Part | string;
6387
8007
 
8008
+ declare class PermissionDeniedError extends APIError<403, Headers> {
8009
+ }
8010
+
6388
8011
  /** Enum that controls the generation of people. */
6389
8012
  export declare enum PersonGeneration {
6390
8013
  /**
@@ -6507,6 +8130,13 @@ export declare interface ProductImage {
6507
8130
  productImage?: Image_2;
6508
8131
  }
6509
8132
 
8133
+ /**
8134
+ * @license
8135
+ * Copyright 2025 Google LLC
8136
+ * SPDX-License-Identifier: Apache-2.0
8137
+ */
8138
+ declare type PromiseOrValue<T> = T | Promise<T>;
8139
+
6510
8140
  /** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. This data type is not supported in Gemini API. */
6511
8141
  export declare interface RagChunk {
6512
8142
  /** If populated, represents where the chunk starts and ends in the document. */
@@ -6571,6 +8201,9 @@ export declare interface RagRetrievalConfigRankingRankService {
6571
8201
  modelName?: string;
6572
8202
  }
6573
8203
 
8204
+ declare class RateLimitError extends APIError<429, Headers> {
8205
+ }
8206
+
6574
8207
  /** A raw reference image.
6575
8208
 
6576
8209
  A raw reference image represents the base image to edit, provided by the user.
@@ -6587,6 +8220,8 @@ export declare class RawReferenceImage {
6587
8220
  toReferenceImageAPI(): ReferenceImageAPIInternal;
6588
8221
  }
6589
8222
 
8223
+ declare type _ReadableStream_2<R = any> = NeverToAny<([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>) | ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)>;
8224
+
6590
8225
  /** Marks the end of user activity.
6591
8226
 
6592
8227
  This can only be sent if automatic (i.e. server-side) activity detection is
@@ -6726,6 +8361,82 @@ export declare interface ReplicatedVoiceConfig {
6726
8361
  voiceSampleAudio?: string;
6727
8362
  }
6728
8363
 
8364
+ /**
8365
+ * The type for the first argument to `fetch`.
8366
+ *
8367
+ * https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
8368
+ */
8369
+ declare type _RequestInfo = Request | URL | string;
8370
+
8371
+ /**
8372
+ * An alias to the builtin `RequestInit` type so we can
8373
+ * easily alias it in import statements if there are name clashes.
8374
+ *
8375
+ * https://developer.mozilla.org/docs/Web/API/RequestInit
8376
+ */
8377
+ declare type _RequestInit = RequestInit;
8378
+
8379
+ declare type RequestInits = NotAny<UndiciTypesRequestInit> | NotAny<UndiciRequestInit> | NotAny<BunRequestInit> | NotAny<NodeFetch2RequestInit> | NotAny<NodeFetch3RequestInit> | NotAny<RequestInit> | NotAny<FetchRequestInit>;
8380
+
8381
+ declare type RequestOptions = {
8382
+ /**
8383
+ * The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
8384
+ */
8385
+ method?: HTTPMethod;
8386
+ /**
8387
+ * The URL path for the request.
8388
+ *
8389
+ * @example "/v1/foo"
8390
+ */
8391
+ path?: string;
8392
+ /**
8393
+ * Query parameters to include in the request URL.
8394
+ */
8395
+ query?: object | undefined | null;
8396
+ /**
8397
+ * The request body. Can be a string, JSON object, FormData, or other supported types.
8398
+ */
8399
+ body?: unknown;
8400
+ /**
8401
+ * HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
8402
+ */
8403
+ headers?: HeadersLike;
8404
+ /**
8405
+ * The maximum number of times that the client will retry a request in case of a
8406
+ * temporary failure, like a network error or a 5XX error from the server.
8407
+ *
8408
+ * @default 2
8409
+ */
8410
+ maxRetries?: number;
8411
+ stream?: boolean | undefined;
8412
+ /**
8413
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
8414
+ * from the server before timing out a single request.
8415
+ *
8416
+ * @unit milliseconds
8417
+ */
8418
+ timeout?: number;
8419
+ /**
8420
+ * Additional `RequestInit` options to be passed to the underlying `fetch` call.
8421
+ * These options will be merged with the client's default fetch options.
8422
+ */
8423
+ fetchOptions?: MergedRequestInit;
8424
+ /**
8425
+ * An AbortSignal that can be used to cancel the request.
8426
+ */
8427
+ signal?: AbortSignal | undefined | null;
8428
+ /**
8429
+ * A unique key for this request to enable idempotency.
8430
+ */
8431
+ idempotencyKey?: string;
8432
+ /**
8433
+ * Override the default base URL for this specific request.
8434
+ */
8435
+ defaultBaseURL?: string | undefined;
8436
+ __binaryResponse?: boolean | undefined;
8437
+ __streamClass?: typeof Stream;
8438
+ };
8439
+
6729
8440
  /** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
6730
8441
  export declare interface Retrieval {
6731
8442
  /** Optional. Deprecated. This option is no longer supported. */
@@ -7225,6 +8936,24 @@ export declare interface SpeechConfig {
7225
8936
  multiSpeakerVoiceConfig?: MultiSpeakerVoiceConfig;
7226
8937
  }
7227
8938
 
8939
+ /**
8940
+ * The configuration for speech interaction.
8941
+ */
8942
+ declare interface SpeechConfig_2 {
8943
+ /**
8944
+ * The language of the speech.
8945
+ */
8946
+ language?: string;
8947
+ /**
8948
+ * The speaker's name, it should match the speaker name given in the prompt.
8949
+ */
8950
+ speaker?: string;
8951
+ /**
8952
+ * The voice of the speaker.
8953
+ */
8954
+ voice?: string;
8955
+ }
8956
+
7228
8957
  export declare type SpeechConfigUnion = SpeechConfig | string;
7229
8958
 
7230
8959
  /** Start of speech sensitivity. */
@@ -7243,6 +8972,31 @@ export declare enum StartSensitivity {
7243
8972
  START_SENSITIVITY_LOW = "START_SENSITIVITY_LOW"
7244
8973
  }
7245
8974
 
8975
+ declare class Stream<Item> implements AsyncIterable<Item> {
8976
+ private iterator;
8977
+ controller: AbortController;
8978
+ private client;
8979
+ constructor(iterator: () => AsyncIterator<Item>, controller: AbortController, client?: BaseGeminiNextGenAPIClient);
8980
+ static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8981
+ /**
8982
+ * Generates a Stream from a newline-separated ReadableStream
8983
+ * where each item is a JSON value.
8984
+ */
8985
+ static fromReadableStream<Item>(readableStream: _ReadableStream_2, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8986
+ [Symbol.asyncIterator](): AsyncIterator<Item>;
8987
+ /**
8988
+ * Splits the stream into two streams which can be
8989
+ * independently read from at different speeds.
8990
+ */
8991
+ tee(): [Stream<Item>, Stream<Item>];
8992
+ /**
8993
+ * Converts this stream to a newline-separated ReadableStream of
8994
+ * JSON stringified values in the stream
8995
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
8996
+ */
8997
+ toReadableStream(): _ReadableStream_2;
8998
+ }
8999
+
7246
9000
  /** User provided string values assigned to a single metadata key. This data type is not supported in Vertex AI. */
7247
9001
  export declare interface StringList {
7248
9002
  /** The string values of the metadata to store. */
@@ -7424,6 +9178,24 @@ export declare interface TestTableItem {
7424
9178
  ignoreKeys?: string[];
7425
9179
  }
7426
9180
 
9181
+ /**
9182
+ * A text content block.
9183
+ */
9184
+ declare interface TextContent {
9185
+ /**
9186
+ * Used as the OpenAPI type discriminator for the content oneof.
9187
+ */
9188
+ type: 'text';
9189
+ /**
9190
+ * Citation information for model-generated content.
9191
+ */
9192
+ annotations?: Array<Annotation>;
9193
+ /**
9194
+ * The text content.
9195
+ */
9196
+ text?: string;
9197
+ }
9198
+
7427
9199
  /** The thinking features configuration. */
7428
9200
  export declare interface ThinkingConfig {
7429
9201
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
@@ -7452,6 +9224,26 @@ export declare enum ThinkingLevel {
7452
9224
  HIGH = "HIGH"
7453
9225
  }
7454
9226
 
9227
+ declare type ThinkingLevel_2 = 'low' | 'high';
9228
+
9229
+ /**
9230
+ * A thought content block.
9231
+ */
9232
+ declare interface ThoughtContent {
9233
+ /**
9234
+ * Used as the OpenAPI type discriminator for the content oneof.
9235
+ */
9236
+ type: 'thought';
9237
+ /**
9238
+ * Signature to match the backend source to be part of the generation.
9239
+ */
9240
+ signature?: string;
9241
+ /**
9242
+ * A summary of the thought.
9243
+ */
9244
+ summary?: Array<TextContent | ImageContent>;
9245
+ }
9246
+
7455
9247
  export declare class Tokens extends BaseModule {
7456
9248
  private readonly apiClient;
7457
9249
  constructor(apiClient: ApiClient);
@@ -7578,6 +9370,103 @@ export declare interface Tool {
7578
9370
  urlContext?: UrlContext;
7579
9371
  }
7580
9372
 
9373
+ /**
9374
+ * A tool that can be used by the model.
9375
+ */
9376
+ declare type Tool_2 = Function_2 | Tool_2.GoogleSearch | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.FileSearch;
9377
+
9378
+ declare namespace Tool_2 {
9379
+ /**
9380
+ * A tool that can be used by the model to search Google.
9381
+ */
9382
+ interface GoogleSearch {
9383
+ type: 'google_search';
9384
+ }
9385
+ /**
9386
+ * A tool that can be used by the model to execute code.
9387
+ */
9388
+ interface CodeExecution {
9389
+ type: 'code_execution';
9390
+ }
9391
+ /**
9392
+ * A tool that can be used by the model to fetch URL context.
9393
+ */
9394
+ interface URLContext {
9395
+ type: 'url_context';
9396
+ }
9397
+ /**
9398
+ * A tool that can be used by the model to interact with the computer.
9399
+ */
9400
+ interface ComputerUse {
9401
+ type: 'computer_use';
9402
+ /**
9403
+ * The environment being operated.
9404
+ */
9405
+ environment?: 'browser';
9406
+ /**
9407
+ * The list of predefined functions that are excluded from the model call.
9408
+ */
9409
+ excludedPredefinedFunctions?: Array<string>;
9410
+ }
9411
+ /**
9412
+ * A MCPServer is a server that can be called by the model to perform actions.
9413
+ */
9414
+ interface MCPServer {
9415
+ type: 'mcp_server';
9416
+ /**
9417
+ * The allowed tools.
9418
+ */
9419
+ allowed_tools?: Array<InteractionsAPI.AllowedTools>;
9420
+ /**
9421
+ * Optional: Fields for authentication headers, timeouts, etc., if needed.
9422
+ */
9423
+ headers?: {
9424
+ [key: string]: string;
9425
+ };
9426
+ /**
9427
+ * The name of the MCPServer.
9428
+ */
9429
+ name?: string;
9430
+ /**
9431
+ * The full URL for the MCPServer endpoint.
9432
+ * Example: "https://api.example.com/mcp"
9433
+ */
9434
+ url?: string;
9435
+ }
9436
+ /**
9437
+ * A tool that can be used by the model to search files.
9438
+ */
9439
+ interface FileSearch {
9440
+ type: 'file_search';
9441
+ /**
9442
+ * The file search store names to search.
9443
+ */
9444
+ file_search_store_names?: Array<string>;
9445
+ /**
9446
+ * Metadata filter to apply to the semantic retrieval documents and chunks.
9447
+ */
9448
+ metadata_filter?: string;
9449
+ /**
9450
+ * The number of semantic retrieval chunks to retrieve.
9451
+ */
9452
+ top_k?: number;
9453
+ }
9454
+ }
9455
+
9456
+ /**
9457
+ * The configuration for tool choice.
9458
+ */
9459
+ declare type ToolChoice = ToolChoiceType | ToolChoiceConfig;
9460
+
9461
+ declare interface ToolChoiceConfig {
9462
+ /**
9463
+ * The configuration for allowed tools.
9464
+ */
9465
+ allowed_tools?: AllowedTools;
9466
+ }
9467
+
9468
+ declare type ToolChoiceType = 'auto' | 'any' | 'none' | 'validated';
9469
+
7581
9470
  /** Tool that executes code generated by the model, and automatically returns the result to the model. See also [ExecutableCode]and [CodeExecutionResult] which are input and output to this tool. This data type is not supported in Gemini API. */
7582
9471
  export declare interface ToolCodeExecution {
7583
9472
  }
@@ -7875,6 +9764,18 @@ export declare interface TuningValidationDataset {
7875
9764
  vertexDatasetResource?: string;
7876
9765
  }
7877
9766
 
9767
+ declare interface Turn {
9768
+ /**
9769
+ * The content of the turn.
9770
+ */
9771
+ content?: string | Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
9772
+ /**
9773
+ * The originator of this turn. Must be user for input or model for
9774
+ * model output.
9775
+ */
9776
+ role?: string;
9777
+ }
9778
+
7878
9779
  /** The reason why the turn is complete. */
7879
9780
  export declare enum TurnCompleteReason {
7880
9781
  /**
@@ -8008,6 +9909,7 @@ declare namespace types {
8008
9909
  FileSource,
8009
9910
  TurnCompleteReason,
8010
9911
  MediaModality,
9912
+ VadSignalType,
8011
9913
  StartSensitivity,
8012
9914
  EndSensitivity,
8013
9915
  ActivityHandling,
@@ -8329,6 +10231,7 @@ declare namespace types {
8329
10231
  UsageMetadata,
8330
10232
  LiveServerGoAway,
8331
10233
  LiveServerSessionResumptionUpdate,
10234
+ VoiceActivityDetectionSignal,
8332
10235
  LiveServerMessage,
8333
10236
  OperationFromAPIResponseParameters,
8334
10237
  GenerationConfigThinkingConfig,
@@ -8394,6 +10297,37 @@ declare namespace types {
8394
10297
  }
8395
10298
  }
8396
10299
 
10300
+ /** @ts-ignore For users with undici */
10301
+ declare type UndiciRequestInit = NotAny<import('../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
10302
+
10303
+ /**
10304
+ * These imports attempt to get types from a parent package's dependencies.
10305
+ * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
10306
+ * would cause typescript to show types not present at runtime. To avoid this, we import
10307
+ * directly from parent node_modules folders.
10308
+ *
10309
+ * We need to check multiple levels because we don't know what directory structure we'll be in.
10310
+ * For example, pnpm generates directories like this:
10311
+ * ```
10312
+ * node_modules
10313
+ * ├── .pnpm
10314
+ * │ └── pkg@1.0.0
10315
+ * │ └── node_modules
10316
+ * │ └── pkg
10317
+ * │ └── internal
10318
+ * │ └── types.d.ts
10319
+ * ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg
10320
+ * └── undici
10321
+ * ```
10322
+ *
10323
+ * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
10324
+ */
10325
+ /** @ts-ignore For users with \@types/node */
10326
+ declare type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
10327
+
10328
+ declare class UnprocessableEntityError extends APIError<422, Headers> {
10329
+ }
10330
+
8397
10331
  /** Optional parameters for caches.update method. */
8398
10332
  export declare interface UpdateCachedContentConfig {
8399
10333
  /** Used to override HTTP request options. */
@@ -8644,12 +10578,80 @@ export declare class UpscaleImageResponse {
8644
10578
  export declare interface UrlContext {
8645
10579
  }
8646
10580
 
10581
+ /**
10582
+ * The arguments to pass to the URL context.
10583
+ */
10584
+ declare interface URLContextCallArguments {
10585
+ /**
10586
+ * The URLs to fetch.
10587
+ */
10588
+ urls?: Array<string>;
10589
+ }
10590
+
10591
+ /**
10592
+ * URL context content.
10593
+ */
10594
+ declare interface URLContextCallContent {
10595
+ /**
10596
+ * Used as the OpenAPI type discriminator for the content oneof.
10597
+ */
10598
+ type: 'url_context_call';
10599
+ /**
10600
+ * A unique ID for this specific tool call.
10601
+ */
10602
+ id?: string;
10603
+ /**
10604
+ * The arguments to pass to the URL context.
10605
+ */
10606
+ arguments?: URLContextCallArguments;
10607
+ }
10608
+
8647
10609
  /** Metadata related to url context retrieval tool. */
8648
10610
  export declare interface UrlContextMetadata {
8649
10611
  /** Output only. List of url context. */
8650
10612
  urlMetadata?: UrlMetadata[];
8651
10613
  }
8652
10614
 
10615
+ /**
10616
+ * The result of the URL context.
10617
+ */
10618
+ declare interface URLContextResult {
10619
+ /**
10620
+ * The status of the URL retrieval.
10621
+ */
10622
+ status?: 'success' | 'error' | 'paywall' | 'unsafe';
10623
+ /**
10624
+ * The URL that was fetched.
10625
+ */
10626
+ url?: string;
10627
+ }
10628
+
10629
+ /**
10630
+ * URL context result content.
10631
+ */
10632
+ declare interface URLContextResultContent {
10633
+ /**
10634
+ * Used as the OpenAPI type discriminator for the content oneof.
10635
+ */
10636
+ type: 'url_context_result';
10637
+ /**
10638
+ * ID to match the ID from the url context call block.
10639
+ */
10640
+ call_id?: string;
10641
+ /**
10642
+ * Whether the URL context resulted in an error.
10643
+ */
10644
+ is_error?: boolean;
10645
+ /**
10646
+ * The results of the URL context.
10647
+ */
10648
+ result?: Array<URLContextResult>;
10649
+ /**
10650
+ * The signature of the URL context result.
10651
+ */
10652
+ signature?: string;
10653
+ }
10654
+
8653
10655
  /** Context of the a single url retrieval. */
8654
10656
  export declare interface UrlMetadata {
8655
10657
  /** Retrieved url by the tool. */
@@ -8682,6 +10684,108 @@ export declare enum UrlRetrievalStatus {
8682
10684
  URL_RETRIEVAL_STATUS_UNSAFE = "URL_RETRIEVAL_STATUS_UNSAFE"
8683
10685
  }
8684
10686
 
10687
+ /**
10688
+ * Statistics on the interaction request's token usage.
10689
+ */
10690
+ declare interface Usage {
10691
+ /**
10692
+ * A breakdown of cached token usage by modality.
10693
+ */
10694
+ cached_tokens_by_modality?: Array<Usage.CachedTokensByModality>;
10695
+ /**
10696
+ * A breakdown of input token usage by modality.
10697
+ */
10698
+ input_tokens_by_modality?: Array<Usage.InputTokensByModality>;
10699
+ /**
10700
+ * A breakdown of output token usage by modality.
10701
+ */
10702
+ output_tokens_by_modality?: Array<Usage.OutputTokensByModality>;
10703
+ /**
10704
+ * A breakdown of tool-use token usage by modality.
10705
+ */
10706
+ tool_use_tokens_by_modality?: Array<Usage.ToolUseTokensByModality>;
10707
+ /**
10708
+ * Number of tokens in the cached part of the prompt (the cached content).
10709
+ */
10710
+ total_cached_tokens?: number;
10711
+ /**
10712
+ * Number of tokens in the prompt (context).
10713
+ */
10714
+ total_input_tokens?: number;
10715
+ /**
10716
+ * Total number of tokens across all the generated responses.
10717
+ */
10718
+ total_output_tokens?: number;
10719
+ /**
10720
+ * Number of tokens of thoughts for thinking models.
10721
+ */
10722
+ total_reasoning_tokens?: number;
10723
+ /**
10724
+ * Total token count for the interaction request (prompt + responses + other
10725
+ * internal tokens).
10726
+ */
10727
+ total_tokens?: number;
10728
+ /**
10729
+ * Number of tokens present in tool-use prompt(s).
10730
+ */
10731
+ total_tool_use_tokens?: number;
10732
+ }
10733
+
10734
+ declare namespace Usage {
10735
+ /**
10736
+ * The token count for a single response modality.
10737
+ */
10738
+ interface CachedTokensByModality {
10739
+ /**
10740
+ * The modality associated with the token count.
10741
+ */
10742
+ modality?: 'text' | 'image' | 'audio';
10743
+ /**
10744
+ * Number of tokens for the modality.
10745
+ */
10746
+ tokens?: number;
10747
+ }
10748
+ /**
10749
+ * The token count for a single response modality.
10750
+ */
10751
+ interface InputTokensByModality {
10752
+ /**
10753
+ * The modality associated with the token count.
10754
+ */
10755
+ modality?: 'text' | 'image' | 'audio';
10756
+ /**
10757
+ * Number of tokens for the modality.
10758
+ */
10759
+ tokens?: number;
10760
+ }
10761
+ /**
10762
+ * The token count for a single response modality.
10763
+ */
10764
+ interface OutputTokensByModality {
10765
+ /**
10766
+ * The modality associated with the token count.
10767
+ */
10768
+ modality?: 'text' | 'image' | 'audio';
10769
+ /**
10770
+ * Number of tokens for the modality.
10771
+ */
10772
+ tokens?: number;
10773
+ }
10774
+ /**
10775
+ * The token count for a single response modality.
10776
+ */
10777
+ interface ToolUseTokensByModality {
10778
+ /**
10779
+ * The modality associated with the token count.
10780
+ */
10781
+ modality?: 'text' | 'image' | 'audio';
10782
+ /**
10783
+ * Number of tokens for the modality.
10784
+ */
10785
+ tokens?: number;
10786
+ }
10787
+ }
10788
+
8685
10789
  /** Usage metadata about response(s). */
8686
10790
  export declare interface UsageMetadata {
8687
10791
  /** 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. */
@@ -8709,6 +10813,22 @@ export declare interface UsageMetadata {
8709
10813
  trafficType?: TrafficType;
8710
10814
  }
8711
10815
 
10816
+ /** The type of the VAD signal. */
10817
+ export declare enum VadSignalType {
10818
+ /**
10819
+ * The default is VAD_SIGNAL_TYPE_UNSPECIFIED.
10820
+ */
10821
+ VAD_SIGNAL_TYPE_UNSPECIFIED = "VAD_SIGNAL_TYPE_UNSPECIFIED",
10822
+ /**
10823
+ * Start of sentence signal.
10824
+ */
10825
+ VAD_SIGNAL_TYPE_SOS = "VAD_SIGNAL_TYPE_SOS",
10826
+ /**
10827
+ * End of sentence signal.
10828
+ */
10829
+ VAD_SIGNAL_TYPE_EOS = "VAD_SIGNAL_TYPE_EOS"
10830
+ }
10831
+
8712
10832
  /** Hyperparameters for Veo. This data type is not supported in Gemini API. */
8713
10833
  export declare interface VeoHyperParameters {
8714
10834
  /** Optional. Number of complete passes the model makes over the entire training dataset during training. */
@@ -8800,6 +10920,26 @@ export declare enum VideoCompressionQuality {
8800
10920
  LOSSLESS = "LOSSLESS"
8801
10921
  }
8802
10922
 
10923
+ /**
10924
+ * A video content block.
10925
+ */
10926
+ declare interface VideoContent {
10927
+ /**
10928
+ * Used as the OpenAPI type discriminator for the content oneof.
10929
+ */
10930
+ type: 'video';
10931
+ data?: string;
10932
+ /**
10933
+ * The mime type of the video.
10934
+ */
10935
+ mime_type?: VideoMimeType;
10936
+ /**
10937
+ * The resolution of the media.
10938
+ */
10939
+ resolution?: 'low' | 'medium' | 'high';
10940
+ uri?: string;
10941
+ }
10942
+
8803
10943
  /** A mask for video generation. */
8804
10944
  export declare interface VideoGenerationMask {
8805
10945
  /** The image mask to use for generating videos. */
@@ -8871,6 +11011,16 @@ export declare interface VideoMetadata {
8871
11011
  startOffset?: string;
8872
11012
  }
8873
11013
 
11014
+ /**
11015
+ * The mime type of the video.
11016
+ */
11017
+ declare type VideoMimeType = 'video/mp4' | 'video/mpeg' | 'video/mov' | 'video/avi' | 'video/x-flv' | 'video/mpg' | 'video/webm' | 'video/wmv' | 'video/3gpp' | (string & {});
11018
+
11019
+ export declare interface VoiceActivityDetectionSignal {
11020
+ /** The type of the VAD signal. */
11021
+ vadSignalType?: VadSignalType;
11022
+ }
11023
+
8874
11024
  export declare interface VoiceConfig {
8875
11025
  /** If true, the model will use a replicated voice for the response. */
8876
11026
  replicatedVoiceConfig?: ReplicatedVoiceConfig;