@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.
@@ -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. */
@@ -3761,6 +4856,8 @@ export declare class GoogleGenAI {
3761
4856
  readonly authTokens: Tokens;
3762
4857
  readonly tunings: Tunings;
3763
4858
  readonly fileSearchStores: FileSearchStores;
4859
+ private _interactions;
4860
+ get interactions(): Interactions;
3764
4861
  constructor(options: GoogleGenAIOptions);
3765
4862
  }
3766
4863
 
@@ -3855,6 +4952,72 @@ export declare interface GoogleSearch {
3855
4952
  timeRangeFilter?: Interval;
3856
4953
  }
3857
4954
 
4955
+ /**
4956
+ * The arguments to pass to Google Search.
4957
+ */
4958
+ declare interface GoogleSearchCallArguments {
4959
+ /**
4960
+ * Web search queries for the following-up web search.
4961
+ */
4962
+ queries?: Array<string>;
4963
+ }
4964
+
4965
+ /**
4966
+ * Google Search content.
4967
+ */
4968
+ declare interface GoogleSearchCallContent {
4969
+ type: 'google_search_call';
4970
+ /**
4971
+ * A unique ID for this specific tool call.
4972
+ */
4973
+ id?: string;
4974
+ /**
4975
+ * The arguments to pass to Google Search.
4976
+ */
4977
+ arguments?: GoogleSearchCallArguments;
4978
+ }
4979
+
4980
+ /**
4981
+ * The result of the Google Search.
4982
+ */
4983
+ declare interface GoogleSearchResult {
4984
+ /**
4985
+ * Web content snippet that can be embedded in a web page or an app webview.
4986
+ */
4987
+ rendered_content?: string;
4988
+ /**
4989
+ * Title of the search result.
4990
+ */
4991
+ title?: string;
4992
+ /**
4993
+ * URI reference of the search result.
4994
+ */
4995
+ url?: string;
4996
+ }
4997
+
4998
+ /**
4999
+ * Google Search result content.
5000
+ */
5001
+ declare interface GoogleSearchResultContent {
5002
+ type: 'google_search_result';
5003
+ /**
5004
+ * ID to match the ID from the google search call block.
5005
+ */
5006
+ call_id?: string;
5007
+ /**
5008
+ * Whether the Google Search resulted in an error.
5009
+ */
5010
+ is_error?: boolean;
5011
+ /**
5012
+ * The results of the Google Search.
5013
+ */
5014
+ result?: Array<GoogleSearchResult>;
5015
+ /**
5016
+ * The signature of the Google Search result.
5017
+ */
5018
+ signature?: string;
5019
+ }
5020
+
3858
5021
  /** Tool to retrieve public web data for grounding, powered by Google. */
3859
5022
  export declare interface GoogleSearchRetrieval {
3860
5023
  /** Specifies the dynamic retrieval configuration for the given source. */
@@ -4133,6 +5296,15 @@ export declare enum HarmSeverity {
4133
5296
  HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH"
4134
5297
  }
4135
5298
 
5299
+ declare type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | NullableHeaders;
5300
+
5301
+ /**
5302
+ * @license
5303
+ * Copyright 2025 Google LLC
5304
+ * SPDX-License-Identifier: Apache-2.0
5305
+ */
5306
+ declare type HeaderValue = string | undefined | null;
5307
+
4136
5308
  /** The location of the API key. This enum is not supported in Gemini API. */
4137
5309
  export declare enum HttpElementLocation {
4138
5310
  HTTP_IN_UNSPECIFIED = "HTTP_IN_UNSPECIFIED",
@@ -4158,6 +5330,8 @@ export declare enum HttpElementLocation {
4158
5330
  HTTP_IN_COOKIE = "HTTP_IN_COOKIE"
4159
5331
  }
4160
5332
 
5333
+ declare type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
5334
+
4161
5335
  /** HTTP options to be used in each of the requests. */
4162
5336
  export declare interface HttpOptions {
4163
5337
  /** The base URL for the AI platform service endpoint. */
@@ -4267,6 +5441,28 @@ export declare interface ImageConfig {
4267
5441
  outputCompressionQuality?: number;
4268
5442
  }
4269
5443
 
5444
+ /**
5445
+ * An image content block.
5446
+ */
5447
+ declare interface ImageContent {
5448
+ type: 'image';
5449
+ data?: string;
5450
+ /**
5451
+ * The mime type of the image.
5452
+ */
5453
+ mime_type?: ImageMimeType;
5454
+ /**
5455
+ * The resolution of the media.
5456
+ */
5457
+ resolution?: 'low' | 'medium' | 'high' | 'ultra_high';
5458
+ uri?: string;
5459
+ }
5460
+
5461
+ /**
5462
+ * The mime type of the image.
5463
+ */
5464
+ declare type ImageMimeType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/heic' | 'image/heif' | (string & {});
5465
+
4270
5466
  /** Enum that specifies the language of the text in the prompt. */
4271
5467
  export declare enum ImagePromptLanguage {
4272
5468
  /**
@@ -4396,6 +5592,218 @@ export declare class InlinedResponse {
4396
5592
  error?: JobError;
4397
5593
  }
4398
5594
 
5595
+ /**
5596
+ * The Interaction resource.
5597
+ */
5598
+ declare interface Interaction {
5599
+ /**
5600
+ * Output only. A unique identifier for the interaction completion.
5601
+ */
5602
+ id: string;
5603
+ /**
5604
+ * Output only. The status of the interaction.
5605
+ */
5606
+ status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5607
+ /**
5608
+ * The name of the `Agent` used for generating the interaction.
5609
+ */
5610
+ agent?: (string & {}) | 'deep-research-pro-preview-12-2025';
5611
+ /**
5612
+ * Output only. The time at which the response was created in ISO 8601 format
5613
+ * (YYYY-MM-DDThh:mm:ssZ).
5614
+ */
5615
+ created?: string;
5616
+ /**
5617
+ * The name of the `Model` used for generating the interaction.
5618
+ */
5619
+ model?: Model_2;
5620
+ /**
5621
+ * Output only. The object type of the interaction. Always set to `interaction`.
5622
+ */
5623
+ object?: 'interaction';
5624
+ /**
5625
+ * Output only. Responses from the model.
5626
+ */
5627
+ outputs?: Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
5628
+ /**
5629
+ * The ID of the previous interaction, if any.
5630
+ */
5631
+ previous_interaction_id?: string;
5632
+ /**
5633
+ * Output only. The role of the interaction.
5634
+ */
5635
+ role?: string;
5636
+ /**
5637
+ * Output only. The time at which the response was last updated in ISO 8601 format
5638
+ * (YYYY-MM-DDThh:mm:ssZ).
5639
+ */
5640
+ updated?: string;
5641
+ /**
5642
+ * Output only. Statistics on the interaction request's token usage.
5643
+ */
5644
+ usage?: Usage;
5645
+ }
5646
+
5647
+ declare interface InteractionCancelParams {
5648
+ /**
5649
+ * Which version of the API to use.
5650
+ */
5651
+ api_version?: string;
5652
+ }
5653
+
5654
+ declare type InteractionCreateParams = CreateModelInteractionParamsNonStreaming | CreateModelInteractionParamsStreaming | CreateAgentInteractionParamsNonStreaming | CreateAgentInteractionParamsStreaming;
5655
+
5656
+ declare interface InteractionDeleteParams {
5657
+ /**
5658
+ * Which version of the API to use.
5659
+ */
5660
+ api_version?: string;
5661
+ }
5662
+
5663
+ declare type InteractionDeleteResponse = unknown;
5664
+
5665
+ declare interface InteractionEvent {
5666
+ /**
5667
+ * The event_id token to be used to resume the interaction stream, from
5668
+ * this event.
5669
+ */
5670
+ event_id?: string;
5671
+ event_type?: 'interaction.start' | 'interaction.complete';
5672
+ /**
5673
+ * The Interaction resource.
5674
+ */
5675
+ interaction?: Interaction;
5676
+ }
5677
+
5678
+ declare type InteractionGetParams = InteractionGetParamsNonStreaming | InteractionGetParamsStreaming;
5679
+
5680
+ declare namespace InteractionGetParams {
5681
+ type InteractionGetParamsNonStreaming = InteractionsAPI.InteractionGetParamsNonStreaming;
5682
+ type InteractionGetParamsStreaming = InteractionsAPI.InteractionGetParamsStreaming;
5683
+ }
5684
+
5685
+ declare interface InteractionGetParamsBase {
5686
+ /**
5687
+ * Path param: Which version of the API to use.
5688
+ */
5689
+ api_version?: string;
5690
+ /**
5691
+ * 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.
5692
+ */
5693
+ last_event_id?: string;
5694
+ /**
5695
+ * Query param: If set to true, the generated content will be streamed incrementally.
5696
+ */
5697
+ stream?: boolean;
5698
+ }
5699
+
5700
+ declare interface InteractionGetParamsNonStreaming extends InteractionGetParamsBase {
5701
+ /**
5702
+ * Query param: If set to true, the generated content will be streamed incrementally.
5703
+ */
5704
+ stream?: false;
5705
+ }
5706
+
5707
+ declare interface InteractionGetParamsStreaming extends InteractionGetParamsBase {
5708
+ /**
5709
+ * Query param: If set to true, the generated content will be streamed incrementally.
5710
+ */
5711
+ stream: true;
5712
+ }
5713
+
5714
+ export declare class Interactions extends BaseInteractions {
5715
+ }
5716
+
5717
+ export declare namespace Interactions {
5718
+ 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, };
5719
+ }
5720
+
5721
+ declare namespace InteractionsAPI {
5722
+ export {
5723
+ BaseInteractions,
5724
+ Interactions,
5725
+ AllowedTools,
5726
+ Annotation,
5727
+ AudioContent,
5728
+ AudioMimeType,
5729
+ CodeExecutionCallArguments,
5730
+ CodeExecutionCallContent,
5731
+ CodeExecutionResultContent,
5732
+ ContentDelta,
5733
+ ContentStart,
5734
+ ContentStop,
5735
+ DeepResearchAgentConfig,
5736
+ DocumentContent,
5737
+ DocumentMimeType,
5738
+ DynamicAgentConfig,
5739
+ ErrorEvent_2 as ErrorEvent,
5740
+ FileSearchResultContent,
5741
+ Function_2 as Function,
5742
+ FunctionCallContent,
5743
+ FunctionResultContent,
5744
+ GenerationConfig_2 as GenerationConfig,
5745
+ GoogleSearchCallArguments,
5746
+ GoogleSearchCallContent,
5747
+ GoogleSearchResult,
5748
+ GoogleSearchResultContent,
5749
+ ImageContent,
5750
+ ImageMimeType,
5751
+ Interaction,
5752
+ InteractionEvent,
5753
+ InteractionSSEEvent,
5754
+ InteractionStatusUpdate,
5755
+ MCPServerToolCallContent,
5756
+ MCPServerToolResultContent,
5757
+ Model_2 as Model,
5758
+ SpeechConfig_2 as SpeechConfig,
5759
+ TextContent,
5760
+ ThinkingLevel_2 as ThinkingLevel,
5761
+ ThoughtContent,
5762
+ Tool_2 as Tool,
5763
+ ToolChoice,
5764
+ ToolChoiceConfig,
5765
+ ToolChoiceType,
5766
+ Turn,
5767
+ URLContextCallArguments,
5768
+ URLContextCallContent,
5769
+ URLContextResult,
5770
+ URLContextResultContent,
5771
+ Usage,
5772
+ VideoContent,
5773
+ VideoMimeType,
5774
+ InteractionDeleteResponse,
5775
+ InteractionCreateParams,
5776
+ BaseCreateModelInteractionParams,
5777
+ BaseCreateAgentInteractionParams,
5778
+ CreateModelInteractionParamsNonStreaming,
5779
+ CreateModelInteractionParamsStreaming,
5780
+ CreateAgentInteractionParamsNonStreaming,
5781
+ CreateAgentInteractionParamsStreaming,
5782
+ InteractionDeleteParams,
5783
+ InteractionCancelParams,
5784
+ InteractionGetParams,
5785
+ InteractionGetParamsBase,
5786
+ InteractionGetParamsNonStreaming,
5787
+ InteractionGetParamsStreaming
5788
+ }
5789
+ }
5790
+
5791
+ declare type InteractionSSEEvent = InteractionEvent | InteractionStatusUpdate | ContentStart | ContentDelta | ContentStop | ErrorEvent_2;
5792
+
5793
+ declare interface InteractionStatusUpdate {
5794
+ /**
5795
+ * The event_id token to be used to resume the interaction stream, from
5796
+ * this event.
5797
+ */
5798
+ event_id?: string;
5799
+ event_type?: 'interaction.status_update';
5800
+ interaction_id?: string;
5801
+ status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5802
+ }
5803
+
5804
+ declare class InternalServerError extends APIError<number, Headers> {
5805
+ }
5806
+
4399
5807
  /** Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive). The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time. */
4400
5808
  export declare interface Interval {
4401
5809
  /** Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. */
@@ -4892,6 +6300,10 @@ export declare interface LiveClientSetup {
4892
6300
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4893
6301
  the input and to ignore irrelevant input. */
4894
6302
  proactivity?: ProactivityConfig;
6303
+ /** Configures the explicit VAD signal. If enabled, the client will send
6304
+ vad_signal to indicate the start and end of speech. This allows the server
6305
+ to process the audio more efficiently. */
6306
+ explicitVadSignal?: boolean;
4895
6307
  }
4896
6308
 
4897
6309
  /** Client generated response to a `ToolCall` received from the server.
@@ -4994,6 +6406,10 @@ export declare interface LiveConnectConfig {
4994
6406
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4995
6407
  the input and to ignore irrelevant input. */
4996
6408
  proactivity?: ProactivityConfig;
6409
+ /** Configures the explicit VAD signal. If enabled, the client will send
6410
+ vad_signal to indicate the start and end of speech. This allows the server
6411
+ to process the audio more efficiently. */
6412
+ explicitVadSignal?: boolean;
4997
6413
  }
4998
6414
 
4999
6415
  /** Config for LiveConnectConstraints for Auth Token creation. */
@@ -5404,6 +6820,8 @@ export declare class LiveServerMessage {
5404
6820
  goAway?: LiveServerGoAway;
5405
6821
  /** Update of the session resumption state. */
5406
6822
  sessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
6823
+ /** Voice activity detection signal. */
6824
+ voiceActivityDetectionSignal?: VoiceActivityDetectionSignal;
5407
6825
  /**
5408
6826
  * Returns the concatenation of all text parts from the server content if present.
5409
6827
  *
@@ -5461,6 +6879,17 @@ export declare interface LiveServerToolCallCancellation {
5461
6879
  ids?: string[];
5462
6880
  }
5463
6881
 
6882
+ declare type LogFn = (message: string, ...rest: unknown[]) => void;
6883
+
6884
+ declare type Logger = {
6885
+ error: LogFn;
6886
+ warn: LogFn;
6887
+ info: LogFn;
6888
+ debug: LogFn;
6889
+ };
6890
+
6891
+ declare type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
6892
+
5464
6893
  /** Logprobs Result */
5465
6894
  export declare interface LogprobsResult {
5466
6895
  /** Length = total number of decoding steps. The chosen candidates may or may not be in top_candidates. */
@@ -5529,6 +6958,60 @@ export declare enum MaskReferenceMode {
5529
6958
  MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
5530
6959
  }
5531
6960
 
6961
+ /**
6962
+ * MCPServer tool call content.
6963
+ */
6964
+ declare interface MCPServerToolCallContent {
6965
+ /**
6966
+ * A unique ID for this specific tool call.
6967
+ */
6968
+ id: string;
6969
+ /**
6970
+ * The JSON object of arguments for the function.
6971
+ */
6972
+ arguments: {
6973
+ [key: string]: unknown;
6974
+ };
6975
+ /**
6976
+ * The name of the tool which was called.
6977
+ */
6978
+ name: string;
6979
+ /**
6980
+ * The name of the used MCP server.
6981
+ */
6982
+ server_name: string;
6983
+ type: 'mcp_server_tool_call';
6984
+ }
6985
+
6986
+ /**
6987
+ * MCPServer tool result content.
6988
+ */
6989
+ declare interface MCPServerToolResultContent {
6990
+ /**
6991
+ * ID to match the ID from the MCP server tool call block.
6992
+ */
6993
+ call_id: string;
6994
+ /**
6995
+ * The result of the tool call.
6996
+ */
6997
+ result: MCPServerToolResultContent.Items | unknown | string;
6998
+ type: 'mcp_server_tool_result';
6999
+ /**
7000
+ * Name of the tool which is called for this specific tool call.
7001
+ */
7002
+ name?: string;
7003
+ /**
7004
+ * The name of the used MCP server.
7005
+ */
7006
+ server_name?: string;
7007
+ }
7008
+
7009
+ declare namespace MCPServerToolResultContent {
7010
+ interface Items {
7011
+ items?: Array<string | InteractionsAPI.ImageContent | unknown>;
7012
+ }
7013
+ }
7014
+
5532
7015
  /**
5533
7016
  * Creates a McpCallableTool from MCP clients and an optional config.
5534
7017
  *
@@ -5589,6 +7072,14 @@ export declare enum MediaResolution {
5589
7072
  MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
5590
7073
  }
5591
7074
 
7075
+ /**
7076
+ * This type contains `RequestInit` options that may be available on the current runtime,
7077
+ * including per-platform extensions like `dispatcher`, `agent`, `client`, etc.
7078
+ */
7079
+ declare type MergedRequestInit = RequestInits &
7080
+ /** We don't include these in the types as they'll be overridden for every request. */
7081
+ Partial<Record<'body' | 'headers' | 'method' | 'signal', never>>;
7082
+
5592
7083
  /** Server content modalities. */
5593
7084
  export declare enum Modality {
5594
7085
  /**
@@ -5684,6 +7175,11 @@ export declare interface Model {
5684
7175
  thinking?: boolean;
5685
7176
  }
5686
7177
 
7178
+ /**
7179
+ * The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7180
+ */
7181
+ 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 & {});
7182
+
5687
7183
  export declare class Models extends BaseModule {
5688
7184
  private readonly apiClient;
5689
7185
  constructor(apiClient: ApiClient);
@@ -6058,9 +7554,9 @@ export declare interface ModelSelectionConfig {
6058
7554
  featureSelectionPreference?: FeatureSelectionPreference;
6059
7555
  }
6060
7556
 
6061
- /** The configuration for the multi-speaker setup. This data type is not supported in Vertex AI. */
7557
+ /** Configuration for a multi-speaker text-to-speech request. */
6062
7558
  export declare interface MultiSpeakerVoiceConfig {
6063
- /** Required. All the enabled speaker voices. */
7559
+ /** Required. A list of configurations for the voices of the speakers. Exactly two speaker voice configurations must be provided. */
6064
7560
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
6065
7561
  }
6066
7562
 
@@ -6087,6 +7583,48 @@ export declare enum MusicGenerationMode {
6087
7583
  VOCALIZATION = "VOCALIZATION"
6088
7584
  }
6089
7585
 
7586
+ /**
7587
+ * @license
7588
+ * Copyright 2025 Google LLC
7589
+ * SPDX-License-Identifier: Apache-2.0
7590
+ */
7591
+ /// <reference types="node" />
7592
+ /**
7593
+ * Shims for types that we can't always rely on being available globally.
7594
+ *
7595
+ * Note: these only exist at the type-level, there is no corresponding runtime
7596
+ * version for any of these symbols.
7597
+ */
7598
+ declare type NeverToAny<T> = T extends never ? any : T;
7599
+
7600
+ /** @ts-ignore For users with node-fetch@2 */
7601
+ 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>;
7602
+
7603
+ /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
7604
+ 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>;
7605
+
7606
+ /** @ts-ignore */
7607
+ declare type _NodeReadableStream<R = any> = ReadableStream_2<R>;
7608
+
7609
+ declare type NotAny<T> = [0] extends [1 & T] ? never : T;
7610
+
7611
+ declare class NotFoundError extends APIError<404, Headers> {
7612
+ }
7613
+
7614
+ /**
7615
+ * @internal
7616
+ * Users can pass explicit nulls to unset default headers. When we parse them
7617
+ * into a standard headers type we need to preserve that information.
7618
+ */
7619
+ declare type NullableHeaders = {
7620
+ /** Brand check, prevent users from creating a NullableHeaders. */
7621
+ [brand_privateNullableHeaders]: true;
7622
+ /** Parsed headers. */
7623
+ values: Headers;
7624
+ /** Set of lowercase header names explicitly set to null. */
7625
+ nulls: Set<string>;
7626
+ };
7627
+
6090
7628
  /** A long-running operation. */
6091
7629
  export declare interface Operation<T> {
6092
7630
  /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
@@ -6163,6 +7701,23 @@ export declare enum Outcome {
6163
7701
  OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
6164
7702
  }
6165
7703
 
7704
+ /**
7705
+ * Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
7706
+ */
7707
+ declare type OverloadedParameters<T> = T extends ({
7708
+ (...args: infer A): unknown;
7709
+ (...args: infer B): unknown;
7710
+ (...args: infer C): unknown;
7711
+ (...args: infer D): unknown;
7712
+ }) ? A | B | C | D : T extends ({
7713
+ (...args: infer A): unknown;
7714
+ (...args: infer B): unknown;
7715
+ (...args: infer C): unknown;
7716
+ }) ? A | B | C : T extends ({
7717
+ (...args: infer A): unknown;
7718
+ (...args: infer B): unknown;
7719
+ }) ? A | B : T extends (...args: infer A) => unknown ? A : never;
7720
+
6166
7721
  export declare enum PagedItem {
6167
7722
  PAGED_ITEM_BATCH_JOBS = "batchJobs",
6168
7723
  PAGED_ITEM_MODELS = "models",
@@ -6370,7 +7925,11 @@ export declare enum PartMediaResolutionLevel {
6370
7925
  /**
6371
7926
  * Media resolution set to high.
6372
7927
  */
6373
- MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
7928
+ MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH",
7929
+ /**
7930
+ * Media resolution set to ultra high.
7931
+ */
7932
+ MEDIA_RESOLUTION_ULTRA_HIGH = "MEDIA_RESOLUTION_ULTRA_HIGH"
6374
7933
  }
6375
7934
 
6376
7935
  /** Tuning spec for Partner models. This data type is not supported in Gemini API. */
@@ -6385,6 +7944,9 @@ export declare interface PartnerModelTuningSpec {
6385
7944
 
6386
7945
  export declare type PartUnion = Part | string;
6387
7946
 
7947
+ declare class PermissionDeniedError extends APIError<403, Headers> {
7948
+ }
7949
+
6388
7950
  /** Enum that controls the generation of people. */
6389
7951
  export declare enum PersonGeneration {
6390
7952
  /**
@@ -6507,6 +8069,13 @@ export declare interface ProductImage {
6507
8069
  productImage?: Image_2;
6508
8070
  }
6509
8071
 
8072
+ /**
8073
+ * @license
8074
+ * Copyright 2025 Google LLC
8075
+ * SPDX-License-Identifier: Apache-2.0
8076
+ */
8077
+ declare type PromiseOrValue<T> = T | Promise<T>;
8078
+
6510
8079
  /** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. This data type is not supported in Gemini API. */
6511
8080
  export declare interface RagChunk {
6512
8081
  /** If populated, represents where the chunk starts and ends in the document. */
@@ -6571,6 +8140,9 @@ export declare interface RagRetrievalConfigRankingRankService {
6571
8140
  modelName?: string;
6572
8141
  }
6573
8142
 
8143
+ declare class RateLimitError extends APIError<429, Headers> {
8144
+ }
8145
+
6574
8146
  /** A raw reference image.
6575
8147
 
6576
8148
  A raw reference image represents the base image to edit, provided by the user.
@@ -6587,6 +8159,8 @@ export declare class RawReferenceImage {
6587
8159
  toReferenceImageAPI(): ReferenceImageAPIInternal;
6588
8160
  }
6589
8161
 
8162
+ declare type _ReadableStream_2<R = any> = NeverToAny<([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>) | ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)>;
8163
+
6590
8164
  /** Marks the end of user activity.
6591
8165
 
6592
8166
  This can only be sent if automatic (i.e. server-side) activity detection is
@@ -6726,6 +8300,82 @@ export declare interface ReplicatedVoiceConfig {
6726
8300
  voiceSampleAudio?: string;
6727
8301
  }
6728
8302
 
8303
+ /**
8304
+ * The type for the first argument to `fetch`.
8305
+ *
8306
+ * https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
8307
+ */
8308
+ declare type _RequestInfo = Request | URL | string;
8309
+
8310
+ /**
8311
+ * An alias to the builtin `RequestInit` type so we can
8312
+ * easily alias it in import statements if there are name clashes.
8313
+ *
8314
+ * https://developer.mozilla.org/docs/Web/API/RequestInit
8315
+ */
8316
+ declare type _RequestInit = RequestInit;
8317
+
8318
+ declare type RequestInits = NotAny<UndiciTypesRequestInit> | NotAny<UndiciRequestInit> | NotAny<BunRequestInit> | NotAny<NodeFetch2RequestInit> | NotAny<NodeFetch3RequestInit> | NotAny<RequestInit> | NotAny<FetchRequestInit>;
8319
+
8320
+ declare type RequestOptions = {
8321
+ /**
8322
+ * The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
8323
+ */
8324
+ method?: HTTPMethod;
8325
+ /**
8326
+ * The URL path for the request.
8327
+ *
8328
+ * @example "/v1/foo"
8329
+ */
8330
+ path?: string;
8331
+ /**
8332
+ * Query parameters to include in the request URL.
8333
+ */
8334
+ query?: object | undefined | null;
8335
+ /**
8336
+ * The request body. Can be a string, JSON object, FormData, or other supported types.
8337
+ */
8338
+ body?: unknown;
8339
+ /**
8340
+ * HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
8341
+ */
8342
+ headers?: HeadersLike;
8343
+ /**
8344
+ * The maximum number of times that the client will retry a request in case of a
8345
+ * temporary failure, like a network error or a 5XX error from the server.
8346
+ *
8347
+ * @default 2
8348
+ */
8349
+ maxRetries?: number;
8350
+ stream?: boolean | undefined;
8351
+ /**
8352
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
8353
+ * from the server before timing out a single request.
8354
+ *
8355
+ * @unit milliseconds
8356
+ */
8357
+ timeout?: number;
8358
+ /**
8359
+ * Additional `RequestInit` options to be passed to the underlying `fetch` call.
8360
+ * These options will be merged with the client's default fetch options.
8361
+ */
8362
+ fetchOptions?: MergedRequestInit;
8363
+ /**
8364
+ * An AbortSignal that can be used to cancel the request.
8365
+ */
8366
+ signal?: AbortSignal | undefined | null;
8367
+ /**
8368
+ * A unique key for this request to enable idempotency.
8369
+ */
8370
+ idempotencyKey?: string;
8371
+ /**
8372
+ * Override the default base URL for this specific request.
8373
+ */
8374
+ defaultBaseURL?: string | undefined;
8375
+ __binaryResponse?: boolean | undefined;
8376
+ __streamClass?: typeof Stream;
8377
+ };
8378
+
6729
8379
  /** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
6730
8380
  export declare interface Retrieval {
6731
8381
  /** Optional. Deprecated. This option is no longer supported. */
@@ -7221,10 +8871,28 @@ export declare interface SpeechConfig {
7221
8871
  voiceConfig?: VoiceConfig;
7222
8872
  /** Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization. */
7223
8873
  languageCode?: string;
7224
- /** 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. */
8874
+ /** The configuration for a multi-speaker text-to-speech request. This field is mutually exclusive with `voice_config`. */
7225
8875
  multiSpeakerVoiceConfig?: MultiSpeakerVoiceConfig;
7226
8876
  }
7227
8877
 
8878
+ /**
8879
+ * The configuration for speech interaction.
8880
+ */
8881
+ declare interface SpeechConfig_2 {
8882
+ /**
8883
+ * The language of the speech.
8884
+ */
8885
+ language?: string;
8886
+ /**
8887
+ * The speaker's name, it should match the speaker name given in the prompt.
8888
+ */
8889
+ speaker?: string;
8890
+ /**
8891
+ * The voice of the speaker.
8892
+ */
8893
+ voice?: string;
8894
+ }
8895
+
7228
8896
  export declare type SpeechConfigUnion = SpeechConfig | string;
7229
8897
 
7230
8898
  /** Start of speech sensitivity. */
@@ -7243,6 +8911,31 @@ export declare enum StartSensitivity {
7243
8911
  START_SENSITIVITY_LOW = "START_SENSITIVITY_LOW"
7244
8912
  }
7245
8913
 
8914
+ declare class Stream<Item> implements AsyncIterable<Item> {
8915
+ private iterator;
8916
+ controller: AbortController;
8917
+ private client;
8918
+ constructor(iterator: () => AsyncIterator<Item>, controller: AbortController, client?: BaseGeminiNextGenAPIClient);
8919
+ static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8920
+ /**
8921
+ * Generates a Stream from a newline-separated ReadableStream
8922
+ * where each item is a JSON value.
8923
+ */
8924
+ static fromReadableStream<Item>(readableStream: _ReadableStream_2, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8925
+ [Symbol.asyncIterator](): AsyncIterator<Item>;
8926
+ /**
8927
+ * Splits the stream into two streams which can be
8928
+ * independently read from at different speeds.
8929
+ */
8930
+ tee(): [Stream<Item>, Stream<Item>];
8931
+ /**
8932
+ * Converts this stream to a newline-separated ReadableStream of
8933
+ * JSON stringified values in the stream
8934
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
8935
+ */
8936
+ toReadableStream(): _ReadableStream_2;
8937
+ }
8938
+
7246
8939
  /** User provided string values assigned to a single metadata key. This data type is not supported in Vertex AI. */
7247
8940
  export declare interface StringList {
7248
8941
  /** The string values of the metadata to store. */
@@ -7424,6 +9117,21 @@ export declare interface TestTableItem {
7424
9117
  ignoreKeys?: string[];
7425
9118
  }
7426
9119
 
9120
+ /**
9121
+ * A text content block.
9122
+ */
9123
+ declare interface TextContent {
9124
+ type: 'text';
9125
+ /**
9126
+ * Citation information for model-generated content.
9127
+ */
9128
+ annotations?: Array<Annotation>;
9129
+ /**
9130
+ * The text content.
9131
+ */
9132
+ text?: string;
9133
+ }
9134
+
7427
9135
  /** The thinking features configuration. */
7428
9136
  export declare interface ThinkingConfig {
7429
9137
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
@@ -7432,24 +9140,49 @@ export declare interface ThinkingConfig {
7432
9140
  /** Indicates the thinking budget in tokens. 0 is DISABLED. -1 is AUTOMATIC. The default values and allowed ranges are model dependent.
7433
9141
  */
7434
9142
  thinkingBudget?: number;
7435
- /** Optional. The level of thoughts tokens that the model should generate. */
9143
+ /** Optional. The number of thoughts tokens that the model should generate. */
7436
9144
  thinkingLevel?: ThinkingLevel;
7437
9145
  }
7438
9146
 
7439
- /** The level of thoughts tokens that the model should generate. */
9147
+ /** The number of thoughts tokens that the model should generate. */
7440
9148
  export declare enum ThinkingLevel {
7441
9149
  /**
7442
- * Default value.
9150
+ * Unspecified thinking level.
7443
9151
  */
7444
9152
  THINKING_LEVEL_UNSPECIFIED = "THINKING_LEVEL_UNSPECIFIED",
7445
9153
  /**
7446
9154
  * Low thinking level.
7447
9155
  */
7448
9156
  LOW = "LOW",
9157
+ /**
9158
+ * Medium thinking level.
9159
+ */
9160
+ MEDIUM = "MEDIUM",
7449
9161
  /**
7450
9162
  * High thinking level.
7451
9163
  */
7452
- HIGH = "HIGH"
9164
+ HIGH = "HIGH",
9165
+ /**
9166
+ * MINIMAL thinking level.
9167
+ */
9168
+ MINIMAL = "MINIMAL"
9169
+ }
9170
+
9171
+ declare type ThinkingLevel_2 = 'minimal' | 'low' | 'medium' | 'high';
9172
+
9173
+ /**
9174
+ * A thought content block.
9175
+ */
9176
+ declare interface ThoughtContent {
9177
+ type: 'thought';
9178
+ /**
9179
+ * Signature to match the backend source to be part of the generation.
9180
+ */
9181
+ signature?: string;
9182
+ /**
9183
+ * A summary of the thought.
9184
+ */
9185
+ summary?: Array<TextContent | ImageContent>;
7453
9186
  }
7454
9187
 
7455
9188
  export declare class Tokens extends BaseModule {
@@ -7578,6 +9311,103 @@ export declare interface Tool {
7578
9311
  urlContext?: UrlContext;
7579
9312
  }
7580
9313
 
9314
+ /**
9315
+ * A tool that can be used by the model.
9316
+ */
9317
+ declare type Tool_2 = Function_2 | Tool_2.GoogleSearch | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.FileSearch;
9318
+
9319
+ declare namespace Tool_2 {
9320
+ /**
9321
+ * A tool that can be used by the model to search Google.
9322
+ */
9323
+ interface GoogleSearch {
9324
+ type: 'google_search';
9325
+ }
9326
+ /**
9327
+ * A tool that can be used by the model to execute code.
9328
+ */
9329
+ interface CodeExecution {
9330
+ type: 'code_execution';
9331
+ }
9332
+ /**
9333
+ * A tool that can be used by the model to fetch URL context.
9334
+ */
9335
+ interface URLContext {
9336
+ type: 'url_context';
9337
+ }
9338
+ /**
9339
+ * A tool that can be used by the model to interact with the computer.
9340
+ */
9341
+ interface ComputerUse {
9342
+ type: 'computer_use';
9343
+ /**
9344
+ * The environment being operated.
9345
+ */
9346
+ environment?: 'browser';
9347
+ /**
9348
+ * The list of predefined functions that are excluded from the model call.
9349
+ */
9350
+ excludedPredefinedFunctions?: Array<string>;
9351
+ }
9352
+ /**
9353
+ * A MCPServer is a server that can be called by the model to perform actions.
9354
+ */
9355
+ interface MCPServer {
9356
+ type: 'mcp_server';
9357
+ /**
9358
+ * The allowed tools.
9359
+ */
9360
+ allowed_tools?: Array<InteractionsAPI.AllowedTools>;
9361
+ /**
9362
+ * Optional: Fields for authentication headers, timeouts, etc., if needed.
9363
+ */
9364
+ headers?: {
9365
+ [key: string]: string;
9366
+ };
9367
+ /**
9368
+ * The name of the MCPServer.
9369
+ */
9370
+ name?: string;
9371
+ /**
9372
+ * The full URL for the MCPServer endpoint.
9373
+ * Example: "https://api.example.com/mcp"
9374
+ */
9375
+ url?: string;
9376
+ }
9377
+ /**
9378
+ * A tool that can be used by the model to search files.
9379
+ */
9380
+ interface FileSearch {
9381
+ type: 'file_search';
9382
+ /**
9383
+ * The file search store names to search.
9384
+ */
9385
+ file_search_store_names?: Array<string>;
9386
+ /**
9387
+ * Metadata filter to apply to the semantic retrieval documents and chunks.
9388
+ */
9389
+ metadata_filter?: string;
9390
+ /**
9391
+ * The number of semantic retrieval chunks to retrieve.
9392
+ */
9393
+ top_k?: number;
9394
+ }
9395
+ }
9396
+
9397
+ /**
9398
+ * The configuration for tool choice.
9399
+ */
9400
+ declare type ToolChoice = ToolChoiceType | ToolChoiceConfig;
9401
+
9402
+ declare interface ToolChoiceConfig {
9403
+ /**
9404
+ * The configuration for allowed tools.
9405
+ */
9406
+ allowed_tools?: AllowedTools;
9407
+ }
9408
+
9409
+ declare type ToolChoiceType = 'auto' | 'any' | 'none' | 'validated';
9410
+
7581
9411
  /** Tool that executes code generated by the model, and automatically returns the result to the model. See also [ExecutableCode]and [CodeExecutionResult] which are input and output to this tool. This data type is not supported in Gemini API. */
7582
9412
  export declare interface ToolCodeExecution {
7583
9413
  }
@@ -7875,6 +9705,18 @@ export declare interface TuningValidationDataset {
7875
9705
  vertexDatasetResource?: string;
7876
9706
  }
7877
9707
 
9708
+ declare interface Turn {
9709
+ /**
9710
+ * The content of the turn.
9711
+ */
9712
+ content?: string | Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
9713
+ /**
9714
+ * The originator of this turn. Must be user for input or model for
9715
+ * model output.
9716
+ */
9717
+ role?: string;
9718
+ }
9719
+
7878
9720
  /** The reason why the turn is complete. */
7879
9721
  export declare enum TurnCompleteReason {
7880
9722
  /**
@@ -8008,6 +9850,7 @@ declare namespace types {
8008
9850
  FileSource,
8009
9851
  TurnCompleteReason,
8010
9852
  MediaModality,
9853
+ VadSignalType,
8011
9854
  StartSensitivity,
8012
9855
  EndSensitivity,
8013
9856
  ActivityHandling,
@@ -8329,6 +10172,7 @@ declare namespace types {
8329
10172
  UsageMetadata,
8330
10173
  LiveServerGoAway,
8331
10174
  LiveServerSessionResumptionUpdate,
10175
+ VoiceActivityDetectionSignal,
8332
10176
  LiveServerMessage,
8333
10177
  OperationFromAPIResponseParameters,
8334
10178
  GenerationConfigThinkingConfig,
@@ -8394,6 +10238,37 @@ declare namespace types {
8394
10238
  }
8395
10239
  }
8396
10240
 
10241
+ /** @ts-ignore For users with undici */
10242
+ 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>;
10243
+
10244
+ /**
10245
+ * These imports attempt to get types from a parent package's dependencies.
10246
+ * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
10247
+ * would cause typescript to show types not present at runtime. To avoid this, we import
10248
+ * directly from parent node_modules folders.
10249
+ *
10250
+ * We need to check multiple levels because we don't know what directory structure we'll be in.
10251
+ * For example, pnpm generates directories like this:
10252
+ * ```
10253
+ * node_modules
10254
+ * ├── .pnpm
10255
+ * │ └── pkg@1.0.0
10256
+ * │ └── node_modules
10257
+ * │ └── pkg
10258
+ * │ └── internal
10259
+ * │ └── types.d.ts
10260
+ * ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg
10261
+ * └── undici
10262
+ * ```
10263
+ *
10264
+ * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
10265
+ */
10266
+ /** @ts-ignore For users with \@types/node */
10267
+ 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>;
10268
+
10269
+ declare class UnprocessableEntityError extends APIError<422, Headers> {
10270
+ }
10271
+
8397
10272
  /** Optional parameters for caches.update method. */
8398
10273
  export declare interface UpdateCachedContentConfig {
8399
10274
  /** Used to override HTTP request options. */
@@ -8644,12 +10519,74 @@ export declare class UpscaleImageResponse {
8644
10519
  export declare interface UrlContext {
8645
10520
  }
8646
10521
 
10522
+ /**
10523
+ * The arguments to pass to the URL context.
10524
+ */
10525
+ declare interface URLContextCallArguments {
10526
+ /**
10527
+ * The URLs to fetch.
10528
+ */
10529
+ urls?: Array<string>;
10530
+ }
10531
+
10532
+ /**
10533
+ * URL context content.
10534
+ */
10535
+ declare interface URLContextCallContent {
10536
+ type: 'url_context_call';
10537
+ /**
10538
+ * A unique ID for this specific tool call.
10539
+ */
10540
+ id?: string;
10541
+ /**
10542
+ * The arguments to pass to the URL context.
10543
+ */
10544
+ arguments?: URLContextCallArguments;
10545
+ }
10546
+
8647
10547
  /** Metadata related to url context retrieval tool. */
8648
10548
  export declare interface UrlContextMetadata {
8649
10549
  /** Output only. List of url context. */
8650
10550
  urlMetadata?: UrlMetadata[];
8651
10551
  }
8652
10552
 
10553
+ /**
10554
+ * The result of the URL context.
10555
+ */
10556
+ declare interface URLContextResult {
10557
+ /**
10558
+ * The status of the URL retrieval.
10559
+ */
10560
+ status?: 'success' | 'error' | 'paywall' | 'unsafe';
10561
+ /**
10562
+ * The URL that was fetched.
10563
+ */
10564
+ url?: string;
10565
+ }
10566
+
10567
+ /**
10568
+ * URL context result content.
10569
+ */
10570
+ declare interface URLContextResultContent {
10571
+ type: 'url_context_result';
10572
+ /**
10573
+ * ID to match the ID from the url context call block.
10574
+ */
10575
+ call_id?: string;
10576
+ /**
10577
+ * Whether the URL context resulted in an error.
10578
+ */
10579
+ is_error?: boolean;
10580
+ /**
10581
+ * The results of the URL context.
10582
+ */
10583
+ result?: Array<URLContextResult>;
10584
+ /**
10585
+ * The signature of the URL context result.
10586
+ */
10587
+ signature?: string;
10588
+ }
10589
+
8653
10590
  /** Context of the a single url retrieval. */
8654
10591
  export declare interface UrlMetadata {
8655
10592
  /** Retrieved url by the tool. */
@@ -8682,6 +10619,108 @@ export declare enum UrlRetrievalStatus {
8682
10619
  URL_RETRIEVAL_STATUS_UNSAFE = "URL_RETRIEVAL_STATUS_UNSAFE"
8683
10620
  }
8684
10621
 
10622
+ /**
10623
+ * Statistics on the interaction request's token usage.
10624
+ */
10625
+ declare interface Usage {
10626
+ /**
10627
+ * A breakdown of cached token usage by modality.
10628
+ */
10629
+ cached_tokens_by_modality?: Array<Usage.CachedTokensByModality>;
10630
+ /**
10631
+ * A breakdown of input token usage by modality.
10632
+ */
10633
+ input_tokens_by_modality?: Array<Usage.InputTokensByModality>;
10634
+ /**
10635
+ * A breakdown of output token usage by modality.
10636
+ */
10637
+ output_tokens_by_modality?: Array<Usage.OutputTokensByModality>;
10638
+ /**
10639
+ * A breakdown of tool-use token usage by modality.
10640
+ */
10641
+ tool_use_tokens_by_modality?: Array<Usage.ToolUseTokensByModality>;
10642
+ /**
10643
+ * Number of tokens in the cached part of the prompt (the cached content).
10644
+ */
10645
+ total_cached_tokens?: number;
10646
+ /**
10647
+ * Number of tokens in the prompt (context).
10648
+ */
10649
+ total_input_tokens?: number;
10650
+ /**
10651
+ * Total number of tokens across all the generated responses.
10652
+ */
10653
+ total_output_tokens?: number;
10654
+ /**
10655
+ * Number of tokens of thoughts for thinking models.
10656
+ */
10657
+ total_reasoning_tokens?: number;
10658
+ /**
10659
+ * Total token count for the interaction request (prompt + responses + other
10660
+ * internal tokens).
10661
+ */
10662
+ total_tokens?: number;
10663
+ /**
10664
+ * Number of tokens present in tool-use prompt(s).
10665
+ */
10666
+ total_tool_use_tokens?: number;
10667
+ }
10668
+
10669
+ declare namespace Usage {
10670
+ /**
10671
+ * The token count for a single response modality.
10672
+ */
10673
+ interface CachedTokensByModality {
10674
+ /**
10675
+ * The modality associated with the token count.
10676
+ */
10677
+ modality?: 'text' | 'image' | 'audio';
10678
+ /**
10679
+ * Number of tokens for the modality.
10680
+ */
10681
+ tokens?: number;
10682
+ }
10683
+ /**
10684
+ * The token count for a single response modality.
10685
+ */
10686
+ interface InputTokensByModality {
10687
+ /**
10688
+ * The modality associated with the token count.
10689
+ */
10690
+ modality?: 'text' | 'image' | 'audio';
10691
+ /**
10692
+ * Number of tokens for the modality.
10693
+ */
10694
+ tokens?: number;
10695
+ }
10696
+ /**
10697
+ * The token count for a single response modality.
10698
+ */
10699
+ interface OutputTokensByModality {
10700
+ /**
10701
+ * The modality associated with the token count.
10702
+ */
10703
+ modality?: 'text' | 'image' | 'audio';
10704
+ /**
10705
+ * Number of tokens for the modality.
10706
+ */
10707
+ tokens?: number;
10708
+ }
10709
+ /**
10710
+ * The token count for a single response modality.
10711
+ */
10712
+ interface ToolUseTokensByModality {
10713
+ /**
10714
+ * The modality associated with the token count.
10715
+ */
10716
+ modality?: 'text' | 'image' | 'audio';
10717
+ /**
10718
+ * Number of tokens for the modality.
10719
+ */
10720
+ tokens?: number;
10721
+ }
10722
+ }
10723
+
8685
10724
  /** Usage metadata about response(s). */
8686
10725
  export declare interface UsageMetadata {
8687
10726
  /** Number of tokens in the prompt. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content. */
@@ -8709,6 +10748,22 @@ export declare interface UsageMetadata {
8709
10748
  trafficType?: TrafficType;
8710
10749
  }
8711
10750
 
10751
+ /** The type of the VAD signal. */
10752
+ export declare enum VadSignalType {
10753
+ /**
10754
+ * The default is VAD_SIGNAL_TYPE_UNSPECIFIED.
10755
+ */
10756
+ VAD_SIGNAL_TYPE_UNSPECIFIED = "VAD_SIGNAL_TYPE_UNSPECIFIED",
10757
+ /**
10758
+ * Start of sentence signal.
10759
+ */
10760
+ VAD_SIGNAL_TYPE_SOS = "VAD_SIGNAL_TYPE_SOS",
10761
+ /**
10762
+ * End of sentence signal.
10763
+ */
10764
+ VAD_SIGNAL_TYPE_EOS = "VAD_SIGNAL_TYPE_EOS"
10765
+ }
10766
+
8712
10767
  /** Hyperparameters for Veo. This data type is not supported in Gemini API. */
8713
10768
  export declare interface VeoHyperParameters {
8714
10769
  /** Optional. Number of complete passes the model makes over the entire training dataset during training. */
@@ -8800,6 +10855,23 @@ export declare enum VideoCompressionQuality {
8800
10855
  LOSSLESS = "LOSSLESS"
8801
10856
  }
8802
10857
 
10858
+ /**
10859
+ * A video content block.
10860
+ */
10861
+ declare interface VideoContent {
10862
+ type: 'video';
10863
+ data?: string;
10864
+ /**
10865
+ * The mime type of the video.
10866
+ */
10867
+ mime_type?: VideoMimeType;
10868
+ /**
10869
+ * The resolution of the media.
10870
+ */
10871
+ resolution?: 'low' | 'medium' | 'high' | 'ultra_high';
10872
+ uri?: string;
10873
+ }
10874
+
8803
10875
  /** A mask for video generation. */
8804
10876
  export declare interface VideoGenerationMask {
8805
10877
  /** The image mask to use for generating videos. */
@@ -8871,6 +10943,16 @@ export declare interface VideoMetadata {
8871
10943
  startOffset?: string;
8872
10944
  }
8873
10945
 
10946
+ /**
10947
+ * The mime type of the video.
10948
+ */
10949
+ declare type VideoMimeType = 'video/mp4' | 'video/mpeg' | 'video/mov' | 'video/avi' | 'video/x-flv' | 'video/mpg' | 'video/webm' | 'video/wmv' | 'video/3gpp' | (string & {});
10950
+
10951
+ export declare interface VoiceActivityDetectionSignal {
10952
+ /** The type of the VAD signal. */
10953
+ vadSignalType?: VadSignalType;
10954
+ }
10955
+
8874
10956
  export declare interface VoiceConfig {
8875
10957
  /** If true, the model will use a replicated voice for the response. */
8876
10958
  replicatedVoiceConfig?: ReplicatedVoiceConfig;