@google/genai 1.32.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/genai.d.ts CHANGED
@@ -1,5 +1,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. */
@@ -81,7 +119,7 @@ export declare interface ApiAuthApiKeyConfig {
81
119
  * The ApiClient class is used to send requests to the Gemini API or Vertex AI
82
120
  * endpoints.
83
121
  */
84
- declare class ApiClient {
122
+ declare class ApiClient implements GeminiNextGenAPIClientAdapter {
85
123
  readonly clientOptions: ApiClientInitOptions;
86
124
  constructor(opts: ApiClientInitOptions);
87
125
  /**
@@ -102,6 +140,7 @@ declare class ApiClient {
102
140
  isVertexAI(): boolean;
103
141
  getProject(): string | undefined;
104
142
  getLocation(): string | undefined;
143
+ getAuthHeaders(): Promise<Headers>;
105
144
  getApiVersion(): string;
106
145
  getBaseUrl(): string;
107
146
  getRequestUrl(): string;
@@ -217,6 +256,31 @@ declare interface ApiClientInitOptions {
217
256
  userAgentExtra?: string;
218
257
  }
219
258
 
259
+ declare class APIConnectionError extends APIError<undefined, undefined, undefined> {
260
+ constructor({ message, cause }: {
261
+ message?: string | undefined;
262
+ cause?: Error | undefined;
263
+ });
264
+ }
265
+
266
+ declare class APIConnectionTimeoutError extends APIConnectionError {
267
+ constructor({ message }?: {
268
+ message?: string;
269
+ });
270
+ }
271
+
272
+ declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends GeminiNextGenAPIClientError {
273
+ /** HTTP status for the response that caused the error */
274
+ readonly status: TStatus;
275
+ /** HTTP headers for the response that caused the error */
276
+ readonly headers: THeaders;
277
+ /** JSON body of the response that caused the error */
278
+ readonly error: TError;
279
+ constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders);
280
+ private static makeMessage;
281
+ static generate(status: number | undefined, errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined): APIError;
282
+ }
283
+
220
284
  /**
221
285
  * API errors raised by the GenAI API.
222
286
  */
@@ -253,6 +317,68 @@ export declare interface ApiKeyConfig {
253
317
  name?: string;
254
318
  }
255
319
 
320
+ /**
321
+ * A subclass of `Promise` providing additional helper methods
322
+ * for interacting with the SDK.
323
+ */
324
+ declare class APIPromise<T> extends Promise<T> {
325
+ private responsePromise;
326
+ private parseResponse;
327
+ private parsedPromise;
328
+ private client;
329
+ constructor(client: BaseGeminiNextGenAPIClient, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: BaseGeminiNextGenAPIClient, props: APIResponseProps) => PromiseOrValue<T>);
330
+ _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
331
+ /**
332
+ * Gets the raw `Response` instance instead of parsing the response
333
+ * data.
334
+ *
335
+ * If you want to parse the response body but still get the `Response`
336
+ * instance, you can use {@link withResponse()}.
337
+ *
338
+ * 👋 Getting the wrong TypeScript type for `Response`?
339
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
340
+ * to your `tsconfig.json`.
341
+ */
342
+ asResponse(): Promise<Response>;
343
+ /**
344
+ * Gets the parsed response data and the raw `Response` instance.
345
+ *
346
+ * If you just want to get the raw `Response` instance without parsing it,
347
+ * you can use {@link asResponse()}.
348
+ *
349
+ * 👋 Getting the wrong TypeScript type for `Response`?
350
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
351
+ * to your `tsconfig.json`.
352
+ */
353
+ withResponse(): Promise<{
354
+ data: T;
355
+ response: Response;
356
+ }>;
357
+ private parse;
358
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
359
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
360
+ finally(onfinally?: (() => void) | undefined | null): Promise<T>;
361
+ }
362
+
363
+ declare abstract class APIResource {
364
+ /**
365
+ * The key path from the client. For example, a resource accessible as `client.resource.subresource` would
366
+ * have a property `static override readonly _key = Object.freeze(['resource', 'subresource'] as const);`.
367
+ */
368
+ static readonly _key: readonly string[];
369
+ protected _client: BaseGeminiNextGenAPIClient;
370
+ constructor(client: BaseGeminiNextGenAPIClient);
371
+ }
372
+
373
+ declare type APIResponseProps = {
374
+ response: Response;
375
+ options: FinalRequestOptions;
376
+ controller: AbortController;
377
+ requestLogID: string;
378
+ retryOfRequestLogID: string | undefined;
379
+ startTime: number;
380
+ };
381
+
256
382
  /** The API spec that the external API implements. This enum is not supported in Gemini API. */
257
383
  export declare enum ApiSpec {
258
384
  /**
@@ -269,6 +395,12 @@ export declare enum ApiSpec {
269
395
  ELASTIC_SEARCH = "ELASTIC_SEARCH"
270
396
  }
271
397
 
398
+ declare class APIUserAbortError extends APIError<undefined, undefined, undefined> {
399
+ constructor({ message }?: {
400
+ message?: string;
401
+ });
402
+ }
403
+
272
404
  /** Representation of an audio chunk. */
273
405
  export declare interface AudioChunk {
274
406
  /** Raw bytes of audio data.
@@ -280,6 +412,24 @@ export declare interface AudioChunk {
280
412
  sourceMetadata?: LiveMusicSourceMetadata;
281
413
  }
282
414
 
415
+ /**
416
+ * An audio content block.
417
+ */
418
+ declare interface AudioContent {
419
+ type: 'audio';
420
+ data?: string;
421
+ /**
422
+ * The mime type of the audio.
423
+ */
424
+ mime_type?: AudioMimeType;
425
+ uri?: string;
426
+ }
427
+
428
+ /**
429
+ * The mime type of the audio.
430
+ */
431
+ declare type AudioMimeType = 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | (string & {});
432
+
283
433
  /** The audio transcription configuration in Setup. */
284
434
  export declare interface AudioTranscriptionConfig {
285
435
  }
@@ -346,6 +496,9 @@ export declare interface AuthConfigOidcConfig {
346
496
  serviceAccount?: string;
347
497
  }
348
498
 
499
+ declare class AuthenticationError extends APIError<401, Headers> {
500
+ }
501
+
349
502
  /** Config for auth_tokens.create parameters. */
350
503
  export declare interface AuthToken {
351
504
  /** The name of the auth token. */
@@ -417,6 +570,259 @@ export declare interface AutomaticFunctionCallingConfig {
417
570
  ignoreCallHistory?: boolean;
418
571
  }
419
572
 
573
+ declare class BadRequestError extends APIError<400, Headers> {
574
+ }
575
+
576
+ declare interface BaseCreateAgentInteractionParams {
577
+ /**
578
+ * Body param: The name of the `Agent` used for generating the interaction.
579
+ */
580
+ agent: (string & {}) | 'deep-research-pro-preview-12-2025';
581
+ /**
582
+ * Body param: The inputs for the interaction.
583
+ */
584
+ 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;
585
+ /**
586
+ * Path param: Which version of the API to use.
587
+ */
588
+ api_version?: string;
589
+ /**
590
+ * Body param: Configuration for the agent.
591
+ */
592
+ agent_config?: DynamicAgentConfig | DeepResearchAgentConfig;
593
+ /**
594
+ * Body param: Whether to run the model interaction in the background.
595
+ */
596
+ background?: boolean;
597
+ /**
598
+ * Body param: The ID of the previous interaction, if any.
599
+ */
600
+ previous_interaction_id?: string;
601
+ /**
602
+ * Body param: Enforces that the generated response is a JSON object that complies with
603
+ * the JSON schema specified in this field.
604
+ */
605
+ response_format?: unknown;
606
+ /**
607
+ * Body param: The mime type of the response. This is required if response_format is set.
608
+ */
609
+ response_mime_type?: string;
610
+ /**
611
+ * Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
612
+ */
613
+ response_modalities?: Array<'text' | 'image' | 'audio'>;
614
+ /**
615
+ * Body param: Input only. Whether to store the response and request for later retrieval.
616
+ */
617
+ store?: boolean;
618
+ /**
619
+ * Body param: Input only. Whether the interaction will be streamed.
620
+ */
621
+ stream?: boolean;
622
+ /**
623
+ * Body param: System instruction for the interaction.
624
+ */
625
+ system_instruction?: string;
626
+ /**
627
+ * Body param: A list of tool declarations the model may call during interaction.
628
+ */
629
+ tools?: Array<Tool_2>;
630
+ }
631
+
632
+ declare interface BaseCreateModelInteractionParams {
633
+ /**
634
+ * Body param: The inputs for the interaction.
635
+ */
636
+ 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;
637
+ /**
638
+ * Body param: The name of the `Model` used for generating the interaction.
639
+ */
640
+ model: Model_2;
641
+ /**
642
+ * Path param: Which version of the API to use.
643
+ */
644
+ api_version?: string;
645
+ /**
646
+ * Body param: Whether to run the model interaction in the background.
647
+ */
648
+ background?: boolean;
649
+ /**
650
+ * Body param: Input only. Configuration parameters for the model interaction.
651
+ */
652
+ generation_config?: GenerationConfig_2;
653
+ /**
654
+ * Body param: The ID of the previous interaction, if any.
655
+ */
656
+ previous_interaction_id?: string;
657
+ /**
658
+ * Body param: Enforces that the generated response is a JSON object that complies with
659
+ * the JSON schema specified in this field.
660
+ */
661
+ response_format?: unknown;
662
+ /**
663
+ * Body param: The mime type of the response. This is required if response_format is set.
664
+ */
665
+ response_mime_type?: string;
666
+ /**
667
+ * Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
668
+ */
669
+ response_modalities?: Array<'text' | 'image' | 'audio'>;
670
+ /**
671
+ * Body param: Input only. Whether to store the response and request for later retrieval.
672
+ */
673
+ store?: boolean;
674
+ /**
675
+ * Body param: Input only. Whether the interaction will be streamed.
676
+ */
677
+ stream?: boolean;
678
+ /**
679
+ * Body param: System instruction for the interaction.
680
+ */
681
+ system_instruction?: string;
682
+ /**
683
+ * Body param: A list of tool declarations the model may call during interaction.
684
+ */
685
+ tools?: Array<Tool_2>;
686
+ }
687
+
688
+ /**
689
+ * Base class for Gemini Next Gen API API clients.
690
+ */
691
+ declare class BaseGeminiNextGenAPIClient {
692
+ apiKey: string | null;
693
+ apiVersion: string;
694
+ baseURL: string;
695
+ maxRetries: number;
696
+ timeout: number;
697
+ logger: Logger;
698
+ logLevel: LogLevel | undefined;
699
+ fetchOptions: MergedRequestInit | undefined;
700
+ private fetch;
701
+ private encoder;
702
+ protected idempotencyHeader?: string;
703
+ private _options;
704
+ private clientAdapter;
705
+ /**
706
+ * API Client for interfacing with the Gemini Next Gen API API.
707
+ *
708
+ * @param {string | null | undefined} [opts.apiKey=process.env['GEMINI_API_KEY'] ?? null]
709
+ * @param {string | undefined} [opts.apiVersion=v1beta]
710
+ * @param {string} [opts.baseURL=process.env['GEMINI_NEXT_GEN_API_BASE_URL'] ?? https://generativelanguage.googleapis.com] - Override the default base URL for the API.
711
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
712
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
713
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
714
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
715
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
716
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
717
+ */
718
+ constructor({ baseURL, apiKey, apiVersion, ...opts }: ClientOptions);
719
+ /**
720
+ * Create a new client instance re-using the same options given to the current client with optional overriding.
721
+ */
722
+ withOptions(options: Partial<ClientOptions>): this;
723
+ /**
724
+ * Check whether the base URL is set to its default.
725
+ */
726
+ private baseURLOverridden;
727
+ protected defaultQuery(): Record<string, string | undefined> | undefined;
728
+ protected validateHeaders({ values, nulls }: NullableHeaders): void;
729
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
730
+ /**
731
+ * Basic re-implementation of `qs.stringify` for primitive types.
732
+ */
733
+ protected stringifyQuery(query: Record<string, unknown>): string;
734
+ private getUserAgent;
735
+ protected defaultIdempotencyKey(): string;
736
+ protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
737
+ buildURL(path: string, query: Record<string, unknown> | null | undefined, defaultBaseURL?: string | undefined): string;
738
+ /**
739
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
740
+
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,107 @@ 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
+ * The adapter to the parent API client instance (for accessing auth, project, location)
1583
+ */
1584
+ clientAdapter: GeminiNextGenAPIClientAdapter;
1585
+ }
1586
+
1587
+ /**
1588
+ * The arguments to pass to the code execution.
1589
+ */
1590
+ declare interface CodeExecutionCallArguments {
1591
+ /**
1592
+ * The code to be executed.
1593
+ */
1594
+ code?: string;
1595
+ /**
1596
+ * Programming language of the `code`.
1597
+ */
1598
+ language?: 'python';
1599
+ }
1600
+
1601
+ /**
1602
+ * Code execution content.
1603
+ */
1604
+ declare interface CodeExecutionCallContent {
1605
+ type: 'code_execution_call';
1606
+ /**
1607
+ * A unique ID for this specific tool call.
1608
+ */
1609
+ id?: string;
1610
+ /**
1611
+ * The arguments to pass to the code execution.
1612
+ */
1613
+ arguments?: CodeExecutionCallArguments;
1614
+ }
1615
+
1104
1616
  /** Result of executing the [ExecutableCode]. Only generated when using the [CodeExecution] tool, and always follows a `part` containing the [ExecutableCode]. */
1105
1617
  export declare interface CodeExecutionResult {
1106
1618
  /** Required. Outcome of the code execution. */
@@ -1109,6 +1621,29 @@ export declare interface CodeExecutionResult {
1109
1621
  output?: string;
1110
1622
  }
1111
1623
 
1624
+ /**
1625
+ * Code execution result content.
1626
+ */
1627
+ declare interface CodeExecutionResultContent {
1628
+ type: 'code_execution_result';
1629
+ /**
1630
+ * ID to match the ID from the code execution call block.
1631
+ */
1632
+ call_id?: string;
1633
+ /**
1634
+ * Whether the code execution resulted in an error.
1635
+ */
1636
+ is_error?: boolean;
1637
+ /**
1638
+ * The output of the code execution.
1639
+ */
1640
+ result?: string;
1641
+ /**
1642
+ * A signature hash for backend validation.
1643
+ */
1644
+ signature?: string;
1645
+ }
1646
+
1112
1647
  /** 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
1648
  export declare interface CompletionStats {
1114
1649
  /** Output only. The number of entities for which any error was encountered. */
@@ -1166,6 +1701,13 @@ export declare class ComputeTokensResponse {
1166
1701
  tokensInfo?: TokensInfo[];
1167
1702
  }
1168
1703
 
1704
+ declare type _ConditionalNodeReadableStream<R = any> = typeof globalThis extends {
1705
+ ReadableStream: any;
1706
+ } ? never : _NodeReadableStream<R>;
1707
+
1708
+ declare class ConflictError extends APIError<409, Headers> {
1709
+ }
1710
+
1169
1711
  /** Contains the multi-part content of a message. */
1170
1712
  export declare interface Content {
1171
1713
  /** List of parts that constitute a single message. Each part may have
@@ -1175,6 +1717,231 @@ export declare interface Content {
1175
1717
  role?: string;
1176
1718
  }
1177
1719
 
1720
+ declare interface ContentDelta {
1721
+ 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;
1722
+ /**
1723
+ * The event_id token to be used to resume the interaction stream, from
1724
+ * this event.
1725
+ */
1726
+ event_id?: string;
1727
+ event_type?: 'content.delta';
1728
+ index?: number;
1729
+ }
1730
+
1731
+ declare namespace ContentDelta {
1732
+ interface TextDelta {
1733
+ type: 'text';
1734
+ /**
1735
+ * Citation information for model-generated content.
1736
+ */
1737
+ annotations?: Array<InteractionsAPI.Annotation>;
1738
+ text?: string;
1739
+ }
1740
+ interface ImageDelta {
1741
+ type: 'image';
1742
+ data?: string;
1743
+ /**
1744
+ * The mime type of the image.
1745
+ */
1746
+ mime_type?: InteractionsAPI.ImageMimeType;
1747
+ /**
1748
+ * The resolution of the media.
1749
+ */
1750
+ resolution?: 'low' | 'medium' | 'high' | 'ultra_high';
1751
+ uri?: string;
1752
+ }
1753
+ interface AudioDelta {
1754
+ type: 'audio';
1755
+ data?: string;
1756
+ /**
1757
+ * The mime type of the audio.
1758
+ */
1759
+ mime_type?: InteractionsAPI.AudioMimeType;
1760
+ uri?: string;
1761
+ }
1762
+ interface DocumentDelta {
1763
+ type: 'document';
1764
+ data?: string;
1765
+ /**
1766
+ * The mime type of the document.
1767
+ */
1768
+ mime_type?: InteractionsAPI.DocumentMimeType;
1769
+ uri?: string;
1770
+ }
1771
+ interface VideoDelta {
1772
+ type: 'video';
1773
+ data?: string;
1774
+ /**
1775
+ * The mime type of the video.
1776
+ */
1777
+ mime_type?: InteractionsAPI.VideoMimeType;
1778
+ /**
1779
+ * The resolution of the media.
1780
+ */
1781
+ resolution?: 'low' | 'medium' | 'high' | 'ultra_high';
1782
+ uri?: string;
1783
+ }
1784
+ interface ThoughtSummaryDelta {
1785
+ type: 'thought_summary';
1786
+ /**
1787
+ * A text content block.
1788
+ */
1789
+ content?: InteractionsAPI.TextContent | InteractionsAPI.ImageContent;
1790
+ }
1791
+ interface ThoughtSignatureDelta {
1792
+ type: 'thought_signature';
1793
+ /**
1794
+ * Signature to match the backend source to be part of the generation.
1795
+ */
1796
+ signature?: string;
1797
+ }
1798
+ interface FunctionCallDelta {
1799
+ type: 'function_call';
1800
+ /**
1801
+ * A unique ID for this specific tool call.
1802
+ */
1803
+ id?: string;
1804
+ arguments?: {
1805
+ [key: string]: unknown;
1806
+ };
1807
+ name?: string;
1808
+ }
1809
+ interface FunctionResultDelta {
1810
+ type: 'function_result';
1811
+ /**
1812
+ * ID to match the ID from the function call block.
1813
+ */
1814
+ call_id?: string;
1815
+ is_error?: boolean;
1816
+ name?: string;
1817
+ /**
1818
+ * Tool call result delta.
1819
+ */
1820
+ result?: FunctionResultDelta.Items | string;
1821
+ }
1822
+ namespace FunctionResultDelta {
1823
+ interface Items {
1824
+ items?: Array<string | InteractionsAPI.ImageContent | unknown>;
1825
+ }
1826
+ }
1827
+ interface CodeExecutionCallDelta {
1828
+ type: 'code_execution_call';
1829
+ /**
1830
+ * A unique ID for this specific tool call.
1831
+ */
1832
+ id?: string;
1833
+ /**
1834
+ * The arguments to pass to the code execution.
1835
+ */
1836
+ arguments?: InteractionsAPI.CodeExecutionCallArguments;
1837
+ }
1838
+ interface CodeExecutionResultDelta {
1839
+ type: 'code_execution_result';
1840
+ /**
1841
+ * ID to match the ID from the function call block.
1842
+ */
1843
+ call_id?: string;
1844
+ is_error?: boolean;
1845
+ result?: string;
1846
+ signature?: string;
1847
+ }
1848
+ interface URLContextCallDelta {
1849
+ type: 'url_context_call';
1850
+ /**
1851
+ * A unique ID for this specific tool call.
1852
+ */
1853
+ id?: string;
1854
+ /**
1855
+ * The arguments to pass to the URL context.
1856
+ */
1857
+ arguments?: InteractionsAPI.URLContextCallArguments;
1858
+ }
1859
+ interface URLContextResultDelta {
1860
+ type: 'url_context_result';
1861
+ /**
1862
+ * ID to match the ID from the function call block.
1863
+ */
1864
+ call_id?: string;
1865
+ is_error?: boolean;
1866
+ result?: Array<InteractionsAPI.URLContextResult>;
1867
+ signature?: string;
1868
+ }
1869
+ interface GoogleSearchCallDelta {
1870
+ type: 'google_search_call';
1871
+ /**
1872
+ * A unique ID for this specific tool call.
1873
+ */
1874
+ id?: string;
1875
+ /**
1876
+ * The arguments to pass to Google Search.
1877
+ */
1878
+ arguments?: InteractionsAPI.GoogleSearchCallArguments;
1879
+ }
1880
+ interface GoogleSearchResultDelta {
1881
+ type: 'google_search_result';
1882
+ /**
1883
+ * ID to match the ID from the function call block.
1884
+ */
1885
+ call_id?: string;
1886
+ is_error?: boolean;
1887
+ result?: Array<InteractionsAPI.GoogleSearchResult>;
1888
+ signature?: string;
1889
+ }
1890
+ interface MCPServerToolCallDelta {
1891
+ type: 'mcp_server_tool_call';
1892
+ /**
1893
+ * A unique ID for this specific tool call.
1894
+ */
1895
+ id?: string;
1896
+ arguments?: {
1897
+ [key: string]: unknown;
1898
+ };
1899
+ name?: string;
1900
+ server_name?: string;
1901
+ }
1902
+ interface MCPServerToolResultDelta {
1903
+ type: 'mcp_server_tool_result';
1904
+ /**
1905
+ * ID to match the ID from the function call block.
1906
+ */
1907
+ call_id?: string;
1908
+ name?: string;
1909
+ /**
1910
+ * Tool call result delta.
1911
+ */
1912
+ result?: MCPServerToolResultDelta.Items | string;
1913
+ server_name?: string;
1914
+ }
1915
+ namespace MCPServerToolResultDelta {
1916
+ interface Items {
1917
+ items?: Array<string | InteractionsAPI.ImageContent | unknown>;
1918
+ }
1919
+ }
1920
+ interface FileSearchResultDelta {
1921
+ type: 'file_search_result';
1922
+ result?: Array<FileSearchResultDelta.Result>;
1923
+ }
1924
+ namespace FileSearchResultDelta {
1925
+ /**
1926
+ * The result of the File Search.
1927
+ */
1928
+ interface Result {
1929
+ /**
1930
+ * The name of the file search store.
1931
+ */
1932
+ file_search_store?: string;
1933
+ /**
1934
+ * The text of the search result.
1935
+ */
1936
+ text?: string;
1937
+ /**
1938
+ * The title of the search result.
1939
+ */
1940
+ title?: string;
1941
+ }
1942
+ }
1943
+ }
1944
+
1178
1945
  /** The embedding generated from an input content. */
1179
1946
  export declare interface ContentEmbedding {
1180
1947
  /** A list of floats representing an embedding.
@@ -1215,6 +1982,30 @@ export declare class ContentReferenceImage {
1215
1982
  toReferenceImageAPI(): ReferenceImageAPIInternal;
1216
1983
  }
1217
1984
 
1985
+ declare interface ContentStart {
1986
+ /**
1987
+ * The content of the response.
1988
+ */
1989
+ content?: TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent;
1990
+ /**
1991
+ * The event_id token to be used to resume the interaction stream, from
1992
+ * this event.
1993
+ */
1994
+ event_id?: string;
1995
+ event_type?: 'content.start';
1996
+ index?: number;
1997
+ }
1998
+
1999
+ declare interface ContentStop {
2000
+ /**
2001
+ * The event_id token to be used to resume the interaction stream, from
2002
+ * this event.
2003
+ */
2004
+ event_id?: string;
2005
+ event_type?: 'content.stop';
2006
+ index?: number;
2007
+ }
2008
+
1218
2009
  export declare type ContentUnion = Content | PartUnion[] | PartUnion;
1219
2010
 
1220
2011
  /** Enables context window compression -- mechanism managing model context window so it does not exceed given length. */
@@ -1310,6 +2101,20 @@ export declare class CountTokensResponse {
1310
2101
  cachedContentTokenCount?: number;
1311
2102
  }
1312
2103
 
2104
+ declare interface CreateAgentInteractionParamsNonStreaming extends BaseCreateAgentInteractionParams {
2105
+ /**
2106
+ * Body param: Input only. Whether the interaction will be streamed.
2107
+ */
2108
+ stream?: false;
2109
+ }
2110
+
2111
+ declare interface CreateAgentInteractionParamsStreaming extends BaseCreateAgentInteractionParams {
2112
+ /**
2113
+ * Body param: Input only. Whether the interaction will be streamed.
2114
+ */
2115
+ stream: true;
2116
+ }
2117
+
1313
2118
  /** Optional parameters. */
1314
2119
  export declare interface CreateAuthTokenConfig {
1315
2120
  /** Used to override HTTP request options. */
@@ -1560,6 +2365,20 @@ export declare function createFunctionResponsePartFromUri(uri: string, mimeType:
1560
2365
  */
1561
2366
  export declare function createModelContent(partOrString: PartListUnion | string): Content;
1562
2367
 
2368
+ declare interface CreateModelInteractionParamsNonStreaming extends BaseCreateModelInteractionParams {
2369
+ /**
2370
+ * Body param: Input only. Whether the interaction will be streamed.
2371
+ */
2372
+ stream?: false;
2373
+ }
2374
+
2375
+ declare interface CreateModelInteractionParamsStreaming extends BaseCreateModelInteractionParams {
2376
+ /**
2377
+ * Body param: Input only. Whether the interaction will be streamed.
2378
+ */
2379
+ stream: true;
2380
+ }
2381
+
1563
2382
  /**
1564
2383
  * Creates a `Part` object from a `base64` encoded `string`.
1565
2384
  */
@@ -1723,6 +2542,17 @@ export declare interface DatasetStats {
1723
2542
  userOutputTokenDistribution?: DatasetDistribution;
1724
2543
  }
1725
2544
 
2545
+ /**
2546
+ * Configuration for the Deep Research agent.
2547
+ */
2548
+ declare interface DeepResearchAgentConfig {
2549
+ /**
2550
+ * Whether to include thought summaries in the response.
2551
+ */
2552
+ thinking_summaries?: 'auto' | 'none';
2553
+ type?: 'deep-research';
2554
+ }
2555
+
1726
2556
  /** Optional parameters for models.get method. */
1727
2557
  export declare interface DeleteBatchJobConfig {
1728
2558
  /** Used to override HTTP request options. */
@@ -1917,6 +2747,24 @@ declare interface Document_2 {
1917
2747
  }
1918
2748
  export { Document_2 as Document }
1919
2749
 
2750
+ /**
2751
+ * A document content block.
2752
+ */
2753
+ declare interface DocumentContent {
2754
+ type: 'document';
2755
+ data?: string;
2756
+ /**
2757
+ * The mime type of the document.
2758
+ */
2759
+ mime_type?: DocumentMimeType;
2760
+ uri?: string;
2761
+ }
2762
+
2763
+ /**
2764
+ * The mime type of the document.
2765
+ */
2766
+ declare type DocumentMimeType = (string & {}) | 'application/pdf';
2767
+
1920
2768
  declare class Documents extends BaseModule {
1921
2769
  private readonly apiClient;
1922
2770
  constructor(apiClient: ApiClient);
@@ -1959,6 +2807,9 @@ export declare enum DocumentState {
1959
2807
  STATE_FAILED = "STATE_FAILED"
1960
2808
  }
1961
2809
 
2810
+ /** @ts-ignore */
2811
+ declare type _DOMReadableStream<R = any> = globalThis.ReadableStream<R>;
2812
+
1962
2813
  export declare type DownloadableFileUnion = string | File_2 | GeneratedVideo | Video;
1963
2814
 
1964
2815
  declare interface Downloader {
@@ -1995,6 +2846,14 @@ export declare interface DownloadFileParameters {
1995
2846
  config?: DownloadFileConfig;
1996
2847
  }
1997
2848
 
2849
+ /**
2850
+ * Configuration for dynamic agents.
2851
+ */
2852
+ declare interface DynamicAgentConfig {
2853
+ type?: 'dynamic';
2854
+ [k: string]: unknown;
2855
+ }
2856
+
1998
2857
  /** Describes the options to customize dynamic retrieval. */
1999
2858
  export declare interface DynamicRetrievalConfig {
2000
2859
  /** The mode of the predictor to be used in dynamic retrieval. */
@@ -2248,6 +3107,53 @@ export declare enum Environment {
2248
3107
  ENVIRONMENT_BROWSER = "ENVIRONMENT_BROWSER"
2249
3108
  }
2250
3109
 
3110
+ declare interface ErrorEvent_2 {
3111
+ /**
3112
+ * Error message from an interaction.
3113
+ */
3114
+ error?: ErrorEvent_2.Error;
3115
+ /**
3116
+ * The event_id token to be used to resume the interaction stream, from
3117
+ * this event.
3118
+ */
3119
+ event_id?: string;
3120
+ event_type?: 'error';
3121
+ }
3122
+
3123
+ declare namespace ErrorEvent_2 {
3124
+ /**
3125
+ * Error message from an interaction.
3126
+ */
3127
+ interface Error {
3128
+ /**
3129
+ * A URI that identifies the error type.
3130
+ */
3131
+ code?: string;
3132
+ /**
3133
+ * A human-readable error message.
3134
+ */
3135
+ message?: string;
3136
+ }
3137
+ }
3138
+
3139
+ declare namespace Errors {
3140
+ export {
3141
+ GeminiNextGenAPIClientError,
3142
+ APIError,
3143
+ APIUserAbortError,
3144
+ APIConnectionError,
3145
+ APIConnectionTimeoutError,
3146
+ BadRequestError,
3147
+ AuthenticationError,
3148
+ PermissionDeniedError,
3149
+ NotFoundError,
3150
+ ConflictError,
3151
+ UnprocessableEntityError,
3152
+ RateLimitError,
3153
+ InternalServerError
3154
+ }
3155
+ }
3156
+
2251
3157
  /** 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
3158
  export declare interface ExecutableCode {
2253
3159
  /** Required. The code to be executed. */
@@ -2294,6 +3200,13 @@ export declare enum FeatureSelectionPreference {
2294
3200
  PRIORITIZE_COST = "PRIORITIZE_COST"
2295
3201
  }
2296
3202
 
3203
+ /**
3204
+ * @license
3205
+ * Copyright 2025 Google LLC
3206
+ * SPDX-License-Identifier: Apache-2.0
3207
+ */
3208
+ declare type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
3209
+
2297
3210
  export declare interface FetchPredictOperationConfig {
2298
3211
  /** Used to override HTTP request options. */
2299
3212
  httpOptions?: HttpOptions;
@@ -2315,6 +3228,9 @@ export declare interface FetchPredictOperationParameters {
2315
3228
  config?: FetchPredictOperationConfig;
2316
3229
  }
2317
3230
 
3231
+ /** @ts-ignore For users who use Deno */
3232
+ declare type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
3233
+
2318
3234
  /** A file uploaded to the API. */
2319
3235
  declare interface File_2 {
2320
3236
  /** 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 +3398,37 @@ export declare interface FileSearch {
2482
3398
  metadataFilter?: string;
2483
3399
  }
2484
3400
 
3401
+ /**
3402
+ * File Search result content.
3403
+ */
3404
+ declare interface FileSearchResultContent {
3405
+ type: 'file_search_result';
3406
+ /**
3407
+ * The results of the File Search.
3408
+ */
3409
+ result?: Array<FileSearchResultContent.Result>;
3410
+ }
3411
+
3412
+ declare namespace FileSearchResultContent {
3413
+ /**
3414
+ * The result of the File Search.
3415
+ */
3416
+ interface Result {
3417
+ /**
3418
+ * The name of the file search store.
3419
+ */
3420
+ file_search_store?: string;
3421
+ /**
3422
+ * The text of the search result.
3423
+ */
3424
+ text?: string;
3425
+ /**
3426
+ * The title of the search result.
3427
+ */
3428
+ title?: string;
3429
+ }
3430
+ }
3431
+
2485
3432
  /** A collection of Documents. */
2486
3433
  export declare interface FileSearchStore {
2487
3434
  /** The resource name of the FileSearchStore. Example: `fileSearchStores/my-file-search-store-123` */
@@ -2634,6 +3581,15 @@ export declare interface FileStatus {
2634
3581
  code?: number;
2635
3582
  }
2636
3583
 
3584
+ declare type FinalizedRequestInit = RequestInit & {
3585
+ headers: Headers;
3586
+ };
3587
+
3588
+ declare type FinalRequestOptions = RequestOptions & {
3589
+ method: HTTPMethod;
3590
+ path: string;
3591
+ };
3592
+
2637
3593
  /** Output only. The reason why the model stopped generating tokens.
2638
3594
 
2639
3595
  If empty, the model has not stopped generating the tokens. */
@@ -2697,7 +3653,34 @@ export declare enum FinishReason {
2697
3653
  /**
2698
3654
  * The model was expected to generate an image, but none was generated.
2699
3655
  */
2700
- NO_IMAGE = "NO_IMAGE"
3656
+ NO_IMAGE = "NO_IMAGE",
3657
+ /**
3658
+ * Image generation stopped because the generated image may be a recitation from a source.
3659
+ */
3660
+ IMAGE_RECITATION = "IMAGE_RECITATION",
3661
+ /**
3662
+ * Image generation stopped for a reason not otherwise specified.
3663
+ */
3664
+ IMAGE_OTHER = "IMAGE_OTHER"
3665
+ }
3666
+
3667
+ /**
3668
+ * A tool that can be used by the model.
3669
+ */
3670
+ declare interface Function_2 {
3671
+ type: 'function';
3672
+ /**
3673
+ * A description of the function.
3674
+ */
3675
+ description?: string;
3676
+ /**
3677
+ * The name of the function.
3678
+ */
3679
+ name?: string;
3680
+ /**
3681
+ * The JSON Schema for the function's parameters.
3682
+ */
3683
+ parameters?: unknown;
2701
3684
  }
2702
3685
 
2703
3686
  /** A function call. */
@@ -2715,6 +3698,27 @@ export declare interface FunctionCall {
2715
3698
  willContinue?: boolean;
2716
3699
  }
2717
3700
 
3701
+ /**
3702
+ * A function tool call content block.
3703
+ */
3704
+ declare interface FunctionCallContent {
3705
+ /**
3706
+ * A unique ID for this specific tool call.
3707
+ */
3708
+ id: string;
3709
+ /**
3710
+ * The arguments to pass to the function.
3711
+ */
3712
+ arguments: {
3713
+ [key: string]: unknown;
3714
+ };
3715
+ /**
3716
+ * The name of the tool to call.
3717
+ */
3718
+ name: string;
3719
+ type: 'function_call';
3720
+ }
3721
+
2718
3722
  /** Function calling config. */
2719
3723
  export declare interface FunctionCallingConfig {
2720
3724
  /** Optional. Function calling mode. */
@@ -2849,6 +3853,55 @@ export declare enum FunctionResponseScheduling {
2849
3853
  INTERRUPT = "INTERRUPT"
2850
3854
  }
2851
3855
 
3856
+ /**
3857
+ * A function tool result content block.
3858
+ */
3859
+ declare interface FunctionResultContent {
3860
+ /**
3861
+ * ID to match the ID from the function call block.
3862
+ */
3863
+ call_id: string;
3864
+ /**
3865
+ * The result of the tool call.
3866
+ */
3867
+ result: FunctionResultContent.Items | unknown | string;
3868
+ type: 'function_result';
3869
+ /**
3870
+ * Whether the tool call resulted in an error.
3871
+ */
3872
+ is_error?: boolean;
3873
+ /**
3874
+ * The name of the tool that was called.
3875
+ */
3876
+ name?: string;
3877
+ }
3878
+
3879
+ declare namespace FunctionResultContent {
3880
+ interface Items {
3881
+ items?: Array<string | InteractionsAPI.ImageContent | unknown>;
3882
+ }
3883
+ }
3884
+
3885
+ /**
3886
+ * @license
3887
+ * Copyright 2025 Google LLC
3888
+ * SPDX-License-Identifier: Apache-2.0
3889
+ */
3890
+ declare interface GeminiNextGenAPIClientAdapter {
3891
+ isVertexAI: () => boolean;
3892
+ getProject: () => string | undefined;
3893
+ getLocation: () => string | undefined;
3894
+ getAuthHeaders: () => Headers | Promise<Headers>;
3895
+ }
3896
+
3897
+ /**
3898
+ * @license
3899
+ * Copyright 2025 Google LLC
3900
+ * SPDX-License-Identifier: Apache-2.0
3901
+ */
3902
+ declare class GeminiNextGenAPIClientError extends Error {
3903
+ }
3904
+
2852
3905
  /** Input example for preference optimization. This data type is not supported in Gemini API. */
2853
3906
  export declare interface GeminiPreferenceExample {
2854
3907
  /** List of completions for a given prompt. */
@@ -3504,6 +4557,48 @@ export declare interface GenerationConfig {
3504
4557
  enableEnhancedCivicAnswers?: boolean;
3505
4558
  }
3506
4559
 
4560
+ /**
4561
+ * Configuration parameters for model interactions.
4562
+ */
4563
+ declare interface GenerationConfig_2 {
4564
+ /**
4565
+ * The maximum number of tokens to include in the response.
4566
+ */
4567
+ max_output_tokens?: number;
4568
+ /**
4569
+ * Seed used in decoding for reproducibility.
4570
+ */
4571
+ seed?: number;
4572
+ /**
4573
+ * Configuration for speech interaction.
4574
+ */
4575
+ speech_config?: Array<SpeechConfig_2>;
4576
+ /**
4577
+ * A list of character sequences that will stop output interaction.
4578
+ */
4579
+ stop_sequences?: Array<string>;
4580
+ /**
4581
+ * Controls the randomness of the output.
4582
+ */
4583
+ temperature?: number;
4584
+ /**
4585
+ * The level of thought tokens that the model should generate.
4586
+ */
4587
+ thinking_level?: ThinkingLevel_2;
4588
+ /**
4589
+ * Whether to include thought summaries in the response.
4590
+ */
4591
+ thinking_summaries?: 'auto' | 'none';
4592
+ /**
4593
+ * The tool choice for the interaction.
4594
+ */
4595
+ tool_choice?: ToolChoice;
4596
+ /**
4597
+ * The maximum cumulative probability of tokens to consider when sampling.
4598
+ */
4599
+ top_p?: number;
4600
+ }
4601
+
3507
4602
  /** The configuration for routing the request to a specific model. This data type is not supported in Gemini API. */
3508
4603
  export declare interface GenerationConfigRoutingConfig {
3509
4604
  /** Automated routing. */
@@ -3749,6 +4844,8 @@ export declare class GoogleGenAI {
3749
4844
  readonly authTokens: Tokens;
3750
4845
  readonly tunings: Tunings;
3751
4846
  readonly fileSearchStores: FileSearchStores;
4847
+ private _interactions;
4848
+ get interactions(): Interactions;
3752
4849
  constructor(options: GoogleGenAIOptions);
3753
4850
  }
3754
4851
 
@@ -3843,6 +4940,72 @@ export declare interface GoogleSearch {
3843
4940
  timeRangeFilter?: Interval;
3844
4941
  }
3845
4942
 
4943
+ /**
4944
+ * The arguments to pass to Google Search.
4945
+ */
4946
+ declare interface GoogleSearchCallArguments {
4947
+ /**
4948
+ * Web search queries for the following-up web search.
4949
+ */
4950
+ queries?: Array<string>;
4951
+ }
4952
+
4953
+ /**
4954
+ * Google Search content.
4955
+ */
4956
+ declare interface GoogleSearchCallContent {
4957
+ type: 'google_search_call';
4958
+ /**
4959
+ * A unique ID for this specific tool call.
4960
+ */
4961
+ id?: string;
4962
+ /**
4963
+ * The arguments to pass to Google Search.
4964
+ */
4965
+ arguments?: GoogleSearchCallArguments;
4966
+ }
4967
+
4968
+ /**
4969
+ * The result of the Google Search.
4970
+ */
4971
+ declare interface GoogleSearchResult {
4972
+ /**
4973
+ * Web content snippet that can be embedded in a web page or an app webview.
4974
+ */
4975
+ rendered_content?: string;
4976
+ /**
4977
+ * Title of the search result.
4978
+ */
4979
+ title?: string;
4980
+ /**
4981
+ * URI reference of the search result.
4982
+ */
4983
+ url?: string;
4984
+ }
4985
+
4986
+ /**
4987
+ * Google Search result content.
4988
+ */
4989
+ declare interface GoogleSearchResultContent {
4990
+ type: 'google_search_result';
4991
+ /**
4992
+ * ID to match the ID from the google search call block.
4993
+ */
4994
+ call_id?: string;
4995
+ /**
4996
+ * Whether the Google Search resulted in an error.
4997
+ */
4998
+ is_error?: boolean;
4999
+ /**
5000
+ * The results of the Google Search.
5001
+ */
5002
+ result?: Array<GoogleSearchResult>;
5003
+ /**
5004
+ * The signature of the Google Search result.
5005
+ */
5006
+ signature?: string;
5007
+ }
5008
+
3846
5009
  /** Tool to retrieve public web data for grounding, powered by Google. */
3847
5010
  export declare interface GoogleSearchRetrieval {
3848
5011
  /** Specifies the dynamic retrieval configuration for the given source. */
@@ -4121,6 +5284,15 @@ export declare enum HarmSeverity {
4121
5284
  HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH"
4122
5285
  }
4123
5286
 
5287
+ declare type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | NullableHeaders;
5288
+
5289
+ /**
5290
+ * @license
5291
+ * Copyright 2025 Google LLC
5292
+ * SPDX-License-Identifier: Apache-2.0
5293
+ */
5294
+ declare type HeaderValue = string | undefined | null;
5295
+
4124
5296
  /** The location of the API key. This enum is not supported in Gemini API. */
4125
5297
  export declare enum HttpElementLocation {
4126
5298
  HTTP_IN_UNSPECIFIED = "HTTP_IN_UNSPECIFIED",
@@ -4146,6 +5318,8 @@ export declare enum HttpElementLocation {
4146
5318
  HTTP_IN_COOKIE = "HTTP_IN_COOKIE"
4147
5319
  }
4148
5320
 
5321
+ declare type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
5322
+
4149
5323
  /** HTTP options to be used in each of the requests. */
4150
5324
  export declare interface HttpOptions {
4151
5325
  /** The base URL for the AI platform service endpoint. */
@@ -4255,6 +5429,28 @@ export declare interface ImageConfig {
4255
5429
  outputCompressionQuality?: number;
4256
5430
  }
4257
5431
 
5432
+ /**
5433
+ * An image content block.
5434
+ */
5435
+ declare interface ImageContent {
5436
+ type: 'image';
5437
+ data?: string;
5438
+ /**
5439
+ * The mime type of the image.
5440
+ */
5441
+ mime_type?: ImageMimeType;
5442
+ /**
5443
+ * The resolution of the media.
5444
+ */
5445
+ resolution?: 'low' | 'medium' | 'high' | 'ultra_high';
5446
+ uri?: string;
5447
+ }
5448
+
5449
+ /**
5450
+ * The mime type of the image.
5451
+ */
5452
+ declare type ImageMimeType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/heic' | 'image/heif' | (string & {});
5453
+
4258
5454
  /** Enum that specifies the language of the text in the prompt. */
4259
5455
  export declare enum ImagePromptLanguage {
4260
5456
  /**
@@ -4384,6 +5580,218 @@ export declare class InlinedResponse {
4384
5580
  error?: JobError;
4385
5581
  }
4386
5582
 
5583
+ /**
5584
+ * The Interaction resource.
5585
+ */
5586
+ declare interface Interaction {
5587
+ /**
5588
+ * Output only. A unique identifier for the interaction completion.
5589
+ */
5590
+ id: string;
5591
+ /**
5592
+ * Output only. The status of the interaction.
5593
+ */
5594
+ status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5595
+ /**
5596
+ * The name of the `Agent` used for generating the interaction.
5597
+ */
5598
+ agent?: (string & {}) | 'deep-research-pro-preview-12-2025';
5599
+ /**
5600
+ * Output only. The time at which the response was created in ISO 8601 format
5601
+ * (YYYY-MM-DDThh:mm:ssZ).
5602
+ */
5603
+ created?: string;
5604
+ /**
5605
+ * The name of the `Model` used for generating the interaction.
5606
+ */
5607
+ model?: Model_2;
5608
+ /**
5609
+ * Output only. The object type of the interaction. Always set to `interaction`.
5610
+ */
5611
+ object?: 'interaction';
5612
+ /**
5613
+ * Output only. Responses from the model.
5614
+ */
5615
+ outputs?: Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
5616
+ /**
5617
+ * The ID of the previous interaction, if any.
5618
+ */
5619
+ previous_interaction_id?: string;
5620
+ /**
5621
+ * Output only. The role of the interaction.
5622
+ */
5623
+ role?: string;
5624
+ /**
5625
+ * Output only. The time at which the response was last updated in ISO 8601 format
5626
+ * (YYYY-MM-DDThh:mm:ssZ).
5627
+ */
5628
+ updated?: string;
5629
+ /**
5630
+ * Output only. Statistics on the interaction request's token usage.
5631
+ */
5632
+ usage?: Usage;
5633
+ }
5634
+
5635
+ declare interface InteractionCancelParams {
5636
+ /**
5637
+ * Which version of the API to use.
5638
+ */
5639
+ api_version?: string;
5640
+ }
5641
+
5642
+ declare type InteractionCreateParams = CreateModelInteractionParamsNonStreaming | CreateModelInteractionParamsStreaming | CreateAgentInteractionParamsNonStreaming | CreateAgentInteractionParamsStreaming;
5643
+
5644
+ declare interface InteractionDeleteParams {
5645
+ /**
5646
+ * Which version of the API to use.
5647
+ */
5648
+ api_version?: string;
5649
+ }
5650
+
5651
+ declare type InteractionDeleteResponse = unknown;
5652
+
5653
+ declare interface InteractionEvent {
5654
+ /**
5655
+ * The event_id token to be used to resume the interaction stream, from
5656
+ * this event.
5657
+ */
5658
+ event_id?: string;
5659
+ event_type?: 'interaction.start' | 'interaction.complete';
5660
+ /**
5661
+ * The Interaction resource.
5662
+ */
5663
+ interaction?: Interaction;
5664
+ }
5665
+
5666
+ declare type InteractionGetParams = InteractionGetParamsNonStreaming | InteractionGetParamsStreaming;
5667
+
5668
+ declare namespace InteractionGetParams {
5669
+ type InteractionGetParamsNonStreaming = InteractionsAPI.InteractionGetParamsNonStreaming;
5670
+ type InteractionGetParamsStreaming = InteractionsAPI.InteractionGetParamsStreaming;
5671
+ }
5672
+
5673
+ declare interface InteractionGetParamsBase {
5674
+ /**
5675
+ * Path param: Which version of the API to use.
5676
+ */
5677
+ api_version?: string;
5678
+ /**
5679
+ * 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.
5680
+ */
5681
+ last_event_id?: string;
5682
+ /**
5683
+ * Query param: If set to true, the generated content will be streamed incrementally.
5684
+ */
5685
+ stream?: boolean;
5686
+ }
5687
+
5688
+ declare interface InteractionGetParamsNonStreaming extends InteractionGetParamsBase {
5689
+ /**
5690
+ * Query param: If set to true, the generated content will be streamed incrementally.
5691
+ */
5692
+ stream?: false;
5693
+ }
5694
+
5695
+ declare interface InteractionGetParamsStreaming extends InteractionGetParamsBase {
5696
+ /**
5697
+ * Query param: If set to true, the generated content will be streamed incrementally.
5698
+ */
5699
+ stream: true;
5700
+ }
5701
+
5702
+ export declare class Interactions extends BaseInteractions {
5703
+ }
5704
+
5705
+ export declare namespace Interactions {
5706
+ 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 DocumentMimeType as DocumentMimeType, 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, };
5707
+ }
5708
+
5709
+ declare namespace InteractionsAPI {
5710
+ export {
5711
+ BaseInteractions,
5712
+ Interactions,
5713
+ AllowedTools,
5714
+ Annotation,
5715
+ AudioContent,
5716
+ AudioMimeType,
5717
+ CodeExecutionCallArguments,
5718
+ CodeExecutionCallContent,
5719
+ CodeExecutionResultContent,
5720
+ ContentDelta,
5721
+ ContentStart,
5722
+ ContentStop,
5723
+ DeepResearchAgentConfig,
5724
+ DocumentContent,
5725
+ DocumentMimeType,
5726
+ DynamicAgentConfig,
5727
+ ErrorEvent_2 as ErrorEvent,
5728
+ FileSearchResultContent,
5729
+ Function_2 as Function,
5730
+ FunctionCallContent,
5731
+ FunctionResultContent,
5732
+ GenerationConfig_2 as GenerationConfig,
5733
+ GoogleSearchCallArguments,
5734
+ GoogleSearchCallContent,
5735
+ GoogleSearchResult,
5736
+ GoogleSearchResultContent,
5737
+ ImageContent,
5738
+ ImageMimeType,
5739
+ Interaction,
5740
+ InteractionEvent,
5741
+ InteractionSSEEvent,
5742
+ InteractionStatusUpdate,
5743
+ MCPServerToolCallContent,
5744
+ MCPServerToolResultContent,
5745
+ Model_2 as Model,
5746
+ SpeechConfig_2 as SpeechConfig,
5747
+ TextContent,
5748
+ ThinkingLevel_2 as ThinkingLevel,
5749
+ ThoughtContent,
5750
+ Tool_2 as Tool,
5751
+ ToolChoice,
5752
+ ToolChoiceConfig,
5753
+ ToolChoiceType,
5754
+ Turn,
5755
+ URLContextCallArguments,
5756
+ URLContextCallContent,
5757
+ URLContextResult,
5758
+ URLContextResultContent,
5759
+ Usage,
5760
+ VideoContent,
5761
+ VideoMimeType,
5762
+ InteractionDeleteResponse,
5763
+ InteractionCreateParams,
5764
+ BaseCreateModelInteractionParams,
5765
+ BaseCreateAgentInteractionParams,
5766
+ CreateModelInteractionParamsNonStreaming,
5767
+ CreateModelInteractionParamsStreaming,
5768
+ CreateAgentInteractionParamsNonStreaming,
5769
+ CreateAgentInteractionParamsStreaming,
5770
+ InteractionDeleteParams,
5771
+ InteractionCancelParams,
5772
+ InteractionGetParams,
5773
+ InteractionGetParamsBase,
5774
+ InteractionGetParamsNonStreaming,
5775
+ InteractionGetParamsStreaming
5776
+ }
5777
+ }
5778
+
5779
+ declare type InteractionSSEEvent = InteractionEvent | InteractionStatusUpdate | ContentStart | ContentDelta | ContentStop | ErrorEvent_2;
5780
+
5781
+ declare interface InteractionStatusUpdate {
5782
+ /**
5783
+ * The event_id token to be used to resume the interaction stream, from
5784
+ * this event.
5785
+ */
5786
+ event_id?: string;
5787
+ event_type?: 'interaction.status_update';
5788
+ interaction_id?: string;
5789
+ status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5790
+ }
5791
+
5792
+ declare class InternalServerError extends APIError<number, Headers> {
5793
+ }
5794
+
4387
5795
  /** 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. */
4388
5796
  export declare interface Interval {
4389
5797
  /** Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. */
@@ -4880,6 +6288,10 @@ export declare interface LiveClientSetup {
4880
6288
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4881
6289
  the input and to ignore irrelevant input. */
4882
6290
  proactivity?: ProactivityConfig;
6291
+ /** Configures the explicit VAD signal. If enabled, the client will send
6292
+ vad_signal to indicate the start and end of speech. This allows the server
6293
+ to process the audio more efficiently. */
6294
+ explicitVadSignal?: boolean;
4883
6295
  }
4884
6296
 
4885
6297
  /** Client generated response to a `ToolCall` received from the server.
@@ -4982,6 +6394,10 @@ export declare interface LiveConnectConfig {
4982
6394
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4983
6395
  the input and to ignore irrelevant input. */
4984
6396
  proactivity?: ProactivityConfig;
6397
+ /** Configures the explicit VAD signal. If enabled, the client will send
6398
+ vad_signal to indicate the start and end of speech. This allows the server
6399
+ to process the audio more efficiently. */
6400
+ explicitVadSignal?: boolean;
4985
6401
  }
4986
6402
 
4987
6403
  /** Config for LiveConnectConstraints for Auth Token creation. */
@@ -5392,6 +6808,8 @@ export declare class LiveServerMessage {
5392
6808
  goAway?: LiveServerGoAway;
5393
6809
  /** Update of the session resumption state. */
5394
6810
  sessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
6811
+ /** Voice activity detection signal. */
6812
+ voiceActivityDetectionSignal?: VoiceActivityDetectionSignal;
5395
6813
  /**
5396
6814
  * Returns the concatenation of all text parts from the server content if present.
5397
6815
  *
@@ -5449,6 +6867,17 @@ export declare interface LiveServerToolCallCancellation {
5449
6867
  ids?: string[];
5450
6868
  }
5451
6869
 
6870
+ declare type LogFn = (message: string, ...rest: unknown[]) => void;
6871
+
6872
+ declare type Logger = {
6873
+ error: LogFn;
6874
+ warn: LogFn;
6875
+ info: LogFn;
6876
+ debug: LogFn;
6877
+ };
6878
+
6879
+ declare type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
6880
+
5452
6881
  /** Logprobs Result */
5453
6882
  export declare interface LogprobsResult {
5454
6883
  /** Length = total number of decoding steps. The chosen candidates may or may not be in top_candidates. */
@@ -5517,6 +6946,60 @@ export declare enum MaskReferenceMode {
5517
6946
  MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
5518
6947
  }
5519
6948
 
6949
+ /**
6950
+ * MCPServer tool call content.
6951
+ */
6952
+ declare interface MCPServerToolCallContent {
6953
+ /**
6954
+ * A unique ID for this specific tool call.
6955
+ */
6956
+ id: string;
6957
+ /**
6958
+ * The JSON object of arguments for the function.
6959
+ */
6960
+ arguments: {
6961
+ [key: string]: unknown;
6962
+ };
6963
+ /**
6964
+ * The name of the tool which was called.
6965
+ */
6966
+ name: string;
6967
+ /**
6968
+ * The name of the used MCP server.
6969
+ */
6970
+ server_name: string;
6971
+ type: 'mcp_server_tool_call';
6972
+ }
6973
+
6974
+ /**
6975
+ * MCPServer tool result content.
6976
+ */
6977
+ declare interface MCPServerToolResultContent {
6978
+ /**
6979
+ * ID to match the ID from the MCP server tool call block.
6980
+ */
6981
+ call_id: string;
6982
+ /**
6983
+ * The result of the tool call.
6984
+ */
6985
+ result: MCPServerToolResultContent.Items | unknown | string;
6986
+ type: 'mcp_server_tool_result';
6987
+ /**
6988
+ * Name of the tool which is called for this specific tool call.
6989
+ */
6990
+ name?: string;
6991
+ /**
6992
+ * The name of the used MCP server.
6993
+ */
6994
+ server_name?: string;
6995
+ }
6996
+
6997
+ declare namespace MCPServerToolResultContent {
6998
+ interface Items {
6999
+ items?: Array<string | InteractionsAPI.ImageContent | unknown>;
7000
+ }
7001
+ }
7002
+
5520
7003
  /**
5521
7004
  * Creates a McpCallableTool from MCP clients and an optional config.
5522
7005
  *
@@ -5577,6 +7060,14 @@ export declare enum MediaResolution {
5577
7060
  MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
5578
7061
  }
5579
7062
 
7063
+ /**
7064
+ * This type contains `RequestInit` options that may be available on the current runtime,
7065
+ * including per-platform extensions like `dispatcher`, `agent`, `client`, etc.
7066
+ */
7067
+ declare type MergedRequestInit = RequestInits &
7068
+ /** We don't include these in the types as they'll be overridden for every request. */
7069
+ Partial<Record<'body' | 'headers' | 'method' | 'signal', never>>;
7070
+
5580
7071
  /** Server content modalities. */
5581
7072
  export declare enum Modality {
5582
7073
  /**
@@ -5672,6 +7163,11 @@ export declare interface Model {
5672
7163
  thinking?: boolean;
5673
7164
  }
5674
7165
 
7166
+ /**
7167
+ * The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7168
+ */
7169
+ 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 & {});
7170
+
5675
7171
  export declare class Models extends BaseModule {
5676
7172
  private readonly apiClient;
5677
7173
  constructor(apiClient: ApiClient);
@@ -6046,9 +7542,9 @@ export declare interface ModelSelectionConfig {
6046
7542
  featureSelectionPreference?: FeatureSelectionPreference;
6047
7543
  }
6048
7544
 
6049
- /** The configuration for the multi-speaker setup. This data type is not supported in Vertex AI. */
7545
+ /** Configuration for a multi-speaker text-to-speech request. */
6050
7546
  export declare interface MultiSpeakerVoiceConfig {
6051
- /** Required. All the enabled speaker voices. */
7547
+ /** Required. A list of configurations for the voices of the speakers. Exactly two speaker voice configurations must be provided. */
6052
7548
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
6053
7549
  }
6054
7550
 
@@ -6075,6 +7571,48 @@ export declare enum MusicGenerationMode {
6075
7571
  VOCALIZATION = "VOCALIZATION"
6076
7572
  }
6077
7573
 
7574
+ /**
7575
+ * @license
7576
+ * Copyright 2025 Google LLC
7577
+ * SPDX-License-Identifier: Apache-2.0
7578
+ */
7579
+ /// <reference types="node" />
7580
+ /**
7581
+ * Shims for types that we can't always rely on being available globally.
7582
+ *
7583
+ * Note: these only exist at the type-level, there is no corresponding runtime
7584
+ * version for any of these symbols.
7585
+ */
7586
+ declare type NeverToAny<T> = T extends never ? any : T;
7587
+
7588
+ /** @ts-ignore For users with node-fetch@2 */
7589
+ 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>;
7590
+
7591
+ /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
7592
+ 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>;
7593
+
7594
+ /** @ts-ignore */
7595
+ declare type _NodeReadableStream<R = any> = ReadableStream_2<R>;
7596
+
7597
+ declare type NotAny<T> = [0] extends [1 & T] ? never : T;
7598
+
7599
+ declare class NotFoundError extends APIError<404, Headers> {
7600
+ }
7601
+
7602
+ /**
7603
+ * @internal
7604
+ * Users can pass explicit nulls to unset default headers. When we parse them
7605
+ * into a standard headers type we need to preserve that information.
7606
+ */
7607
+ declare type NullableHeaders = {
7608
+ /** Brand check, prevent users from creating a NullableHeaders. */
7609
+ [brand_privateNullableHeaders]: true;
7610
+ /** Parsed headers. */
7611
+ values: Headers;
7612
+ /** Set of lowercase header names explicitly set to null. */
7613
+ nulls: Set<string>;
7614
+ };
7615
+
6078
7616
  /** A long-running operation. */
6079
7617
  export declare interface Operation<T> {
6080
7618
  /** 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}`. */
@@ -6151,6 +7689,23 @@ export declare enum Outcome {
6151
7689
  OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
6152
7690
  }
6153
7691
 
7692
+ /**
7693
+ * Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
7694
+ */
7695
+ declare type OverloadedParameters<T> = T extends ({
7696
+ (...args: infer A): unknown;
7697
+ (...args: infer B): unknown;
7698
+ (...args: infer C): unknown;
7699
+ (...args: infer D): unknown;
7700
+ }) ? A | B | C | D : T extends ({
7701
+ (...args: infer A): unknown;
7702
+ (...args: infer B): unknown;
7703
+ (...args: infer C): unknown;
7704
+ }) ? A | B | C : T extends ({
7705
+ (...args: infer A): unknown;
7706
+ (...args: infer B): unknown;
7707
+ }) ? A | B : T extends (...args: infer A) => unknown ? A : never;
7708
+
6154
7709
  export declare enum PagedItem {
6155
7710
  PAGED_ITEM_BATCH_JOBS = "batchJobs",
6156
7711
  PAGED_ITEM_MODELS = "models",
@@ -6358,7 +7913,11 @@ export declare enum PartMediaResolutionLevel {
6358
7913
  /**
6359
7914
  * Media resolution set to high.
6360
7915
  */
6361
- MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
7916
+ MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH",
7917
+ /**
7918
+ * Media resolution set to ultra high.
7919
+ */
7920
+ MEDIA_RESOLUTION_ULTRA_HIGH = "MEDIA_RESOLUTION_ULTRA_HIGH"
6362
7921
  }
6363
7922
 
6364
7923
  /** Tuning spec for Partner models. This data type is not supported in Gemini API. */
@@ -6373,6 +7932,9 @@ export declare interface PartnerModelTuningSpec {
6373
7932
 
6374
7933
  export declare type PartUnion = Part | string;
6375
7934
 
7935
+ declare class PermissionDeniedError extends APIError<403, Headers> {
7936
+ }
7937
+
6376
7938
  /** Enum that controls the generation of people. */
6377
7939
  export declare enum PersonGeneration {
6378
7940
  /**
@@ -6495,6 +8057,13 @@ export declare interface ProductImage {
6495
8057
  productImage?: Image_2;
6496
8058
  }
6497
8059
 
8060
+ /**
8061
+ * @license
8062
+ * Copyright 2025 Google LLC
8063
+ * SPDX-License-Identifier: Apache-2.0
8064
+ */
8065
+ declare type PromiseOrValue<T> = T | Promise<T>;
8066
+
6498
8067
  /** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. This data type is not supported in Gemini API. */
6499
8068
  export declare interface RagChunk {
6500
8069
  /** If populated, represents where the chunk starts and ends in the document. */
@@ -6559,6 +8128,9 @@ export declare interface RagRetrievalConfigRankingRankService {
6559
8128
  modelName?: string;
6560
8129
  }
6561
8130
 
8131
+ declare class RateLimitError extends APIError<429, Headers> {
8132
+ }
8133
+
6562
8134
  /** A raw reference image.
6563
8135
 
6564
8136
  A raw reference image represents the base image to edit, provided by the user.
@@ -6575,6 +8147,8 @@ export declare class RawReferenceImage {
6575
8147
  toReferenceImageAPI(): ReferenceImageAPIInternal;
6576
8148
  }
6577
8149
 
8150
+ declare type _ReadableStream_2<R = any> = NeverToAny<([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>) | ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)>;
8151
+
6578
8152
  /** Marks the end of user activity.
6579
8153
 
6580
8154
  This can only be sent if automatic (i.e. server-side) activity detection is
@@ -6714,6 +8288,82 @@ export declare interface ReplicatedVoiceConfig {
6714
8288
  voiceSampleAudio?: string;
6715
8289
  }
6716
8290
 
8291
+ /**
8292
+ * The type for the first argument to `fetch`.
8293
+ *
8294
+ * https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
8295
+ */
8296
+ declare type _RequestInfo = Request | URL | string;
8297
+
8298
+ /**
8299
+ * An alias to the builtin `RequestInit` type so we can
8300
+ * easily alias it in import statements if there are name clashes.
8301
+ *
8302
+ * https://developer.mozilla.org/docs/Web/API/RequestInit
8303
+ */
8304
+ declare type _RequestInit = RequestInit;
8305
+
8306
+ declare type RequestInits = NotAny<UndiciTypesRequestInit> | NotAny<UndiciRequestInit> | NotAny<BunRequestInit> | NotAny<NodeFetch2RequestInit> | NotAny<NodeFetch3RequestInit> | NotAny<RequestInit> | NotAny<FetchRequestInit>;
8307
+
8308
+ declare type RequestOptions = {
8309
+ /**
8310
+ * The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
8311
+ */
8312
+ method?: HTTPMethod;
8313
+ /**
8314
+ * The URL path for the request.
8315
+ *
8316
+ * @example "/v1/foo"
8317
+ */
8318
+ path?: string;
8319
+ /**
8320
+ * Query parameters to include in the request URL.
8321
+ */
8322
+ query?: object | undefined | null;
8323
+ /**
8324
+ * The request body. Can be a string, JSON object, FormData, or other supported types.
8325
+ */
8326
+ body?: unknown;
8327
+ /**
8328
+ * HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
8329
+ */
8330
+ headers?: HeadersLike;
8331
+ /**
8332
+ * The maximum number of times that the client will retry a request in case of a
8333
+ * temporary failure, like a network error or a 5XX error from the server.
8334
+ *
8335
+ * @default 2
8336
+ */
8337
+ maxRetries?: number;
8338
+ stream?: boolean | undefined;
8339
+ /**
8340
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
8341
+ * from the server before timing out a single request.
8342
+ *
8343
+ * @unit milliseconds
8344
+ */
8345
+ timeout?: number;
8346
+ /**
8347
+ * Additional `RequestInit` options to be passed to the underlying `fetch` call.
8348
+ * These options will be merged with the client's default fetch options.
8349
+ */
8350
+ fetchOptions?: MergedRequestInit;
8351
+ /**
8352
+ * An AbortSignal that can be used to cancel the request.
8353
+ */
8354
+ signal?: AbortSignal | undefined | null;
8355
+ /**
8356
+ * A unique key for this request to enable idempotency.
8357
+ */
8358
+ idempotencyKey?: string;
8359
+ /**
8360
+ * Override the default base URL for this specific request.
8361
+ */
8362
+ defaultBaseURL?: string | undefined;
8363
+ __binaryResponse?: boolean | undefined;
8364
+ __streamClass?: typeof Stream;
8365
+ };
8366
+
6717
8367
  /** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
6718
8368
  export declare interface Retrieval {
6719
8369
  /** Optional. Deprecated. This option is no longer supported. */
@@ -7209,10 +8859,28 @@ export declare interface SpeechConfig {
7209
8859
  voiceConfig?: VoiceConfig;
7210
8860
  /** Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization. */
7211
8861
  languageCode?: string;
7212
- /** Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI. */
8862
+ /** The configuration for a multi-speaker text-to-speech request. This field is mutually exclusive with `voice_config`. */
7213
8863
  multiSpeakerVoiceConfig?: MultiSpeakerVoiceConfig;
7214
8864
  }
7215
8865
 
8866
+ /**
8867
+ * The configuration for speech interaction.
8868
+ */
8869
+ declare interface SpeechConfig_2 {
8870
+ /**
8871
+ * The language of the speech.
8872
+ */
8873
+ language?: string;
8874
+ /**
8875
+ * The speaker's name, it should match the speaker name given in the prompt.
8876
+ */
8877
+ speaker?: string;
8878
+ /**
8879
+ * The voice of the speaker.
8880
+ */
8881
+ voice?: string;
8882
+ }
8883
+
7216
8884
  export declare type SpeechConfigUnion = SpeechConfig | string;
7217
8885
 
7218
8886
  /** Start of speech sensitivity. */
@@ -7231,6 +8899,31 @@ export declare enum StartSensitivity {
7231
8899
  START_SENSITIVITY_LOW = "START_SENSITIVITY_LOW"
7232
8900
  }
7233
8901
 
8902
+ declare class Stream<Item> implements AsyncIterable<Item> {
8903
+ private iterator;
8904
+ controller: AbortController;
8905
+ private client;
8906
+ constructor(iterator: () => AsyncIterator<Item>, controller: AbortController, client?: BaseGeminiNextGenAPIClient);
8907
+ static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8908
+ /**
8909
+ * Generates a Stream from a newline-separated ReadableStream
8910
+ * where each item is a JSON value.
8911
+ */
8912
+ static fromReadableStream<Item>(readableStream: _ReadableStream_2, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8913
+ [Symbol.asyncIterator](): AsyncIterator<Item>;
8914
+ /**
8915
+ * Splits the stream into two streams which can be
8916
+ * independently read from at different speeds.
8917
+ */
8918
+ tee(): [Stream<Item>, Stream<Item>];
8919
+ /**
8920
+ * Converts this stream to a newline-separated ReadableStream of
8921
+ * JSON stringified values in the stream
8922
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
8923
+ */
8924
+ toReadableStream(): _ReadableStream_2;
8925
+ }
8926
+
7234
8927
  /** User provided string values assigned to a single metadata key. This data type is not supported in Vertex AI. */
7235
8928
  export declare interface StringList {
7236
8929
  /** The string values of the metadata to store. */
@@ -7412,6 +9105,21 @@ export declare interface TestTableItem {
7412
9105
  ignoreKeys?: string[];
7413
9106
  }
7414
9107
 
9108
+ /**
9109
+ * A text content block.
9110
+ */
9111
+ declare interface TextContent {
9112
+ type: 'text';
9113
+ /**
9114
+ * Citation information for model-generated content.
9115
+ */
9116
+ annotations?: Array<Annotation>;
9117
+ /**
9118
+ * The text content.
9119
+ */
9120
+ text?: string;
9121
+ }
9122
+
7415
9123
  /** The thinking features configuration. */
7416
9124
  export declare interface ThinkingConfig {
7417
9125
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
@@ -7420,24 +9128,49 @@ export declare interface ThinkingConfig {
7420
9128
  /** Indicates the thinking budget in tokens. 0 is DISABLED. -1 is AUTOMATIC. The default values and allowed ranges are model dependent.
7421
9129
  */
7422
9130
  thinkingBudget?: number;
7423
- /** Optional. The level of thoughts tokens that the model should generate. */
9131
+ /** Optional. The number of thoughts tokens that the model should generate. */
7424
9132
  thinkingLevel?: ThinkingLevel;
7425
9133
  }
7426
9134
 
7427
- /** The level of thoughts tokens that the model should generate. */
9135
+ /** The number of thoughts tokens that the model should generate. */
7428
9136
  export declare enum ThinkingLevel {
7429
9137
  /**
7430
- * Default value.
9138
+ * Unspecified thinking level.
7431
9139
  */
7432
9140
  THINKING_LEVEL_UNSPECIFIED = "THINKING_LEVEL_UNSPECIFIED",
7433
9141
  /**
7434
9142
  * Low thinking level.
7435
9143
  */
7436
9144
  LOW = "LOW",
9145
+ /**
9146
+ * Medium thinking level.
9147
+ */
9148
+ MEDIUM = "MEDIUM",
7437
9149
  /**
7438
9150
  * High thinking level.
7439
9151
  */
7440
- HIGH = "HIGH"
9152
+ HIGH = "HIGH",
9153
+ /**
9154
+ * MINIMAL thinking level.
9155
+ */
9156
+ MINIMAL = "MINIMAL"
9157
+ }
9158
+
9159
+ declare type ThinkingLevel_2 = 'minimal' | 'low' | 'medium' | 'high';
9160
+
9161
+ /**
9162
+ * A thought content block.
9163
+ */
9164
+ declare interface ThoughtContent {
9165
+ type: 'thought';
9166
+ /**
9167
+ * Signature to match the backend source to be part of the generation.
9168
+ */
9169
+ signature?: string;
9170
+ /**
9171
+ * A summary of the thought.
9172
+ */
9173
+ summary?: Array<TextContent | ImageContent>;
7441
9174
  }
7442
9175
 
7443
9176
  export declare class Tokens extends BaseModule {
@@ -7566,6 +9299,103 @@ export declare interface Tool {
7566
9299
  urlContext?: UrlContext;
7567
9300
  }
7568
9301
 
9302
+ /**
9303
+ * A tool that can be used by the model.
9304
+ */
9305
+ declare type Tool_2 = Function_2 | Tool_2.GoogleSearch | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.FileSearch;
9306
+
9307
+ declare namespace Tool_2 {
9308
+ /**
9309
+ * A tool that can be used by the model to search Google.
9310
+ */
9311
+ interface GoogleSearch {
9312
+ type: 'google_search';
9313
+ }
9314
+ /**
9315
+ * A tool that can be used by the model to execute code.
9316
+ */
9317
+ interface CodeExecution {
9318
+ type: 'code_execution';
9319
+ }
9320
+ /**
9321
+ * A tool that can be used by the model to fetch URL context.
9322
+ */
9323
+ interface URLContext {
9324
+ type: 'url_context';
9325
+ }
9326
+ /**
9327
+ * A tool that can be used by the model to interact with the computer.
9328
+ */
9329
+ interface ComputerUse {
9330
+ type: 'computer_use';
9331
+ /**
9332
+ * The environment being operated.
9333
+ */
9334
+ environment?: 'browser';
9335
+ /**
9336
+ * The list of predefined functions that are excluded from the model call.
9337
+ */
9338
+ excludedPredefinedFunctions?: Array<string>;
9339
+ }
9340
+ /**
9341
+ * A MCPServer is a server that can be called by the model to perform actions.
9342
+ */
9343
+ interface MCPServer {
9344
+ type: 'mcp_server';
9345
+ /**
9346
+ * The allowed tools.
9347
+ */
9348
+ allowed_tools?: Array<InteractionsAPI.AllowedTools>;
9349
+ /**
9350
+ * Optional: Fields for authentication headers, timeouts, etc., if needed.
9351
+ */
9352
+ headers?: {
9353
+ [key: string]: string;
9354
+ };
9355
+ /**
9356
+ * The name of the MCPServer.
9357
+ */
9358
+ name?: string;
9359
+ /**
9360
+ * The full URL for the MCPServer endpoint.
9361
+ * Example: "https://api.example.com/mcp"
9362
+ */
9363
+ url?: string;
9364
+ }
9365
+ /**
9366
+ * A tool that can be used by the model to search files.
9367
+ */
9368
+ interface FileSearch {
9369
+ type: 'file_search';
9370
+ /**
9371
+ * The file search store names to search.
9372
+ */
9373
+ file_search_store_names?: Array<string>;
9374
+ /**
9375
+ * Metadata filter to apply to the semantic retrieval documents and chunks.
9376
+ */
9377
+ metadata_filter?: string;
9378
+ /**
9379
+ * The number of semantic retrieval chunks to retrieve.
9380
+ */
9381
+ top_k?: number;
9382
+ }
9383
+ }
9384
+
9385
+ /**
9386
+ * The configuration for tool choice.
9387
+ */
9388
+ declare type ToolChoice = ToolChoiceType | ToolChoiceConfig;
9389
+
9390
+ declare interface ToolChoiceConfig {
9391
+ /**
9392
+ * The configuration for allowed tools.
9393
+ */
9394
+ allowed_tools?: AllowedTools;
9395
+ }
9396
+
9397
+ declare type ToolChoiceType = 'auto' | 'any' | 'none' | 'validated';
9398
+
7569
9399
  /** 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. */
7570
9400
  export declare interface ToolCodeExecution {
7571
9401
  }
@@ -7863,6 +9693,18 @@ export declare interface TuningValidationDataset {
7863
9693
  vertexDatasetResource?: string;
7864
9694
  }
7865
9695
 
9696
+ declare interface Turn {
9697
+ /**
9698
+ * The content of the turn.
9699
+ */
9700
+ content?: string | Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
9701
+ /**
9702
+ * The originator of this turn. Must be user for input or model for
9703
+ * model output.
9704
+ */
9705
+ role?: string;
9706
+ }
9707
+
7866
9708
  /** The reason why the turn is complete. */
7867
9709
  export declare enum TurnCompleteReason {
7868
9710
  /**
@@ -7996,6 +9838,7 @@ declare namespace types {
7996
9838
  FileSource,
7997
9839
  TurnCompleteReason,
7998
9840
  MediaModality,
9841
+ VadSignalType,
7999
9842
  StartSensitivity,
8000
9843
  EndSensitivity,
8001
9844
  ActivityHandling,
@@ -8317,6 +10160,7 @@ declare namespace types {
8317
10160
  UsageMetadata,
8318
10161
  LiveServerGoAway,
8319
10162
  LiveServerSessionResumptionUpdate,
10163
+ VoiceActivityDetectionSignal,
8320
10164
  LiveServerMessage,
8321
10165
  OperationFromAPIResponseParameters,
8322
10166
  GenerationConfigThinkingConfig,
@@ -8382,6 +10226,37 @@ declare namespace types {
8382
10226
  }
8383
10227
  }
8384
10228
 
10229
+ /** @ts-ignore For users with undici */
10230
+ 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>;
10231
+
10232
+ /**
10233
+ * These imports attempt to get types from a parent package's dependencies.
10234
+ * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
10235
+ * would cause typescript to show types not present at runtime. To avoid this, we import
10236
+ * directly from parent node_modules folders.
10237
+ *
10238
+ * We need to check multiple levels because we don't know what directory structure we'll be in.
10239
+ * For example, pnpm generates directories like this:
10240
+ * ```
10241
+ * node_modules
10242
+ * ├── .pnpm
10243
+ * │ └── pkg@1.0.0
10244
+ * │ └── node_modules
10245
+ * │ └── pkg
10246
+ * │ └── internal
10247
+ * │ └── types.d.ts
10248
+ * ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg
10249
+ * └── undici
10250
+ * ```
10251
+ *
10252
+ * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
10253
+ */
10254
+ /** @ts-ignore For users with \@types/node */
10255
+ 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>;
10256
+
10257
+ declare class UnprocessableEntityError extends APIError<422, Headers> {
10258
+ }
10259
+
8385
10260
  /** Optional parameters for caches.update method. */
8386
10261
  export declare interface UpdateCachedContentConfig {
8387
10262
  /** Used to override HTTP request options. */
@@ -8632,12 +10507,74 @@ export declare class UpscaleImageResponse {
8632
10507
  export declare interface UrlContext {
8633
10508
  }
8634
10509
 
10510
+ /**
10511
+ * The arguments to pass to the URL context.
10512
+ */
10513
+ declare interface URLContextCallArguments {
10514
+ /**
10515
+ * The URLs to fetch.
10516
+ */
10517
+ urls?: Array<string>;
10518
+ }
10519
+
10520
+ /**
10521
+ * URL context content.
10522
+ */
10523
+ declare interface URLContextCallContent {
10524
+ type: 'url_context_call';
10525
+ /**
10526
+ * A unique ID for this specific tool call.
10527
+ */
10528
+ id?: string;
10529
+ /**
10530
+ * The arguments to pass to the URL context.
10531
+ */
10532
+ arguments?: URLContextCallArguments;
10533
+ }
10534
+
8635
10535
  /** Metadata related to url context retrieval tool. */
8636
10536
  export declare interface UrlContextMetadata {
8637
10537
  /** Output only. List of url context. */
8638
10538
  urlMetadata?: UrlMetadata[];
8639
10539
  }
8640
10540
 
10541
+ /**
10542
+ * The result of the URL context.
10543
+ */
10544
+ declare interface URLContextResult {
10545
+ /**
10546
+ * The status of the URL retrieval.
10547
+ */
10548
+ status?: 'success' | 'error' | 'paywall' | 'unsafe';
10549
+ /**
10550
+ * The URL that was fetched.
10551
+ */
10552
+ url?: string;
10553
+ }
10554
+
10555
+ /**
10556
+ * URL context result content.
10557
+ */
10558
+ declare interface URLContextResultContent {
10559
+ type: 'url_context_result';
10560
+ /**
10561
+ * ID to match the ID from the url context call block.
10562
+ */
10563
+ call_id?: string;
10564
+ /**
10565
+ * Whether the URL context resulted in an error.
10566
+ */
10567
+ is_error?: boolean;
10568
+ /**
10569
+ * The results of the URL context.
10570
+ */
10571
+ result?: Array<URLContextResult>;
10572
+ /**
10573
+ * The signature of the URL context result.
10574
+ */
10575
+ signature?: string;
10576
+ }
10577
+
8641
10578
  /** Context of the a single url retrieval. */
8642
10579
  export declare interface UrlMetadata {
8643
10580
  /** Retrieved url by the tool. */
@@ -8670,6 +10607,108 @@ export declare enum UrlRetrievalStatus {
8670
10607
  URL_RETRIEVAL_STATUS_UNSAFE = "URL_RETRIEVAL_STATUS_UNSAFE"
8671
10608
  }
8672
10609
 
10610
+ /**
10611
+ * Statistics on the interaction request's token usage.
10612
+ */
10613
+ declare interface Usage {
10614
+ /**
10615
+ * A breakdown of cached token usage by modality.
10616
+ */
10617
+ cached_tokens_by_modality?: Array<Usage.CachedTokensByModality>;
10618
+ /**
10619
+ * A breakdown of input token usage by modality.
10620
+ */
10621
+ input_tokens_by_modality?: Array<Usage.InputTokensByModality>;
10622
+ /**
10623
+ * A breakdown of output token usage by modality.
10624
+ */
10625
+ output_tokens_by_modality?: Array<Usage.OutputTokensByModality>;
10626
+ /**
10627
+ * A breakdown of tool-use token usage by modality.
10628
+ */
10629
+ tool_use_tokens_by_modality?: Array<Usage.ToolUseTokensByModality>;
10630
+ /**
10631
+ * Number of tokens in the cached part of the prompt (the cached content).
10632
+ */
10633
+ total_cached_tokens?: number;
10634
+ /**
10635
+ * Number of tokens in the prompt (context).
10636
+ */
10637
+ total_input_tokens?: number;
10638
+ /**
10639
+ * Total number of tokens across all the generated responses.
10640
+ */
10641
+ total_output_tokens?: number;
10642
+ /**
10643
+ * Number of tokens of thoughts for thinking models.
10644
+ */
10645
+ total_reasoning_tokens?: number;
10646
+ /**
10647
+ * Total token count for the interaction request (prompt + responses + other
10648
+ * internal tokens).
10649
+ */
10650
+ total_tokens?: number;
10651
+ /**
10652
+ * Number of tokens present in tool-use prompt(s).
10653
+ */
10654
+ total_tool_use_tokens?: number;
10655
+ }
10656
+
10657
+ declare namespace Usage {
10658
+ /**
10659
+ * The token count for a single response modality.
10660
+ */
10661
+ interface CachedTokensByModality {
10662
+ /**
10663
+ * The modality associated with the token count.
10664
+ */
10665
+ modality?: 'text' | 'image' | 'audio';
10666
+ /**
10667
+ * Number of tokens for the modality.
10668
+ */
10669
+ tokens?: number;
10670
+ }
10671
+ /**
10672
+ * The token count for a single response modality.
10673
+ */
10674
+ interface InputTokensByModality {
10675
+ /**
10676
+ * The modality associated with the token count.
10677
+ */
10678
+ modality?: 'text' | 'image' | 'audio';
10679
+ /**
10680
+ * Number of tokens for the modality.
10681
+ */
10682
+ tokens?: number;
10683
+ }
10684
+ /**
10685
+ * The token count for a single response modality.
10686
+ */
10687
+ interface OutputTokensByModality {
10688
+ /**
10689
+ * The modality associated with the token count.
10690
+ */
10691
+ modality?: 'text' | 'image' | 'audio';
10692
+ /**
10693
+ * Number of tokens for the modality.
10694
+ */
10695
+ tokens?: number;
10696
+ }
10697
+ /**
10698
+ * The token count for a single response modality.
10699
+ */
10700
+ interface ToolUseTokensByModality {
10701
+ /**
10702
+ * The modality associated with the token count.
10703
+ */
10704
+ modality?: 'text' | 'image' | 'audio';
10705
+ /**
10706
+ * Number of tokens for the modality.
10707
+ */
10708
+ tokens?: number;
10709
+ }
10710
+ }
10711
+
8673
10712
  /** Usage metadata about response(s). */
8674
10713
  export declare interface UsageMetadata {
8675
10714
  /** 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. */
@@ -8697,6 +10736,22 @@ export declare interface UsageMetadata {
8697
10736
  trafficType?: TrafficType;
8698
10737
  }
8699
10738
 
10739
+ /** The type of the VAD signal. */
10740
+ export declare enum VadSignalType {
10741
+ /**
10742
+ * The default is VAD_SIGNAL_TYPE_UNSPECIFIED.
10743
+ */
10744
+ VAD_SIGNAL_TYPE_UNSPECIFIED = "VAD_SIGNAL_TYPE_UNSPECIFIED",
10745
+ /**
10746
+ * Start of sentence signal.
10747
+ */
10748
+ VAD_SIGNAL_TYPE_SOS = "VAD_SIGNAL_TYPE_SOS",
10749
+ /**
10750
+ * End of sentence signal.
10751
+ */
10752
+ VAD_SIGNAL_TYPE_EOS = "VAD_SIGNAL_TYPE_EOS"
10753
+ }
10754
+
8700
10755
  /** Hyperparameters for Veo. This data type is not supported in Gemini API. */
8701
10756
  export declare interface VeoHyperParameters {
8702
10757
  /** Optional. Number of complete passes the model makes over the entire training dataset during training. */
@@ -8788,6 +10843,23 @@ export declare enum VideoCompressionQuality {
8788
10843
  LOSSLESS = "LOSSLESS"
8789
10844
  }
8790
10845
 
10846
+ /**
10847
+ * A video content block.
10848
+ */
10849
+ declare interface VideoContent {
10850
+ type: 'video';
10851
+ data?: string;
10852
+ /**
10853
+ * The mime type of the video.
10854
+ */
10855
+ mime_type?: VideoMimeType;
10856
+ /**
10857
+ * The resolution of the media.
10858
+ */
10859
+ resolution?: 'low' | 'medium' | 'high' | 'ultra_high';
10860
+ uri?: string;
10861
+ }
10862
+
8791
10863
  /** A mask for video generation. */
8792
10864
  export declare interface VideoGenerationMask {
8793
10865
  /** The image mask to use for generating videos. */
@@ -8859,6 +10931,16 @@ export declare interface VideoMetadata {
8859
10931
  startOffset?: string;
8860
10932
  }
8861
10933
 
10934
+ /**
10935
+ * The mime type of the video.
10936
+ */
10937
+ declare type VideoMimeType = 'video/mp4' | 'video/mpeg' | 'video/mov' | 'video/avi' | 'video/x-flv' | 'video/mpg' | 'video/webm' | 'video/wmv' | 'video/3gpp' | (string & {});
10938
+
10939
+ export declare interface VoiceActivityDetectionSignal {
10940
+ /** The type of the VAD signal. */
10941
+ vadSignalType?: VadSignalType;
10942
+ }
10943
+
8862
10944
  export declare interface VoiceConfig {
8863
10945
  /** If true, the model will use a replicated voice for the response. */
8864
10946
  replicatedVoiceConfig?: ReplicatedVoiceConfig;