@google/genai 1.31.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/web/web.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. */
@@ -2697,7 +3710,34 @@ export declare enum FinishReason {
2697
3710
  /**
2698
3711
  * The model was expected to generate an image, but none was generated.
2699
3712
  */
2700
- NO_IMAGE = "NO_IMAGE"
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.
3731
+ */
3732
+ description?: string;
3733
+ /**
3734
+ * The name of the function.
3735
+ */
3736
+ name?: string;
3737
+ /**
3738
+ * The JSON Schema for the function's parameters.
3739
+ */
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. */
@@ -3017,6 +4121,10 @@ export declare interface GenerateContentConfig {
3017
4121
  /** The image generation configuration.
3018
4122
  */
3019
4123
  imageConfig?: ImageConfig;
4124
+ /** Enables enhanced civic answers. It may not be available for all
4125
+ models. This field is not supported in Vertex AI.
4126
+ */
4127
+ enableEnhancedCivicAnswers?: boolean;
3020
4128
  }
3021
4129
 
3022
4130
  /** Config for models.generate_content parameters. */
@@ -3500,6 +4608,48 @@ export declare interface GenerationConfig {
3500
4608
  enableEnhancedCivicAnswers?: boolean;
3501
4609
  }
3502
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
+
3503
4653
  /** The configuration for routing the request to a specific model. This data type is not supported in Gemini API. */
3504
4654
  export declare interface GenerationConfigRoutingConfig {
3505
4655
  /** Automated routing. */
@@ -3750,6 +4900,8 @@ export declare class GoogleGenAI {
3750
4900
  readonly authTokens: Tokens;
3751
4901
  readonly tunings: Tunings;
3752
4902
  readonly fileSearchStores: FileSearchStores;
4903
+ private _interactions;
4904
+ get interactions(): Interactions;
3753
4905
  constructor(options: GoogleGenAIOptions);
3754
4906
  }
3755
4907
 
@@ -3844,6 +4996,78 @@ export declare interface GoogleSearch {
3844
4996
  timeRangeFilter?: Interval;
3845
4997
  }
3846
4998
 
4999
+ /**
5000
+ * The arguments to pass to Google Search.
5001
+ */
5002
+ declare interface GoogleSearchCallArguments {
5003
+ /**
5004
+ * Web search queries for the following-up web search.
5005
+ */
5006
+ queries?: Array<string>;
5007
+ }
5008
+
5009
+ /**
5010
+ * Google Search content.
5011
+ */
5012
+ declare interface GoogleSearchCallContent {
5013
+ /**
5014
+ * Used as the OpenAPI type discriminator for the content oneof.
5015
+ */
5016
+ type: 'google_search_call';
5017
+ /**
5018
+ * A unique ID for this specific tool call.
5019
+ */
5020
+ id?: string;
5021
+ /**
5022
+ * The arguments to pass to Google Search.
5023
+ */
5024
+ arguments?: GoogleSearchCallArguments;
5025
+ }
5026
+
5027
+ /**
5028
+ * The result of the Google Search.
5029
+ */
5030
+ declare interface GoogleSearchResult {
5031
+ /**
5032
+ * Web content snippet that can be embedded in a web page or an app webview.
5033
+ */
5034
+ rendered_content?: string;
5035
+ /**
5036
+ * Title of the search result.
5037
+ */
5038
+ title?: string;
5039
+ /**
5040
+ * URI reference of the search result.
5041
+ */
5042
+ url?: string;
5043
+ }
5044
+
5045
+ /**
5046
+ * Google Search result content.
5047
+ */
5048
+ declare interface GoogleSearchResultContent {
5049
+ /**
5050
+ * Used as the OpenAPI type discriminator for the content oneof.
5051
+ */
5052
+ type: 'google_search_result';
5053
+ /**
5054
+ * ID to match the ID from the google search call block.
5055
+ */
5056
+ call_id?: string;
5057
+ /**
5058
+ * Whether the Google Search resulted in an error.
5059
+ */
5060
+ is_error?: boolean;
5061
+ /**
5062
+ * The results of the Google Search.
5063
+ */
5064
+ result?: Array<GoogleSearchResult>;
5065
+ /**
5066
+ * The signature of the Google Search result.
5067
+ */
5068
+ signature?: string;
5069
+ }
5070
+
3847
5071
  /** Tool to retrieve public web data for grounding, powered by Google. */
3848
5072
  export declare interface GoogleSearchRetrieval {
3849
5073
  /** Specifies the dynamic retrieval configuration for the given source. */
@@ -4122,6 +5346,15 @@ export declare enum HarmSeverity {
4122
5346
  HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH"
4123
5347
  }
4124
5348
 
5349
+ declare type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | NullableHeaders;
5350
+
5351
+ /**
5352
+ * @license
5353
+ * Copyright 2025 Google LLC
5354
+ * SPDX-License-Identifier: Apache-2.0
5355
+ */
5356
+ declare type HeaderValue = string | undefined | null;
5357
+
4125
5358
  /** The location of the API key. This enum is not supported in Gemini API. */
4126
5359
  export declare enum HttpElementLocation {
4127
5360
  HTTP_IN_UNSPECIFIED = "HTTP_IN_UNSPECIFIED",
@@ -4147,6 +5380,8 @@ export declare enum HttpElementLocation {
4147
5380
  HTTP_IN_COOKIE = "HTTP_IN_COOKIE"
4148
5381
  }
4149
5382
 
5383
+ declare type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
5384
+
4150
5385
  /** HTTP options to be used in each of the requests. */
4151
5386
  export declare interface HttpOptions {
4152
5387
  /** The base URL for the AI platform service endpoint. */
@@ -4256,6 +5491,31 @@ export declare interface ImageConfig {
4256
5491
  outputCompressionQuality?: number;
4257
5492
  }
4258
5493
 
5494
+ /**
5495
+ * An image content block.
5496
+ */
5497
+ declare interface ImageContent {
5498
+ /**
5499
+ * Used as the OpenAPI type discriminator for the content oneof.
5500
+ */
5501
+ type: 'image';
5502
+ data?: string;
5503
+ /**
5504
+ * The mime type of the image.
5505
+ */
5506
+ mime_type?: ImageMimeType;
5507
+ /**
5508
+ * The resolution of the media.
5509
+ */
5510
+ resolution?: 'low' | 'medium' | 'high';
5511
+ uri?: string;
5512
+ }
5513
+
5514
+ /**
5515
+ * The mime type of the image.
5516
+ */
5517
+ declare type ImageMimeType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/heic' | 'image/heif' | (string & {});
5518
+
4259
5519
  /** Enum that specifies the language of the text in the prompt. */
4260
5520
  export declare enum ImagePromptLanguage {
4261
5521
  /**
@@ -4385,6 +5645,217 @@ export declare class InlinedResponse {
4385
5645
  error?: JobError;
4386
5646
  }
4387
5647
 
5648
+ /**
5649
+ * The Interaction resource.
5650
+ */
5651
+ declare interface Interaction {
5652
+ /**
5653
+ * Output only. A unique identifier for the interaction completion.
5654
+ */
5655
+ id: string;
5656
+ /**
5657
+ * Output only. The status of the interaction.
5658
+ */
5659
+ status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5660
+ /**
5661
+ * The name of the `Agent` used for generating the interaction.
5662
+ */
5663
+ agent?: (string & {}) | 'deep-research-pro-preview-12-2025';
5664
+ /**
5665
+ * Output only. The time at which the response was created in ISO 8601 format
5666
+ * (YYYY-MM-DDThh:mm:ssZ).
5667
+ */
5668
+ created?: string;
5669
+ /**
5670
+ * The name of the `Model` used for generating the interaction.
5671
+ */
5672
+ model?: Model_2;
5673
+ /**
5674
+ * Output only. The object type of the interaction. Always set to `interaction`.
5675
+ */
5676
+ object?: 'interaction';
5677
+ /**
5678
+ * Output only. Responses from the model.
5679
+ */
5680
+ outputs?: Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
5681
+ /**
5682
+ * The ID of the previous interaction, if any.
5683
+ */
5684
+ previous_interaction_id?: string;
5685
+ /**
5686
+ * Output only. The role of the interaction.
5687
+ */
5688
+ role?: string;
5689
+ /**
5690
+ * Output only. The time at which the response was last updated in ISO 8601 format
5691
+ * (YYYY-MM-DDThh:mm:ssZ).
5692
+ */
5693
+ updated?: string;
5694
+ /**
5695
+ * Output only. Statistics on the interaction request's token usage.
5696
+ */
5697
+ usage?: Usage;
5698
+ }
5699
+
5700
+ declare interface InteractionCancelParams {
5701
+ /**
5702
+ * Which version of the API to use.
5703
+ */
5704
+ api_version?: string;
5705
+ }
5706
+
5707
+ declare type InteractionCreateParams = CreateModelInteractionParamsNonStreaming | CreateModelInteractionParamsStreaming | CreateAgentInteractionParamsNonStreaming | CreateAgentInteractionParamsStreaming;
5708
+
5709
+ declare interface InteractionDeleteParams {
5710
+ /**
5711
+ * Which version of the API to use.
5712
+ */
5713
+ api_version?: string;
5714
+ }
5715
+
5716
+ declare type InteractionDeleteResponse = unknown;
5717
+
5718
+ declare interface InteractionEvent {
5719
+ /**
5720
+ * The event_id token to be used to resume the interaction stream, from
5721
+ * this event.
5722
+ */
5723
+ event_id?: string;
5724
+ event_type?: 'interaction.start' | 'interaction.complete';
5725
+ /**
5726
+ * The Interaction resource.
5727
+ */
5728
+ interaction?: Interaction;
5729
+ }
5730
+
5731
+ declare type InteractionGetParams = InteractionGetParamsNonStreaming | InteractionGetParamsStreaming;
5732
+
5733
+ declare namespace InteractionGetParams {
5734
+ type InteractionGetParamsNonStreaming = InteractionsAPI.InteractionGetParamsNonStreaming;
5735
+ type InteractionGetParamsStreaming = InteractionsAPI.InteractionGetParamsStreaming;
5736
+ }
5737
+
5738
+ declare interface InteractionGetParamsBase {
5739
+ /**
5740
+ * Path param: Which version of the API to use.
5741
+ */
5742
+ api_version?: string;
5743
+ /**
5744
+ * 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.
5745
+ */
5746
+ last_event_id?: string;
5747
+ /**
5748
+ * Query param: If set to true, the generated content will be streamed incrementally.
5749
+ */
5750
+ stream?: boolean;
5751
+ }
5752
+
5753
+ declare interface InteractionGetParamsNonStreaming extends InteractionGetParamsBase {
5754
+ /**
5755
+ * Query param: If set to true, the generated content will be streamed incrementally.
5756
+ */
5757
+ stream?: false;
5758
+ }
5759
+
5760
+ declare interface InteractionGetParamsStreaming extends InteractionGetParamsBase {
5761
+ /**
5762
+ * Query param: If set to true, the generated content will be streamed incrementally.
5763
+ */
5764
+ stream: true;
5765
+ }
5766
+
5767
+ export declare class Interactions extends BaseInteractions {
5768
+ }
5769
+
5770
+ export declare namespace Interactions {
5771
+ 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, };
5772
+ }
5773
+
5774
+ declare namespace InteractionsAPI {
5775
+ export {
5776
+ BaseInteractions,
5777
+ Interactions,
5778
+ AllowedTools,
5779
+ Annotation,
5780
+ AudioContent,
5781
+ AudioMimeType,
5782
+ CodeExecutionCallArguments,
5783
+ CodeExecutionCallContent,
5784
+ CodeExecutionResultContent,
5785
+ ContentDelta,
5786
+ ContentStart,
5787
+ ContentStop,
5788
+ DeepResearchAgentConfig,
5789
+ DocumentContent,
5790
+ DynamicAgentConfig,
5791
+ ErrorEvent_2 as ErrorEvent,
5792
+ FileSearchResultContent,
5793
+ Function_2 as Function,
5794
+ FunctionCallContent,
5795
+ FunctionResultContent,
5796
+ GenerationConfig_2 as GenerationConfig,
5797
+ GoogleSearchCallArguments,
5798
+ GoogleSearchCallContent,
5799
+ GoogleSearchResult,
5800
+ GoogleSearchResultContent,
5801
+ ImageContent,
5802
+ ImageMimeType,
5803
+ Interaction,
5804
+ InteractionEvent,
5805
+ InteractionSSEEvent,
5806
+ InteractionStatusUpdate,
5807
+ MCPServerToolCallContent,
5808
+ MCPServerToolResultContent,
5809
+ Model_2 as Model,
5810
+ SpeechConfig_2 as SpeechConfig,
5811
+ TextContent,
5812
+ ThinkingLevel_2 as ThinkingLevel,
5813
+ ThoughtContent,
5814
+ Tool_2 as Tool,
5815
+ ToolChoice,
5816
+ ToolChoiceConfig,
5817
+ ToolChoiceType,
5818
+ Turn,
5819
+ URLContextCallArguments,
5820
+ URLContextCallContent,
5821
+ URLContextResult,
5822
+ URLContextResultContent,
5823
+ Usage,
5824
+ VideoContent,
5825
+ VideoMimeType,
5826
+ InteractionDeleteResponse,
5827
+ InteractionCreateParams,
5828
+ BaseCreateModelInteractionParams,
5829
+ BaseCreateAgentInteractionParams,
5830
+ CreateModelInteractionParamsNonStreaming,
5831
+ CreateModelInteractionParamsStreaming,
5832
+ CreateAgentInteractionParamsNonStreaming,
5833
+ CreateAgentInteractionParamsStreaming,
5834
+ InteractionDeleteParams,
5835
+ InteractionCancelParams,
5836
+ InteractionGetParams,
5837
+ InteractionGetParamsBase,
5838
+ InteractionGetParamsNonStreaming,
5839
+ InteractionGetParamsStreaming
5840
+ }
5841
+ }
5842
+
5843
+ declare type InteractionSSEEvent = InteractionEvent | InteractionStatusUpdate | ContentStart | ContentDelta | ContentStop | ErrorEvent_2;
5844
+
5845
+ declare interface InteractionStatusUpdate {
5846
+ /**
5847
+ * The event_id token to be used to resume the interaction stream, from
5848
+ * this event.
5849
+ */
5850
+ event_id?: string;
5851
+ event_type?: 'interaction.status_update';
5852
+ interaction_id?: string;
5853
+ status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled';
5854
+ }
5855
+
5856
+ declare class InternalServerError extends APIError<number, Headers> {
5857
+ }
5858
+
4388
5859
  /** 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. */
4389
5860
  export declare interface Interval {
4390
5861
  /** Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. */
@@ -4881,6 +6352,10 @@ export declare interface LiveClientSetup {
4881
6352
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4882
6353
  the input and to ignore irrelevant input. */
4883
6354
  proactivity?: ProactivityConfig;
6355
+ /** Configures the explicit VAD signal. If enabled, the client will send
6356
+ vad_signal to indicate the start and end of speech. This allows the server
6357
+ to process the audio more efficiently. */
6358
+ explicitVadSignal?: boolean;
4884
6359
  }
4885
6360
 
4886
6361
  /** Client generated response to a `ToolCall` received from the server.
@@ -4983,6 +6458,10 @@ export declare interface LiveConnectConfig {
4983
6458
  /** Configures the proactivity of the model. This allows the model to respond proactively to
4984
6459
  the input and to ignore irrelevant input. */
4985
6460
  proactivity?: ProactivityConfig;
6461
+ /** Configures the explicit VAD signal. If enabled, the client will send
6462
+ vad_signal to indicate the start and end of speech. This allows the server
6463
+ to process the audio more efficiently. */
6464
+ explicitVadSignal?: boolean;
4986
6465
  }
4987
6466
 
4988
6467
  /** Config for LiveConnectConstraints for Auth Token creation. */
@@ -5393,6 +6872,8 @@ export declare class LiveServerMessage {
5393
6872
  goAway?: LiveServerGoAway;
5394
6873
  /** Update of the session resumption state. */
5395
6874
  sessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
6875
+ /** Voice activity detection signal. */
6876
+ voiceActivityDetectionSignal?: VoiceActivityDetectionSignal;
5396
6877
  /**
5397
6878
  * Returns the concatenation of all text parts from the server content if present.
5398
6879
  *
@@ -5450,6 +6931,17 @@ export declare interface LiveServerToolCallCancellation {
5450
6931
  ids?: string[];
5451
6932
  }
5452
6933
 
6934
+ declare type LogFn = (message: string, ...rest: unknown[]) => void;
6935
+
6936
+ declare type Logger = {
6937
+ error: LogFn;
6938
+ warn: LogFn;
6939
+ info: LogFn;
6940
+ debug: LogFn;
6941
+ };
6942
+
6943
+ declare type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
6944
+
5453
6945
  /** Logprobs Result */
5454
6946
  export declare interface LogprobsResult {
5455
6947
  /** Length = total number of decoding steps. The chosen candidates may or may not be in top_candidates. */
@@ -5518,6 +7010,66 @@ export declare enum MaskReferenceMode {
5518
7010
  MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
5519
7011
  }
5520
7012
 
7013
+ /**
7014
+ * MCPServer tool call content.
7015
+ */
7016
+ declare interface MCPServerToolCallContent {
7017
+ /**
7018
+ * A unique ID for this specific tool call.
7019
+ */
7020
+ id: string;
7021
+ /**
7022
+ * The JSON object of arguments for the function.
7023
+ */
7024
+ arguments: {
7025
+ [key: string]: unknown;
7026
+ };
7027
+ /**
7028
+ * The name of the tool which was called.
7029
+ */
7030
+ name: string;
7031
+ /**
7032
+ * The name of the used MCP server.
7033
+ */
7034
+ server_name: string;
7035
+ /**
7036
+ * Used as the OpenAPI type discriminator for the content oneof.
7037
+ */
7038
+ type: 'mcp_server_tool_call';
7039
+ }
7040
+
7041
+ /**
7042
+ * MCPServer tool result content.
7043
+ */
7044
+ declare interface MCPServerToolResultContent {
7045
+ /**
7046
+ * ID to match the ID from the MCP server tool call block.
7047
+ */
7048
+ call_id: string;
7049
+ /**
7050
+ * The result of the tool call.
7051
+ */
7052
+ result: MCPServerToolResultContent.Items | unknown | string;
7053
+ /**
7054
+ * Used as the OpenAPI type discriminator for the content oneof.
7055
+ */
7056
+ type: 'mcp_server_tool_result';
7057
+ /**
7058
+ * Name of the tool which is called for this specific tool call.
7059
+ */
7060
+ name?: string;
7061
+ /**
7062
+ * The name of the used MCP server.
7063
+ */
7064
+ server_name?: string;
7065
+ }
7066
+
7067
+ declare namespace MCPServerToolResultContent {
7068
+ interface Items {
7069
+ items?: Array<string | InteractionsAPI.ImageContent>;
7070
+ }
7071
+ }
7072
+
5521
7073
  /**
5522
7074
  * Creates a McpCallableTool from MCP clients and an optional config.
5523
7075
  *
@@ -5578,6 +7130,14 @@ export declare enum MediaResolution {
5578
7130
  MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
5579
7131
  }
5580
7132
 
7133
+ /**
7134
+ * This type contains `RequestInit` options that may be available on the current runtime,
7135
+ * including per-platform extensions like `dispatcher`, `agent`, `client`, etc.
7136
+ */
7137
+ declare type MergedRequestInit = RequestInits &
7138
+ /** We don't include these in the types as they'll be overridden for every request. */
7139
+ Partial<Record<'body' | 'headers' | 'method' | 'signal', never>>;
7140
+
5581
7141
  /** Server content modalities. */
5582
7142
  export declare enum Modality {
5583
7143
  /**
@@ -5673,6 +7233,11 @@ export declare interface Model {
5673
7233
  thinking?: boolean;
5674
7234
  }
5675
7235
 
7236
+ /**
7237
+ * The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
7238
+ */
7239
+ 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 & {});
7240
+
5676
7241
  export declare class Models extends BaseModule {
5677
7242
  private readonly apiClient;
5678
7243
  constructor(apiClient: ApiClient);
@@ -6076,6 +7641,48 @@ export declare enum MusicGenerationMode {
6076
7641
  VOCALIZATION = "VOCALIZATION"
6077
7642
  }
6078
7643
 
7644
+ /**
7645
+ * @license
7646
+ * Copyright 2025 Google LLC
7647
+ * SPDX-License-Identifier: Apache-2.0
7648
+ */
7649
+ /// <reference types="node" />
7650
+ /**
7651
+ * Shims for types that we can't always rely on being available globally.
7652
+ *
7653
+ * Note: these only exist at the type-level, there is no corresponding runtime
7654
+ * version for any of these symbols.
7655
+ */
7656
+ declare type NeverToAny<T> = T extends never ? any : T;
7657
+
7658
+ /** @ts-ignore For users with node-fetch@2 */
7659
+ 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>;
7660
+
7661
+ /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
7662
+ 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>;
7663
+
7664
+ /** @ts-ignore */
7665
+ declare type _NodeReadableStream<R = any> = ReadableStream_2<R>;
7666
+
7667
+ declare type NotAny<T> = [0] extends [1 & T] ? never : T;
7668
+
7669
+ declare class NotFoundError extends APIError<404, Headers> {
7670
+ }
7671
+
7672
+ /**
7673
+ * @internal
7674
+ * Users can pass explicit nulls to unset default headers. When we parse them
7675
+ * into a standard headers type we need to preserve that information.
7676
+ */
7677
+ declare type NullableHeaders = {
7678
+ /** Brand check, prevent users from creating a NullableHeaders. */
7679
+ [brand_privateNullableHeaders]: true;
7680
+ /** Parsed headers. */
7681
+ values: Headers;
7682
+ /** Set of lowercase header names explicitly set to null. */
7683
+ nulls: Set<string>;
7684
+ };
7685
+
6079
7686
  /** A long-running operation. */
6080
7687
  export declare interface Operation<T> {
6081
7688
  /** 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}`. */
@@ -6152,6 +7759,23 @@ export declare enum Outcome {
6152
7759
  OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
6153
7760
  }
6154
7761
 
7762
+ /**
7763
+ * Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
7764
+ */
7765
+ declare type OverloadedParameters<T> = T extends ({
7766
+ (...args: infer A): unknown;
7767
+ (...args: infer B): unknown;
7768
+ (...args: infer C): unknown;
7769
+ (...args: infer D): unknown;
7770
+ }) ? A | B | C | D : T extends ({
7771
+ (...args: infer A): unknown;
7772
+ (...args: infer B): unknown;
7773
+ (...args: infer C): unknown;
7774
+ }) ? A | B | C : T extends ({
7775
+ (...args: infer A): unknown;
7776
+ (...args: infer B): unknown;
7777
+ }) ? A | B : T extends (...args: infer A) => unknown ? A : never;
7778
+
6155
7779
  export declare enum PagedItem {
6156
7780
  PAGED_ITEM_BATCH_JOBS = "batchJobs",
6157
7781
  PAGED_ITEM_MODELS = "models",
@@ -6374,6 +7998,9 @@ export declare interface PartnerModelTuningSpec {
6374
7998
 
6375
7999
  export declare type PartUnion = Part | string;
6376
8000
 
8001
+ declare class PermissionDeniedError extends APIError<403, Headers> {
8002
+ }
8003
+
6377
8004
  /** Enum that controls the generation of people. */
6378
8005
  export declare enum PersonGeneration {
6379
8006
  /**
@@ -6496,6 +8123,13 @@ export declare interface ProductImage {
6496
8123
  productImage?: Image_2;
6497
8124
  }
6498
8125
 
8126
+ /**
8127
+ * @license
8128
+ * Copyright 2025 Google LLC
8129
+ * SPDX-License-Identifier: Apache-2.0
8130
+ */
8131
+ declare type PromiseOrValue<T> = T | Promise<T>;
8132
+
6499
8133
  /** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. This data type is not supported in Gemini API. */
6500
8134
  export declare interface RagChunk {
6501
8135
  /** If populated, represents where the chunk starts and ends in the document. */
@@ -6560,6 +8194,9 @@ export declare interface RagRetrievalConfigRankingRankService {
6560
8194
  modelName?: string;
6561
8195
  }
6562
8196
 
8197
+ declare class RateLimitError extends APIError<429, Headers> {
8198
+ }
8199
+
6563
8200
  /** A raw reference image.
6564
8201
 
6565
8202
  A raw reference image represents the base image to edit, provided by the user.
@@ -6576,6 +8213,8 @@ export declare class RawReferenceImage {
6576
8213
  toReferenceImageAPI(): ReferenceImageAPIInternal;
6577
8214
  }
6578
8215
 
8216
+ declare type _ReadableStream_2<R = any> = NeverToAny<([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>) | ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)>;
8217
+
6579
8218
  /** Marks the end of user activity.
6580
8219
 
6581
8220
  This can only be sent if automatic (i.e. server-side) activity detection is
@@ -6704,6 +8343,93 @@ export declare class ReplayResponse {
6704
8343
  sdkResponseSegments?: Record<string, unknown>[];
6705
8344
  }
6706
8345
 
8346
+ /** ReplicatedVoiceConfig is used to configure replicated voice. */
8347
+ export declare interface ReplicatedVoiceConfig {
8348
+ /** The mime type of the replicated voice.
8349
+ */
8350
+ mimeType?: string;
8351
+ /** The sample audio of the replicated voice.
8352
+
8353
+ * @remarks Encoded as base64 string. */
8354
+ voiceSampleAudio?: string;
8355
+ }
8356
+
8357
+ /**
8358
+ * The type for the first argument to `fetch`.
8359
+ *
8360
+ * https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
8361
+ */
8362
+ declare type _RequestInfo = Request | URL | string;
8363
+
8364
+ /**
8365
+ * An alias to the builtin `RequestInit` type so we can
8366
+ * easily alias it in import statements if there are name clashes.
8367
+ *
8368
+ * https://developer.mozilla.org/docs/Web/API/RequestInit
8369
+ */
8370
+ declare type _RequestInit = RequestInit;
8371
+
8372
+ declare type RequestInits = NotAny<UndiciTypesRequestInit> | NotAny<UndiciRequestInit> | NotAny<BunRequestInit> | NotAny<NodeFetch2RequestInit> | NotAny<NodeFetch3RequestInit> | NotAny<RequestInit> | NotAny<FetchRequestInit>;
8373
+
8374
+ declare type RequestOptions = {
8375
+ /**
8376
+ * The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
8377
+ */
8378
+ method?: HTTPMethod;
8379
+ /**
8380
+ * The URL path for the request.
8381
+ *
8382
+ * @example "/v1/foo"
8383
+ */
8384
+ path?: string;
8385
+ /**
8386
+ * Query parameters to include in the request URL.
8387
+ */
8388
+ query?: object | undefined | null;
8389
+ /**
8390
+ * The request body. Can be a string, JSON object, FormData, or other supported types.
8391
+ */
8392
+ body?: unknown;
8393
+ /**
8394
+ * HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
8395
+ */
8396
+ headers?: HeadersLike;
8397
+ /**
8398
+ * The maximum number of times that the client will retry a request in case of a
8399
+ * temporary failure, like a network error or a 5XX error from the server.
8400
+ *
8401
+ * @default 2
8402
+ */
8403
+ maxRetries?: number;
8404
+ stream?: boolean | undefined;
8405
+ /**
8406
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
8407
+ * from the server before timing out a single request.
8408
+ *
8409
+ * @unit milliseconds
8410
+ */
8411
+ timeout?: number;
8412
+ /**
8413
+ * Additional `RequestInit` options to be passed to the underlying `fetch` call.
8414
+ * These options will be merged with the client's default fetch options.
8415
+ */
8416
+ fetchOptions?: MergedRequestInit;
8417
+ /**
8418
+ * An AbortSignal that can be used to cancel the request.
8419
+ */
8420
+ signal?: AbortSignal | undefined | null;
8421
+ /**
8422
+ * A unique key for this request to enable idempotency.
8423
+ */
8424
+ idempotencyKey?: string;
8425
+ /**
8426
+ * Override the default base URL for this specific request.
8427
+ */
8428
+ defaultBaseURL?: string | undefined;
8429
+ __binaryResponse?: boolean | undefined;
8430
+ __streamClass?: typeof Stream;
8431
+ };
8432
+
6707
8433
  /** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
6708
8434
  export declare interface Retrieval {
6709
8435
  /** Optional. Deprecated. This option is no longer supported. */
@@ -7194,16 +8920,33 @@ export declare interface SpeakerVoiceConfig {
7194
8920
  voiceConfig?: VoiceConfig;
7195
8921
  }
7196
8922
 
7197
- /** The speech generation config. */
7198
8923
  export declare interface SpeechConfig {
8924
+ /** Configuration for the voice of the response. */
8925
+ voiceConfig?: VoiceConfig;
7199
8926
  /** Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization. */
7200
8927
  languageCode?: string;
7201
- /** The configuration for the speaker to use. */
7202
- voiceConfig?: VoiceConfig;
7203
8928
  /** Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI. */
7204
8929
  multiSpeakerVoiceConfig?: MultiSpeakerVoiceConfig;
7205
8930
  }
7206
8931
 
8932
+ /**
8933
+ * The configuration for speech interaction.
8934
+ */
8935
+ declare interface SpeechConfig_2 {
8936
+ /**
8937
+ * The language of the speech.
8938
+ */
8939
+ language?: string;
8940
+ /**
8941
+ * The speaker's name, it should match the speaker name given in the prompt.
8942
+ */
8943
+ speaker?: string;
8944
+ /**
8945
+ * The voice of the speaker.
8946
+ */
8947
+ voice?: string;
8948
+ }
8949
+
7207
8950
  export declare type SpeechConfigUnion = SpeechConfig | string;
7208
8951
 
7209
8952
  /** Start of speech sensitivity. */
@@ -7222,6 +8965,31 @@ export declare enum StartSensitivity {
7222
8965
  START_SENSITIVITY_LOW = "START_SENSITIVITY_LOW"
7223
8966
  }
7224
8967
 
8968
+ declare class Stream<Item> implements AsyncIterable<Item> {
8969
+ private iterator;
8970
+ controller: AbortController;
8971
+ private client;
8972
+ constructor(iterator: () => AsyncIterator<Item>, controller: AbortController, client?: BaseGeminiNextGenAPIClient);
8973
+ static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8974
+ /**
8975
+ * Generates a Stream from a newline-separated ReadableStream
8976
+ * where each item is a JSON value.
8977
+ */
8978
+ static fromReadableStream<Item>(readableStream: _ReadableStream_2, controller: AbortController, client?: BaseGeminiNextGenAPIClient): Stream<Item>;
8979
+ [Symbol.asyncIterator](): AsyncIterator<Item>;
8980
+ /**
8981
+ * Splits the stream into two streams which can be
8982
+ * independently read from at different speeds.
8983
+ */
8984
+ tee(): [Stream<Item>, Stream<Item>];
8985
+ /**
8986
+ * Converts this stream to a newline-separated ReadableStream of
8987
+ * JSON stringified values in the stream
8988
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
8989
+ */
8990
+ toReadableStream(): _ReadableStream_2;
8991
+ }
8992
+
7225
8993
  /** User provided string values assigned to a single metadata key. This data type is not supported in Vertex AI. */
7226
8994
  export declare interface StringList {
7227
8995
  /** The string values of the metadata to store. */
@@ -7403,6 +9171,24 @@ export declare interface TestTableItem {
7403
9171
  ignoreKeys?: string[];
7404
9172
  }
7405
9173
 
9174
+ /**
9175
+ * A text content block.
9176
+ */
9177
+ declare interface TextContent {
9178
+ /**
9179
+ * Used as the OpenAPI type discriminator for the content oneof.
9180
+ */
9181
+ type: 'text';
9182
+ /**
9183
+ * Citation information for model-generated content.
9184
+ */
9185
+ annotations?: Array<Annotation>;
9186
+ /**
9187
+ * The text content.
9188
+ */
9189
+ text?: string;
9190
+ }
9191
+
7406
9192
  /** The thinking features configuration. */
7407
9193
  export declare interface ThinkingConfig {
7408
9194
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
@@ -7431,6 +9217,26 @@ export declare enum ThinkingLevel {
7431
9217
  HIGH = "HIGH"
7432
9218
  }
7433
9219
 
9220
+ declare type ThinkingLevel_2 = 'low' | 'high';
9221
+
9222
+ /**
9223
+ * A thought content block.
9224
+ */
9225
+ declare interface ThoughtContent {
9226
+ /**
9227
+ * Used as the OpenAPI type discriminator for the content oneof.
9228
+ */
9229
+ type: 'thought';
9230
+ /**
9231
+ * Signature to match the backend source to be part of the generation.
9232
+ */
9233
+ signature?: string;
9234
+ /**
9235
+ * A summary of the thought.
9236
+ */
9237
+ summary?: Array<TextContent | ImageContent>;
9238
+ }
9239
+
7434
9240
  export declare class Tokens extends BaseModule {
7435
9241
  private readonly apiClient;
7436
9242
  constructor(apiClient: ApiClient);
@@ -7557,6 +9363,103 @@ export declare interface Tool {
7557
9363
  urlContext?: UrlContext;
7558
9364
  }
7559
9365
 
9366
+ /**
9367
+ * A tool that can be used by the model.
9368
+ */
9369
+ declare type Tool_2 = Function_2 | Tool_2.GoogleSearch | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.FileSearch;
9370
+
9371
+ declare namespace Tool_2 {
9372
+ /**
9373
+ * A tool that can be used by the model to search Google.
9374
+ */
9375
+ interface GoogleSearch {
9376
+ type: 'google_search';
9377
+ }
9378
+ /**
9379
+ * A tool that can be used by the model to execute code.
9380
+ */
9381
+ interface CodeExecution {
9382
+ type: 'code_execution';
9383
+ }
9384
+ /**
9385
+ * A tool that can be used by the model to fetch URL context.
9386
+ */
9387
+ interface URLContext {
9388
+ type: 'url_context';
9389
+ }
9390
+ /**
9391
+ * A tool that can be used by the model to interact with the computer.
9392
+ */
9393
+ interface ComputerUse {
9394
+ type: 'computer_use';
9395
+ /**
9396
+ * The environment being operated.
9397
+ */
9398
+ environment?: 'browser';
9399
+ /**
9400
+ * The list of predefined functions that are excluded from the model call.
9401
+ */
9402
+ excludedPredefinedFunctions?: Array<string>;
9403
+ }
9404
+ /**
9405
+ * A MCPServer is a server that can be called by the model to perform actions.
9406
+ */
9407
+ interface MCPServer {
9408
+ type: 'mcp_server';
9409
+ /**
9410
+ * The allowed tools.
9411
+ */
9412
+ allowed_tools?: Array<InteractionsAPI.AllowedTools>;
9413
+ /**
9414
+ * Optional: Fields for authentication headers, timeouts, etc., if needed.
9415
+ */
9416
+ headers?: {
9417
+ [key: string]: string;
9418
+ };
9419
+ /**
9420
+ * The name of the MCPServer.
9421
+ */
9422
+ name?: string;
9423
+ /**
9424
+ * The full URL for the MCPServer endpoint.
9425
+ * Example: "https://api.example.com/mcp"
9426
+ */
9427
+ url?: string;
9428
+ }
9429
+ /**
9430
+ * A tool that can be used by the model to search files.
9431
+ */
9432
+ interface FileSearch {
9433
+ type: 'file_search';
9434
+ /**
9435
+ * The file search store names to search.
9436
+ */
9437
+ file_search_store_names?: Array<string>;
9438
+ /**
9439
+ * Metadata filter to apply to the semantic retrieval documents and chunks.
9440
+ */
9441
+ metadata_filter?: string;
9442
+ /**
9443
+ * The number of semantic retrieval chunks to retrieve.
9444
+ */
9445
+ top_k?: number;
9446
+ }
9447
+ }
9448
+
9449
+ /**
9450
+ * The configuration for tool choice.
9451
+ */
9452
+ declare type ToolChoice = ToolChoiceType | ToolChoiceConfig;
9453
+
9454
+ declare interface ToolChoiceConfig {
9455
+ /**
9456
+ * The configuration for allowed tools.
9457
+ */
9458
+ allowed_tools?: AllowedTools;
9459
+ }
9460
+
9461
+ declare type ToolChoiceType = 'auto' | 'any' | 'none' | 'validated';
9462
+
7560
9463
  /** 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. */
7561
9464
  export declare interface ToolCodeExecution {
7562
9465
  }
@@ -7854,6 +9757,18 @@ export declare interface TuningValidationDataset {
7854
9757
  vertexDatasetResource?: string;
7855
9758
  }
7856
9759
 
9760
+ declare interface Turn {
9761
+ /**
9762
+ * The content of the turn.
9763
+ */
9764
+ content?: string | Array<TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchResultContent>;
9765
+ /**
9766
+ * The originator of this turn. Must be user for input or model for
9767
+ * model output.
9768
+ */
9769
+ role?: string;
9770
+ }
9771
+
7857
9772
  /** The reason why the turn is complete. */
7858
9773
  export declare enum TurnCompleteReason {
7859
9774
  /**
@@ -7987,6 +9902,7 @@ declare namespace types {
7987
9902
  FileSource,
7988
9903
  TurnCompleteReason,
7989
9904
  MediaModality,
9905
+ VadSignalType,
7990
9906
  StartSensitivity,
7991
9907
  EndSensitivity,
7992
9908
  ActivityHandling,
@@ -8049,6 +9965,12 @@ declare namespace types {
8049
9965
  LatLng,
8050
9966
  RetrievalConfig,
8051
9967
  ToolConfig,
9968
+ ReplicatedVoiceConfig,
9969
+ PrebuiltVoiceConfig,
9970
+ VoiceConfig,
9971
+ SpeakerVoiceConfig,
9972
+ MultiSpeakerVoiceConfig,
9973
+ SpeechConfig,
8052
9974
  AutomaticFunctionCallingConfig,
8053
9975
  ThinkingConfig,
8054
9976
  ImageConfig,
@@ -8136,11 +10058,6 @@ declare namespace types {
8136
10058
  DeleteModelConfig,
8137
10059
  DeleteModelParameters,
8138
10060
  DeleteModelResponse,
8139
- PrebuiltVoiceConfig,
8140
- VoiceConfig,
8141
- SpeakerVoiceConfig,
8142
- MultiSpeakerVoiceConfig,
8143
- SpeechConfig,
8144
10061
  GenerationConfig,
8145
10062
  CountTokensConfig,
8146
10063
  CountTokensParameters,
@@ -8307,6 +10224,7 @@ declare namespace types {
8307
10224
  UsageMetadata,
8308
10225
  LiveServerGoAway,
8309
10226
  LiveServerSessionResumptionUpdate,
10227
+ VoiceActivityDetectionSignal,
8310
10228
  LiveServerMessage,
8311
10229
  OperationFromAPIResponseParameters,
8312
10230
  GenerationConfigThinkingConfig,
@@ -8372,6 +10290,37 @@ declare namespace types {
8372
10290
  }
8373
10291
  }
8374
10292
 
10293
+ /** @ts-ignore For users with undici */
10294
+ 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>;
10295
+
10296
+ /**
10297
+ * These imports attempt to get types from a parent package's dependencies.
10298
+ * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
10299
+ * would cause typescript to show types not present at runtime. To avoid this, we import
10300
+ * directly from parent node_modules folders.
10301
+ *
10302
+ * We need to check multiple levels because we don't know what directory structure we'll be in.
10303
+ * For example, pnpm generates directories like this:
10304
+ * ```
10305
+ * node_modules
10306
+ * ├── .pnpm
10307
+ * │ └── pkg@1.0.0
10308
+ * │ └── node_modules
10309
+ * │ └── pkg
10310
+ * │ └── internal
10311
+ * │ └── types.d.ts
10312
+ * ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg
10313
+ * └── undici
10314
+ * ```
10315
+ *
10316
+ * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
10317
+ */
10318
+ /** @ts-ignore For users with \@types/node */
10319
+ 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>;
10320
+
10321
+ declare class UnprocessableEntityError extends APIError<422, Headers> {
10322
+ }
10323
+
8375
10324
  /** Optional parameters for caches.update method. */
8376
10325
  export declare interface UpdateCachedContentConfig {
8377
10326
  /** Used to override HTTP request options. */
@@ -8622,12 +10571,80 @@ export declare class UpscaleImageResponse {
8622
10571
  export declare interface UrlContext {
8623
10572
  }
8624
10573
 
10574
+ /**
10575
+ * The arguments to pass to the URL context.
10576
+ */
10577
+ declare interface URLContextCallArguments {
10578
+ /**
10579
+ * The URLs to fetch.
10580
+ */
10581
+ urls?: Array<string>;
10582
+ }
10583
+
10584
+ /**
10585
+ * URL context content.
10586
+ */
10587
+ declare interface URLContextCallContent {
10588
+ /**
10589
+ * Used as the OpenAPI type discriminator for the content oneof.
10590
+ */
10591
+ type: 'url_context_call';
10592
+ /**
10593
+ * A unique ID for this specific tool call.
10594
+ */
10595
+ id?: string;
10596
+ /**
10597
+ * The arguments to pass to the URL context.
10598
+ */
10599
+ arguments?: URLContextCallArguments;
10600
+ }
10601
+
8625
10602
  /** Metadata related to url context retrieval tool. */
8626
10603
  export declare interface UrlContextMetadata {
8627
10604
  /** Output only. List of url context. */
8628
10605
  urlMetadata?: UrlMetadata[];
8629
10606
  }
8630
10607
 
10608
+ /**
10609
+ * The result of the URL context.
10610
+ */
10611
+ declare interface URLContextResult {
10612
+ /**
10613
+ * The status of the URL retrieval.
10614
+ */
10615
+ status?: 'success' | 'error' | 'paywall' | 'unsafe';
10616
+ /**
10617
+ * The URL that was fetched.
10618
+ */
10619
+ url?: string;
10620
+ }
10621
+
10622
+ /**
10623
+ * URL context result content.
10624
+ */
10625
+ declare interface URLContextResultContent {
10626
+ /**
10627
+ * Used as the OpenAPI type discriminator for the content oneof.
10628
+ */
10629
+ type: 'url_context_result';
10630
+ /**
10631
+ * ID to match the ID from the url context call block.
10632
+ */
10633
+ call_id?: string;
10634
+ /**
10635
+ * Whether the URL context resulted in an error.
10636
+ */
10637
+ is_error?: boolean;
10638
+ /**
10639
+ * The results of the URL context.
10640
+ */
10641
+ result?: Array<URLContextResult>;
10642
+ /**
10643
+ * The signature of the URL context result.
10644
+ */
10645
+ signature?: string;
10646
+ }
10647
+
8631
10648
  /** Context of the a single url retrieval. */
8632
10649
  export declare interface UrlMetadata {
8633
10650
  /** Retrieved url by the tool. */
@@ -8660,6 +10677,108 @@ export declare enum UrlRetrievalStatus {
8660
10677
  URL_RETRIEVAL_STATUS_UNSAFE = "URL_RETRIEVAL_STATUS_UNSAFE"
8661
10678
  }
8662
10679
 
10680
+ /**
10681
+ * Statistics on the interaction request's token usage.
10682
+ */
10683
+ declare interface Usage {
10684
+ /**
10685
+ * A breakdown of cached token usage by modality.
10686
+ */
10687
+ cached_tokens_by_modality?: Array<Usage.CachedTokensByModality>;
10688
+ /**
10689
+ * A breakdown of input token usage by modality.
10690
+ */
10691
+ input_tokens_by_modality?: Array<Usage.InputTokensByModality>;
10692
+ /**
10693
+ * A breakdown of output token usage by modality.
10694
+ */
10695
+ output_tokens_by_modality?: Array<Usage.OutputTokensByModality>;
10696
+ /**
10697
+ * A breakdown of tool-use token usage by modality.
10698
+ */
10699
+ tool_use_tokens_by_modality?: Array<Usage.ToolUseTokensByModality>;
10700
+ /**
10701
+ * Number of tokens in the cached part of the prompt (the cached content).
10702
+ */
10703
+ total_cached_tokens?: number;
10704
+ /**
10705
+ * Number of tokens in the prompt (context).
10706
+ */
10707
+ total_input_tokens?: number;
10708
+ /**
10709
+ * Total number of tokens across all the generated responses.
10710
+ */
10711
+ total_output_tokens?: number;
10712
+ /**
10713
+ * Number of tokens of thoughts for thinking models.
10714
+ */
10715
+ total_reasoning_tokens?: number;
10716
+ /**
10717
+ * Total token count for the interaction request (prompt + responses + other
10718
+ * internal tokens).
10719
+ */
10720
+ total_tokens?: number;
10721
+ /**
10722
+ * Number of tokens present in tool-use prompt(s).
10723
+ */
10724
+ total_tool_use_tokens?: number;
10725
+ }
10726
+
10727
+ declare namespace Usage {
10728
+ /**
10729
+ * The token count for a single response modality.
10730
+ */
10731
+ interface CachedTokensByModality {
10732
+ /**
10733
+ * The modality associated with the token count.
10734
+ */
10735
+ modality?: 'text' | 'image' | 'audio';
10736
+ /**
10737
+ * Number of tokens for the modality.
10738
+ */
10739
+ tokens?: number;
10740
+ }
10741
+ /**
10742
+ * The token count for a single response modality.
10743
+ */
10744
+ interface InputTokensByModality {
10745
+ /**
10746
+ * The modality associated with the token count.
10747
+ */
10748
+ modality?: 'text' | 'image' | 'audio';
10749
+ /**
10750
+ * Number of tokens for the modality.
10751
+ */
10752
+ tokens?: number;
10753
+ }
10754
+ /**
10755
+ * The token count for a single response modality.
10756
+ */
10757
+ interface OutputTokensByModality {
10758
+ /**
10759
+ * The modality associated with the token count.
10760
+ */
10761
+ modality?: 'text' | 'image' | 'audio';
10762
+ /**
10763
+ * Number of tokens for the modality.
10764
+ */
10765
+ tokens?: number;
10766
+ }
10767
+ /**
10768
+ * The token count for a single response modality.
10769
+ */
10770
+ interface ToolUseTokensByModality {
10771
+ /**
10772
+ * The modality associated with the token count.
10773
+ */
10774
+ modality?: 'text' | 'image' | 'audio';
10775
+ /**
10776
+ * Number of tokens for the modality.
10777
+ */
10778
+ tokens?: number;
10779
+ }
10780
+ }
10781
+
8663
10782
  /** Usage metadata about response(s). */
8664
10783
  export declare interface UsageMetadata {
8665
10784
  /** 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. */
@@ -8687,6 +10806,22 @@ export declare interface UsageMetadata {
8687
10806
  trafficType?: TrafficType;
8688
10807
  }
8689
10808
 
10809
+ /** The type of the VAD signal. */
10810
+ export declare enum VadSignalType {
10811
+ /**
10812
+ * The default is VAD_SIGNAL_TYPE_UNSPECIFIED.
10813
+ */
10814
+ VAD_SIGNAL_TYPE_UNSPECIFIED = "VAD_SIGNAL_TYPE_UNSPECIFIED",
10815
+ /**
10816
+ * Start of sentence signal.
10817
+ */
10818
+ VAD_SIGNAL_TYPE_SOS = "VAD_SIGNAL_TYPE_SOS",
10819
+ /**
10820
+ * End of sentence signal.
10821
+ */
10822
+ VAD_SIGNAL_TYPE_EOS = "VAD_SIGNAL_TYPE_EOS"
10823
+ }
10824
+
8690
10825
  /** Hyperparameters for Veo. This data type is not supported in Gemini API. */
8691
10826
  export declare interface VeoHyperParameters {
8692
10827
  /** Optional. Number of complete passes the model makes over the entire training dataset during training. */
@@ -8778,6 +10913,26 @@ export declare enum VideoCompressionQuality {
8778
10913
  LOSSLESS = "LOSSLESS"
8779
10914
  }
8780
10915
 
10916
+ /**
10917
+ * A video content block.
10918
+ */
10919
+ declare interface VideoContent {
10920
+ /**
10921
+ * Used as the OpenAPI type discriminator for the content oneof.
10922
+ */
10923
+ type: 'video';
10924
+ data?: string;
10925
+ /**
10926
+ * The mime type of the video.
10927
+ */
10928
+ mime_type?: VideoMimeType;
10929
+ /**
10930
+ * The resolution of the media.
10931
+ */
10932
+ resolution?: 'low' | 'medium' | 'high';
10933
+ uri?: string;
10934
+ }
10935
+
8781
10936
  /** A mask for video generation. */
8782
10937
  export declare interface VideoGenerationMask {
8783
10938
  /** The image mask to use for generating videos. */
@@ -8849,8 +11004,19 @@ export declare interface VideoMetadata {
8849
11004
  startOffset?: string;
8850
11005
  }
8851
11006
 
8852
- /** The configuration for the voice to use. */
11007
+ /**
11008
+ * The mime type of the video.
11009
+ */
11010
+ declare type VideoMimeType = 'video/mp4' | 'video/mpeg' | 'video/mov' | 'video/avi' | 'video/x-flv' | 'video/mpg' | 'video/webm' | 'video/wmv' | 'video/3gpp' | (string & {});
11011
+
11012
+ export declare interface VoiceActivityDetectionSignal {
11013
+ /** The type of the VAD signal. */
11014
+ vadSignalType?: VadSignalType;
11015
+ }
11016
+
8853
11017
  export declare interface VoiceConfig {
11018
+ /** If true, the model will use a replicated voice for the response. */
11019
+ replicatedVoiceConfig?: ReplicatedVoiceConfig;
8854
11020
  /** The configuration for the prebuilt voice to use. */
8855
11021
  prebuiltVoiceConfig?: PrebuiltVoiceConfig;
8856
11022
  }