@google/genai 1.32.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/genai.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ /// <reference types="node" />
2
+
1
3
  import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
4
  import { GoogleAuthOptions } from 'google-auth-library';
5
+ import { ReadableStream as ReadableStream_2 } from 'stream/web';
3
6
 
4
7
  /** Marks the end of user activity.
5
8
 
@@ -63,6 +66,41 @@ export declare enum AdapterSize {
63
66
  ADAPTER_SIZE_THIRTY_TWO = "ADAPTER_SIZE_THIRTY_TWO"
64
67
  }
65
68
 
69
+ /**
70
+ * The configuration for allowed tools.
71
+ */
72
+ declare interface AllowedTools {
73
+ /**
74
+ * The mode of the tool choice.
75
+ */
76
+ mode?: ToolChoiceType;
77
+ /**
78
+ * The names of the allowed tools.
79
+ */
80
+ tools?: Array<string>;
81
+ }
82
+
83
+ /**
84
+ * Citation information for model-generated content.
85
+ */
86
+ declare interface Annotation {
87
+ /**
88
+ * End of the attributed segment, exclusive.
89
+ */
90
+ end_index?: number;
91
+ /**
92
+ * Source attributed for a portion of the text. Could be a URL, title, or
93
+ * other identifier.
94
+ */
95
+ source?: string;
96
+ /**
97
+ * Start of segment of the response that is attributed to this source.
98
+ *
99
+ * Index indicates the start of the segment, measured in bytes.
100
+ */
101
+ start_index?: number;
102
+ }
103
+
66
104
  /** The generic reusable api auth config. Deprecated. Please use AuthConfig (google/cloud/aiplatform/master/auth.proto) instead. This data type is not supported in Gemini API. */
67
105
  export declare interface ApiAuth {
68
106
  /** The API secret. */
@@ -217,6 +255,31 @@ declare interface ApiClientInitOptions {
217
255
  userAgentExtra?: string;
218
256
  }
219
257
 
258
+ declare class APIConnectionError extends APIError<undefined, undefined, undefined> {
259
+ constructor({ message, cause }: {
260
+ message?: string | undefined;
261
+ cause?: Error | undefined;
262
+ });
263
+ }
264
+
265
+ declare class APIConnectionTimeoutError extends APIConnectionError {
266
+ constructor({ message }?: {
267
+ message?: string;
268
+ });
269
+ }
270
+
271
+ declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends GeminiNextGenAPIClientError {
272
+ /** HTTP status for the response that caused the error */
273
+ readonly status: TStatus;
274
+ /** HTTP headers for the response that caused the error */
275
+ readonly headers: THeaders;
276
+ /** JSON body of the response that caused the error */
277
+ readonly error: TError;
278
+ constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders);
279
+ private static makeMessage;
280
+ static generate(status: number | undefined, errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined): APIError;
281
+ }
282
+
220
283
  /**
221
284
  * API errors raised by the GenAI API.
222
285
  */
@@ -253,6 +316,68 @@ export declare interface ApiKeyConfig {
253
316
  name?: string;
254
317
  }
255
318
 
319
+ /**
320
+ * A subclass of `Promise` providing additional helper methods
321
+ * for interacting with the SDK.
322
+ */
323
+ declare class APIPromise<T> extends Promise<T> {
324
+ private responsePromise;
325
+ private parseResponse;
326
+ private parsedPromise;
327
+ private client;
328
+ constructor(client: BaseGeminiNextGenAPIClient, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: BaseGeminiNextGenAPIClient, props: APIResponseProps) => PromiseOrValue<T>);
329
+ _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
330
+ /**
331
+ * Gets the raw `Response` instance instead of parsing the response
332
+ * data.
333
+ *
334
+ * If you want to parse the response body but still get the `Response`
335
+ * instance, you can use {@link withResponse()}.
336
+ *
337
+ * 👋 Getting the wrong TypeScript type for `Response`?
338
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
339
+ * to your `tsconfig.json`.
340
+ */
341
+ asResponse(): Promise<Response>;
342
+ /**
343
+ * Gets the parsed response data and the raw `Response` instance.
344
+ *
345
+ * If you just want to get the raw `Response` instance without parsing it,
346
+ * you can use {@link asResponse()}.
347
+ *
348
+ * 👋 Getting the wrong TypeScript type for `Response`?
349
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
350
+ * to your `tsconfig.json`.
351
+ */
352
+ withResponse(): Promise<{
353
+ data: T;
354
+ response: Response;
355
+ }>;
356
+ private parse;
357
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
358
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
359
+ finally(onfinally?: (() => void) | undefined | null): Promise<T>;
360
+ }
361
+
362
+ declare abstract class APIResource {
363
+ /**
364
+ * The key path from the client. For example, a resource accessible as `client.resource.subresource` would
365
+ * have a property `static override readonly _key = Object.freeze(['resource', 'subresource'] as const);`.
366
+ */
367
+ static readonly _key: readonly string[];
368
+ protected _client: BaseGeminiNextGenAPIClient;
369
+ constructor(client: BaseGeminiNextGenAPIClient);
370
+ }
371
+
372
+ declare type APIResponseProps = {
373
+ response: Response;
374
+ options: FinalRequestOptions;
375
+ controller: AbortController;
376
+ requestLogID: string;
377
+ retryOfRequestLogID: string | undefined;
378
+ startTime: number;
379
+ };
380
+
256
381
  /** The API spec that the external API implements. This enum is not supported in Gemini API. */
257
382
  export declare enum ApiSpec {
258
383
  /**
@@ -269,6 +394,12 @@ export declare enum ApiSpec {
269
394
  ELASTIC_SEARCH = "ELASTIC_SEARCH"
270
395
  }
271
396
 
397
+ declare class APIUserAbortError extends APIError<undefined, undefined, undefined> {
398
+ constructor({ message }?: {
399
+ message?: string;
400
+ });
401
+ }
402
+
272
403
  /** Representation of an audio chunk. */
273
404
  export declare interface AudioChunk {
274
405
  /** Raw bytes of audio data.
@@ -280,6 +411,27 @@ export declare interface AudioChunk {
280
411
  sourceMetadata?: LiveMusicSourceMetadata;
281
412
  }
282
413
 
414
+ /**
415
+ * An audio content block.
416
+ */
417
+ declare interface AudioContent {
418
+ /**
419
+ * Used as the OpenAPI type discriminator for the content oneof.
420
+ */
421
+ type: 'audio';
422
+ data?: string;
423
+ /**
424
+ * The mime type of the audio.
425
+ */
426
+ mime_type?: AudioMimeType;
427
+ uri?: string;
428
+ }
429
+
430
+ /**
431
+ * The mime type of the audio.
432
+ */
433
+ declare type AudioMimeType = 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | (string & {});
434
+
283
435
  /** The audio transcription configuration in Setup. */
284
436
  export declare interface AudioTranscriptionConfig {
285
437
  }
@@ -346,6 +498,9 @@ export declare interface AuthConfigOidcConfig {
346
498
  serviceAccount?: string;
347
499
  }
348
500
 
501
+ declare class AuthenticationError extends APIError<401, Headers> {
502
+ }
503
+
349
504
  /** Config for auth_tokens.create parameters. */
350
505
  export declare interface AuthToken {
351
506
  /** The name of the auth token. */
@@ -417,6 +572,257 @@ export declare interface AutomaticFunctionCallingConfig {
417
572
  ignoreCallHistory?: boolean;
418
573
  }
419
574
 
575
+ declare class BadRequestError extends APIError<400, Headers> {
576
+ }
577
+
578
+ declare interface BaseCreateAgentInteractionParams {
579
+ /**
580
+ * Body param: The name of the `Agent` used for generating the interaction.
581
+ */
582
+ agent: (string & {}) | 'deep-research-pro-preview-12-2025';
583
+ /**
584
+ * Body param: The inputs for the interaction.
585
+ */
586
+ input: string | Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent> | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent;
587
+ /**
588
+ * Path param: Which version of the API to use.
589
+ */
590
+ api_version?: string;
591
+ /**
592
+ * Body param: Configuration for the agent.
593
+ */
594
+ agent_config?: DynamicAgentConfig | DeepResearchAgentConfig;
595
+ /**
596
+ * Body param: Whether to run the model interaction in the background.
597
+ */
598
+ background?: boolean;
599
+ /**
600
+ * Body param: The ID of the previous interaction, if any.
601
+ */
602
+ previous_interaction_id?: string;
603
+ /**
604
+ * Body param: Enforces that the generated response is a JSON object that complies with
605
+ * the JSON schema specified in this field.
606
+ */
607
+ response_format?: unknown;
608
+ /**
609
+ * Body param: The mime type of the response. This is required if response_format is set.
610
+ */
611
+ response_mime_type?: string;
612
+ /**
613
+ * Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
614
+ */
615
+ response_modalities?: Array<'text' | 'image' | 'audio'>;
616
+ /**
617
+ * Body param: Input only. Whether to store the response and request for later retrieval.
618
+ */
619
+ store?: boolean;
620
+ /**
621
+ * Body param: Input only. Whether the interaction will be streamed.
622
+ */
623
+ stream?: boolean;
624
+ /**
625
+ * Body param: System instruction for the interaction.
626
+ */
627
+ system_instruction?: string;
628
+ /**
629
+ * Body param: A list of tool declarations the model may call during interaction.
630
+ */
631
+ tools?: Array<Tool_2>;
632
+ }
633
+
634
+ declare interface BaseCreateModelInteractionParams {
635
+ /**
636
+ * Body param: The inputs for the interaction.
637
+ */
638
+ input: string | Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent> | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent;
639
+ /**
640
+ * Body param: The name of the `Model` used for generating the interaction.
641
+ */
642
+ model: Model_2;
643
+ /**
644
+ * Path param: Which version of the API to use.
645
+ */
646
+ api_version?: string;
647
+ /**
648
+ * Body param: Whether to run the model interaction in the background.
649
+ */
650
+ background?: boolean;
651
+ /**
652
+ * Body param: Input only. Configuration parameters for the model interaction.
653
+ */
654
+ generation_config?: GenerationConfig_2;
655
+ /**
656
+ * Body param: The ID of the previous interaction, if any.
657
+ */
658
+ previous_interaction_id?: string;
659
+ /**
660
+ * Body param: Enforces that the generated response is a JSON object that complies with
661
+ * the JSON schema specified in this field.
662
+ */
663
+ response_format?: unknown;
664
+ /**
665
+ * Body param: The mime type of the response. This is required if response_format is set.
666
+ */
667
+ response_mime_type?: string;
668
+ /**
669
+ * Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
670
+ */
671
+ response_modalities?: Array<'text' | 'image' | 'audio'>;
672
+ /**
673
+ * Body param: Input only. Whether to store the response and request for later retrieval.
674
+ */
675
+ store?: boolean;
676
+ /**
677
+ * Body param: Input only. Whether the interaction will be streamed.
678
+ */
679
+ stream?: boolean;
680
+ /**
681
+ * Body param: System instruction for the interaction.
682
+ */
683
+ system_instruction?: string;
684
+ /**
685
+ * Body param: A list of tool declarations the model may call during interaction.
686
+ */
687
+ tools?: Array<Tool_2>;
688
+ }
689
+
690
+ /**
691
+ * Base class for Gemini Next Gen API API clients.
692
+ */
693
+ declare class BaseGeminiNextGenAPIClient {
694
+ apiKey: string | null;
695
+ apiVersion: string;
696
+ baseURL: string;
697
+ maxRetries: number;
698
+ timeout: number;
699
+ logger: Logger;
700
+ logLevel: LogLevel | undefined;
701
+ fetchOptions: MergedRequestInit | undefined;
702
+ private fetch;
703
+ private encoder;
704
+ protected idempotencyHeader?: string;
705
+ private _options;
706
+ /**
707
+ * API Client for interfacing with the Gemini Next Gen API API.
708
+ *
709
+ * @param {string | null | undefined} [opts.apiKey=process.env['GEMINI_API_KEY'] ?? null]
710
+ * @param {string | undefined} [opts.apiVersion=v1beta]
711
+ * @param {string} [opts.baseURL=process.env['GEMINI_NEXT_GEN_API_BASE_URL'] ?? https://generativelanguage.googleapis.com] - Override the default base URL for the API.
712
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
713
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
714
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
715
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
716
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
717
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
718
+ */
719
+ constructor({ baseURL, apiKey, apiVersion, ...opts }?: ClientOptions);
720
+ /**
721
+ * Create a new client instance re-using the same options given to the current client with optional overriding.
722
+ */
723
+ withOptions(options: Partial<ClientOptions>): this;
724
+ /**
725
+ * Check whether the base URL is set to its default.
726
+ */
727
+ private baseURLOverridden;
728
+ protected defaultQuery(): Record<string, string | undefined> | undefined;
729
+ protected validateHeaders({ values, nulls }: NullableHeaders): void;
730
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
731
+ /**
732
+ * Basic re-implementation of `qs.stringify` for primitive types.
733
+ */
734
+ protected stringifyQuery(query: Record<string, unknown>): string;
735
+ private getUserAgent;
736
+ protected defaultIdempotencyKey(): string;
737
+ protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
738
+ buildURL(path: string, query: Record<string, unknown> | null | undefined, defaultBaseURL?: string | undefined): string;
739
+ /**
740
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
741
+ */
742
+ protected prepareOptions(options: FinalRequestOptions): Promise<void>;
743
+ /**
744
+ * Used as a callback for mutating the given `RequestInit` object.
745
+ *
746
+ * This is useful for cases where you want to add certain headers based off of
747
+ * the request properties, e.g. `method` or `url`.
748
+ */
749
+ protected prepareRequest(request: _RequestInit, { url, options }: {
750
+ url: string;
751
+ options: FinalRequestOptions;
752
+ }): Promise<void>;
753
+ get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
754
+ post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
755
+ patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
756
+ put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
757
+ delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
758
+ private methodRequest;
759
+ request<Rsp>(options: PromiseOrValue<FinalRequestOptions>, remainingRetries?: number | null): APIPromise<Rsp>;
760
+ private makeRequest;
761
+ fetchWithTimeout(url: _RequestInfo, init: _RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
762
+ private shouldRetry;
763
+ private retryRequest;
764
+ private calculateDefaultRetryTimeoutMillis;
765
+ buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
766
+ retryCount?: number;
767
+ }): Promise<{
768
+ req: FinalizedRequestInit;
769
+ url: string;
770
+ timeout: number;
771
+ }>;
772
+ private buildHeaders;
773
+ private buildBody;
774
+ static DEFAULT_TIMEOUT: number;
775
+ }
776
+
777
+ declare class BaseInteractions extends APIResource {
778
+ static readonly _key: readonly ['interactions'];
779
+ /**
780
+ * Creates a new interaction.
781
+ *
782
+ * @example
783
+ * ```ts
784
+ * const interaction = await client.interactions.create({
785
+ * input: 'string',
786
+ * model: 'gemini-2.5-pro',
787
+ * });
788
+ * ```
789
+ */
790
+ create(params: CreateModelInteractionParamsNonStreaming, options?: RequestOptions): APIPromise<Interaction>;
791
+ create(params: CreateModelInteractionParamsStreaming, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent>>;
792
+ create(params: CreateAgentInteractionParamsNonStreaming, options?: RequestOptions): APIPromise<Interaction>;
793
+ create(params: CreateAgentInteractionParamsStreaming, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent>>;
794
+ create(params: BaseCreateModelInteractionParams | BaseCreateAgentInteractionParams, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent> | Interaction>;
795
+ /**
796
+ * Deletes the interaction by id.
797
+ *
798
+ * @example
799
+ * ```ts
800
+ * const interaction = await client.interactions.delete('id');
801
+ * ```
802
+ */
803
+ delete(id: string, params?: InteractionDeleteParams | null | undefined, options?: RequestOptions): APIPromise<unknown>;
804
+ /**
805
+ * Cancels an interaction by id. This only applies to background interactions that are still running.
806
+ *
807
+ * @example
808
+ * ```ts
809
+ * const interaction = await client.interactions.cancel('id');
810
+ * ```
811
+ */
812
+ cancel(id: string, params?: InteractionCancelParams | null | undefined, options?: RequestOptions): APIPromise<Interaction>;
813
+ /**
814
+ * Retrieves the full details of a single interaction based on its `Interaction.id`.
815
+ *
816
+ * @example
817
+ * ```ts
818
+ * const interaction = await client.interactions.get('id');
819
+ * ```
820
+ */
821
+ get(id: string, params?: InteractionGetParamsNonStreaming, options?: RequestOptions): APIPromise<Interaction>;
822
+ get(id: string, params: InteractionGetParamsStreaming, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent>>;
823
+ get(id: string, params?: InteractionGetParamsBase | undefined, options?: RequestOptions): APIPromise<Stream<InteractionSSEEvent> | Interaction>;
824
+ }
825
+
420
826
  /**
421
827
  * @license
422
828
  * Copyright 2025 Google LLC
@@ -705,6 +1111,11 @@ export declare enum BlockedReason {
705
1111
  JAILBREAK = "JAILBREAK"
706
1112
  }
707
1113
 
1114
+ declare const brand_privateNullableHeaders: unique symbol;
1115
+
1116
+ /** @ts-ignore For users with \@types/bun */
1117
+ declare type BunRequestInit = globalThis.FetchRequestInit;
1118
+
708
1119
  /** A resource used in LLM queries for users to explicitly specify what to cache. */
709
1120
  export declare interface CachedContent {
710
1121
  /** The server-generated resource name of the cached content. */
@@ -1101,6 +1512,106 @@ export declare interface CitationMetadata {
1101
1512
  citations?: Citation[];
1102
1513
  }
1103
1514
 
1515
+ declare interface ClientOptions {
1516
+ /**
1517
+ * Defaults to process.env['GEMINI_API_KEY'].
1518
+ */
1519
+ apiKey?: string | null | undefined;
1520
+ apiVersion?: string | undefined;
1521
+ /**
1522
+ * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
1523
+ *
1524
+ * Defaults to process.env['GEMINI_NEXT_GEN_API_BASE_URL'].
1525
+ */
1526
+ baseURL?: string | null | undefined;
1527
+ /**
1528
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
1529
+ * from the server before timing out a single request.
1530
+ *
1531
+ * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
1532
+ * much longer than this timeout before the promise succeeds or fails.
1533
+ *
1534
+ * @unit milliseconds
1535
+ */
1536
+ timeout?: number | undefined;
1537
+ /**
1538
+ * Additional `RequestInit` options to be passed to `fetch` calls.
1539
+ * Properties will be overridden by per-request `fetchOptions`.
1540
+ */
1541
+ fetchOptions?: MergedRequestInit | undefined;
1542
+ /**
1543
+ * Specify a custom `fetch` function implementation.
1544
+ *
1545
+ * If not provided, we expect that `fetch` is defined globally.
1546
+ */
1547
+ fetch?: Fetch | undefined;
1548
+ /**
1549
+ * The maximum number of times that the client will retry a request in case of a
1550
+ * temporary failure, like a network error or a 5XX error from the server.
1551
+ *
1552
+ * @default 2
1553
+ */
1554
+ maxRetries?: number | undefined;
1555
+ /**
1556
+ * Default headers to include with every request to the API.
1557
+ *
1558
+ * These can be removed in individual requests by explicitly setting the
1559
+ * header to `null` in request options.
1560
+ */
1561
+ defaultHeaders?: HeadersLike | undefined;
1562
+ /**
1563
+ * Default query parameters to include with every request to the API.
1564
+ *
1565
+ * These can be removed in individual requests by explicitly setting the
1566
+ * param to `undefined` in request options.
1567
+ */
1568
+ defaultQuery?: Record<string, string | undefined> | undefined;
1569
+ /**
1570
+ * Set the log level.
1571
+ *
1572
+ * Defaults to process.env['GEMINI_NEXT_GEN_API_LOG'] or 'warn' if it isn't set.
1573
+ */
1574
+ logLevel?: LogLevel | undefined;
1575
+ /**
1576
+ * Set the logger.
1577
+ *
1578
+ * Defaults to globalThis.console.
1579
+ */
1580
+ logger?: Logger | undefined;
1581
+ }
1582
+
1583
+ /**
1584
+ * The arguments to pass to the code execution.
1585
+ */
1586
+ declare interface CodeExecutionCallArguments {
1587
+ /**
1588
+ * The code to be executed.
1589
+ */
1590
+ code?: string;
1591
+ /**
1592
+ * Programming language of the `code`.
1593
+ */
1594
+ language?: 'python';
1595
+ }
1596
+
1597
+ /**
1598
+ * Code execution content.
1599
+ */
1600
+ declare interface CodeExecutionCallContent {
1601
+ /**
1602
+ * Used as the OpenAPI type discriminator for the content oneof.
1603
+ */
1604
+ type: 'code_execution_call';
1605
+ /**
1606
+ * A unique ID for this specific tool call.
1607
+ */
1608
+ id?: string;
1609
+ /**
1610
+ * The arguments to pass to the code execution.
1611
+ */
1612
+ arguments?: CodeExecutionCallArguments;
1613
+ }
1614
+
1104
1615
  /** Result of executing the [ExecutableCode]. Only generated when using the [CodeExecution] tool, and always follows a `part` containing the [ExecutableCode]. */
1105
1616
  export declare interface CodeExecutionResult {
1106
1617
  /** Required. Outcome of the code execution. */
@@ -1109,6 +1620,32 @@ export declare interface CodeExecutionResult {
1109
1620
  output?: string;
1110
1621
  }
1111
1622
 
1623
+ /**
1624
+ * Code execution result content.
1625
+ */
1626
+ declare interface CodeExecutionResultContent {
1627
+ /**
1628
+ * Used as the OpenAPI type discriminator for the content oneof.
1629
+ */
1630
+ type: 'code_execution_result';
1631
+ /**
1632
+ * ID to match the ID from the code execution call block.
1633
+ */
1634
+ call_id?: string;
1635
+ /**
1636
+ * Whether the code execution resulted in an error.
1637
+ */
1638
+ is_error?: boolean;
1639
+ /**
1640
+ * The output of the code execution.
1641
+ */
1642
+ result?: string;
1643
+ /**
1644
+ * A signature hash for backend validation.
1645
+ */
1646
+ signature?: string;
1647
+ }
1648
+
1112
1649
  /** Success and error statistics of processing multiple entities (for example, DataItems or structured data rows) in batch. This data type is not supported in Gemini API. */
1113
1650
  export declare interface CompletionStats {
1114
1651
  /** Output only. The number of entities for which any error was encountered. */
@@ -1166,6 +1703,13 @@ export declare class ComputeTokensResponse {
1166
1703
  tokensInfo?: TokensInfo[];
1167
1704
  }
1168
1705
 
1706
+ declare type _ConditionalNodeReadableStream<R = any> = typeof globalThis extends {
1707
+ ReadableStream: any;
1708
+ } ? never : _NodeReadableStream<R>;
1709
+
1710
+ declare class ConflictError extends APIError<409, Headers> {
1711
+ }
1712
+
1169
1713
  /** Contains the multi-part content of a message. */
1170
1714
  export declare interface Content {
1171
1715
  /** List of parts that constitute a single message. Each part may have
@@ -1175,6 +1719,282 @@ export declare interface Content {
1175
1719
  role?: string;
1176
1720
  }
1177
1721
 
1722
+ declare interface ContentDelta {
1723
+ delta?: ContentDelta.TextDelta | ContentDelta.ImageDelta | ContentDelta.AudioDelta | ContentDelta.DocumentDelta | ContentDelta.VideoDelta | ContentDelta.ThoughtSummaryDelta | ContentDelta.ThoughtSignatureDelta | ContentDelta.FunctionCallDelta | ContentDelta.FunctionResultDelta | ContentDelta.CodeExecutionCallDelta | ContentDelta.CodeExecutionResultDelta | ContentDelta.URLContextCallDelta | ContentDelta.URLContextResultDelta | ContentDelta.GoogleSearchCallDelta | ContentDelta.GoogleSearchResultDelta | ContentDelta.MCPServerToolCallDelta | ContentDelta.MCPServerToolResultDelta | ContentDelta.FileSearchResultDelta;
1724
+ /**
1725
+ * The event_id token to be used to resume the interaction stream, from
1726
+ * this event.
1727
+ */
1728
+ event_id?: string;
1729
+ event_type?: 'content.delta';
1730
+ index?: number;
1731
+ }
1732
+
1733
+ declare namespace ContentDelta {
1734
+ interface TextDelta {
1735
+ /**
1736
+ * Used as the OpenAPI type discriminator for the content oneof.
1737
+ */
1738
+ type: 'text';
1739
+ /**
1740
+ * Citation information for model-generated content.
1741
+ */
1742
+ annotations?: Array<InteractionsAPI.Annotation>;
1743
+ text?: string;
1744
+ }
1745
+ interface ImageDelta {
1746
+ /**
1747
+ * Used as the OpenAPI type discriminator for the content oneof.
1748
+ */
1749
+ type: 'image';
1750
+ data?: string;
1751
+ /**
1752
+ * The mime type of the image.
1753
+ */
1754
+ mime_type?: InteractionsAPI.ImageMimeType;
1755
+ /**
1756
+ * The resolution of the media.
1757
+ */
1758
+ resolution?: 'low' | 'medium' | 'high';
1759
+ uri?: string;
1760
+ }
1761
+ interface AudioDelta {
1762
+ /**
1763
+ * Used as the OpenAPI type discriminator for the content oneof.
1764
+ */
1765
+ type: 'audio';
1766
+ data?: string;
1767
+ /**
1768
+ * The mime type of the audio.
1769
+ */
1770
+ mime_type?: InteractionsAPI.AudioMimeType;
1771
+ uri?: string;
1772
+ }
1773
+ interface DocumentDelta {
1774
+ /**
1775
+ * Used as the OpenAPI type discriminator for the content oneof.
1776
+ */
1777
+ type: 'document';
1778
+ data?: string;
1779
+ mime_type?: string;
1780
+ uri?: string;
1781
+ }
1782
+ interface VideoDelta {
1783
+ /**
1784
+ * Used as the OpenAPI type discriminator for the content oneof.
1785
+ */
1786
+ type: 'video';
1787
+ data?: string;
1788
+ /**
1789
+ * The mime type of the video.
1790
+ */
1791
+ mime_type?: InteractionsAPI.VideoMimeType;
1792
+ /**
1793
+ * The resolution of the media.
1794
+ */
1795
+ resolution?: 'low' | 'medium' | 'high';
1796
+ uri?: string;
1797
+ }
1798
+ interface ThoughtSummaryDelta {
1799
+ /**
1800
+ * Used as the OpenAPI type discriminator for the content oneof.
1801
+ */
1802
+ type: 'thought_summary';
1803
+ /**
1804
+ * A text content block.
1805
+ */
1806
+ content?: InteractionsAPI.TextContent | InteractionsAPI.ImageContent;
1807
+ }
1808
+ interface ThoughtSignatureDelta {
1809
+ /**
1810
+ * Used as the OpenAPI type discriminator for the content oneof.
1811
+ */
1812
+ type: 'thought_signature';
1813
+ /**
1814
+ * Signature to match the backend source to be part of the generation.
1815
+ */
1816
+ signature?: string;
1817
+ }
1818
+ interface FunctionCallDelta {
1819
+ /**
1820
+ * Used as the OpenAPI type discriminator for the content oneof.
1821
+ */
1822
+ type: 'function_call';
1823
+ /**
1824
+ * A unique ID for this specific tool call.
1825
+ */
1826
+ id?: string;
1827
+ arguments?: {
1828
+ [key: string]: unknown;
1829
+ };
1830
+ name?: string;
1831
+ }
1832
+ interface FunctionResultDelta {
1833
+ /**
1834
+ * Used as the OpenAPI type discriminator for the content oneof.
1835
+ */
1836
+ type: 'function_result';
1837
+ /**
1838
+ * ID to match the ID from the function call block.
1839
+ */
1840
+ call_id?: string;
1841
+ is_error?: boolean;
1842
+ name?: string;
1843
+ /**
1844
+ * Tool call result delta.
1845
+ */
1846
+ result?: FunctionResultDelta.Items | string;
1847
+ }
1848
+ namespace FunctionResultDelta {
1849
+ interface Items {
1850
+ items?: Array<string | InteractionsAPI.ImageContent>;
1851
+ }
1852
+ }
1853
+ interface CodeExecutionCallDelta {
1854
+ /**
1855
+ * Used as the OpenAPI type discriminator for the content oneof.
1856
+ */
1857
+ type: 'code_execution_call';
1858
+ /**
1859
+ * A unique ID for this specific tool call.
1860
+ */
1861
+ id?: string;
1862
+ /**
1863
+ * The arguments to pass to the code execution.
1864
+ */
1865
+ arguments?: InteractionsAPI.CodeExecutionCallArguments;
1866
+ }
1867
+ interface CodeExecutionResultDelta {
1868
+ /**
1869
+ * Used as the OpenAPI type discriminator for the content oneof.
1870
+ */
1871
+ type: 'code_execution_result';
1872
+ /**
1873
+ * ID to match the ID from the function call block.
1874
+ */
1875
+ call_id?: string;
1876
+ is_error?: boolean;
1877
+ result?: string;
1878
+ signature?: string;
1879
+ }
1880
+ interface URLContextCallDelta {
1881
+ /**
1882
+ * Used as the OpenAPI type discriminator for the content oneof.
1883
+ */
1884
+ type: 'url_context_call';
1885
+ /**
1886
+ * A unique ID for this specific tool call.
1887
+ */
1888
+ id?: string;
1889
+ /**
1890
+ * The arguments to pass to the URL context.
1891
+ */
1892
+ arguments?: InteractionsAPI.URLContextCallArguments;
1893
+ }
1894
+ interface URLContextResultDelta {
1895
+ /**
1896
+ * Used as the OpenAPI type discriminator for the content oneof.
1897
+ */
1898
+ type: 'url_context_result';
1899
+ /**
1900
+ * ID to match the ID from the function call block.
1901
+ */
1902
+ call_id?: string;
1903
+ is_error?: boolean;
1904
+ result?: Array<InteractionsAPI.URLContextResult>;
1905
+ signature?: string;
1906
+ }
1907
+ interface GoogleSearchCallDelta {
1908
+ /**
1909
+ * Used as the OpenAPI type discriminator for the content oneof.
1910
+ */
1911
+ type: 'google_search_call';
1912
+ /**
1913
+ * A unique ID for this specific tool call.
1914
+ */
1915
+ id?: string;
1916
+ /**
1917
+ * The arguments to pass to Google Search.
1918
+ */
1919
+ arguments?: InteractionsAPI.GoogleSearchCallArguments;
1920
+ }
1921
+ interface GoogleSearchResultDelta {
1922
+ /**
1923
+ * Used as the OpenAPI type discriminator for the content oneof.
1924
+ */
1925
+ type: 'google_search_result';
1926
+ /**
1927
+ * ID to match the ID from the function call block.
1928
+ */
1929
+ call_id?: string;
1930
+ is_error?: boolean;
1931
+ result?: Array<InteractionsAPI.GoogleSearchResult>;
1932
+ signature?: string;
1933
+ }
1934
+ interface MCPServerToolCallDelta {
1935
+ /**
1936
+ * Used as the OpenAPI type discriminator for the content oneof.
1937
+ */
1938
+ type: 'mcp_server_tool_call';
1939
+ /**
1940
+ * A unique ID for this specific tool call.
1941
+ */
1942
+ id?: string;
1943
+ arguments?: {
1944
+ [key: string]: unknown;
1945
+ };
1946
+ name?: string;
1947
+ server_name?: string;
1948
+ }
1949
+ interface MCPServerToolResultDelta {
1950
+ /**
1951
+ * Used as the OpenAPI type discriminator for the content oneof.
1952
+ */
1953
+ type: 'mcp_server_tool_result';
1954
+ /**
1955
+ * ID to match the ID from the function call block.
1956
+ */
1957
+ call_id?: string;
1958
+ name?: string;
1959
+ /**
1960
+ * Tool call result delta.
1961
+ */
1962
+ result?: MCPServerToolResultDelta.Items | string;
1963
+ server_name?: string;
1964
+ }
1965
+ namespace MCPServerToolResultDelta {
1966
+ interface Items {
1967
+ items?: Array<string | InteractionsAPI.ImageContent>;
1968
+ }
1969
+ }
1970
+ interface FileSearchResultDelta {
1971
+ /**
1972
+ * Used as the OpenAPI type discriminator for the content oneof.
1973
+ */
1974
+ type: 'file_search_result';
1975
+ result?: Array<FileSearchResultDelta.Result>;
1976
+ }
1977
+ namespace FileSearchResultDelta {
1978
+ /**
1979
+ * The result of the File Search.
1980
+ */
1981
+ interface Result {
1982
+ /**
1983
+ * The name of the file search store.
1984
+ */
1985
+ file_search_store?: string;
1986
+ /**
1987
+ * The text of the search result.
1988
+ */
1989
+ text?: string;
1990
+ /**
1991
+ * The title of the search result.
1992
+ */
1993
+ title?: string;
1994
+ }
1995
+ }
1996
+ }
1997
+
1178
1998
  /** The embedding generated from an input content. */
1179
1999
  export declare interface ContentEmbedding {
1180
2000
  /** A list of floats representing an embedding.
@@ -1215,6 +2035,30 @@ export declare class ContentReferenceImage {
1215
2035
  toReferenceImageAPI(): ReferenceImageAPIInternal;
1216
2036
  }
1217
2037
 
2038
+ declare interface ContentStart {
2039
+ /**
2040
+ * The content of the response.
2041
+ */
2042
+ content?: TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent;
2043
+ /**
2044
+ * The event_id token to be used to resume the interaction stream, from
2045
+ * this event.
2046
+ */
2047
+ event_id?: string;
2048
+ event_type?: 'content.start';
2049
+ index?: number;
2050
+ }
2051
+
2052
+ declare interface ContentStop {
2053
+ /**
2054
+ * The event_id token to be used to resume the interaction stream, from
2055
+ * this event.
2056
+ */
2057
+ event_id?: string;
2058
+ event_type?: 'content.stop';
2059
+ index?: number;
2060
+ }
2061
+
1218
2062
  export declare type ContentUnion = Content | PartUnion[] | PartUnion;
1219
2063
 
1220
2064
  /** Enables context window compression -- mechanism managing model context window so it does not exceed given length. */
@@ -1310,6 +2154,20 @@ export declare class CountTokensResponse {
1310
2154
  cachedContentTokenCount?: number;
1311
2155
  }
1312
2156
 
2157
+ declare interface CreateAgentInteractionParamsNonStreaming extends BaseCreateAgentInteractionParams {
2158
+ /**
2159
+ * Body param: Input only. Whether the interaction will be streamed.
2160
+ */
2161
+ stream?: false;
2162
+ }
2163
+
2164
+ declare interface CreateAgentInteractionParamsStreaming extends BaseCreateAgentInteractionParams {
2165
+ /**
2166
+ * Body param: Input only. Whether the interaction will be streamed.
2167
+ */
2168
+ stream: true;
2169
+ }
2170
+
1313
2171
  /** Optional parameters. */
1314
2172
  export declare interface CreateAuthTokenConfig {
1315
2173
  /** Used to override HTTP request options. */
@@ -1560,6 +2418,20 @@ export declare function createFunctionResponsePartFromUri(uri: string, mimeType:
1560
2418
  */
1561
2419
  export declare function createModelContent(partOrString: PartListUnion | string): Content;
1562
2420
 
2421
+ declare interface CreateModelInteractionParamsNonStreaming extends BaseCreateModelInteractionParams {
2422
+ /**
2423
+ * Body param: Input only. Whether the interaction will be streamed.
2424
+ */
2425
+ stream?: false;
2426
+ }
2427
+
2428
+ declare interface CreateModelInteractionParamsStreaming extends BaseCreateModelInteractionParams {
2429
+ /**
2430
+ * Body param: Input only. Whether the interaction will be streamed.
2431
+ */
2432
+ stream: true;
2433
+ }
2434
+
1563
2435
  /**
1564
2436
  * Creates a `Part` object from a `base64` encoded `string`.
1565
2437
  */
@@ -1723,6 +2595,20 @@ export declare interface DatasetStats {
1723
2595
  userOutputTokenDistribution?: DatasetDistribution;
1724
2596
  }
1725
2597
 
2598
+ /**
2599
+ * Configuration for the Deep Research agent.
2600
+ */
2601
+ declare interface DeepResearchAgentConfig {
2602
+ /**
2603
+ * Whether to include thought summaries in the response.
2604
+ */
2605
+ thinking_summaries?: 'auto' | 'none';
2606
+ /**
2607
+ * Used as the OpenAPI type discriminator for the content oneof.
2608
+ */
2609
+ type?: 'deep-research';
2610
+ }
2611
+
1726
2612
  /** Optional parameters for models.get method. */
1727
2613
  export declare interface DeleteBatchJobConfig {
1728
2614
  /** Used to override HTTP request options. */
@@ -1917,6 +2803,19 @@ declare interface Document_2 {
1917
2803
  }
1918
2804
  export { Document_2 as Document }
1919
2805
 
2806
+ /**
2807
+ * A document content block.
2808
+ */
2809
+ declare interface DocumentContent {
2810
+ /**
2811
+ * Used as the OpenAPI type discriminator for the content oneof.
2812
+ */
2813
+ type: 'document';
2814
+ data?: string;
2815
+ mime_type?: string;
2816
+ uri?: string;
2817
+ }
2818
+
1920
2819
  declare class Documents extends BaseModule {
1921
2820
  private readonly apiClient;
1922
2821
  constructor(apiClient: ApiClient);
@@ -1959,6 +2858,9 @@ export declare enum DocumentState {
1959
2858
  STATE_FAILED = "STATE_FAILED"
1960
2859
  }
1961
2860
 
2861
+ /** @ts-ignore */
2862
+ declare type _DOMReadableStream<R = any> = globalThis.ReadableStream<R>;
2863
+
1962
2864
  export declare type DownloadableFileUnion = string | File_2 | GeneratedVideo | Video;
1963
2865
 
1964
2866
  declare interface Downloader {
@@ -1995,6 +2897,17 @@ export declare interface DownloadFileParameters {
1995
2897
  config?: DownloadFileConfig;
1996
2898
  }
1997
2899
 
2900
+ /**
2901
+ * Configuration for dynamic agents.
2902
+ */
2903
+ declare interface DynamicAgentConfig {
2904
+ /**
2905
+ * Used as the OpenAPI type discriminator for the content oneof.
2906
+ */
2907
+ type?: 'dynamic';
2908
+ [k: string]: unknown;
2909
+ }
2910
+
1998
2911
  /** Describes the options to customize dynamic retrieval. */
1999
2912
  export declare interface DynamicRetrievalConfig {
2000
2913
  /** The mode of the predictor to be used in dynamic retrieval. */
@@ -2248,6 +3161,53 @@ export declare enum Environment {
2248
3161
  ENVIRONMENT_BROWSER = "ENVIRONMENT_BROWSER"
2249
3162
  }
2250
3163
 
3164
+ declare interface ErrorEvent_2 {
3165
+ /**
3166
+ * Error message from an interaction.
3167
+ */
3168
+ error?: ErrorEvent_2.Error;
3169
+ /**
3170
+ * The event_id token to be used to resume the interaction stream, from
3171
+ * this event.
3172
+ */
3173
+ event_id?: string;
3174
+ event_type?: 'error';
3175
+ }
3176
+
3177
+ declare namespace ErrorEvent_2 {
3178
+ /**
3179
+ * Error message from an interaction.
3180
+ */
3181
+ interface Error {
3182
+ /**
3183
+ * A URI that identifies the error type.
3184
+ */
3185
+ code?: string;
3186
+ /**
3187
+ * A human-readable error message.
3188
+ */
3189
+ message?: string;
3190
+ }
3191
+ }
3192
+
3193
+ declare namespace Errors {
3194
+ export {
3195
+ GeminiNextGenAPIClientError,
3196
+ APIError,
3197
+ APIUserAbortError,
3198
+ APIConnectionError,
3199
+ APIConnectionTimeoutError,
3200
+ BadRequestError,
3201
+ AuthenticationError,
3202
+ PermissionDeniedError,
3203
+ NotFoundError,
3204
+ ConflictError,
3205
+ UnprocessableEntityError,
3206
+ RateLimitError,
3207
+ InternalServerError
3208
+ }
3209
+ }
3210
+
2251
3211
  /** Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the [CodeExecution] tool, in which the code will be automatically executed, and a corresponding [CodeExecutionResult] will also be generated. */
2252
3212
  export declare interface ExecutableCode {
2253
3213
  /** Required. The code to be executed. */
@@ -2294,6 +3254,13 @@ export declare enum FeatureSelectionPreference {
2294
3254
  PRIORITIZE_COST = "PRIORITIZE_COST"
2295
3255
  }
2296
3256
 
3257
+ /**
3258
+ * @license
3259
+ * Copyright 2025 Google LLC
3260
+ * SPDX-License-Identifier: Apache-2.0
3261
+ */
3262
+ declare type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
3263
+
2297
3264
  export declare interface FetchPredictOperationConfig {
2298
3265
  /** Used to override HTTP request options. */
2299
3266
  httpOptions?: HttpOptions;
@@ -2315,6 +3282,9 @@ export declare interface FetchPredictOperationParameters {
2315
3282
  config?: FetchPredictOperationConfig;
2316
3283
  }
2317
3284
 
3285
+ /** @ts-ignore For users who use Deno */
3286
+ declare type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
3287
+
2318
3288
  /** A file uploaded to the API. */
2319
3289
  declare interface File_2 {
2320
3290
  /** The `File` resource name. The ID (name excluding the "files/" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456` */
@@ -2482,6 +3452,40 @@ export declare interface FileSearch {
2482
3452
  metadataFilter?: string;
2483
3453
  }
2484
3454
 
3455
+ /**
3456
+ * File Search result content.
3457
+ */
3458
+ declare interface FileSearchResultContent {
3459
+ /**
3460
+ * Used as the OpenAPI type discriminator for the content oneof.
3461
+ */
3462
+ type: 'file_search_result';
3463
+ /**
3464
+ * The results of the File Search.
3465
+ */
3466
+ result?: Array<FileSearchResultContent.Result>;
3467
+ }
3468
+
3469
+ declare namespace FileSearchResultContent {
3470
+ /**
3471
+ * The result of the File Search.
3472
+ */
3473
+ interface Result {
3474
+ /**
3475
+ * The name of the file search store.
3476
+ */
3477
+ file_search_store?: string;
3478
+ /**
3479
+ * The text of the search result.
3480
+ */
3481
+ text?: string;
3482
+ /**
3483
+ * The title of the search result.
3484
+ */
3485
+ title?: string;
3486
+ }
3487
+ }
3488
+
2485
3489
  /** A collection of Documents. */
2486
3490
  export declare interface FileSearchStore {
2487
3491
  /** The resource name of the FileSearchStore. Example: `fileSearchStores/my-file-search-store-123` */
@@ -2634,6 +3638,15 @@ export declare interface FileStatus {
2634
3638
  code?: number;
2635
3639
  }
2636
3640
 
3641
+ declare type FinalizedRequestInit = RequestInit & {
3642
+ headers: Headers;
3643
+ };
3644
+
3645
+ declare type FinalRequestOptions = RequestOptions & {
3646
+ method: HTTPMethod;
3647
+ path: string;
3648
+ };
3649
+
2637
3650
  /** Output only. The reason why the model stopped generating tokens.
2638
3651
 
2639
3652
  If empty, the model has not stopped generating the tokens. */
@@ -2687,17 +3700,44 @@ export declare enum FinishReason {
2687
3700
  */
2688
3701
  IMAGE_SAFETY = "IMAGE_SAFETY",
2689
3702
  /**
2690
- * The tool call generated by the model is invalid.
3703
+ * The tool call generated by the model is invalid.
3704
+ */
3705
+ UNEXPECTED_TOOL_CALL = "UNEXPECTED_TOOL_CALL",
3706
+ /**
3707
+ * Image generation stopped because the generated images have prohibited content.
3708
+ */
3709
+ IMAGE_PROHIBITED_CONTENT = "IMAGE_PROHIBITED_CONTENT",
3710
+ /**
3711
+ * The model was expected to generate an image, but none was generated.
3712
+ */
3713
+ NO_IMAGE = "NO_IMAGE",
3714
+ /**
3715
+ * Image generation stopped because the generated image may be a recitation from a source.
3716
+ */
3717
+ IMAGE_RECITATION = "IMAGE_RECITATION",
3718
+ /**
3719
+ * Image generation stopped for a reason not otherwise specified.
3720
+ */
3721
+ IMAGE_OTHER = "IMAGE_OTHER"
3722
+ }
3723
+
3724
+ /**
3725
+ * A tool that can be used by the model.
3726
+ */
3727
+ declare interface Function_2 {
3728
+ type: 'function';
3729
+ /**
3730
+ * A description of the function.
2691
3731
  */
2692
- UNEXPECTED_TOOL_CALL = "UNEXPECTED_TOOL_CALL",
3732
+ description?: string;
2693
3733
  /**
2694
- * Image generation stopped because the generated images have prohibited content.
3734
+ * The name of the function.
2695
3735
  */
2696
- IMAGE_PROHIBITED_CONTENT = "IMAGE_PROHIBITED_CONTENT",
3736
+ name?: string;
2697
3737
  /**
2698
- * The model was expected to generate an image, but none was generated.
3738
+ * The JSON Schema for the function's parameters.
2699
3739
  */
2700
- NO_IMAGE = "NO_IMAGE"
3740
+ parameters?: unknown;
2701
3741
  }
2702
3742
 
2703
3743
  /** A function call. */
@@ -2715,6 +3755,30 @@ export declare interface FunctionCall {
2715
3755
  willContinue?: boolean;
2716
3756
  }
2717
3757
 
3758
+ /**
3759
+ * A function tool call content block.
3760
+ */
3761
+ declare interface FunctionCallContent {
3762
+ /**
3763
+ * A unique ID for this specific tool call.
3764
+ */
3765
+ id: string;
3766
+ /**
3767
+ * The arguments to pass to the function.
3768
+ */
3769
+ arguments: {
3770
+ [key: string]: unknown;
3771
+ };
3772
+ /**
3773
+ * The name of the tool to call.
3774
+ */
3775
+ name: string;
3776
+ /**
3777
+ * Used as the OpenAPI type discriminator for the content oneof.
3778
+ */
3779
+ type: 'function_call';
3780
+ }
3781
+
2718
3782
  /** Function calling config. */
2719
3783
  export declare interface FunctionCallingConfig {
2720
3784
  /** Optional. Function calling mode. */
@@ -2849,6 +3913,46 @@ export declare enum FunctionResponseScheduling {
2849
3913
  INTERRUPT = "INTERRUPT"
2850
3914
  }
2851
3915
 
3916
+ /**
3917
+ * A function tool result content block.
3918
+ */
3919
+ declare interface FunctionResultContent {
3920
+ /**
3921
+ * ID to match the ID from the function call block.
3922
+ */
3923
+ call_id: string;
3924
+ /**
3925
+ * The result of the tool call.
3926
+ */
3927
+ result: FunctionResultContent.Items | unknown | string;
3928
+ /**
3929
+ * Used as the OpenAPI type discriminator for the content oneof.
3930
+ */
3931
+ type: 'function_result';
3932
+ /**
3933
+ * Whether the tool call resulted in an error.
3934
+ */
3935
+ is_error?: boolean;
3936
+ /**
3937
+ * The name of the tool that was called.
3938
+ */
3939
+ name?: string;
3940
+ }
3941
+
3942
+ declare namespace FunctionResultContent {
3943
+ interface Items {
3944
+ items?: Array<string | InteractionsAPI.ImageContent>;
3945
+ }
3946
+ }
3947
+
3948
+ /**
3949
+ * @license
3950
+ * Copyright 2025 Google LLC
3951
+ * SPDX-License-Identifier: Apache-2.0
3952
+ */
3953
+ declare class GeminiNextGenAPIClientError extends Error {
3954
+ }
3955
+
2852
3956
  /** Input example for preference optimization. This data type is not supported in Gemini API. */
2853
3957
  export declare interface GeminiPreferenceExample {
2854
3958
  /** List of completions for a given prompt. */
@@ -3504,6 +4608,48 @@ export declare interface GenerationConfig {
3504
4608
  enableEnhancedCivicAnswers?: boolean;
3505
4609
  }
3506
4610
 
4611
+ /**
4612
+ * Configuration parameters for model interactions.
4613
+ */
4614
+ declare interface GenerationConfig_2 {
4615
+ /**
4616
+ * The maximum number of tokens to include in the response.
4617
+ */
4618
+ max_output_tokens?: number;
4619
+ /**
4620
+ * Seed used in decoding for reproducibility.
4621
+ */
4622
+ seed?: number;
4623
+ /**
4624
+ * Configuration for speech interaction.
4625
+ */
4626
+ speech_config?: Array<SpeechConfig_2>;
4627
+ /**
4628
+ * A list of character sequences that will stop output interaction.
4629
+ */
4630
+ stop_sequences?: Array<string>;
4631
+ /**
4632
+ * Controls the randomness of the output.
4633
+ */
4634
+ temperature?: number;
4635
+ /**
4636
+ * The level of thought tokens that the model should generate.
4637
+ */
4638
+ thinking_level?: ThinkingLevel_2;
4639
+ /**
4640
+ * Whether to include thought summaries in the response.
4641
+ */
4642
+ thinking_summaries?: 'auto' | 'none';
4643
+ /**
4644
+ * The tool choice for the interaction.
4645
+ */
4646
+ tool_choice?: ToolChoice;
4647
+ /**
4648
+ * The maximum cumulative probability of tokens to consider when sampling.
4649
+ */
4650
+ top_p?: number;
4651
+ }
4652
+
3507
4653
  /** The configuration for routing the request to a specific model. This data type is not supported in Gemini API. */
3508
4654
  export declare interface GenerationConfigRoutingConfig {
3509
4655
  /** Automated routing. */
@@ -3749,6 +4895,8 @@ export declare class GoogleGenAI {
3749
4895
  readonly authTokens: Tokens;
3750
4896
  readonly tunings: Tunings;
3751
4897
  readonly fileSearchStores: FileSearchStores;
4898
+ private _interactions;
4899
+ get interactions(): Interactions;
3752
4900
  constructor(options: GoogleGenAIOptions);
3753
4901
  }
3754
4902
 
@@ -3843,6 +4991,78 @@ export declare interface GoogleSearch {
3843
4991
  timeRangeFilter?: Interval;
3844
4992
  }
3845
4993
 
4994
+ /**
4995
+ * The arguments to pass to Google Search.
4996
+ */
4997
+ declare interface GoogleSearchCallArguments {
4998
+ /**
4999
+ * Web search queries for the following-up web search.
5000
+ */
5001
+ queries?: Array<string>;
5002
+ }
5003
+
5004
+ /**
5005
+ * Google Search content.
5006
+ */
5007
+ declare interface GoogleSearchCallContent {
5008
+ /**
5009
+ * Used as the OpenAPI type discriminator for the content oneof.
5010
+ */
5011
+ type: 'google_search_call';
5012
+ /**
5013
+ * A unique ID for this specific tool call.
5014
+ */
5015
+ id?: string;
5016
+ /**
5017
+ * The arguments to pass to Google Search.
5018
+ */
5019
+ arguments?: GoogleSearchCallArguments;
5020
+ }
5021
+
5022
+ /**
5023
+ * The result of the Google Search.
5024
+ */
5025
+ declare interface GoogleSearchResult {
5026
+ /**
5027
+ * Web content snippet that can be embedded in a web page or an app webview.
5028
+ */
5029
+ rendered_content?: string;
5030
+ /**
5031
+ * Title of the search result.
5032
+ */
5033
+ title?: string;
5034
+ /**
5035
+ * URI reference of the search result.
5036
+ */
5037
+ url?: string;
5038
+ }
5039
+
5040
+ /**
5041
+ * Google Search result content.
5042
+ */
5043
+ declare interface GoogleSearchResultContent {
5044
+ /**
5045
+ * Used as the OpenAPI type discriminator for the content oneof.
5046
+ */
5047
+ type: 'google_search_result';
5048
+ /**
5049
+ * ID to match the ID from the google search call block.
5050
+ */
5051
+ call_id?: string;
5052
+ /**
5053
+ * Whether the Google Search resulted in an error.
5054
+ */
5055
+ is_error?: boolean;
5056
+ /**
5057
+ * The results of the Google Search.
5058
+ */
5059
+ result?: Array<GoogleSearchResult>;
5060
+ /**
5061
+ * The signature of the Google Search result.
5062
+ */
5063
+ signature?: string;
5064
+ }
5065
+
3846
5066
  /** Tool to retrieve public web data for grounding, powered by Google. */
3847
5067
  export declare interface GoogleSearchRetrieval {
3848
5068
  /** Specifies the dynamic retrieval configuration for the given source. */
@@ -4121,6 +5341,15 @@ export declare enum HarmSeverity {
4121
5341
  HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH"
4122
5342
  }
4123
5343
 
5344
+ declare type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | NullableHeaders;
5345
+
5346
+ /**
5347
+ * @license
5348
+ * Copyright 2025 Google LLC
5349
+ * SPDX-License-Identifier: Apache-2.0
5350
+ */
5351
+ declare type HeaderValue = string | undefined | null;
5352
+
4124
5353
  /** The location of the API key. This enum is not supported in Gemini API. */
4125
5354
  export declare enum HttpElementLocation {
4126
5355
  HTTP_IN_UNSPECIFIED = "HTTP_IN_UNSPECIFIED",
@@ -4146,6 +5375,8 @@ export declare enum HttpElementLocation {
4146
5375
  HTTP_IN_COOKIE = "HTTP_IN_COOKIE"
4147
5376
  }
4148
5377
 
5378
+ declare type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
5379
+
4149
5380
  /** HTTP options to be used in each of the requests. */
4150
5381
  export declare interface HttpOptions {
4151
5382
  /** The base URL for the AI platform service endpoint. */
@@ -4255,6 +5486,31 @@ export declare interface ImageConfig {
4255
5486
  outputCompressionQuality?: number;
4256
5487
  }
4257
5488
 
5489
+ /**
5490
+ * An image content block.
5491
+ */
5492
+ declare interface ImageContent {
5493
+ /**
5494
+ * Used as the OpenAPI type discriminator for the content oneof.
5495
+ */
5496
+ type: 'image';
5497
+ data?: string;
5498
+ /**
5499
+ * The mime type of the image.
5500
+ */
5501
+ mime_type?: ImageMimeType;
5502
+ /**
5503
+ * The resolution of the media.
5504
+ */
5505
+ resolution?: 'low' | 'medium' | 'high';
5506
+ uri?: string;
5507
+ }
5508
+
5509
+ /**
5510
+ * The mime type of the image.
5511
+ */
5512
+ declare type ImageMimeType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/heic' | 'image/heif' | (string & {});
5513
+
4258
5514
  /** Enum that specifies the language of the text in the prompt. */
4259
5515
  export declare enum ImagePromptLanguage {
4260
5516
  /**
@@ -4384,6 +5640,217 @@ export declare class InlinedResponse {
4384
5640
  error?: JobError;
4385
5641
  }
4386
5642
 
5643
+ /**
5644
+ * The Interaction resource.
5645
+ */
5646
+ declare interface Interaction {
5647
+ /**
5648
+ * Output only. A unique identifier for the interaction completion.
5649
+ */
5650
+ id: string;
5651
+ /**
5652
+ * Output only. The status of the interaction.
5653
+ */
5654
+ status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5655
+ /**
5656
+ * The name of the `Agent` used for generating the interaction.
5657
+ */
5658
+ agent?: (string & {}) | 'deep-research-pro-preview-12-2025';
5659
+ /**
5660
+ * Output only. The time at which the response was created in ISO 8601 format
5661
+ * (YYYY-MM-DDThh:mm:ssZ).
5662
+ */
5663
+ created?: string;
5664
+ /**
5665
+ * The name of the `Model` used for generating the interaction.
5666
+ */
5667
+ model?: Model_2;
5668
+ /**
5669
+ * Output only. The object type of the interaction. Always set to `interaction`.
5670
+ */
5671
+ object?: 'interaction';
5672
+ /**
5673
+ * Output only. Responses from the model.
5674
+ */
5675
+ outputs?: Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
5676
+ /**
5677
+ * The ID of the previous interaction, if any.
5678
+ */
5679
+ previous_interaction_id?: string;
5680
+ /**
5681
+ * Output only. The role of the interaction.
5682
+ */
5683
+ role?: string;
5684
+ /**
5685
+ * Output only. The time at which the response was last updated in ISO 8601 format
5686
+ * (YYYY-MM-DDThh:mm:ssZ).
5687
+ */
5688
+ updated?: string;
5689
+ /**
5690
+ * Output only. Statistics on the interaction request's token usage.
5691
+ */
5692
+ usage?: Usage;
5693
+ }
5694
+
5695
+ declare interface InteractionCancelParams {
5696
+ /**
5697
+ * Which version of the API to use.
5698
+ */
5699
+ api_version?: string;
5700
+ }
5701
+
5702
+ declare type InteractionCreateParams = CreateModelInteractionParamsNonStreaming | CreateModelInteractionParamsStreaming | CreateAgentInteractionParamsNonStreaming | CreateAgentInteractionParamsStreaming;
5703
+
5704
+ declare interface InteractionDeleteParams {
5705
+ /**
5706
+ * Which version of the API to use.
5707
+ */
5708
+ api_version?: string;
5709
+ }
5710
+
5711
+ declare type InteractionDeleteResponse = unknown;
5712
+
5713
+ declare interface InteractionEvent {
5714
+ /**
5715
+ * The event_id token to be used to resume the interaction stream, from
5716
+ * this event.
5717
+ */
5718
+ event_id?: string;
5719
+ event_type?: 'interaction.start' | 'interaction.complete';
5720
+ /**
5721
+ * The Interaction resource.
5722
+ */
5723
+ interaction?: Interaction;
5724
+ }
5725
+
5726
+ declare type InteractionGetParams = InteractionGetParamsNonStreaming | InteractionGetParamsStreaming;
5727
+
5728
+ declare namespace InteractionGetParams {
5729
+ type InteractionGetParamsNonStreaming = InteractionsAPI.InteractionGetParamsNonStreaming;
5730
+ type InteractionGetParamsStreaming = InteractionsAPI.InteractionGetParamsStreaming;
5731
+ }
5732
+
5733
+ declare interface InteractionGetParamsBase {
5734
+ /**
5735
+ * Path param: Which version of the API to use.
5736
+ */
5737
+ api_version?: string;
5738
+ /**
5739
+ * 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.
5740
+ */
5741
+ last_event_id?: string;
5742
+ /**
5743
+ * Query param: If set to true, the generated content will be streamed incrementally.
5744
+ */
5745
+ stream?: boolean;
5746
+ }
5747
+
5748
+ declare interface InteractionGetParamsNonStreaming extends InteractionGetParamsBase {
5749
+ /**
5750
+ * Query param: If set to true, the generated content will be streamed incrementally.
5751
+ */
5752
+ stream?: false;
5753
+ }
5754
+
5755
+ declare interface InteractionGetParamsStreaming extends InteractionGetParamsBase {
5756
+ /**
5757
+ * Query param: If set to true, the generated content will be streamed incrementally.
5758
+ */
5759
+ stream: true;
5760
+ }
5761
+
5762
+ export declare class Interactions extends BaseInteractions {
5763
+ }
5764
+
5765
+ export declare namespace Interactions {
5766
+ export { type AllowedTools as AllowedTools, type Annotation as Annotation, type AudioContent as AudioContent, type AudioMimeType as AudioMimeType, type CodeExecutionCallArguments as CodeExecutionCallArguments, type CodeExecutionCallContent as CodeExecutionCallContent, type CodeExecutionResultContent as CodeExecutionResultContent, type ContentDelta as ContentDelta, type ContentStart as ContentStart, type ContentStop as ContentStop, type DeepResearchAgentConfig as DeepResearchAgentConfig, type DocumentContent as DocumentContent, type DynamicAgentConfig as DynamicAgentConfig, type ErrorEvent_2 as ErrorEvent, type FileSearchResultContent as FileSearchResultContent, type Function_2 as Function, type FunctionCallContent as FunctionCallContent, type FunctionResultContent as FunctionResultContent, type GenerationConfig_2 as GenerationConfig, type GoogleSearchCallArguments as GoogleSearchCallArguments, type GoogleSearchCallContent as GoogleSearchCallContent, type GoogleSearchResult as GoogleSearchResult, type GoogleSearchResultContent as GoogleSearchResultContent, type ImageContent as ImageContent, type ImageMimeType as ImageMimeType, type Interaction as Interaction, type InteractionEvent as InteractionEvent, type InteractionSSEEvent as InteractionSSEEvent, type InteractionStatusUpdate as InteractionStatusUpdate, type MCPServerToolCallContent as MCPServerToolCallContent, type MCPServerToolResultContent as MCPServerToolResultContent, type Model_2 as Model, type SpeechConfig_2 as SpeechConfig, type TextContent as TextContent, type ThinkingLevel_2 as ThinkingLevel, type ThoughtContent as ThoughtContent, type Tool_2 as Tool, type ToolChoice as ToolChoice, type ToolChoiceConfig as ToolChoiceConfig, type ToolChoiceType as ToolChoiceType, type Turn as Turn, type URLContextCallArguments as URLContextCallArguments, type URLContextCallContent as URLContextCallContent, type URLContextResult as URLContextResult, type URLContextResultContent as URLContextResultContent, type Usage as Usage, type VideoContent as VideoContent, type VideoMimeType as VideoMimeType, type InteractionDeleteResponse as InteractionDeleteResponse, type InteractionCreateParams as InteractionCreateParams, type CreateModelInteractionParamsNonStreaming as CreateModelInteractionParamsNonStreaming, type CreateModelInteractionParamsStreaming as CreateModelInteractionParamsStreaming, type CreateAgentInteractionParamsNonStreaming as CreateAgentInteractionParamsNonStreaming, type CreateAgentInteractionParamsStreaming as CreateAgentInteractionParamsStreaming, type InteractionDeleteParams as InteractionDeleteParams, type InteractionCancelParams as InteractionCancelParams, type InteractionGetParams as InteractionGetParams, type InteractionGetParamsNonStreaming as InteractionGetParamsNonStreaming, type InteractionGetParamsStreaming as InteractionGetParamsStreaming, };
5767
+ }
5768
+
5769
+ declare namespace InteractionsAPI {
5770
+ export {
5771
+ BaseInteractions,
5772
+ Interactions,
5773
+ AllowedTools,
5774
+ Annotation,
5775
+ AudioContent,
5776
+ AudioMimeType,
5777
+ CodeExecutionCallArguments,
5778
+ CodeExecutionCallContent,
5779
+ CodeExecutionResultContent,
5780
+ ContentDelta,
5781
+ ContentStart,
5782
+ ContentStop,
5783
+ DeepResearchAgentConfig,
5784
+ DocumentContent,
5785
+ DynamicAgentConfig,
5786
+ ErrorEvent_2 as ErrorEvent,
5787
+ FileSearchResultContent,
5788
+ Function_2 as Function,
5789
+ FunctionCallContent,
5790
+ FunctionResultContent,
5791
+ GenerationConfig_2 as GenerationConfig,
5792
+ GoogleSearchCallArguments,
5793
+ GoogleSearchCallContent,
5794
+ GoogleSearchResult,
5795
+ GoogleSearchResultContent,
5796
+ ImageContent,
5797
+ ImageMimeType,
5798
+ Interaction,
5799
+ InteractionEvent,
5800
+ InteractionSSEEvent,
5801
+ InteractionStatusUpdate,
5802
+ MCPServerToolCallContent,
5803
+ MCPServerToolResultContent,
5804
+ Model_2 as Model,
5805
+ SpeechConfig_2 as SpeechConfig,
5806
+ TextContent,
5807
+ ThinkingLevel_2 as ThinkingLevel,
5808
+ ThoughtContent,
5809
+ Tool_2 as Tool,
5810
+ ToolChoice,
5811
+ ToolChoiceConfig,
5812
+ ToolChoiceType,
5813
+ Turn,
5814
+ URLContextCallArguments,
5815
+ URLContextCallContent,
5816
+ URLContextResult,
5817
+ URLContextResultContent,
5818
+ Usage,
5819
+ VideoContent,
5820
+ VideoMimeType,
5821
+ InteractionDeleteResponse,
5822
+ InteractionCreateParams,
5823
+ BaseCreateModelInteractionParams,
5824
+ BaseCreateAgentInteractionParams,
5825
+ CreateModelInteractionParamsNonStreaming,
5826
+ CreateModelInteractionParamsStreaming,
5827
+ CreateAgentInteractionParamsNonStreaming,
5828
+ CreateAgentInteractionParamsStreaming,
5829
+ InteractionDeleteParams,
5830
+ InteractionCancelParams,
5831
+ InteractionGetParams,
5832
+ InteractionGetParamsBase,
5833
+ InteractionGetParamsNonStreaming,
5834
+ InteractionGetParamsStreaming
5835
+ }
5836
+ }
5837
+
5838
+ declare type InteractionSSEEvent = InteractionEvent | InteractionStatusUpdate | ContentStart | ContentDelta | ContentStop | ErrorEvent_2;
5839
+
5840
+ declare interface InteractionStatusUpdate {
5841
+ /**
5842
+ * The event_id token to be used to resume the interaction stream, from
5843
+ * this event.
5844
+ */
5845
+ event_id?: string;
5846
+ event_type?: 'interaction.status_update';
5847
+ interaction_id?: string;
5848
+ status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5849
+ }
5850
+
5851
+ declare class InternalServerError extends APIError<number, Headers> {
5852
+ }
5853
+
4387
5854
  /** Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive). The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time. */
4388
5855
  export declare interface Interval {
4389
5856
  /** Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. */
@@ -4880,6 +6347,10 @@ export declare interface LiveClientSetup {
4880
6347
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4881
6348
  the input and to ignore irrelevant input. */
4882
6349
  proactivity?: ProactivityConfig;
6350
+ /** Configures the explicit VAD signal. If enabled, the client will send
6351
+ vad_signal to indicate the start and end of speech. This allows the server
6352
+ to process the audio more efficiently. */
6353
+ explicitVadSignal?: boolean;
4883
6354
  }
4884
6355
 
4885
6356
  /** Client generated response to a `ToolCall` received from the server.
@@ -4982,6 +6453,10 @@ export declare interface LiveConnectConfig {
4982
6453
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4983
6454
  the input and to ignore irrelevant input. */
4984
6455
  proactivity?: ProactivityConfig;
6456
+ /** Configures the explicit VAD signal. If enabled, the client will send
6457
+ vad_signal to indicate the start and end of speech. This allows the server
6458
+ to process the audio more efficiently. */
6459
+ explicitVadSignal?: boolean;
4985
6460
  }
4986
6461
 
4987
6462
  /** Config for LiveConnectConstraints for Auth Token creation. */
@@ -5392,6 +6867,8 @@ export declare class LiveServerMessage {
5392
6867
  goAway?: LiveServerGoAway;
5393
6868
  /** Update of the session resumption state. */
5394
6869
  sessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
6870
+ /** Voice activity detection signal. */
6871
+ voiceActivityDetectionSignal?: VoiceActivityDetectionSignal;
5395
6872
  /**
5396
6873
  * Returns the concatenation of all text parts from the server content if present.
5397
6874
  *
@@ -5449,6 +6926,17 @@ export declare interface LiveServerToolCallCancellation {
5449
6926
  ids?: string[];
5450
6927
  }
5451
6928
 
6929
+ declare type LogFn = (message: string, ...rest: unknown[]) => void;
6930
+
6931
+ declare type Logger = {
6932
+ error: LogFn;
6933
+ warn: LogFn;
6934
+ info: LogFn;
6935
+ debug: LogFn;
6936
+ };
6937
+
6938
+ declare type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
6939
+
5452
6940
  /** Logprobs Result */
5453
6941
  export declare interface LogprobsResult {
5454
6942
  /** Length = total number of decoding steps. The chosen candidates may or may not be in top_candidates. */
@@ -5517,6 +7005,66 @@ export declare enum MaskReferenceMode {
5517
7005
  MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
5518
7006
  }
5519
7007
 
7008
+ /**
7009
+ * MCPServer tool call content.
7010
+ */
7011
+ declare interface MCPServerToolCallContent {
7012
+ /**
7013
+ * A unique ID for this specific tool call.
7014
+ */
7015
+ id: string;
7016
+ /**
7017
+ * The JSON object of arguments for the function.
7018
+ */
7019
+ arguments: {
7020
+ [key: string]: unknown;
7021
+ };
7022
+ /**
7023
+ * The name of the tool which was called.
7024
+ */
7025
+ name: string;
7026
+ /**
7027
+ * The name of the used MCP server.
7028
+ */
7029
+ server_name: string;
7030
+ /**
7031
+ * Used as the OpenAPI type discriminator for the content oneof.
7032
+ */
7033
+ type: 'mcp_server_tool_call';
7034
+ }
7035
+
7036
+ /**
7037
+ * MCPServer tool result content.
7038
+ */
7039
+ declare interface MCPServerToolResultContent {
7040
+ /**
7041
+ * ID to match the ID from the MCP server tool call block.
7042
+ */
7043
+ call_id: string;
7044
+ /**
7045
+ * The result of the tool call.
7046
+ */
7047
+ result: MCPServerToolResultContent.Items | unknown | string;
7048
+ /**
7049
+ * Used as the OpenAPI type discriminator for the content oneof.
7050
+ */
7051
+ type: 'mcp_server_tool_result';
7052
+ /**
7053
+ * Name of the tool which is called for this specific tool call.
7054
+ */
7055
+ name?: string;
7056
+ /**
7057
+ * The name of the used MCP server.
7058
+ */
7059
+ server_name?: string;
7060
+ }
7061
+
7062
+ declare namespace MCPServerToolResultContent {
7063
+ interface Items {
7064
+ items?: Array<string | InteractionsAPI.ImageContent>;
7065
+ }
7066
+ }
7067
+
5520
7068
  /**
5521
7069
  * Creates a McpCallableTool from MCP clients and an optional config.
5522
7070
  *
@@ -5577,6 +7125,14 @@ export declare enum MediaResolution {
5577
7125
  MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
5578
7126
  }
5579
7127
 
7128
+ /**
7129
+ * This type contains `RequestInit` options that may be available on the current runtime,
7130
+ * including per-platform extensions like `dispatcher`, `agent`, `client`, etc.
7131
+ */
7132
+ declare type MergedRequestInit = RequestInits &
7133
+ /** We don't include these in the types as they'll be overridden for every request. */
7134
+ Partial<Record<'body' | 'headers' | 'method' | 'signal', never>>;
7135
+
5580
7136
  /** Server content modalities. */
5581
7137
  export declare enum Modality {
5582
7138
  /**
@@ -5672,6 +7228,11 @@ export declare interface Model {
5672
7228
  thinking?: boolean;
5673
7229
  }
5674
7230
 
7231
+ /**
7232
+ * The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7233
+ */
7234
+ 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 & {});
7235
+
5675
7236
  export declare class Models extends BaseModule {
5676
7237
  private readonly apiClient;
5677
7238
  constructor(apiClient: ApiClient);
@@ -6075,6 +7636,48 @@ export declare enum MusicGenerationMode {
6075
7636
  VOCALIZATION = "VOCALIZATION"
6076
7637
  }
6077
7638
 
7639
+ /**
7640
+ * @license
7641
+ * Copyright 2025 Google LLC
7642
+ * SPDX-License-Identifier: Apache-2.0
7643
+ */
7644
+ /// <reference types="node" />
7645
+ /**
7646
+ * Shims for types that we can't always rely on being available globally.
7647
+ *
7648
+ * Note: these only exist at the type-level, there is no corresponding runtime
7649
+ * version for any of these symbols.
7650
+ */
7651
+ declare type NeverToAny<T> = T extends never ? any : T;
7652
+
7653
+ /** @ts-ignore For users with node-fetch@2 */
7654
+ 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>;
7655
+
7656
+ /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
7657
+ 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>;
7658
+
7659
+ /** @ts-ignore */
7660
+ declare type _NodeReadableStream<R = any> = ReadableStream_2<R>;
7661
+
7662
+ declare type NotAny<T> = [0] extends [1 & T] ? never : T;
7663
+
7664
+ declare class NotFoundError extends APIError<404, Headers> {
7665
+ }
7666
+
7667
+ /**
7668
+ * @internal
7669
+ * Users can pass explicit nulls to unset default headers. When we parse them
7670
+ * into a standard headers type we need to preserve that information.
7671
+ */
7672
+ declare type NullableHeaders = {
7673
+ /** Brand check, prevent users from creating a NullableHeaders. */
7674
+ [brand_privateNullableHeaders]: true;
7675
+ /** Parsed headers. */
7676
+ values: Headers;
7677
+ /** Set of lowercase header names explicitly set to null. */
7678
+ nulls: Set<string>;
7679
+ };
7680
+
6078
7681
  /** A long-running operation. */
6079
7682
  export declare interface Operation<T> {
6080
7683
  /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
@@ -6151,6 +7754,23 @@ export declare enum Outcome {
6151
7754
  OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
6152
7755
  }
6153
7756
 
7757
+ /**
7758
+ * Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
7759
+ */
7760
+ declare type OverloadedParameters<T> = T extends ({
7761
+ (...args: infer A): unknown;
7762
+ (...args: infer B): unknown;
7763
+ (...args: infer C): unknown;
7764
+ (...args: infer D): unknown;
7765
+ }) ? A | B | C | D : T extends ({
7766
+ (...args: infer A): unknown;
7767
+ (...args: infer B): unknown;
7768
+ (...args: infer C): unknown;
7769
+ }) ? A | B | C : T extends ({
7770
+ (...args: infer A): unknown;
7771
+ (...args: infer B): unknown;
7772
+ }) ? A | B : T extends (...args: infer A) => unknown ? A : never;
7773
+
6154
7774
  export declare enum PagedItem {
6155
7775
  PAGED_ITEM_BATCH_JOBS = "batchJobs",
6156
7776
  PAGED_ITEM_MODELS = "models",
@@ -6373,6 +7993,9 @@ export declare interface PartnerModelTuningSpec {
6373
7993
 
6374
7994
  export declare type PartUnion = Part | string;
6375
7995
 
7996
+ declare class PermissionDeniedError extends APIError<403, Headers> {
7997
+ }
7998
+
6376
7999
  /** Enum that controls the generation of people. */
6377
8000
  export declare enum PersonGeneration {
6378
8001
  /**
@@ -6495,6 +8118,13 @@ export declare interface ProductImage {
6495
8118
  productImage?: Image_2;
6496
8119
  }
6497
8120
 
8121
+ /**
8122
+ * @license
8123
+ * Copyright 2025 Google LLC
8124
+ * SPDX-License-Identifier: Apache-2.0
8125
+ */
8126
+ declare type PromiseOrValue<T> = T | Promise<T>;
8127
+
6498
8128
  /** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. This data type is not supported in Gemini API. */
6499
8129
  export declare interface RagChunk {
6500
8130
  /** If populated, represents where the chunk starts and ends in the document. */
@@ -6559,6 +8189,9 @@ export declare interface RagRetrievalConfigRankingRankService {
6559
8189
  modelName?: string;
6560
8190
  }
6561
8191
 
8192
+ declare class RateLimitError extends APIError<429, Headers> {
8193
+ }
8194
+
6562
8195
  /** A raw reference image.
6563
8196
 
6564
8197
  A raw reference image represents the base image to edit, provided by the user.
@@ -6575,6 +8208,8 @@ export declare class RawReferenceImage {
6575
8208
  toReferenceImageAPI(): ReferenceImageAPIInternal;
6576
8209
  }
6577
8210
 
8211
+ declare type _ReadableStream_2<R = any> = NeverToAny<([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>) | ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)>;
8212
+
6578
8213
  /** Marks the end of user activity.
6579
8214
 
6580
8215
  This can only be sent if automatic (i.e. server-side) activity detection is
@@ -6714,6 +8349,82 @@ export declare interface ReplicatedVoiceConfig {
6714
8349
  voiceSampleAudio?: string;
6715
8350
  }
6716
8351
 
8352
+ /**
8353
+ * The type for the first argument to `fetch`.
8354
+ *
8355
+ * https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
8356
+ */
8357
+ declare type _RequestInfo = Request | URL | string;
8358
+
8359
+ /**
8360
+ * An alias to the builtin `RequestInit` type so we can
8361
+ * easily alias it in import statements if there are name clashes.
8362
+ *
8363
+ * https://developer.mozilla.org/docs/Web/API/RequestInit
8364
+ */
8365
+ declare type _RequestInit = RequestInit;
8366
+
8367
+ declare type RequestInits = NotAny<UndiciTypesRequestInit> | NotAny<UndiciRequestInit> | NotAny<BunRequestInit> | NotAny<NodeFetch2RequestInit> | NotAny<NodeFetch3RequestInit> | NotAny<RequestInit> | NotAny<FetchRequestInit>;
8368
+
8369
+ declare type RequestOptions = {
8370
+ /**
8371
+ * The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
8372
+ */
8373
+ method?: HTTPMethod;
8374
+ /**
8375
+ * The URL path for the request.
8376
+ *
8377
+ * @example "/v1/foo"
8378
+ */
8379
+ path?: string;
8380
+ /**
8381
+ * Query parameters to include in the request URL.
8382
+ */
8383
+ query?: object | undefined | null;
8384
+ /**
8385
+ * The request body. Can be a string, JSON object, FormData, or other supported types.
8386
+ */
8387
+ body?: unknown;
8388
+ /**
8389
+ * HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
8390
+ */
8391
+ headers?: HeadersLike;
8392
+ /**
8393
+ * The maximum number of times that the client will retry a request in case of a
8394
+ * temporary failure, like a network error or a 5XX error from the server.
8395
+ *
8396
+ * @default 2
8397
+ */
8398
+ maxRetries?: number;
8399
+ stream?: boolean | undefined;
8400
+ /**
8401
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
8402
+ * from the server before timing out a single request.
8403
+ *
8404
+ * @unit milliseconds
8405
+ */
8406
+ timeout?: number;
8407
+ /**
8408
+ * Additional `RequestInit` options to be passed to the underlying `fetch` call.
8409
+ * These options will be merged with the client's default fetch options.
8410
+ */
8411
+ fetchOptions?: MergedRequestInit;
8412
+ /**
8413
+ * An AbortSignal that can be used to cancel the request.
8414
+ */
8415
+ signal?: AbortSignal | undefined | null;
8416
+ /**
8417
+ * A unique key for this request to enable idempotency.
8418
+ */
8419
+ idempotencyKey?: string;
8420
+ /**
8421
+ * Override the default base URL for this specific request.
8422
+ */
8423
+ defaultBaseURL?: string | undefined;
8424
+ __binaryResponse?: boolean | undefined;
8425
+ __streamClass?: typeof Stream;
8426
+ };
8427
+
6717
8428
  /** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
6718
8429
  export declare interface Retrieval {
6719
8430
  /** Optional. Deprecated. This option is no longer supported. */
@@ -7213,6 +8924,24 @@ export declare interface SpeechConfig {
7213
8924
  multiSpeakerVoiceConfig?: MultiSpeakerVoiceConfig;
7214
8925
  }
7215
8926
 
8927
+ /**
8928
+ * The configuration for speech interaction.
8929
+ */
8930
+ declare interface SpeechConfig_2 {
8931
+ /**
8932
+ * The language of the speech.
8933
+ */
8934
+ language?: string;
8935
+ /**
8936
+ * The speaker's name, it should match the speaker name given in the prompt.
8937
+ */
8938
+ speaker?: string;
8939
+ /**
8940
+ * The voice of the speaker.
8941
+ */
8942
+ voice?: string;
8943
+ }
8944
+
7216
8945
  export declare type SpeechConfigUnion = SpeechConfig | string;
7217
8946
 
7218
8947
  /** Start of speech sensitivity. */
@@ -7231,6 +8960,31 @@ export declare enum StartSensitivity {
7231
8960
  START_SENSITIVITY_LOW = "START_SENSITIVITY_LOW"
7232
8961
  }
7233
8962
 
8963
+ declare class Stream<Item> implements AsyncIterable<Item> {
8964
+ private iterator;
8965
+ controller: AbortController;
8966
+ private client;
8967
+ constructor(iterator: () => AsyncIterator<Item>, controller: AbortController, client?: BaseGeminiNextGenAPIClient);
8968
+ static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8969
+ /**
8970
+ * Generates a Stream from a newline-separated ReadableStream
8971
+ * where each item is a JSON value.
8972
+ */
8973
+ static fromReadableStream<Item>(readableStream: _ReadableStream_2, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8974
+ [Symbol.asyncIterator](): AsyncIterator<Item>;
8975
+ /**
8976
+ * Splits the stream into two streams which can be
8977
+ * independently read from at different speeds.
8978
+ */
8979
+ tee(): [Stream<Item>, Stream<Item>];
8980
+ /**
8981
+ * Converts this stream to a newline-separated ReadableStream of
8982
+ * JSON stringified values in the stream
8983
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
8984
+ */
8985
+ toReadableStream(): _ReadableStream_2;
8986
+ }
8987
+
7234
8988
  /** User provided string values assigned to a single metadata key. This data type is not supported in Vertex AI. */
7235
8989
  export declare interface StringList {
7236
8990
  /** The string values of the metadata to store. */
@@ -7412,6 +9166,24 @@ export declare interface TestTableItem {
7412
9166
  ignoreKeys?: string[];
7413
9167
  }
7414
9168
 
9169
+ /**
9170
+ * A text content block.
9171
+ */
9172
+ declare interface TextContent {
9173
+ /**
9174
+ * Used as the OpenAPI type discriminator for the content oneof.
9175
+ */
9176
+ type: 'text';
9177
+ /**
9178
+ * Citation information for model-generated content.
9179
+ */
9180
+ annotations?: Array<Annotation>;
9181
+ /**
9182
+ * The text content.
9183
+ */
9184
+ text?: string;
9185
+ }
9186
+
7415
9187
  /** The thinking features configuration. */
7416
9188
  export declare interface ThinkingConfig {
7417
9189
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
@@ -7440,6 +9212,26 @@ export declare enum ThinkingLevel {
7440
9212
  HIGH = "HIGH"
7441
9213
  }
7442
9214
 
9215
+ declare type ThinkingLevel_2 = 'low' | 'high';
9216
+
9217
+ /**
9218
+ * A thought content block.
9219
+ */
9220
+ declare interface ThoughtContent {
9221
+ /**
9222
+ * Used as the OpenAPI type discriminator for the content oneof.
9223
+ */
9224
+ type: 'thought';
9225
+ /**
9226
+ * Signature to match the backend source to be part of the generation.
9227
+ */
9228
+ signature?: string;
9229
+ /**
9230
+ * A summary of the thought.
9231
+ */
9232
+ summary?: Array<TextContent | ImageContent>;
9233
+ }
9234
+
7443
9235
  export declare class Tokens extends BaseModule {
7444
9236
  private readonly apiClient;
7445
9237
  constructor(apiClient: ApiClient);
@@ -7566,6 +9358,103 @@ export declare interface Tool {
7566
9358
  urlContext?: UrlContext;
7567
9359
  }
7568
9360
 
9361
+ /**
9362
+ * A tool that can be used by the model.
9363
+ */
9364
+ declare type Tool_2 = Function_2 | Tool_2.GoogleSearch | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.FileSearch;
9365
+
9366
+ declare namespace Tool_2 {
9367
+ /**
9368
+ * A tool that can be used by the model to search Google.
9369
+ */
9370
+ interface GoogleSearch {
9371
+ type: 'google_search';
9372
+ }
9373
+ /**
9374
+ * A tool that can be used by the model to execute code.
9375
+ */
9376
+ interface CodeExecution {
9377
+ type: 'code_execution';
9378
+ }
9379
+ /**
9380
+ * A tool that can be used by the model to fetch URL context.
9381
+ */
9382
+ interface URLContext {
9383
+ type: 'url_context';
9384
+ }
9385
+ /**
9386
+ * A tool that can be used by the model to interact with the computer.
9387
+ */
9388
+ interface ComputerUse {
9389
+ type: 'computer_use';
9390
+ /**
9391
+ * The environment being operated.
9392
+ */
9393
+ environment?: 'browser';
9394
+ /**
9395
+ * The list of predefined functions that are excluded from the model call.
9396
+ */
9397
+ excludedPredefinedFunctions?: Array<string>;
9398
+ }
9399
+ /**
9400
+ * A MCPServer is a server that can be called by the model to perform actions.
9401
+ */
9402
+ interface MCPServer {
9403
+ type: 'mcp_server';
9404
+ /**
9405
+ * The allowed tools.
9406
+ */
9407
+ allowed_tools?: Array<InteractionsAPI.AllowedTools>;
9408
+ /**
9409
+ * Optional: Fields for authentication headers, timeouts, etc., if needed.
9410
+ */
9411
+ headers?: {
9412
+ [key: string]: string;
9413
+ };
9414
+ /**
9415
+ * The name of the MCPServer.
9416
+ */
9417
+ name?: string;
9418
+ /**
9419
+ * The full URL for the MCPServer endpoint.
9420
+ * Example: "https://api.example.com/mcp"
9421
+ */
9422
+ url?: string;
9423
+ }
9424
+ /**
9425
+ * A tool that can be used by the model to search files.
9426
+ */
9427
+ interface FileSearch {
9428
+ type: 'file_search';
9429
+ /**
9430
+ * The file search store names to search.
9431
+ */
9432
+ file_search_store_names?: Array<string>;
9433
+ /**
9434
+ * Metadata filter to apply to the semantic retrieval documents and chunks.
9435
+ */
9436
+ metadata_filter?: string;
9437
+ /**
9438
+ * The number of semantic retrieval chunks to retrieve.
9439
+ */
9440
+ top_k?: number;
9441
+ }
9442
+ }
9443
+
9444
+ /**
9445
+ * The configuration for tool choice.
9446
+ */
9447
+ declare type ToolChoice = ToolChoiceType | ToolChoiceConfig;
9448
+
9449
+ declare interface ToolChoiceConfig {
9450
+ /**
9451
+ * The configuration for allowed tools.
9452
+ */
9453
+ allowed_tools?: AllowedTools;
9454
+ }
9455
+
9456
+ declare type ToolChoiceType = 'auto' | 'any' | 'none' | 'validated';
9457
+
7569
9458
  /** Tool that executes code generated by the model, and automatically returns the result to the model. See also [ExecutableCode]and [CodeExecutionResult] which are input and output to this tool. This data type is not supported in Gemini API. */
7570
9459
  export declare interface ToolCodeExecution {
7571
9460
  }
@@ -7863,6 +9752,18 @@ export declare interface TuningValidationDataset {
7863
9752
  vertexDatasetResource?: string;
7864
9753
  }
7865
9754
 
9755
+ declare interface Turn {
9756
+ /**
9757
+ * The content of the turn.
9758
+ */
9759
+ content?: string | Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
9760
+ /**
9761
+ * The originator of this turn. Must be user for input or model for
9762
+ * model output.
9763
+ */
9764
+ role?: string;
9765
+ }
9766
+
7866
9767
  /** The reason why the turn is complete. */
7867
9768
  export declare enum TurnCompleteReason {
7868
9769
  /**
@@ -7996,6 +9897,7 @@ declare namespace types {
7996
9897
  FileSource,
7997
9898
  TurnCompleteReason,
7998
9899
  MediaModality,
9900
+ VadSignalType,
7999
9901
  StartSensitivity,
8000
9902
  EndSensitivity,
8001
9903
  ActivityHandling,
@@ -8317,6 +10219,7 @@ declare namespace types {
8317
10219
  UsageMetadata,
8318
10220
  LiveServerGoAway,
8319
10221
  LiveServerSessionResumptionUpdate,
10222
+ VoiceActivityDetectionSignal,
8320
10223
  LiveServerMessage,
8321
10224
  OperationFromAPIResponseParameters,
8322
10225
  GenerationConfigThinkingConfig,
@@ -8382,6 +10285,37 @@ declare namespace types {
8382
10285
  }
8383
10286
  }
8384
10287
 
10288
+ /** @ts-ignore For users with undici */
10289
+ 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>;
10290
+
10291
+ /**
10292
+ * These imports attempt to get types from a parent package's dependencies.
10293
+ * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
10294
+ * would cause typescript to show types not present at runtime. To avoid this, we import
10295
+ * directly from parent node_modules folders.
10296
+ *
10297
+ * We need to check multiple levels because we don't know what directory structure we'll be in.
10298
+ * For example, pnpm generates directories like this:
10299
+ * ```
10300
+ * node_modules
10301
+ * ├── .pnpm
10302
+ * │ └── pkg@1.0.0
10303
+ * │ └── node_modules
10304
+ * │ └── pkg
10305
+ * │ └── internal
10306
+ * │ └── types.d.ts
10307
+ * ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg
10308
+ * └── undici
10309
+ * ```
10310
+ *
10311
+ * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
10312
+ */
10313
+ /** @ts-ignore For users with \@types/node */
10314
+ 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>;
10315
+
10316
+ declare class UnprocessableEntityError extends APIError<422, Headers> {
10317
+ }
10318
+
8385
10319
  /** Optional parameters for caches.update method. */
8386
10320
  export declare interface UpdateCachedContentConfig {
8387
10321
  /** Used to override HTTP request options. */
@@ -8632,12 +10566,80 @@ export declare class UpscaleImageResponse {
8632
10566
  export declare interface UrlContext {
8633
10567
  }
8634
10568
 
10569
+ /**
10570
+ * The arguments to pass to the URL context.
10571
+ */
10572
+ declare interface URLContextCallArguments {
10573
+ /**
10574
+ * The URLs to fetch.
10575
+ */
10576
+ urls?: Array<string>;
10577
+ }
10578
+
10579
+ /**
10580
+ * URL context content.
10581
+ */
10582
+ declare interface URLContextCallContent {
10583
+ /**
10584
+ * Used as the OpenAPI type discriminator for the content oneof.
10585
+ */
10586
+ type: 'url_context_call';
10587
+ /**
10588
+ * A unique ID for this specific tool call.
10589
+ */
10590
+ id?: string;
10591
+ /**
10592
+ * The arguments to pass to the URL context.
10593
+ */
10594
+ arguments?: URLContextCallArguments;
10595
+ }
10596
+
8635
10597
  /** Metadata related to url context retrieval tool. */
8636
10598
  export declare interface UrlContextMetadata {
8637
10599
  /** Output only. List of url context. */
8638
10600
  urlMetadata?: UrlMetadata[];
8639
10601
  }
8640
10602
 
10603
+ /**
10604
+ * The result of the URL context.
10605
+ */
10606
+ declare interface URLContextResult {
10607
+ /**
10608
+ * The status of the URL retrieval.
10609
+ */
10610
+ status?: 'success' | 'error' | 'paywall' | 'unsafe';
10611
+ /**
10612
+ * The URL that was fetched.
10613
+ */
10614
+ url?: string;
10615
+ }
10616
+
10617
+ /**
10618
+ * URL context result content.
10619
+ */
10620
+ declare interface URLContextResultContent {
10621
+ /**
10622
+ * Used as the OpenAPI type discriminator for the content oneof.
10623
+ */
10624
+ type: 'url_context_result';
10625
+ /**
10626
+ * ID to match the ID from the url context call block.
10627
+ */
10628
+ call_id?: string;
10629
+ /**
10630
+ * Whether the URL context resulted in an error.
10631
+ */
10632
+ is_error?: boolean;
10633
+ /**
10634
+ * The results of the URL context.
10635
+ */
10636
+ result?: Array<URLContextResult>;
10637
+ /**
10638
+ * The signature of the URL context result.
10639
+ */
10640
+ signature?: string;
10641
+ }
10642
+
8641
10643
  /** Context of the a single url retrieval. */
8642
10644
  export declare interface UrlMetadata {
8643
10645
  /** Retrieved url by the tool. */
@@ -8670,6 +10672,108 @@ export declare enum UrlRetrievalStatus {
8670
10672
  URL_RETRIEVAL_STATUS_UNSAFE = "URL_RETRIEVAL_STATUS_UNSAFE"
8671
10673
  }
8672
10674
 
10675
+ /**
10676
+ * Statistics on the interaction request's token usage.
10677
+ */
10678
+ declare interface Usage {
10679
+ /**
10680
+ * A breakdown of cached token usage by modality.
10681
+ */
10682
+ cached_tokens_by_modality?: Array<Usage.CachedTokensByModality>;
10683
+ /**
10684
+ * A breakdown of input token usage by modality.
10685
+ */
10686
+ input_tokens_by_modality?: Array<Usage.InputTokensByModality>;
10687
+ /**
10688
+ * A breakdown of output token usage by modality.
10689
+ */
10690
+ output_tokens_by_modality?: Array<Usage.OutputTokensByModality>;
10691
+ /**
10692
+ * A breakdown of tool-use token usage by modality.
10693
+ */
10694
+ tool_use_tokens_by_modality?: Array<Usage.ToolUseTokensByModality>;
10695
+ /**
10696
+ * Number of tokens in the cached part of the prompt (the cached content).
10697
+ */
10698
+ total_cached_tokens?: number;
10699
+ /**
10700
+ * Number of tokens in the prompt (context).
10701
+ */
10702
+ total_input_tokens?: number;
10703
+ /**
10704
+ * Total number of tokens across all the generated responses.
10705
+ */
10706
+ total_output_tokens?: number;
10707
+ /**
10708
+ * Number of tokens of thoughts for thinking models.
10709
+ */
10710
+ total_reasoning_tokens?: number;
10711
+ /**
10712
+ * Total token count for the interaction request (prompt + responses + other
10713
+ * internal tokens).
10714
+ */
10715
+ total_tokens?: number;
10716
+ /**
10717
+ * Number of tokens present in tool-use prompt(s).
10718
+ */
10719
+ total_tool_use_tokens?: number;
10720
+ }
10721
+
10722
+ declare namespace Usage {
10723
+ /**
10724
+ * The token count for a single response modality.
10725
+ */
10726
+ interface CachedTokensByModality {
10727
+ /**
10728
+ * The modality associated with the token count.
10729
+ */
10730
+ modality?: 'text' | 'image' | 'audio';
10731
+ /**
10732
+ * Number of tokens for the modality.
10733
+ */
10734
+ tokens?: number;
10735
+ }
10736
+ /**
10737
+ * The token count for a single response modality.
10738
+ */
10739
+ interface InputTokensByModality {
10740
+ /**
10741
+ * The modality associated with the token count.
10742
+ */
10743
+ modality?: 'text' | 'image' | 'audio';
10744
+ /**
10745
+ * Number of tokens for the modality.
10746
+ */
10747
+ tokens?: number;
10748
+ }
10749
+ /**
10750
+ * The token count for a single response modality.
10751
+ */
10752
+ interface OutputTokensByModality {
10753
+ /**
10754
+ * The modality associated with the token count.
10755
+ */
10756
+ modality?: 'text' | 'image' | 'audio';
10757
+ /**
10758
+ * Number of tokens for the modality.
10759
+ */
10760
+ tokens?: number;
10761
+ }
10762
+ /**
10763
+ * The token count for a single response modality.
10764
+ */
10765
+ interface ToolUseTokensByModality {
10766
+ /**
10767
+ * The modality associated with the token count.
10768
+ */
10769
+ modality?: 'text' | 'image' | 'audio';
10770
+ /**
10771
+ * Number of tokens for the modality.
10772
+ */
10773
+ tokens?: number;
10774
+ }
10775
+ }
10776
+
8673
10777
  /** Usage metadata about response(s). */
8674
10778
  export declare interface UsageMetadata {
8675
10779
  /** Number of tokens in the prompt. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content. */
@@ -8697,6 +10801,22 @@ export declare interface UsageMetadata {
8697
10801
  trafficType?: TrafficType;
8698
10802
  }
8699
10803
 
10804
+ /** The type of the VAD signal. */
10805
+ export declare enum VadSignalType {
10806
+ /**
10807
+ * The default is VAD_SIGNAL_TYPE_UNSPECIFIED.
10808
+ */
10809
+ VAD_SIGNAL_TYPE_UNSPECIFIED = "VAD_SIGNAL_TYPE_UNSPECIFIED",
10810
+ /**
10811
+ * Start of sentence signal.
10812
+ */
10813
+ VAD_SIGNAL_TYPE_SOS = "VAD_SIGNAL_TYPE_SOS",
10814
+ /**
10815
+ * End of sentence signal.
10816
+ */
10817
+ VAD_SIGNAL_TYPE_EOS = "VAD_SIGNAL_TYPE_EOS"
10818
+ }
10819
+
8700
10820
  /** Hyperparameters for Veo. This data type is not supported in Gemini API. */
8701
10821
  export declare interface VeoHyperParameters {
8702
10822
  /** Optional. Number of complete passes the model makes over the entire training dataset during training. */
@@ -8788,6 +10908,26 @@ export declare enum VideoCompressionQuality {
8788
10908
  LOSSLESS = "LOSSLESS"
8789
10909
  }
8790
10910
 
10911
+ /**
10912
+ * A video content block.
10913
+ */
10914
+ declare interface VideoContent {
10915
+ /**
10916
+ * Used as the OpenAPI type discriminator for the content oneof.
10917
+ */
10918
+ type: 'video';
10919
+ data?: string;
10920
+ /**
10921
+ * The mime type of the video.
10922
+ */
10923
+ mime_type?: VideoMimeType;
10924
+ /**
10925
+ * The resolution of the media.
10926
+ */
10927
+ resolution?: 'low' | 'medium' | 'high';
10928
+ uri?: string;
10929
+ }
10930
+
8791
10931
  /** A mask for video generation. */
8792
10932
  export declare interface VideoGenerationMask {
8793
10933
  /** The image mask to use for generating videos. */
@@ -8859,6 +10999,16 @@ export declare interface VideoMetadata {
8859
10999
  startOffset?: string;
8860
11000
  }
8861
11001
 
11002
+ /**
11003
+ * The mime type of the video.
11004
+ */
11005
+ declare type VideoMimeType = 'video/mp4' | 'video/mpeg' | 'video/mov' | 'video/avi' | 'video/x-flv' | 'video/mpg' | 'video/webm' | 'video/wmv' | 'video/3gpp' | (string & {});
11006
+
11007
+ export declare interface VoiceActivityDetectionSignal {
11008
+ /** The type of the VAD signal. */
11009
+ vadSignalType?: VadSignalType;
11010
+ }
11011
+
8862
11012
  export declare interface VoiceConfig {
8863
11013
  /** If true, the model will use a replicated voice for the response. */
8864
11014
  replicatedVoiceConfig?: ReplicatedVoiceConfig;