@google/genai 1.33.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -758,21 +758,29 @@ exports.PhishBlockThreshold = void 0;
758
758
  */
759
759
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
760
760
  })(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
761
- /** The level of thoughts tokens that the model should generate. */
761
+ /** The number of thoughts tokens that the model should generate. */
762
762
  exports.ThinkingLevel = void 0;
763
763
  (function (ThinkingLevel) {
764
764
  /**
765
- * Default value.
765
+ * Unspecified thinking level.
766
766
  */
767
767
  ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
768
768
  /**
769
769
  * Low thinking level.
770
770
  */
771
771
  ThinkingLevel["LOW"] = "LOW";
772
+ /**
773
+ * Medium thinking level.
774
+ */
775
+ ThinkingLevel["MEDIUM"] = "MEDIUM";
772
776
  /**
773
777
  * High thinking level.
774
778
  */
775
779
  ThinkingLevel["HIGH"] = "HIGH";
780
+ /**
781
+ * MINIMAL thinking level.
782
+ */
783
+ ThinkingLevel["MINIMAL"] = "MINIMAL";
776
784
  })(exports.ThinkingLevel || (exports.ThinkingLevel = {}));
777
785
  /** Harm category. */
778
786
  exports.HarmCategory = void 0;
@@ -1243,6 +1251,10 @@ exports.PartMediaResolutionLevel = void 0;
1243
1251
  * Media resolution set to high.
1244
1252
  */
1245
1253
  PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1254
+ /**
1255
+ * Media resolution set to ultra high.
1256
+ */
1257
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
1246
1258
  })(exports.PartMediaResolutionLevel || (exports.PartMediaResolutionLevel = {}));
1247
1259
  /** Options for feature selection preference. */
1248
1260
  exports.FeatureSelectionPreference = void 0;
@@ -6885,7 +6897,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6885
6897
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6886
6898
  const USER_AGENT_HEADER = 'User-Agent';
6887
6899
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6888
- const SDK_VERSION = '1.33.0'; // x-release-please-version
6900
+ const SDK_VERSION = '1.34.0'; // x-release-please-version
6889
6901
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6890
6902
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6891
6903
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -6959,6 +6971,11 @@ class ApiClient {
6959
6971
  getLocation() {
6960
6972
  return this.clientOptions.location;
6961
6973
  }
6974
+ async getAuthHeaders() {
6975
+ const headers = new Headers();
6976
+ await this.clientOptions.auth.addAuthHeaders(headers);
6977
+ return headers;
6978
+ }
6962
6979
  getApiVersion() {
6963
6980
  if (this.clientOptions.httpOptions &&
6964
6981
  this.clientOptions.httpOptions.apiVersion !== undefined) {
@@ -10085,7 +10102,7 @@ class BaseGeminiNextGenAPIClient {
10085
10102
  */
10086
10103
  constructor(_b) {
10087
10104
  var _c, _d, _e, _f, _g, _h, _j;
10088
- var _k = _b === void 0 ? {} : _b, { baseURL = readEnv('GEMINI_NEXT_GEN_API_BASE_URL'), apiKey = (_c = readEnv('GEMINI_API_KEY')) !== null && _c !== void 0 ? _c : null, apiVersion = 'v1beta' } = _k, opts = __rest(_k, ["baseURL", "apiKey", "apiVersion"]);
10105
+ var { baseURL = readEnv('GEMINI_NEXT_GEN_API_BASE_URL'), apiKey = (_c = readEnv('GEMINI_API_KEY')) !== null && _c !== void 0 ? _c : null, apiVersion = 'v1beta' } = _b, opts = __rest(_b, ["baseURL", "apiKey", "apiVersion"]);
10089
10106
  const options = Object.assign(Object.assign({ apiKey,
10090
10107
  apiVersion }, opts), { baseURL: baseURL || `https://generativelanguage.googleapis.com` });
10091
10108
  this.baseURL = options.baseURL;
@@ -10103,6 +10120,7 @@ class BaseGeminiNextGenAPIClient {
10103
10120
  this._options = options;
10104
10121
  this.apiKey = apiKey;
10105
10122
  this.apiVersion = apiVersion;
10123
+ this.clientAdapter = options.clientAdapter;
10106
10124
  }
10107
10125
  /**
10108
10126
  * Create a new client instance re-using the same options given to the current client with optional overriding.
@@ -10121,6 +10139,10 @@ class BaseGeminiNextGenAPIClient {
10121
10139
  return this._options.defaultQuery;
10122
10140
  }
10123
10141
  validateHeaders({ values, nulls }) {
10142
+ // The headers object handles case insensitivity.
10143
+ if (values.has('authorization') || values.has('x-goog-api-key')) {
10144
+ return;
10145
+ }
10124
10146
  if (this.apiKey && values.get('x-goog-api-key')) {
10125
10147
  return;
10126
10148
  }
@@ -10130,10 +10152,17 @@ class BaseGeminiNextGenAPIClient {
10130
10152
  throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted');
10131
10153
  }
10132
10154
  async authHeaders(opts) {
10133
- if (this.apiKey == null) {
10155
+ const existingHeaders = buildHeaders([opts.headers]);
10156
+ if (existingHeaders.values.has('authorization') || existingHeaders.values.has('x-goog-api-key')) {
10134
10157
  return undefined;
10135
10158
  }
10136
- return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
10159
+ if (this.apiKey) {
10160
+ return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
10161
+ }
10162
+ if (this.clientAdapter.isVertexAI()) {
10163
+ return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
10164
+ }
10165
+ return undefined;
10137
10166
  }
10138
10167
  /**
10139
10168
  * Basic re-implementation of `qs.stringify` for primitive types.
@@ -10177,8 +10206,16 @@ class BaseGeminiNextGenAPIClient {
10177
10206
  }
10178
10207
  /**
10179
10208
  * Used as a callback for mutating the given `FinalRequestOptions` object.
10209
+
10180
10210
  */
10181
- async prepareOptions(options) { }
10211
+ async prepareOptions(options) {
10212
+ if (this.clientAdapter &&
10213
+ this.clientAdapter.isVertexAI() &&
10214
+ !options.path.startsWith(`/${this.apiVersion}/projects/`)) {
10215
+ const oldPath = options.path.slice(this.apiVersion.length + 1);
10216
+ options.path = `/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${oldPath}`;
10217
+ }
10218
+ }
10182
10219
  /**
10183
10220
  * Used as a callback for mutating the given `RequestInit` object.
10184
10221
  *
@@ -10420,13 +10457,14 @@ class BaseGeminiNextGenAPIClient {
10420
10457
  options.idempotencyKey = this.defaultIdempotencyKey();
10421
10458
  idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
10422
10459
  }
10423
- const headers = buildHeaders([
10460
+ const authHeaders = await this.authHeaders(options);
10461
+ let headers = buildHeaders([
10424
10462
  idempotencyHeaders,
10425
10463
  Object.assign(Object.assign({ Accept: 'application/json', 'User-Agent': this.getUserAgent(), 'X-Stainless-Retry-Count': String(retryCount) }, (options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {})), getPlatformHeaders()),
10426
- await this.authHeaders(options),
10427
10464
  this._options.defaultHeaders,
10428
10465
  bodyHeaders,
10429
10466
  options.headers,
10467
+ authHeaders,
10430
10468
  ]);
10431
10469
  this.validateHeaders(headers);
10432
10470
  return headers.values;
@@ -10698,7 +10736,7 @@ function generationConfigToVertex$1(fromObject) {
10698
10736
  }
10699
10737
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
10700
10738
  if (fromSpeechConfig != null) {
10701
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex$1(fromSpeechConfig));
10739
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
10702
10740
  }
10703
10741
  const fromStopSequences = getValueByPath(fromObject, [
10704
10742
  'stopSequences',
@@ -10914,7 +10952,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
10914
10952
  }
10915
10953
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
10916
10954
  if (parentObject !== undefined && fromSpeechConfig != null) {
10917
- setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToVertex$1(tLiveSpeechConfig(fromSpeechConfig)));
10955
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
10918
10956
  }
10919
10957
  const fromThinkingConfig = getValueByPath(fromObject, [
10920
10958
  'thinkingConfig',
@@ -11239,21 +11277,6 @@ function sessionResumptionConfigToMldev$1(fromObject) {
11239
11277
  }
11240
11278
  return toObject;
11241
11279
  }
11242
- function speechConfigToVertex$1(fromObject) {
11243
- const toObject = {};
11244
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
11245
- if (fromVoiceConfig != null) {
11246
- setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
11247
- }
11248
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
11249
- if (fromLanguageCode != null) {
11250
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
11251
- }
11252
- if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
11253
- throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
11254
- }
11255
- return toObject;
11256
- }
11257
11280
  function toolToMldev$2(fromObject) {
11258
11281
  const toObject = {};
11259
11282
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -12496,7 +12519,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
12496
12519
  }
12497
12520
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
12498
12521
  if (fromSpeechConfig != null) {
12499
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(tSpeechConfig(fromSpeechConfig)));
12522
+ setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
12500
12523
  }
12501
12524
  const fromAudioTimestamp = getValueByPath(fromObject, [
12502
12525
  'audioTimestamp',
@@ -13442,7 +13465,7 @@ function generationConfigToVertex(fromObject) {
13442
13465
  }
13443
13466
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
13444
13467
  if (fromSpeechConfig != null) {
13445
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(fromSpeechConfig));
13468
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
13446
13469
  }
13447
13470
  const fromStopSequences = getValueByPath(fromObject, [
13448
13471
  'stopSequences',
@@ -14244,21 +14267,6 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
14244
14267
  }
14245
14268
  return toObject;
14246
14269
  }
14247
- function speechConfigToVertex(fromObject) {
14248
- const toObject = {};
14249
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
14250
- if (fromVoiceConfig != null) {
14251
- setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
14252
- }
14253
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
14254
- if (fromLanguageCode != null) {
14255
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
14256
- }
14257
- if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
14258
- throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
14259
- }
14260
- return toObject;
14261
- }
14262
14270
  function toolConfigToMldev(fromObject) {
14263
14271
  const toObject = {};
14264
14272
  const fromFunctionCallingConfig = getValueByPath(fromObject, [
@@ -19110,6 +19118,8 @@ class GoogleGenAI {
19110
19118
  const nextGenClient = new GeminiNextGenAPIClient({
19111
19119
  baseURL: this.apiClient.getBaseUrl(),
19112
19120
  apiKey: this.apiKey,
19121
+ apiVersion: this.apiClient.getApiVersion(),
19122
+ clientAdapter: this.apiClient,
19113
19123
  defaultHeaders: this.apiClient.getDefaultHeaders(),
19114
19124
  timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
19115
19125
  });
package/dist/index.mjs CHANGED
@@ -756,21 +756,29 @@ var PhishBlockThreshold;
756
756
  */
757
757
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
758
758
  })(PhishBlockThreshold || (PhishBlockThreshold = {}));
759
- /** The level of thoughts tokens that the model should generate. */
759
+ /** The number of thoughts tokens that the model should generate. */
760
760
  var ThinkingLevel;
761
761
  (function (ThinkingLevel) {
762
762
  /**
763
- * Default value.
763
+ * Unspecified thinking level.
764
764
  */
765
765
  ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
766
766
  /**
767
767
  * Low thinking level.
768
768
  */
769
769
  ThinkingLevel["LOW"] = "LOW";
770
+ /**
771
+ * Medium thinking level.
772
+ */
773
+ ThinkingLevel["MEDIUM"] = "MEDIUM";
770
774
  /**
771
775
  * High thinking level.
772
776
  */
773
777
  ThinkingLevel["HIGH"] = "HIGH";
778
+ /**
779
+ * MINIMAL thinking level.
780
+ */
781
+ ThinkingLevel["MINIMAL"] = "MINIMAL";
774
782
  })(ThinkingLevel || (ThinkingLevel = {}));
775
783
  /** Harm category. */
776
784
  var HarmCategory;
@@ -1241,6 +1249,10 @@ var PartMediaResolutionLevel;
1241
1249
  * Media resolution set to high.
1242
1250
  */
1243
1251
  PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1252
+ /**
1253
+ * Media resolution set to ultra high.
1254
+ */
1255
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
1244
1256
  })(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
1245
1257
  /** Options for feature selection preference. */
1246
1258
  var FeatureSelectionPreference;
@@ -6883,7 +6895,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6883
6895
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6884
6896
  const USER_AGENT_HEADER = 'User-Agent';
6885
6897
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6886
- const SDK_VERSION = '1.33.0'; // x-release-please-version
6898
+ const SDK_VERSION = '1.34.0'; // x-release-please-version
6887
6899
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6888
6900
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6889
6901
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -6957,6 +6969,11 @@ class ApiClient {
6957
6969
  getLocation() {
6958
6970
  return this.clientOptions.location;
6959
6971
  }
6972
+ async getAuthHeaders() {
6973
+ const headers = new Headers();
6974
+ await this.clientOptions.auth.addAuthHeaders(headers);
6975
+ return headers;
6976
+ }
6960
6977
  getApiVersion() {
6961
6978
  if (this.clientOptions.httpOptions &&
6962
6979
  this.clientOptions.httpOptions.apiVersion !== undefined) {
@@ -10083,7 +10100,7 @@ class BaseGeminiNextGenAPIClient {
10083
10100
  */
10084
10101
  constructor(_b) {
10085
10102
  var _c, _d, _e, _f, _g, _h, _j;
10086
- var _k = _b === void 0 ? {} : _b, { baseURL = readEnv('GEMINI_NEXT_GEN_API_BASE_URL'), apiKey = (_c = readEnv('GEMINI_API_KEY')) !== null && _c !== void 0 ? _c : null, apiVersion = 'v1beta' } = _k, opts = __rest(_k, ["baseURL", "apiKey", "apiVersion"]);
10103
+ var { baseURL = readEnv('GEMINI_NEXT_GEN_API_BASE_URL'), apiKey = (_c = readEnv('GEMINI_API_KEY')) !== null && _c !== void 0 ? _c : null, apiVersion = 'v1beta' } = _b, opts = __rest(_b, ["baseURL", "apiKey", "apiVersion"]);
10087
10104
  const options = Object.assign(Object.assign({ apiKey,
10088
10105
  apiVersion }, opts), { baseURL: baseURL || `https://generativelanguage.googleapis.com` });
10089
10106
  this.baseURL = options.baseURL;
@@ -10101,6 +10118,7 @@ class BaseGeminiNextGenAPIClient {
10101
10118
  this._options = options;
10102
10119
  this.apiKey = apiKey;
10103
10120
  this.apiVersion = apiVersion;
10121
+ this.clientAdapter = options.clientAdapter;
10104
10122
  }
10105
10123
  /**
10106
10124
  * Create a new client instance re-using the same options given to the current client with optional overriding.
@@ -10119,6 +10137,10 @@ class BaseGeminiNextGenAPIClient {
10119
10137
  return this._options.defaultQuery;
10120
10138
  }
10121
10139
  validateHeaders({ values, nulls }) {
10140
+ // The headers object handles case insensitivity.
10141
+ if (values.has('authorization') || values.has('x-goog-api-key')) {
10142
+ return;
10143
+ }
10122
10144
  if (this.apiKey && values.get('x-goog-api-key')) {
10123
10145
  return;
10124
10146
  }
@@ -10128,10 +10150,17 @@ class BaseGeminiNextGenAPIClient {
10128
10150
  throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted');
10129
10151
  }
10130
10152
  async authHeaders(opts) {
10131
- if (this.apiKey == null) {
10153
+ const existingHeaders = buildHeaders([opts.headers]);
10154
+ if (existingHeaders.values.has('authorization') || existingHeaders.values.has('x-goog-api-key')) {
10132
10155
  return undefined;
10133
10156
  }
10134
- return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
10157
+ if (this.apiKey) {
10158
+ return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
10159
+ }
10160
+ if (this.clientAdapter.isVertexAI()) {
10161
+ return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
10162
+ }
10163
+ return undefined;
10135
10164
  }
10136
10165
  /**
10137
10166
  * Basic re-implementation of `qs.stringify` for primitive types.
@@ -10175,8 +10204,16 @@ class BaseGeminiNextGenAPIClient {
10175
10204
  }
10176
10205
  /**
10177
10206
  * Used as a callback for mutating the given `FinalRequestOptions` object.
10207
+
10178
10208
  */
10179
- async prepareOptions(options) { }
10209
+ async prepareOptions(options) {
10210
+ if (this.clientAdapter &&
10211
+ this.clientAdapter.isVertexAI() &&
10212
+ !options.path.startsWith(`/${this.apiVersion}/projects/`)) {
10213
+ const oldPath = options.path.slice(this.apiVersion.length + 1);
10214
+ options.path = `/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${oldPath}`;
10215
+ }
10216
+ }
10180
10217
  /**
10181
10218
  * Used as a callback for mutating the given `RequestInit` object.
10182
10219
  *
@@ -10418,13 +10455,14 @@ class BaseGeminiNextGenAPIClient {
10418
10455
  options.idempotencyKey = this.defaultIdempotencyKey();
10419
10456
  idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
10420
10457
  }
10421
- const headers = buildHeaders([
10458
+ const authHeaders = await this.authHeaders(options);
10459
+ let headers = buildHeaders([
10422
10460
  idempotencyHeaders,
10423
10461
  Object.assign(Object.assign({ Accept: 'application/json', 'User-Agent': this.getUserAgent(), 'X-Stainless-Retry-Count': String(retryCount) }, (options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {})), getPlatformHeaders()),
10424
- await this.authHeaders(options),
10425
10462
  this._options.defaultHeaders,
10426
10463
  bodyHeaders,
10427
10464
  options.headers,
10465
+ authHeaders,
10428
10466
  ]);
10429
10467
  this.validateHeaders(headers);
10430
10468
  return headers.values;
@@ -10696,7 +10734,7 @@ function generationConfigToVertex$1(fromObject) {
10696
10734
  }
10697
10735
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
10698
10736
  if (fromSpeechConfig != null) {
10699
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex$1(fromSpeechConfig));
10737
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
10700
10738
  }
10701
10739
  const fromStopSequences = getValueByPath(fromObject, [
10702
10740
  'stopSequences',
@@ -10912,7 +10950,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
10912
10950
  }
10913
10951
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
10914
10952
  if (parentObject !== undefined && fromSpeechConfig != null) {
10915
- setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToVertex$1(tLiveSpeechConfig(fromSpeechConfig)));
10953
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
10916
10954
  }
10917
10955
  const fromThinkingConfig = getValueByPath(fromObject, [
10918
10956
  'thinkingConfig',
@@ -11237,21 +11275,6 @@ function sessionResumptionConfigToMldev$1(fromObject) {
11237
11275
  }
11238
11276
  return toObject;
11239
11277
  }
11240
- function speechConfigToVertex$1(fromObject) {
11241
- const toObject = {};
11242
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
11243
- if (fromVoiceConfig != null) {
11244
- setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
11245
- }
11246
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
11247
- if (fromLanguageCode != null) {
11248
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
11249
- }
11250
- if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
11251
- throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
11252
- }
11253
- return toObject;
11254
- }
11255
11278
  function toolToMldev$2(fromObject) {
11256
11279
  const toObject = {};
11257
11280
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -12494,7 +12517,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
12494
12517
  }
12495
12518
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
12496
12519
  if (fromSpeechConfig != null) {
12497
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(tSpeechConfig(fromSpeechConfig)));
12520
+ setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
12498
12521
  }
12499
12522
  const fromAudioTimestamp = getValueByPath(fromObject, [
12500
12523
  'audioTimestamp',
@@ -13440,7 +13463,7 @@ function generationConfigToVertex(fromObject) {
13440
13463
  }
13441
13464
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
13442
13465
  if (fromSpeechConfig != null) {
13443
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(fromSpeechConfig));
13466
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
13444
13467
  }
13445
13468
  const fromStopSequences = getValueByPath(fromObject, [
13446
13469
  'stopSequences',
@@ -14242,21 +14265,6 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
14242
14265
  }
14243
14266
  return toObject;
14244
14267
  }
14245
- function speechConfigToVertex(fromObject) {
14246
- const toObject = {};
14247
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
14248
- if (fromVoiceConfig != null) {
14249
- setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
14250
- }
14251
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
14252
- if (fromLanguageCode != null) {
14253
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
14254
- }
14255
- if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
14256
- throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
14257
- }
14258
- return toObject;
14259
- }
14260
14268
  function toolConfigToMldev(fromObject) {
14261
14269
  const toObject = {};
14262
14270
  const fromFunctionCallingConfig = getValueByPath(fromObject, [
@@ -19108,6 +19116,8 @@ class GoogleGenAI {
19108
19116
  const nextGenClient = new GeminiNextGenAPIClient({
19109
19117
  baseURL: this.apiClient.getBaseUrl(),
19110
19118
  apiKey: this.apiKey,
19119
+ apiVersion: this.apiClient.getApiVersion(),
19120
+ clientAdapter: this.apiClient,
19111
19121
  defaultHeaders: this.apiClient.getDefaultHeaders(),
19112
19122
  timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
19113
19123
  });