@google/genai 1.45.0 → 1.46.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.mjs CHANGED
@@ -556,6 +556,18 @@ function videoFromVertex$1(fromObject) {
556
556
  * Copyright 2025 Google LLC
557
557
  * SPDX-License-Identifier: Apache-2.0
558
558
  */
559
+ /** Programming language of the `code`. */
560
+ var Language;
561
+ (function (Language) {
562
+ /**
563
+ * Unspecified language. This value should not be used.
564
+ */
565
+ Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
566
+ /**
567
+ * Python >= 3.10, with numpy and simpy available.
568
+ */
569
+ Language["PYTHON"] = "PYTHON";
570
+ })(Language || (Language = {}));
559
571
  /** Outcome of the code execution. */
560
572
  var Outcome;
561
573
  (function (Outcome) {
@@ -576,18 +588,6 @@ var Outcome;
576
588
  */
577
589
  Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
578
590
  })(Outcome || (Outcome = {}));
579
- /** Programming language of the `code`. */
580
- var Language;
581
- (function (Language) {
582
- /**
583
- * Unspecified language. This value should not be used.
584
- */
585
- Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
586
- /**
587
- * Python >= 3.10, with numpy and simpy available.
588
- */
589
- Language["PYTHON"] = "PYTHON";
590
- })(Language || (Language = {}));
591
591
  /** Specifies how the response should be scheduled in the conversation. */
592
592
  var FunctionResponseScheduling;
593
593
  (function (FunctionResponseScheduling) {
@@ -1416,6 +1416,34 @@ var PartMediaResolutionLevel;
1416
1416
  */
1417
1417
  PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
1418
1418
  })(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
1419
+ /** The type of tool in the function call. */
1420
+ var ToolType;
1421
+ (function (ToolType) {
1422
+ /**
1423
+ * Unspecified tool type.
1424
+ */
1425
+ ToolType["TOOL_TYPE_UNSPECIFIED"] = "TOOL_TYPE_UNSPECIFIED";
1426
+ /**
1427
+ * Google search tool, maps to Tool.google_search.search_types.web_search.
1428
+ */
1429
+ ToolType["GOOGLE_SEARCH_WEB"] = "GOOGLE_SEARCH_WEB";
1430
+ /**
1431
+ * Image search tool, maps to Tool.google_search.search_types.image_search.
1432
+ */
1433
+ ToolType["GOOGLE_SEARCH_IMAGE"] = "GOOGLE_SEARCH_IMAGE";
1434
+ /**
1435
+ * URL context tool, maps to Tool.url_context.
1436
+ */
1437
+ ToolType["URL_CONTEXT"] = "URL_CONTEXT";
1438
+ /**
1439
+ * Google maps tool, maps to Tool.google_maps.
1440
+ */
1441
+ ToolType["GOOGLE_MAPS"] = "GOOGLE_MAPS";
1442
+ /**
1443
+ * File search tool, maps to Tool.file_search.
1444
+ */
1445
+ ToolType["FILE_SEARCH"] = "FILE_SEARCH";
1446
+ })(ToolType || (ToolType = {}));
1419
1447
  /** Resource scope. */
1420
1448
  var ResourceScope;
1421
1449
  (function (ResourceScope) {
@@ -1911,6 +1939,14 @@ var LiveMusicPlaybackControl;
1911
1939
  */
1912
1940
  LiveMusicPlaybackControl["RESET_CONTEXT"] = "RESET_CONTEXT";
1913
1941
  })(LiveMusicPlaybackControl || (LiveMusicPlaybackControl = {}));
1942
+ /** The output from a server-side `ToolCall` execution.
1943
+
1944
+ This message contains the results of a tool invocation that was initiated by a
1945
+ `ToolCall` from the model. The client should pass this `ToolResponse` back to
1946
+ the API in a subsequent turn within a `Content` message, along with the
1947
+ corresponding `ToolCall`. */
1948
+ class ToolResponse {
1949
+ }
1914
1950
  /** Raw media bytes for function response.
1915
1951
 
1916
1952
  Text should not be sent as raw bytes, use the FunctionResponse.response
@@ -4639,6 +4675,14 @@ function partToMldev$4(fromObject) {
4639
4675
  if (fromVideoMetadata != null) {
4640
4676
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4641
4677
  }
4678
+ const fromToolCall = getValueByPath(fromObject, ['toolCall']);
4679
+ if (fromToolCall != null) {
4680
+ setValueByPath(toObject, ['toolCall'], fromToolCall);
4681
+ }
4682
+ const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
4683
+ if (fromToolResponse != null) {
4684
+ setValueByPath(toObject, ['toolResponse'], fromToolResponse);
4685
+ }
4642
4686
  return toObject;
4643
4687
  }
4644
4688
  function safetySettingToMldev$1(fromObject) {
@@ -4670,6 +4714,10 @@ function toolConfigToMldev$2(fromObject) {
4670
4714
  if (fromFunctionCallingConfig != null) {
4671
4715
  setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
4672
4716
  }
4717
+ const fromIncludeServerSideToolInvocations = getValueByPath(fromObject, ['includeServerSideToolInvocations']);
4718
+ if (fromIncludeServerSideToolInvocations != null) {
4719
+ setValueByPath(toObject, ['includeServerSideToolInvocations'], fromIncludeServerSideToolInvocations);
4720
+ }
4673
4721
  return toObject;
4674
4722
  }
4675
4723
  function toolToMldev$4(fromObject) {
@@ -5492,6 +5540,24 @@ function contentToMldev$3(fromObject) {
5492
5540
  }
5493
5541
  return toObject;
5494
5542
  }
5543
+ function contentToVertex$2(fromObject) {
5544
+ const toObject = {};
5545
+ const fromParts = getValueByPath(fromObject, ['parts']);
5546
+ if (fromParts != null) {
5547
+ let transformedList = fromParts;
5548
+ if (Array.isArray(transformedList)) {
5549
+ transformedList = transformedList.map((item) => {
5550
+ return partToVertex$2(item);
5551
+ });
5552
+ }
5553
+ setValueByPath(toObject, ['parts'], transformedList);
5554
+ }
5555
+ const fromRole = getValueByPath(fromObject, ['role']);
5556
+ if (fromRole != null) {
5557
+ setValueByPath(toObject, ['role'], fromRole);
5558
+ }
5559
+ return toObject;
5560
+ }
5495
5561
  function createCachedContentConfigToMldev(fromObject, parentObject) {
5496
5562
  const toObject = {};
5497
5563
  const fromTtl = getValueByPath(fromObject, ['ttl']);
@@ -5560,7 +5626,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
5560
5626
  let transformedList = tContents(fromContents);
5561
5627
  if (Array.isArray(transformedList)) {
5562
5628
  transformedList = transformedList.map((item) => {
5563
- return item;
5629
+ return contentToVertex$2(item);
5564
5630
  });
5565
5631
  }
5566
5632
  setValueByPath(parentObject, ['contents'], transformedList);
@@ -5569,7 +5635,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
5569
5635
  'systemInstruction',
5570
5636
  ]);
5571
5637
  if (parentObject !== undefined && fromSystemInstruction != null) {
5572
- setValueByPath(parentObject, ['systemInstruction'], tContent(fromSystemInstruction));
5638
+ setValueByPath(parentObject, ['systemInstruction'], contentToVertex$2(tContent(fromSystemInstruction)));
5573
5639
  }
5574
5640
  const fromTools = getValueByPath(fromObject, ['tools']);
5575
5641
  if (parentObject !== undefined && fromTools != null) {
@@ -5583,7 +5649,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
5583
5649
  }
5584
5650
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5585
5651
  if (parentObject !== undefined && fromToolConfig != null) {
5586
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
5652
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex$1(fromToolConfig));
5587
5653
  }
5588
5654
  const fromKmsKeyName = getValueByPath(fromObject, ['kmsKeyName']);
5589
5655
  if (parentObject !== undefined && fromKmsKeyName != null) {
@@ -5943,6 +6009,80 @@ function partToMldev$3(fromObject) {
5943
6009
  if (fromVideoMetadata != null) {
5944
6010
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
5945
6011
  }
6012
+ const fromToolCall = getValueByPath(fromObject, ['toolCall']);
6013
+ if (fromToolCall != null) {
6014
+ setValueByPath(toObject, ['toolCall'], fromToolCall);
6015
+ }
6016
+ const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
6017
+ if (fromToolResponse != null) {
6018
+ setValueByPath(toObject, ['toolResponse'], fromToolResponse);
6019
+ }
6020
+ return toObject;
6021
+ }
6022
+ function partToVertex$2(fromObject) {
6023
+ const toObject = {};
6024
+ const fromMediaResolution = getValueByPath(fromObject, [
6025
+ 'mediaResolution',
6026
+ ]);
6027
+ if (fromMediaResolution != null) {
6028
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
6029
+ }
6030
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
6031
+ 'codeExecutionResult',
6032
+ ]);
6033
+ if (fromCodeExecutionResult != null) {
6034
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
6035
+ }
6036
+ const fromExecutableCode = getValueByPath(fromObject, [
6037
+ 'executableCode',
6038
+ ]);
6039
+ if (fromExecutableCode != null) {
6040
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
6041
+ }
6042
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
6043
+ if (fromFileData != null) {
6044
+ setValueByPath(toObject, ['fileData'], fromFileData);
6045
+ }
6046
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
6047
+ if (fromFunctionCall != null) {
6048
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
6049
+ }
6050
+ const fromFunctionResponse = getValueByPath(fromObject, [
6051
+ 'functionResponse',
6052
+ ]);
6053
+ if (fromFunctionResponse != null) {
6054
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
6055
+ }
6056
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
6057
+ if (fromInlineData != null) {
6058
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
6059
+ }
6060
+ const fromText = getValueByPath(fromObject, ['text']);
6061
+ if (fromText != null) {
6062
+ setValueByPath(toObject, ['text'], fromText);
6063
+ }
6064
+ const fromThought = getValueByPath(fromObject, ['thought']);
6065
+ if (fromThought != null) {
6066
+ setValueByPath(toObject, ['thought'], fromThought);
6067
+ }
6068
+ const fromThoughtSignature = getValueByPath(fromObject, [
6069
+ 'thoughtSignature',
6070
+ ]);
6071
+ if (fromThoughtSignature != null) {
6072
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
6073
+ }
6074
+ const fromVideoMetadata = getValueByPath(fromObject, [
6075
+ 'videoMetadata',
6076
+ ]);
6077
+ if (fromVideoMetadata != null) {
6078
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
6079
+ }
6080
+ if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
6081
+ throw new Error('toolCall parameter is not supported in Vertex AI.');
6082
+ }
6083
+ if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
6084
+ throw new Error('toolResponse parameter is not supported in Vertex AI.');
6085
+ }
5946
6086
  return toObject;
5947
6087
  }
5948
6088
  function toolConfigToMldev$1(fromObject) {
@@ -5959,6 +6099,30 @@ function toolConfigToMldev$1(fromObject) {
5959
6099
  if (fromFunctionCallingConfig != null) {
5960
6100
  setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
5961
6101
  }
6102
+ const fromIncludeServerSideToolInvocations = getValueByPath(fromObject, ['includeServerSideToolInvocations']);
6103
+ if (fromIncludeServerSideToolInvocations != null) {
6104
+ setValueByPath(toObject, ['includeServerSideToolInvocations'], fromIncludeServerSideToolInvocations);
6105
+ }
6106
+ return toObject;
6107
+ }
6108
+ function toolConfigToVertex$1(fromObject) {
6109
+ const toObject = {};
6110
+ const fromRetrievalConfig = getValueByPath(fromObject, [
6111
+ 'retrievalConfig',
6112
+ ]);
6113
+ if (fromRetrievalConfig != null) {
6114
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
6115
+ }
6116
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
6117
+ 'functionCallingConfig',
6118
+ ]);
6119
+ if (fromFunctionCallingConfig != null) {
6120
+ setValueByPath(toObject, ['functionCallingConfig'], fromFunctionCallingConfig);
6121
+ }
6122
+ if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
6123
+ undefined) {
6124
+ throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
6125
+ }
5962
6126
  return toObject;
5963
6127
  }
5964
6128
  function toolToMldev$3(fromObject) {
@@ -7175,7 +7339,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
7175
7339
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
7176
7340
  const USER_AGENT_HEADER = 'User-Agent';
7177
7341
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
7178
- const SDK_VERSION = '1.45.0'; // x-release-please-version
7342
+ const SDK_VERSION = '1.46.0'; // x-release-please-version
7179
7343
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
7180
7344
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
7181
7345
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -7873,20 +8037,20 @@ const INITIAL_RETRY_DELAY_MS = 1000;
7873
8037
  const DELAY_MULTIPLIER = 2;
7874
8038
  const X_GOOG_UPLOAD_STATUS_HEADER_FIELD = 'x-goog-upload-status';
7875
8039
  class CrossUploader {
7876
- async upload(file, uploadUrl, apiClient) {
8040
+ async upload(file, uploadUrl, apiClient, httpOptions) {
7877
8041
  if (typeof file === 'string') {
7878
8042
  throw crossError();
7879
8043
  }
7880
8044
  else {
7881
- return uploadBlob(file, uploadUrl, apiClient);
8045
+ return uploadBlob(file, uploadUrl, apiClient, httpOptions);
7882
8046
  }
7883
8047
  }
7884
- async uploadToFileSearchStore(file, uploadUrl, apiClient) {
8048
+ async uploadToFileSearchStore(file, uploadUrl, apiClient, httpOptions) {
7885
8049
  if (typeof file === 'string') {
7886
8050
  throw crossError();
7887
8051
  }
7888
8052
  else {
7889
- return uploadBlobToFileSearchStore(file, uploadUrl, apiClient);
8053
+ return uploadBlobToFileSearchStore(file, uploadUrl, apiClient, httpOptions);
7890
8054
  }
7891
8055
  }
7892
8056
  async stat(file) {
@@ -7898,18 +8062,18 @@ class CrossUploader {
7898
8062
  }
7899
8063
  }
7900
8064
  }
7901
- async function uploadBlob(file, uploadUrl, apiClient) {
8065
+ async function uploadBlob(file, uploadUrl, apiClient, httpOptions) {
7902
8066
  var _a;
7903
- const response = await uploadBlobInternal(file, uploadUrl, apiClient);
8067
+ const response = await uploadBlobInternal(file, uploadUrl, apiClient, httpOptions);
7904
8068
  const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
7905
8069
  if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
7906
8070
  throw new Error('Failed to upload file: Upload status is not finalized.');
7907
8071
  }
7908
8072
  return responseJson['file'];
7909
8073
  }
7910
- async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient) {
8074
+ async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient, httpOptions) {
7911
8075
  var _a;
7912
- const response = await uploadBlobInternal(file, uploadUrl, apiClient);
8076
+ const response = await uploadBlobInternal(file, uploadUrl, apiClient, httpOptions);
7913
8077
  const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
7914
8078
  if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
7915
8079
  throw new Error('Failed to upload file: Upload status is not finalized.');
@@ -7919,8 +8083,18 @@ async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient) {
7919
8083
  Object.assign(typedResp, resp);
7920
8084
  return typedResp;
7921
8085
  }
7922
- async function uploadBlobInternal(file, uploadUrl, apiClient) {
7923
- var _a, _b;
8086
+ async function uploadBlobInternal(file, uploadUrl, apiClient, httpOptions) {
8087
+ var _a, _b, _c;
8088
+ let finalUrl = uploadUrl;
8089
+ const effectiveBaseUrl = (httpOptions === null || httpOptions === void 0 ? void 0 : httpOptions.baseUrl) || ((_a = apiClient.clientOptions.httpOptions) === null || _a === void 0 ? void 0 : _a.baseUrl);
8090
+ if (effectiveBaseUrl) {
8091
+ const baseUri = new URL(effectiveBaseUrl);
8092
+ const uploadUri = new URL(uploadUrl);
8093
+ uploadUri.protocol = baseUri.protocol;
8094
+ uploadUri.host = baseUri.host;
8095
+ uploadUri.port = baseUri.port;
8096
+ finalUrl = uploadUri.toString();
8097
+ }
7924
8098
  let fileSize = 0;
7925
8099
  let offset = 0;
7926
8100
  let response = new HttpResponse(new Response());
@@ -7935,21 +8109,14 @@ async function uploadBlobInternal(file, uploadUrl, apiClient) {
7935
8109
  let retryCount = 0;
7936
8110
  let currentDelayMs = INITIAL_RETRY_DELAY_MS;
7937
8111
  while (retryCount < MAX_RETRY_COUNT) {
8112
+ const mergedHeaders = Object.assign(Object.assign({}, ((httpOptions === null || httpOptions === void 0 ? void 0 : httpOptions.headers) || {})), { 'X-Goog-Upload-Command': uploadCommand, 'X-Goog-Upload-Offset': String(offset), 'Content-Length': String(chunkSize) });
7938
8113
  response = await apiClient.request({
7939
8114
  path: '',
7940
8115
  body: chunk,
7941
8116
  httpMethod: 'POST',
7942
- httpOptions: {
7943
- apiVersion: '',
7944
- baseUrl: uploadUrl,
7945
- headers: {
7946
- 'X-Goog-Upload-Command': uploadCommand,
7947
- 'X-Goog-Upload-Offset': String(offset),
7948
- 'Content-Length': String(chunkSize),
7949
- },
7950
- },
8117
+ httpOptions: Object.assign(Object.assign({}, httpOptions), { apiVersion: '', baseUrl: finalUrl, headers: mergedHeaders }),
7951
8118
  });
7952
- if ((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) {
8119
+ if ((_b = response === null || response === void 0 ? void 0 : response.headers) === null || _b === void 0 ? void 0 : _b[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) {
7953
8120
  break;
7954
8121
  }
7955
8122
  retryCount++;
@@ -7959,7 +8126,7 @@ async function uploadBlobInternal(file, uploadUrl, apiClient) {
7959
8126
  offset += chunkSize;
7960
8127
  // The `x-goog-upload-status` header field can be `active`, `final` and
7961
8128
  //`cancelled` in resposne.
7962
- if (((_b = response === null || response === void 0 ? void 0 : response.headers) === null || _b === void 0 ? void 0 : _b[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'active') {
8129
+ if (((_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'active') {
7963
8130
  break;
7964
8131
  }
7965
8132
  // TODO(b/401391430) Investigate why the upload status is not finalized
@@ -10854,6 +11021,24 @@ function contentToMldev$2(fromObject) {
10854
11021
  }
10855
11022
  return toObject;
10856
11023
  }
11024
+ function contentToVertex$1(fromObject) {
11025
+ const toObject = {};
11026
+ const fromParts = getValueByPath(fromObject, ['parts']);
11027
+ if (fromParts != null) {
11028
+ let transformedList = fromParts;
11029
+ if (Array.isArray(transformedList)) {
11030
+ transformedList = transformedList.map((item) => {
11031
+ return partToVertex$1(item);
11032
+ });
11033
+ }
11034
+ setValueByPath(toObject, ['parts'], transformedList);
11035
+ }
11036
+ const fromRole = getValueByPath(fromObject, ['role']);
11037
+ if (fromRole != null) {
11038
+ setValueByPath(toObject, ['role'], fromRole);
11039
+ }
11040
+ return toObject;
11041
+ }
10857
11042
  function fileDataToMldev$2(fromObject) {
10858
11043
  const toObject = {};
10859
11044
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
@@ -11261,7 +11446,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
11261
11446
  'systemInstruction',
11262
11447
  ]);
11263
11448
  if (parentObject !== undefined && fromSystemInstruction != null) {
11264
- setValueByPath(parentObject, ['setup', 'systemInstruction'], tContent(fromSystemInstruction));
11449
+ setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
11265
11450
  }
11266
11451
  const fromTools = getValueByPath(fromObject, ['tools']);
11267
11452
  if (parentObject !== undefined && fromTools != null) {
@@ -11561,6 +11746,80 @@ function partToMldev$2(fromObject) {
11561
11746
  if (fromVideoMetadata != null) {
11562
11747
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
11563
11748
  }
11749
+ const fromToolCall = getValueByPath(fromObject, ['toolCall']);
11750
+ if (fromToolCall != null) {
11751
+ setValueByPath(toObject, ['toolCall'], fromToolCall);
11752
+ }
11753
+ const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
11754
+ if (fromToolResponse != null) {
11755
+ setValueByPath(toObject, ['toolResponse'], fromToolResponse);
11756
+ }
11757
+ return toObject;
11758
+ }
11759
+ function partToVertex$1(fromObject) {
11760
+ const toObject = {};
11761
+ const fromMediaResolution = getValueByPath(fromObject, [
11762
+ 'mediaResolution',
11763
+ ]);
11764
+ if (fromMediaResolution != null) {
11765
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
11766
+ }
11767
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
11768
+ 'codeExecutionResult',
11769
+ ]);
11770
+ if (fromCodeExecutionResult != null) {
11771
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
11772
+ }
11773
+ const fromExecutableCode = getValueByPath(fromObject, [
11774
+ 'executableCode',
11775
+ ]);
11776
+ if (fromExecutableCode != null) {
11777
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
11778
+ }
11779
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
11780
+ if (fromFileData != null) {
11781
+ setValueByPath(toObject, ['fileData'], fromFileData);
11782
+ }
11783
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
11784
+ if (fromFunctionCall != null) {
11785
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
11786
+ }
11787
+ const fromFunctionResponse = getValueByPath(fromObject, [
11788
+ 'functionResponse',
11789
+ ]);
11790
+ if (fromFunctionResponse != null) {
11791
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
11792
+ }
11793
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
11794
+ if (fromInlineData != null) {
11795
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
11796
+ }
11797
+ const fromText = getValueByPath(fromObject, ['text']);
11798
+ if (fromText != null) {
11799
+ setValueByPath(toObject, ['text'], fromText);
11800
+ }
11801
+ const fromThought = getValueByPath(fromObject, ['thought']);
11802
+ if (fromThought != null) {
11803
+ setValueByPath(toObject, ['thought'], fromThought);
11804
+ }
11805
+ const fromThoughtSignature = getValueByPath(fromObject, [
11806
+ 'thoughtSignature',
11807
+ ]);
11808
+ if (fromThoughtSignature != null) {
11809
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
11810
+ }
11811
+ const fromVideoMetadata = getValueByPath(fromObject, [
11812
+ 'videoMetadata',
11813
+ ]);
11814
+ if (fromVideoMetadata != null) {
11815
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
11816
+ }
11817
+ if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
11818
+ throw new Error('toolCall parameter is not supported in Vertex AI.');
11819
+ }
11820
+ if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
11821
+ throw new Error('toolResponse parameter is not supported in Vertex AI.');
11822
+ }
11564
11823
  return toObject;
11565
11824
  }
11566
11825
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -11929,7 +12188,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
11929
12188
  }
11930
12189
  return toObject;
11931
12190
  }
11932
- function computeTokensParametersToVertex(apiClient, fromObject, _rootObject) {
12191
+ function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
11933
12192
  const toObject = {};
11934
12193
  const fromModel = getValueByPath(fromObject, ['model']);
11935
12194
  if (fromModel != null) {
@@ -11940,7 +12199,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, _rootObject) {
11940
12199
  let transformedList = tContents(fromContents);
11941
12200
  if (Array.isArray(transformedList)) {
11942
12201
  transformedList = transformedList.map((item) => {
11943
- return item;
12202
+ return contentToVertex(item);
11944
12203
  });
11945
12204
  }
11946
12205
  setValueByPath(toObject, ['contents'], transformedList);
@@ -12009,6 +12268,24 @@ function contentToMldev$1(fromObject, rootObject) {
12009
12268
  }
12010
12269
  return toObject;
12011
12270
  }
12271
+ function contentToVertex(fromObject, rootObject) {
12272
+ const toObject = {};
12273
+ const fromParts = getValueByPath(fromObject, ['parts']);
12274
+ if (fromParts != null) {
12275
+ let transformedList = fromParts;
12276
+ if (Array.isArray(transformedList)) {
12277
+ transformedList = transformedList.map((item) => {
12278
+ return partToVertex(item);
12279
+ });
12280
+ }
12281
+ setValueByPath(toObject, ['parts'], transformedList);
12282
+ }
12283
+ const fromRole = getValueByPath(fromObject, ['role']);
12284
+ if (fromRole != null) {
12285
+ setValueByPath(toObject, ['role'], fromRole);
12286
+ }
12287
+ return toObject;
12288
+ }
12012
12289
  function controlReferenceConfigToVertex(fromObject, _rootObject) {
12013
12290
  const toObject = {};
12014
12291
  const fromControlType = getValueByPath(fromObject, ['controlType']);
@@ -12042,7 +12319,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
12042
12319
  'systemInstruction',
12043
12320
  ]);
12044
12321
  if (parentObject !== undefined && fromSystemInstruction != null) {
12045
- setValueByPath(parentObject, ['systemInstruction'], tContent(fromSystemInstruction));
12322
+ setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
12046
12323
  }
12047
12324
  const fromTools = getValueByPath(fromObject, ['tools']);
12048
12325
  if (parentObject !== undefined && fromTools != null) {
@@ -12095,7 +12372,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
12095
12372
  let transformedList = tContents(fromContents);
12096
12373
  if (Array.isArray(transformedList)) {
12097
12374
  transformedList = transformedList.map((item) => {
12098
- return item;
12375
+ return contentToVertex(item);
12099
12376
  });
12100
12377
  }
12101
12378
  setValueByPath(toObject, ['contents'], transformedList);
@@ -12499,7 +12776,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
12499
12776
  if (discriminatorContent === 'EMBED_CONTENT') {
12500
12777
  const fromContent = getValueByPath(fromObject, ['content']);
12501
12778
  if (fromContent != null) {
12502
- setValueByPath(toObject, ['content'], tContent(fromContent));
12779
+ setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
12503
12780
  }
12504
12781
  }
12505
12782
  const fromConfig = getValueByPath(fromObject, ['config']);
@@ -12850,7 +13127,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
12850
13127
  'systemInstruction',
12851
13128
  ]);
12852
13129
  if (parentObject !== undefined && fromSystemInstruction != null) {
12853
- setValueByPath(parentObject, ['systemInstruction'], tContent(fromSystemInstruction));
13130
+ setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
12854
13131
  }
12855
13132
  const fromTemperature = getValueByPath(fromObject, ['temperature']);
12856
13133
  if (fromTemperature != null) {
@@ -12962,7 +13239,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
12962
13239
  }
12963
13240
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
12964
13241
  if (parentObject !== undefined && fromToolConfig != null) {
12965
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
13242
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex(fromToolConfig));
12966
13243
  }
12967
13244
  const fromLabels = getValueByPath(fromObject, ['labels']);
12968
13245
  if (parentObject !== undefined && fromLabels != null) {
@@ -13051,7 +13328,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
13051
13328
  let transformedList = tContents(fromContents);
13052
13329
  if (Array.isArray(transformedList)) {
13053
13330
  transformedList = transformedList.map((item) => {
13054
- return item;
13331
+ return contentToVertex(item);
13055
13332
  });
13056
13333
  }
13057
13334
  setValueByPath(toObject, ['contents'], transformedList);
@@ -14455,6 +14732,80 @@ function partToMldev$1(fromObject, rootObject) {
14455
14732
  if (fromVideoMetadata != null) {
14456
14733
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
14457
14734
  }
14735
+ const fromToolCall = getValueByPath(fromObject, ['toolCall']);
14736
+ if (fromToolCall != null) {
14737
+ setValueByPath(toObject, ['toolCall'], fromToolCall);
14738
+ }
14739
+ const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
14740
+ if (fromToolResponse != null) {
14741
+ setValueByPath(toObject, ['toolResponse'], fromToolResponse);
14742
+ }
14743
+ return toObject;
14744
+ }
14745
+ function partToVertex(fromObject, _rootObject) {
14746
+ const toObject = {};
14747
+ const fromMediaResolution = getValueByPath(fromObject, [
14748
+ 'mediaResolution',
14749
+ ]);
14750
+ if (fromMediaResolution != null) {
14751
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
14752
+ }
14753
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
14754
+ 'codeExecutionResult',
14755
+ ]);
14756
+ if (fromCodeExecutionResult != null) {
14757
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
14758
+ }
14759
+ const fromExecutableCode = getValueByPath(fromObject, [
14760
+ 'executableCode',
14761
+ ]);
14762
+ if (fromExecutableCode != null) {
14763
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
14764
+ }
14765
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
14766
+ if (fromFileData != null) {
14767
+ setValueByPath(toObject, ['fileData'], fromFileData);
14768
+ }
14769
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14770
+ if (fromFunctionCall != null) {
14771
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
14772
+ }
14773
+ const fromFunctionResponse = getValueByPath(fromObject, [
14774
+ 'functionResponse',
14775
+ ]);
14776
+ if (fromFunctionResponse != null) {
14777
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
14778
+ }
14779
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
14780
+ if (fromInlineData != null) {
14781
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
14782
+ }
14783
+ const fromText = getValueByPath(fromObject, ['text']);
14784
+ if (fromText != null) {
14785
+ setValueByPath(toObject, ['text'], fromText);
14786
+ }
14787
+ const fromThought = getValueByPath(fromObject, ['thought']);
14788
+ if (fromThought != null) {
14789
+ setValueByPath(toObject, ['thought'], fromThought);
14790
+ }
14791
+ const fromThoughtSignature = getValueByPath(fromObject, [
14792
+ 'thoughtSignature',
14793
+ ]);
14794
+ if (fromThoughtSignature != null) {
14795
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
14796
+ }
14797
+ const fromVideoMetadata = getValueByPath(fromObject, [
14798
+ 'videoMetadata',
14799
+ ]);
14800
+ if (fromVideoMetadata != null) {
14801
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
14802
+ }
14803
+ if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
14804
+ throw new Error('toolCall parameter is not supported in Vertex AI.');
14805
+ }
14806
+ if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
14807
+ throw new Error('toolResponse parameter is not supported in Vertex AI.');
14808
+ }
14458
14809
  return toObject;
14459
14810
  }
14460
14811
  function productImageToVertex(fromObject, rootObject) {
@@ -14788,6 +15139,30 @@ function toolConfigToMldev(fromObject, rootObject) {
14788
15139
  if (fromFunctionCallingConfig != null) {
14789
15140
  setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
14790
15141
  }
15142
+ const fromIncludeServerSideToolInvocations = getValueByPath(fromObject, ['includeServerSideToolInvocations']);
15143
+ if (fromIncludeServerSideToolInvocations != null) {
15144
+ setValueByPath(toObject, ['includeServerSideToolInvocations'], fromIncludeServerSideToolInvocations);
15145
+ }
15146
+ return toObject;
15147
+ }
15148
+ function toolConfigToVertex(fromObject, _rootObject) {
15149
+ const toObject = {};
15150
+ const fromRetrievalConfig = getValueByPath(fromObject, [
15151
+ 'retrievalConfig',
15152
+ ]);
15153
+ if (fromRetrievalConfig != null) {
15154
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
15155
+ }
15156
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
15157
+ 'functionCallingConfig',
15158
+ ]);
15159
+ if (fromFunctionCallingConfig != null) {
15160
+ setValueByPath(toObject, ['functionCallingConfig'], fromFunctionCallingConfig);
15161
+ }
15162
+ if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
15163
+ undefined) {
15164
+ throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
15165
+ }
14791
15166
  return toObject;
14792
15167
  }
14793
15168
  function toolToMldev$1(fromObject, rootObject) {
@@ -15926,7 +16301,7 @@ class Session {
15926
16301
  }
15927
16302
  }
15928
16303
  const clientMessage = {
15929
- toolResponse: { functionResponses: functionResponses },
16304
+ toolResponse: { 'functionResponses': functionResponses },
15930
16305
  };
15931
16306
  return clientMessage;
15932
16307
  }
@@ -18256,6 +18631,14 @@ function partToMldev(fromObject) {
18256
18631
  if (fromVideoMetadata != null) {
18257
18632
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
18258
18633
  }
18634
+ const fromToolCall = getValueByPath(fromObject, ['toolCall']);
18635
+ if (fromToolCall != null) {
18636
+ setValueByPath(toObject, ['toolCall'], fromToolCall);
18637
+ }
18638
+ const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
18639
+ if (fromToolResponse != null) {
18640
+ setValueByPath(toObject, ['toolResponse'], fromToolResponse);
18641
+ }
18259
18642
  return toObject;
18260
18643
  }
18261
18644
  function sessionResumptionConfigToMldev(fromObject) {
@@ -19969,5 +20352,5 @@ class GoogleGenAI {
19969
20352
  }
19970
20353
  }
19971
20354
 
19972
- export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReplayResponse, ResourceScope, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
20355
+ export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReplayResponse, ResourceScope, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, ToolResponse, ToolType, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
19973
20356
  //# sourceMappingURL=index.mjs.map