@google/genai 1.44.0 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/genai.d.ts CHANGED
@@ -497,6 +497,9 @@ declare interface AudioContent {
497
497
 
498
498
  /** The audio transcription configuration in Setup. */
499
499
  export declare interface AudioTranscriptionConfig {
500
+ /** The language codes of the audio. BCP-47 language code. If not set, the transcription will be in the language detected by the model. If set, the server will use the language code specified in the model config as a hint for the language of the audio
501
+ */
502
+ languageCodes?: string[];
500
503
  }
501
504
 
502
505
  /**
@@ -650,11 +653,11 @@ declare interface BaseCreateAgentInteractionParams {
650
653
  */
651
654
  agent: (string & {}) | 'deep-research-pro-preview-12-2025';
652
655
  /**
653
- * Body param: The inputs for the interaction.
656
+ * Body param: The input for the interaction.
654
657
  */
655
- input: string | Array<Content_2> | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchCallContent | FileSearchResultContent;
658
+ input: Array<Content_2> | string | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchCallContent | FileSearchResultContent;
656
659
  /**
657
- * Body param: Configuration for the agent.
660
+ * Body param: Configuration parameters for the agent interaction.
658
661
  */
659
662
  agent_config?: DynamicAgentConfig | DeepResearchAgentConfig;
660
663
  /**
@@ -702,9 +705,9 @@ declare interface BaseCreateModelInteractionParams {
702
705
  */
703
706
  api_version?: string;
704
707
  /**
705
- * Body param: The inputs for the interaction.
708
+ * Body param: The input for the interaction.
706
709
  */
707
- input: string | Array<Content_2> | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchCallContent | FileSearchResultContent;
710
+ input: Array<Content_2> | string | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchCallContent | FileSearchResultContent;
708
711
  /**
709
712
  * Body param: The name of the `Model` used for generating the interaction.
710
713
  */
@@ -797,7 +800,7 @@ declare class BaseGeminiNextGenAPIClient {
797
800
  /**
798
801
  * Basic re-implementation of `qs.stringify` for primitive types.
799
802
  */
800
- protected stringifyQuery(query: Record<string, unknown>): string;
803
+ protected stringifyQuery(query: object | Record<string, unknown>): string;
801
804
  private getUserAgent;
802
805
  protected defaultIdempotencyKey(): string;
803
806
  protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
@@ -851,7 +854,7 @@ declare class BaseInteractions extends APIResource {
851
854
  * ```ts
852
855
  * const interaction = await client.interactions.create({
853
856
  * api_version: 'api_version',
854
- * input: 'string',
857
+ * input: [{ text: 'text', type: 'text' }],
855
858
  * model: 'gemini-2.5-flash',
856
859
  * });
857
860
  * ```
@@ -1700,10 +1703,6 @@ declare interface CodeExecutionCallContent {
1700
1703
  */
1701
1704
  arguments: CodeExecutionCallArguments;
1702
1705
  type: 'code_execution_call';
1703
- /**
1704
- * A signature hash for backend validation.
1705
- */
1706
- signature?: string;
1707
1706
  }
1708
1707
 
1709
1708
  /** Result of executing the [ExecutableCode]. Only generated when using the [CodeExecution] tool, and always follows a `part` containing the [ExecutableCode]. */
@@ -1875,7 +1874,7 @@ declare namespace ContentDelta {
1875
1874
  interface ThoughtSummaryDelta {
1876
1875
  type: 'thought_summary';
1877
1876
  /**
1878
- * A text content block.
1877
+ * A new summary item to be added to the thought.
1879
1878
  */
1880
1879
  content?: InteractionsAPI.TextContent | InteractionsAPI.ImageContent;
1881
1880
  }
@@ -1896,10 +1895,6 @@ declare namespace ContentDelta {
1896
1895
  };
1897
1896
  name: string;
1898
1897
  type: 'function_call';
1899
- /**
1900
- * A signature hash for backend validation.
1901
- */
1902
- signature?: string;
1903
1898
  }
1904
1899
  interface FunctionResultDelta {
1905
1900
  /**
@@ -1933,10 +1928,6 @@ declare namespace ContentDelta {
1933
1928
  */
1934
1929
  arguments: InteractionsAPI.CodeExecutionCallArguments;
1935
1930
  type: 'code_execution_call';
1936
- /**
1937
- * A signature hash for backend validation.
1938
- */
1939
- signature?: string;
1940
1931
  }
1941
1932
  interface CodeExecutionResultDelta {
1942
1933
  /**
@@ -1961,10 +1952,6 @@ declare namespace ContentDelta {
1961
1952
  */
1962
1953
  arguments: InteractionsAPI.URLContextCallArguments;
1963
1954
  type: 'url_context_call';
1964
- /**
1965
- * A signature hash for backend validation.
1966
- */
1967
- signature?: string;
1968
1955
  }
1969
1956
  interface URLContextResultDelta {
1970
1957
  /**
@@ -1989,10 +1976,6 @@ declare namespace ContentDelta {
1989
1976
  */
1990
1977
  arguments: InteractionsAPI.GoogleSearchCallArguments;
1991
1978
  type: 'google_search_call';
1992
- /**
1993
- * A signature hash for backend validation.
1994
- */
1995
- signature?: string;
1996
1979
  }
1997
1980
  interface GoogleSearchResultDelta {
1998
1981
  /**
@@ -2018,10 +2001,6 @@ declare namespace ContentDelta {
2018
2001
  name: string;
2019
2002
  server_name: string;
2020
2003
  type: 'mcp_server_tool_call';
2021
- /**
2022
- * A signature hash for backend validation.
2023
- */
2024
- signature?: string;
2025
2004
  }
2026
2005
  interface MCPServerToolResultDelta {
2027
2006
  /**
@@ -2051,14 +2030,18 @@ declare namespace ContentDelta {
2051
2030
  */
2052
2031
  id: string;
2053
2032
  type: 'file_search_call';
2054
- /**
2055
- * A signature hash for backend validation.
2056
- */
2057
- signature?: string;
2058
2033
  }
2059
2034
  interface FileSearchResultDelta {
2035
+ /**
2036
+ * ID to match the ID from the function call block.
2037
+ */
2038
+ call_id: string;
2060
2039
  type: 'file_search_result';
2061
2040
  result?: Array<FileSearchResultDelta.Result>;
2041
+ /**
2042
+ * A signature hash for backend validation.
2043
+ */
2044
+ signature?: string;
2062
2045
  }
2063
2046
  namespace FileSearchResultDelta {
2064
2047
  /**
@@ -3684,10 +3667,6 @@ declare interface FileSearchCallContent {
3684
3667
  */
3685
3668
  id: string;
3686
3669
  type: 'file_search_call';
3687
- /**
3688
- * A signature hash for backend validation.
3689
- */
3690
- signature?: string;
3691
3670
  }
3692
3671
 
3693
3672
  /**
@@ -4028,10 +4007,6 @@ declare interface FunctionCallContent {
4028
4007
  */
4029
4008
  name: string;
4030
4009
  type: 'function_call';
4031
- /**
4032
- * A signature hash for backend validation.
4033
- */
4034
- signature?: string;
4035
4010
  }
4036
4011
 
4037
4012
  /** Function calling config. */
@@ -4176,7 +4151,7 @@ declare interface FunctionResultContent {
4176
4151
  /**
4177
4152
  * The result of the tool call.
4178
4153
  */
4179
- result: FunctionResultContent.Items | unknown | string;
4154
+ result: unknown | Array<TextContent | ImageContent> | string;
4180
4155
  type: 'function_result';
4181
4156
  /**
4182
4157
  * Whether the tool call resulted in an error.
@@ -4192,12 +4167,6 @@ declare interface FunctionResultContent {
4192
4167
  signature?: string;
4193
4168
  }
4194
4169
 
4195
- declare namespace FunctionResultContent {
4196
- interface Items {
4197
- items?: Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent>;
4198
- }
4199
- }
4200
-
4201
4170
  /** The Google Cloud Storage location for the input content. This data type is not supported in Gemini API. */
4202
4171
  export declare interface GcsSource {
4203
4172
  /** Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/wildcards. */
@@ -4316,7 +4285,6 @@ export declare interface GenerateContentConfig {
4316
4285
  - `application/json`: JSON response in the candidates.
4317
4286
  The model needs to be prompted to output the appropriate response type,
4318
4287
  otherwise the behavior is undefined.
4319
- This is a preview feature.
4320
4288
  */
4321
4289
  responseMimeType?: string;
4322
4290
  /** The `Schema` object allows the definition of input and output data types.
@@ -5299,10 +5267,6 @@ declare interface GoogleSearchCallContent {
5299
5267
  * The type of search grounding enabled.
5300
5268
  */
5301
5269
  search_type?: 'web_search' | 'image_search';
5302
- /**
5303
- * A signature hash for backend validation.
5304
- */
5305
- signature?: string;
5306
5270
  }
5307
5271
 
5308
5272
  /**
@@ -6048,13 +6012,13 @@ declare interface Interaction {
6048
6012
  */
6049
6013
  agent?: (string & {}) | 'deep-research-pro-preview-12-2025';
6050
6014
  /**
6051
- * Configuration for the agent.
6015
+ * Configuration parameters for the agent interaction.
6052
6016
  */
6053
6017
  agent_config?: DynamicAgentConfig | DeepResearchAgentConfig;
6054
6018
  /**
6055
- * The inputs for the interaction.
6019
+ * The input for the interaction.
6056
6020
  */
6057
- input?: string | Array<Content_2> | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchCallContent | FileSearchResultContent;
6021
+ input?: Array<Content_2> | string | Array<Turn> | TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchCallContent | FileSearchResultContent;
6058
6022
  /**
6059
6023
  * The name of the `Model` used for generating the interaction.
6060
6024
  */
@@ -7467,10 +7431,6 @@ declare interface MCPServerToolCallContent {
7467
7431
  */
7468
7432
  server_name: string;
7469
7433
  type: 'mcp_server_tool_call';
7470
- /**
7471
- * A signature hash for backend validation.
7472
- */
7473
- signature?: string;
7474
7434
  }
7475
7435
 
7476
7436
  /**
@@ -7482,9 +7442,9 @@ declare interface MCPServerToolResultContent {
7482
7442
  */
7483
7443
  call_id: string;
7484
7444
  /**
7485
- * The result of the tool call.
7445
+ * The output from the MCP server call. Can be simple text or rich content.
7486
7446
  */
7487
- result: MCPServerToolResultContent.Items | unknown | string;
7447
+ result: unknown | Array<TextContent | ImageContent> | string;
7488
7448
  type: 'mcp_server_tool_result';
7489
7449
  /**
7490
7450
  * Name of the tool which is called for this specific tool call.
@@ -7500,12 +7460,6 @@ declare interface MCPServerToolResultContent {
7500
7460
  signature?: string;
7501
7461
  }
7502
7462
 
7503
- declare namespace MCPServerToolResultContent {
7504
- interface Items {
7505
- items?: Array<InteractionsAPI.TextContent | InteractionsAPI.ImageContent>;
7506
- }
7507
- }
7508
-
7509
7463
  /**
7510
7464
  * Creates a McpCallableTool from MCP clients and an optional config.
7511
7465
  *
@@ -9991,19 +9945,9 @@ export declare interface Tool {
9991
9945
  /**
9992
9946
  * A tool that can be used by the model.
9993
9947
  */
9994
- declare type Tool_2 = Function_2 | Tool_2.GoogleSearch | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.FileSearch;
9948
+ declare type Tool_2 = Function_2 | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.GoogleSearch | Tool_2.FileSearch;
9995
9949
 
9996
9950
  declare namespace Tool_2 {
9997
- /**
9998
- * A tool that can be used by the model to search Google.
9999
- */
10000
- interface GoogleSearch {
10001
- type: 'google_search';
10002
- /**
10003
- * The types of search grounding to enable.
10004
- */
10005
- search_types?: Array<'web_search' | 'image_search'>;
10006
- }
10007
9951
  /**
10008
9952
  * A tool that can be used by the model to execute code.
10009
9953
  */
@@ -10055,6 +9999,16 @@ declare namespace Tool_2 {
10055
9999
  */
10056
10000
  url?: string;
10057
10001
  }
10002
+ /**
10003
+ * A tool that can be used by the model to search Google.
10004
+ */
10005
+ interface GoogleSearch {
10006
+ type: 'google_search';
10007
+ /**
10008
+ * The types of search grounding to enable.
10009
+ */
10010
+ search_types?: Array<'web_search' | 'image_search'>;
10011
+ }
10058
10012
  /**
10059
10013
  * A tool that can be used by the model to search files.
10060
10014
  */
@@ -11320,10 +11274,6 @@ declare interface URLContextCallContent {
11320
11274
  */
11321
11275
  arguments: URLContextCallArguments;
11322
11276
  type: 'url_context_call';
11323
- /**
11324
- * A signature hash for backend validation.
11325
- */
11326
- signature?: string;
11327
11277
  }
11328
11278
 
11329
11279
  /** Metadata returned when the model uses the `url_context` tool to get information from a user-provided URL. */
package/dist/index.cjs CHANGED
@@ -7177,7 +7177,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
7177
7177
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
7178
7178
  const USER_AGENT_HEADER = 'User-Agent';
7179
7179
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
7180
- const SDK_VERSION = '1.44.0'; // x-release-please-version
7180
+ const SDK_VERSION = '1.45.0'; // x-release-please-version
7181
7181
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
7182
7182
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
7183
7183
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -9252,6 +9252,30 @@ const FallbackEncoder = ({ headers, body }) => {
9252
9252
  };
9253
9253
  };
9254
9254
 
9255
+ /**
9256
+ * @license
9257
+ * Copyright 2025 Google LLC
9258
+ * SPDX-License-Identifier: Apache-2.0
9259
+ */
9260
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
9261
+ /**
9262
+ * Basic re-implementation of `qs.stringify` for primitive types.
9263
+ */
9264
+ function stringifyQuery(query) {
9265
+ return Object.entries(query)
9266
+ .filter(([_, value]) => typeof value !== 'undefined')
9267
+ .map(([key, value]) => {
9268
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
9269
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
9270
+ }
9271
+ if (value === null) {
9272
+ return `${encodeURIComponent(key)}=`;
9273
+ }
9274
+ throw new GeminiNextGenAPIClientError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
9275
+ })
9276
+ .join('&');
9277
+ }
9278
+
9255
9279
  /**
9256
9280
  * @license
9257
9281
  * Copyright 2025 Google LLC
@@ -10395,18 +10419,7 @@ class BaseGeminiNextGenAPIClient {
10395
10419
  * Basic re-implementation of `qs.stringify` for primitive types.
10396
10420
  */
10397
10421
  stringifyQuery(query) {
10398
- return Object.entries(query)
10399
- .filter(([_, value]) => typeof value !== 'undefined')
10400
- .map(([key, value]) => {
10401
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
10402
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
10403
- }
10404
- if (value === null) {
10405
- return `${encodeURIComponent(key)}=`;
10406
- }
10407
- throw new GeminiNextGenAPIClientError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
10408
- })
10409
- .join('&');
10422
+ return stringifyQuery(query);
10410
10423
  }
10411
10424
  getUserAgent() {
10412
10425
  return `${this.constructor.name}/JS ${VERSION}`;
@@ -10423,8 +10436,9 @@ class BaseGeminiNextGenAPIClient {
10423
10436
  new URL(path)
10424
10437
  : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
10425
10438
  const defaultQuery = this.defaultQuery();
10426
- if (!isEmptyObj(defaultQuery)) {
10427
- query = Object.assign(Object.assign({}, defaultQuery), query);
10439
+ const pathQuery = Object.fromEntries(url.searchParams);
10440
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
10441
+ query = Object.assign(Object.assign(Object.assign({}, pathQuery), defaultQuery), query);
10428
10442
  }
10429
10443
  if (typeof query === 'object' && query && !Array.isArray(query)) {
10430
10444
  url.search = this.stringifyQuery(query);
@@ -10645,9 +10659,9 @@ class BaseGeminiNextGenAPIClient {
10645
10659
  timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
10646
10660
  }
10647
10661
  }
10648
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
10649
- // just do what it says, but otherwise calculate a default
10650
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
10662
+ // If the API asks us to wait a certain amount of time, just do what it
10663
+ // says, but otherwise calculate a default
10664
+ if (timeoutMillis === undefined) {
10651
10665
  const maxRetries = (_b = options.maxRetries) !== null && _b !== void 0 ? _b : this.maxRetries;
10652
10666
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
10653
10667
  }
@@ -10775,6 +10789,13 @@ GeminiNextGenAPIClient.Interactions = Interactions;
10775
10789
  * Copyright 2025 Google LLC
10776
10790
  * SPDX-License-Identifier: Apache-2.0
10777
10791
  */
10792
+ function audioTranscriptionConfigToMldev$1(fromObject) {
10793
+ const toObject = {};
10794
+ if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
10795
+ throw new Error('languageCodes parameter is not supported in Gemini API.');
10796
+ }
10797
+ return toObject;
10798
+ }
10778
10799
  function authConfigToMldev$2(fromObject) {
10779
10800
  const toObject = {};
10780
10801
  const fromApiKey = getValueByPath(fromObject, ['apiKey']);
@@ -11151,13 +11172,13 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
11151
11172
  'inputAudioTranscription',
11152
11173
  ]);
11153
11174
  if (parentObject !== undefined && fromInputAudioTranscription != null) {
11154
- setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], fromInputAudioTranscription);
11175
+ setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1(fromInputAudioTranscription));
11155
11176
  }
11156
11177
  const fromOutputAudioTranscription = getValueByPath(fromObject, [
11157
11178
  'outputAudioTranscription',
11158
11179
  ]);
11159
11180
  if (parentObject !== undefined && fromOutputAudioTranscription != null) {
11160
- setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], fromOutputAudioTranscription);
11181
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1(fromOutputAudioTranscription));
11161
11182
  }
11162
11183
  const fromRealtimeInputConfig = getValueByPath(fromObject, [
11163
11184
  'realtimeInputConfig',
@@ -17880,6 +17901,13 @@ class Operations extends BaseModule {
17880
17901
  * Copyright 2025 Google LLC
17881
17902
  * SPDX-License-Identifier: Apache-2.0
17882
17903
  */
17904
+ function audioTranscriptionConfigToMldev(fromObject) {
17905
+ const toObject = {};
17906
+ if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
17907
+ throw new Error('languageCodes parameter is not supported in Gemini API.');
17908
+ }
17909
+ return toObject;
17910
+ }
17883
17911
  function authConfigToMldev(fromObject) {
17884
17912
  const toObject = {};
17885
17913
  const fromApiKey = getValueByPath(fromObject, ['apiKey']);
@@ -18131,13 +18159,13 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
18131
18159
  'inputAudioTranscription',
18132
18160
  ]);
18133
18161
  if (parentObject !== undefined && fromInputAudioTranscription != null) {
18134
- setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], fromInputAudioTranscription);
18162
+ setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev(fromInputAudioTranscription));
18135
18163
  }
18136
18164
  const fromOutputAudioTranscription = getValueByPath(fromObject, [
18137
18165
  'outputAudioTranscription',
18138
18166
  ]);
18139
18167
  if (parentObject !== undefined && fromOutputAudioTranscription != null) {
18140
- setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], fromOutputAudioTranscription);
18168
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev(fromOutputAudioTranscription));
18141
18169
  }
18142
18170
  const fromRealtimeInputConfig = getValueByPath(fromObject, [
18143
18171
  'realtimeInputConfig',
package/dist/index.mjs CHANGED
@@ -7175,7 +7175,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
7175
7175
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
7176
7176
  const USER_AGENT_HEADER = 'User-Agent';
7177
7177
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
7178
- const SDK_VERSION = '1.44.0'; // x-release-please-version
7178
+ const SDK_VERSION = '1.45.0'; // x-release-please-version
7179
7179
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
7180
7180
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
7181
7181
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -9250,6 +9250,30 @@ const FallbackEncoder = ({ headers, body }) => {
9250
9250
  };
9251
9251
  };
9252
9252
 
9253
+ /**
9254
+ * @license
9255
+ * Copyright 2025 Google LLC
9256
+ * SPDX-License-Identifier: Apache-2.0
9257
+ */
9258
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
9259
+ /**
9260
+ * Basic re-implementation of `qs.stringify` for primitive types.
9261
+ */
9262
+ function stringifyQuery(query) {
9263
+ return Object.entries(query)
9264
+ .filter(([_, value]) => typeof value !== 'undefined')
9265
+ .map(([key, value]) => {
9266
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
9267
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
9268
+ }
9269
+ if (value === null) {
9270
+ return `${encodeURIComponent(key)}=`;
9271
+ }
9272
+ throw new GeminiNextGenAPIClientError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
9273
+ })
9274
+ .join('&');
9275
+ }
9276
+
9253
9277
  /**
9254
9278
  * @license
9255
9279
  * Copyright 2025 Google LLC
@@ -10393,18 +10417,7 @@ class BaseGeminiNextGenAPIClient {
10393
10417
  * Basic re-implementation of `qs.stringify` for primitive types.
10394
10418
  */
10395
10419
  stringifyQuery(query) {
10396
- return Object.entries(query)
10397
- .filter(([_, value]) => typeof value !== 'undefined')
10398
- .map(([key, value]) => {
10399
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
10400
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
10401
- }
10402
- if (value === null) {
10403
- return `${encodeURIComponent(key)}=`;
10404
- }
10405
- throw new GeminiNextGenAPIClientError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
10406
- })
10407
- .join('&');
10420
+ return stringifyQuery(query);
10408
10421
  }
10409
10422
  getUserAgent() {
10410
10423
  return `${this.constructor.name}/JS ${VERSION}`;
@@ -10421,8 +10434,9 @@ class BaseGeminiNextGenAPIClient {
10421
10434
  new URL(path)
10422
10435
  : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
10423
10436
  const defaultQuery = this.defaultQuery();
10424
- if (!isEmptyObj(defaultQuery)) {
10425
- query = Object.assign(Object.assign({}, defaultQuery), query);
10437
+ const pathQuery = Object.fromEntries(url.searchParams);
10438
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
10439
+ query = Object.assign(Object.assign(Object.assign({}, pathQuery), defaultQuery), query);
10426
10440
  }
10427
10441
  if (typeof query === 'object' && query && !Array.isArray(query)) {
10428
10442
  url.search = this.stringifyQuery(query);
@@ -10643,9 +10657,9 @@ class BaseGeminiNextGenAPIClient {
10643
10657
  timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
10644
10658
  }
10645
10659
  }
10646
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
10647
- // just do what it says, but otherwise calculate a default
10648
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
10660
+ // If the API asks us to wait a certain amount of time, just do what it
10661
+ // says, but otherwise calculate a default
10662
+ if (timeoutMillis === undefined) {
10649
10663
  const maxRetries = (_b = options.maxRetries) !== null && _b !== void 0 ? _b : this.maxRetries;
10650
10664
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
10651
10665
  }
@@ -10773,6 +10787,13 @@ GeminiNextGenAPIClient.Interactions = Interactions;
10773
10787
  * Copyright 2025 Google LLC
10774
10788
  * SPDX-License-Identifier: Apache-2.0
10775
10789
  */
10790
+ function audioTranscriptionConfigToMldev$1(fromObject) {
10791
+ const toObject = {};
10792
+ if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
10793
+ throw new Error('languageCodes parameter is not supported in Gemini API.');
10794
+ }
10795
+ return toObject;
10796
+ }
10776
10797
  function authConfigToMldev$2(fromObject) {
10777
10798
  const toObject = {};
10778
10799
  const fromApiKey = getValueByPath(fromObject, ['apiKey']);
@@ -11149,13 +11170,13 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
11149
11170
  'inputAudioTranscription',
11150
11171
  ]);
11151
11172
  if (parentObject !== undefined && fromInputAudioTranscription != null) {
11152
- setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], fromInputAudioTranscription);
11173
+ setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1(fromInputAudioTranscription));
11153
11174
  }
11154
11175
  const fromOutputAudioTranscription = getValueByPath(fromObject, [
11155
11176
  'outputAudioTranscription',
11156
11177
  ]);
11157
11178
  if (parentObject !== undefined && fromOutputAudioTranscription != null) {
11158
- setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], fromOutputAudioTranscription);
11179
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1(fromOutputAudioTranscription));
11159
11180
  }
11160
11181
  const fromRealtimeInputConfig = getValueByPath(fromObject, [
11161
11182
  'realtimeInputConfig',
@@ -17878,6 +17899,13 @@ class Operations extends BaseModule {
17878
17899
  * Copyright 2025 Google LLC
17879
17900
  * SPDX-License-Identifier: Apache-2.0
17880
17901
  */
17902
+ function audioTranscriptionConfigToMldev(fromObject) {
17903
+ const toObject = {};
17904
+ if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
17905
+ throw new Error('languageCodes parameter is not supported in Gemini API.');
17906
+ }
17907
+ return toObject;
17908
+ }
17881
17909
  function authConfigToMldev(fromObject) {
17882
17910
  const toObject = {};
17883
17911
  const fromApiKey = getValueByPath(fromObject, ['apiKey']);
@@ -18129,13 +18157,13 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
18129
18157
  'inputAudioTranscription',
18130
18158
  ]);
18131
18159
  if (parentObject !== undefined && fromInputAudioTranscription != null) {
18132
- setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], fromInputAudioTranscription);
18160
+ setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev(fromInputAudioTranscription));
18133
18161
  }
18134
18162
  const fromOutputAudioTranscription = getValueByPath(fromObject, [
18135
18163
  'outputAudioTranscription',
18136
18164
  ]);
18137
18165
  if (parentObject !== undefined && fromOutputAudioTranscription != null) {
18138
- setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], fromOutputAudioTranscription);
18166
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev(fromOutputAudioTranscription));
18139
18167
  }
18140
18168
  const fromRealtimeInputConfig = getValueByPath(fromObject, [
18141
18169
  'realtimeInputConfig',