@google/genai 1.44.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/genai.d.ts +401 -125
- package/dist/index.cjs +480 -68
- package/dist/index.mjs +480 -69
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +502 -88
- package/dist/node/index.mjs +502 -89
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +401 -125
- package/dist/tokenizer/node.cjs +40 -12
- package/dist/tokenizer/node.d.ts +74 -2
- package/dist/tokenizer/node.mjs +40 -12
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +3013 -0
- package/dist/vertex_internal/index.cjs.map +1 -0
- package/dist/vertex_internal/index.d.ts +8038 -0
- package/dist/vertex_internal/index.js +2984 -0
- package/dist/vertex_internal/index.js.map +1 -0
- package/dist/web/index.mjs +480 -69
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +401 -125
- package/package.json +10 -2
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.
|
|
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 ((
|
|
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 (((
|
|
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
|
|
@@ -9250,6 +9417,30 @@ const FallbackEncoder = ({ headers, body }) => {
|
|
|
9250
9417
|
};
|
|
9251
9418
|
};
|
|
9252
9419
|
|
|
9420
|
+
/**
|
|
9421
|
+
* @license
|
|
9422
|
+
* Copyright 2025 Google LLC
|
|
9423
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9424
|
+
*/
|
|
9425
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
9426
|
+
/**
|
|
9427
|
+
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
9428
|
+
*/
|
|
9429
|
+
function stringifyQuery(query) {
|
|
9430
|
+
return Object.entries(query)
|
|
9431
|
+
.filter(([_, value]) => typeof value !== 'undefined')
|
|
9432
|
+
.map(([key, value]) => {
|
|
9433
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
9434
|
+
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
9435
|
+
}
|
|
9436
|
+
if (value === null) {
|
|
9437
|
+
return `${encodeURIComponent(key)}=`;
|
|
9438
|
+
}
|
|
9439
|
+
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.`);
|
|
9440
|
+
})
|
|
9441
|
+
.join('&');
|
|
9442
|
+
}
|
|
9443
|
+
|
|
9253
9444
|
/**
|
|
9254
9445
|
* @license
|
|
9255
9446
|
* Copyright 2025 Google LLC
|
|
@@ -10393,18 +10584,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10393
10584
|
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
10394
10585
|
*/
|
|
10395
10586
|
stringifyQuery(query) {
|
|
10396
|
-
return
|
|
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('&');
|
|
10587
|
+
return stringifyQuery(query);
|
|
10408
10588
|
}
|
|
10409
10589
|
getUserAgent() {
|
|
10410
10590
|
return `${this.constructor.name}/JS ${VERSION}`;
|
|
@@ -10421,8 +10601,9 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10421
10601
|
new URL(path)
|
|
10422
10602
|
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
10423
10603
|
const defaultQuery = this.defaultQuery();
|
|
10424
|
-
|
|
10425
|
-
|
|
10604
|
+
const pathQuery = Object.fromEntries(url.searchParams);
|
|
10605
|
+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
10606
|
+
query = Object.assign(Object.assign(Object.assign({}, pathQuery), defaultQuery), query);
|
|
10426
10607
|
}
|
|
10427
10608
|
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
10428
10609
|
url.search = this.stringifyQuery(query);
|
|
@@ -10643,9 +10824,9 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10643
10824
|
timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
|
|
10644
10825
|
}
|
|
10645
10826
|
}
|
|
10646
|
-
// If the API asks us to wait a certain amount of time
|
|
10647
|
-
//
|
|
10648
|
-
if (
|
|
10827
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
10828
|
+
// says, but otherwise calculate a default
|
|
10829
|
+
if (timeoutMillis === undefined) {
|
|
10649
10830
|
const maxRetries = (_b = options.maxRetries) !== null && _b !== void 0 ? _b : this.maxRetries;
|
|
10650
10831
|
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
10651
10832
|
}
|
|
@@ -10773,6 +10954,13 @@ GeminiNextGenAPIClient.Interactions = Interactions;
|
|
|
10773
10954
|
* Copyright 2025 Google LLC
|
|
10774
10955
|
* SPDX-License-Identifier: Apache-2.0
|
|
10775
10956
|
*/
|
|
10957
|
+
function audioTranscriptionConfigToMldev$1(fromObject) {
|
|
10958
|
+
const toObject = {};
|
|
10959
|
+
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
10960
|
+
throw new Error('languageCodes parameter is not supported in Gemini API.');
|
|
10961
|
+
}
|
|
10962
|
+
return toObject;
|
|
10963
|
+
}
|
|
10776
10964
|
function authConfigToMldev$2(fromObject) {
|
|
10777
10965
|
const toObject = {};
|
|
10778
10966
|
const fromApiKey = getValueByPath(fromObject, ['apiKey']);
|
|
@@ -10833,6 +11021,24 @@ function contentToMldev$2(fromObject) {
|
|
|
10833
11021
|
}
|
|
10834
11022
|
return toObject;
|
|
10835
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
|
+
}
|
|
10836
11042
|
function fileDataToMldev$2(fromObject) {
|
|
10837
11043
|
const toObject = {};
|
|
10838
11044
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
@@ -11149,13 +11355,13 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
11149
11355
|
'inputAudioTranscription',
|
|
11150
11356
|
]);
|
|
11151
11357
|
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
11152
|
-
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], fromInputAudioTranscription);
|
|
11358
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1(fromInputAudioTranscription));
|
|
11153
11359
|
}
|
|
11154
11360
|
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
11155
11361
|
'outputAudioTranscription',
|
|
11156
11362
|
]);
|
|
11157
11363
|
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
11158
|
-
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], fromOutputAudioTranscription);
|
|
11364
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1(fromOutputAudioTranscription));
|
|
11159
11365
|
}
|
|
11160
11366
|
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
11161
11367
|
'realtimeInputConfig',
|
|
@@ -11240,7 +11446,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
11240
11446
|
'systemInstruction',
|
|
11241
11447
|
]);
|
|
11242
11448
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
11243
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], tContent(fromSystemInstruction));
|
|
11449
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
11244
11450
|
}
|
|
11245
11451
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
11246
11452
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -11540,6 +11746,80 @@ function partToMldev$2(fromObject) {
|
|
|
11540
11746
|
if (fromVideoMetadata != null) {
|
|
11541
11747
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
11542
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
|
+
}
|
|
11543
11823
|
return toObject;
|
|
11544
11824
|
}
|
|
11545
11825
|
function sessionResumptionConfigToMldev$1(fromObject) {
|
|
@@ -11908,7 +12188,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
11908
12188
|
}
|
|
11909
12189
|
return toObject;
|
|
11910
12190
|
}
|
|
11911
|
-
function computeTokensParametersToVertex(apiClient, fromObject,
|
|
12191
|
+
function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
11912
12192
|
const toObject = {};
|
|
11913
12193
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
11914
12194
|
if (fromModel != null) {
|
|
@@ -11919,7 +12199,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, _rootObject) {
|
|
|
11919
12199
|
let transformedList = tContents(fromContents);
|
|
11920
12200
|
if (Array.isArray(transformedList)) {
|
|
11921
12201
|
transformedList = transformedList.map((item) => {
|
|
11922
|
-
return item;
|
|
12202
|
+
return contentToVertex(item);
|
|
11923
12203
|
});
|
|
11924
12204
|
}
|
|
11925
12205
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -11988,6 +12268,24 @@ function contentToMldev$1(fromObject, rootObject) {
|
|
|
11988
12268
|
}
|
|
11989
12269
|
return toObject;
|
|
11990
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
|
+
}
|
|
11991
12289
|
function controlReferenceConfigToVertex(fromObject, _rootObject) {
|
|
11992
12290
|
const toObject = {};
|
|
11993
12291
|
const fromControlType = getValueByPath(fromObject, ['controlType']);
|
|
@@ -12021,7 +12319,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
12021
12319
|
'systemInstruction',
|
|
12022
12320
|
]);
|
|
12023
12321
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
12024
|
-
setValueByPath(parentObject, ['systemInstruction'], tContent(fromSystemInstruction));
|
|
12322
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
12025
12323
|
}
|
|
12026
12324
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
12027
12325
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -12074,7 +12372,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
12074
12372
|
let transformedList = tContents(fromContents);
|
|
12075
12373
|
if (Array.isArray(transformedList)) {
|
|
12076
12374
|
transformedList = transformedList.map((item) => {
|
|
12077
|
-
return item;
|
|
12375
|
+
return contentToVertex(item);
|
|
12078
12376
|
});
|
|
12079
12377
|
}
|
|
12080
12378
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -12478,7 +12776,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
|
|
|
12478
12776
|
if (discriminatorContent === 'EMBED_CONTENT') {
|
|
12479
12777
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
12480
12778
|
if (fromContent != null) {
|
|
12481
|
-
setValueByPath(toObject, ['content'], tContent(fromContent));
|
|
12779
|
+
setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
|
|
12482
12780
|
}
|
|
12483
12781
|
}
|
|
12484
12782
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -12829,7 +13127,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
12829
13127
|
'systemInstruction',
|
|
12830
13128
|
]);
|
|
12831
13129
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
12832
|
-
setValueByPath(parentObject, ['systemInstruction'], tContent(fromSystemInstruction));
|
|
13130
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
12833
13131
|
}
|
|
12834
13132
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
12835
13133
|
if (fromTemperature != null) {
|
|
@@ -12941,7 +13239,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
12941
13239
|
}
|
|
12942
13240
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
12943
13241
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
12944
|
-
setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
|
|
13242
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex(fromToolConfig));
|
|
12945
13243
|
}
|
|
12946
13244
|
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
12947
13245
|
if (parentObject !== undefined && fromLabels != null) {
|
|
@@ -13030,7 +13328,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
13030
13328
|
let transformedList = tContents(fromContents);
|
|
13031
13329
|
if (Array.isArray(transformedList)) {
|
|
13032
13330
|
transformedList = transformedList.map((item) => {
|
|
13033
|
-
return item;
|
|
13331
|
+
return contentToVertex(item);
|
|
13034
13332
|
});
|
|
13035
13333
|
}
|
|
13036
13334
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -14434,6 +14732,80 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
14434
14732
|
if (fromVideoMetadata != null) {
|
|
14435
14733
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
14436
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
|
+
}
|
|
14437
14809
|
return toObject;
|
|
14438
14810
|
}
|
|
14439
14811
|
function productImageToVertex(fromObject, rootObject) {
|
|
@@ -14767,6 +15139,30 @@ function toolConfigToMldev(fromObject, rootObject) {
|
|
|
14767
15139
|
if (fromFunctionCallingConfig != null) {
|
|
14768
15140
|
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
14769
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
|
+
}
|
|
14770
15166
|
return toObject;
|
|
14771
15167
|
}
|
|
14772
15168
|
function toolToMldev$1(fromObject, rootObject) {
|
|
@@ -15905,7 +16301,7 @@ class Session {
|
|
|
15905
16301
|
}
|
|
15906
16302
|
}
|
|
15907
16303
|
const clientMessage = {
|
|
15908
|
-
toolResponse: { functionResponses: functionResponses },
|
|
16304
|
+
toolResponse: { 'functionResponses': functionResponses },
|
|
15909
16305
|
};
|
|
15910
16306
|
return clientMessage;
|
|
15911
16307
|
}
|
|
@@ -17878,6 +18274,13 @@ class Operations extends BaseModule {
|
|
|
17878
18274
|
* Copyright 2025 Google LLC
|
|
17879
18275
|
* SPDX-License-Identifier: Apache-2.0
|
|
17880
18276
|
*/
|
|
18277
|
+
function audioTranscriptionConfigToMldev(fromObject) {
|
|
18278
|
+
const toObject = {};
|
|
18279
|
+
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
18280
|
+
throw new Error('languageCodes parameter is not supported in Gemini API.');
|
|
18281
|
+
}
|
|
18282
|
+
return toObject;
|
|
18283
|
+
}
|
|
17881
18284
|
function authConfigToMldev(fromObject) {
|
|
17882
18285
|
const toObject = {};
|
|
17883
18286
|
const fromApiKey = getValueByPath(fromObject, ['apiKey']);
|
|
@@ -18129,13 +18532,13 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
18129
18532
|
'inputAudioTranscription',
|
|
18130
18533
|
]);
|
|
18131
18534
|
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
18132
|
-
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], fromInputAudioTranscription);
|
|
18535
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev(fromInputAudioTranscription));
|
|
18133
18536
|
}
|
|
18134
18537
|
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
18135
18538
|
'outputAudioTranscription',
|
|
18136
18539
|
]);
|
|
18137
18540
|
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
18138
|
-
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], fromOutputAudioTranscription);
|
|
18541
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev(fromOutputAudioTranscription));
|
|
18139
18542
|
}
|
|
18140
18543
|
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
18141
18544
|
'realtimeInputConfig',
|
|
@@ -18228,6 +18631,14 @@ function partToMldev(fromObject) {
|
|
|
18228
18631
|
if (fromVideoMetadata != null) {
|
|
18229
18632
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
18230
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
|
+
}
|
|
18231
18642
|
return toObject;
|
|
18232
18643
|
}
|
|
18233
18644
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
@@ -19941,5 +20352,5 @@ class GoogleGenAI {
|
|
|
19941
20352
|
}
|
|
19942
20353
|
}
|
|
19943
20354
|
|
|
19944
|
-
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 };
|
|
19945
20356
|
//# sourceMappingURL=index.mjs.map
|