@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/genai.d.ts +437 -111
- package/dist/index.cjs +431 -47
- package/dist/index.mjs +431 -48
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +453 -67
- package/dist/node/index.mjs +453 -68
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +437 -111
- 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 +87 -54
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +87 -9
- package/dist/vertex_internal/index.js +87 -54
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +431 -48
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +437 -111
- package/package.json +1 -1
package/dist/web/index.mjs
CHANGED
|
@@ -586,6 +586,18 @@ function videoFromVertex$1(fromObject) {
|
|
|
586
586
|
* Copyright 2025 Google LLC
|
|
587
587
|
* SPDX-License-Identifier: Apache-2.0
|
|
588
588
|
*/
|
|
589
|
+
/** Programming language of the `code`. */
|
|
590
|
+
var Language;
|
|
591
|
+
(function (Language) {
|
|
592
|
+
/**
|
|
593
|
+
* Unspecified language. This value should not be used.
|
|
594
|
+
*/
|
|
595
|
+
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
596
|
+
/**
|
|
597
|
+
* Python >= 3.10, with numpy and simpy available.
|
|
598
|
+
*/
|
|
599
|
+
Language["PYTHON"] = "PYTHON";
|
|
600
|
+
})(Language || (Language = {}));
|
|
589
601
|
/** Outcome of the code execution. */
|
|
590
602
|
var Outcome;
|
|
591
603
|
(function (Outcome) {
|
|
@@ -606,18 +618,6 @@ var Outcome;
|
|
|
606
618
|
*/
|
|
607
619
|
Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
|
|
608
620
|
})(Outcome || (Outcome = {}));
|
|
609
|
-
/** Programming language of the `code`. */
|
|
610
|
-
var Language;
|
|
611
|
-
(function (Language) {
|
|
612
|
-
/**
|
|
613
|
-
* Unspecified language. This value should not be used.
|
|
614
|
-
*/
|
|
615
|
-
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
616
|
-
/**
|
|
617
|
-
* Python >= 3.10, with numpy and simpy available.
|
|
618
|
-
*/
|
|
619
|
-
Language["PYTHON"] = "PYTHON";
|
|
620
|
-
})(Language || (Language = {}));
|
|
621
621
|
/** Specifies how the response should be scheduled in the conversation. */
|
|
622
622
|
var FunctionResponseScheduling;
|
|
623
623
|
(function (FunctionResponseScheduling) {
|
|
@@ -1446,6 +1446,34 @@ var PartMediaResolutionLevel;
|
|
|
1446
1446
|
*/
|
|
1447
1447
|
PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
|
|
1448
1448
|
})(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
|
|
1449
|
+
/** The type of tool in the function call. */
|
|
1450
|
+
var ToolType;
|
|
1451
|
+
(function (ToolType) {
|
|
1452
|
+
/**
|
|
1453
|
+
* Unspecified tool type.
|
|
1454
|
+
*/
|
|
1455
|
+
ToolType["TOOL_TYPE_UNSPECIFIED"] = "TOOL_TYPE_UNSPECIFIED";
|
|
1456
|
+
/**
|
|
1457
|
+
* Google search tool, maps to Tool.google_search.search_types.web_search.
|
|
1458
|
+
*/
|
|
1459
|
+
ToolType["GOOGLE_SEARCH_WEB"] = "GOOGLE_SEARCH_WEB";
|
|
1460
|
+
/**
|
|
1461
|
+
* Image search tool, maps to Tool.google_search.search_types.image_search.
|
|
1462
|
+
*/
|
|
1463
|
+
ToolType["GOOGLE_SEARCH_IMAGE"] = "GOOGLE_SEARCH_IMAGE";
|
|
1464
|
+
/**
|
|
1465
|
+
* URL context tool, maps to Tool.url_context.
|
|
1466
|
+
*/
|
|
1467
|
+
ToolType["URL_CONTEXT"] = "URL_CONTEXT";
|
|
1468
|
+
/**
|
|
1469
|
+
* Google maps tool, maps to Tool.google_maps.
|
|
1470
|
+
*/
|
|
1471
|
+
ToolType["GOOGLE_MAPS"] = "GOOGLE_MAPS";
|
|
1472
|
+
/**
|
|
1473
|
+
* File search tool, maps to Tool.file_search.
|
|
1474
|
+
*/
|
|
1475
|
+
ToolType["FILE_SEARCH"] = "FILE_SEARCH";
|
|
1476
|
+
})(ToolType || (ToolType = {}));
|
|
1449
1477
|
/** Resource scope. */
|
|
1450
1478
|
var ResourceScope;
|
|
1451
1479
|
(function (ResourceScope) {
|
|
@@ -1941,6 +1969,14 @@ var LiveMusicPlaybackControl;
|
|
|
1941
1969
|
*/
|
|
1942
1970
|
LiveMusicPlaybackControl["RESET_CONTEXT"] = "RESET_CONTEXT";
|
|
1943
1971
|
})(LiveMusicPlaybackControl || (LiveMusicPlaybackControl = {}));
|
|
1972
|
+
/** The output from a server-side `ToolCall` execution.
|
|
1973
|
+
|
|
1974
|
+
This message contains the results of a tool invocation that was initiated by a
|
|
1975
|
+
`ToolCall` from the model. The client should pass this `ToolResponse` back to
|
|
1976
|
+
the API in a subsequent turn within a `Content` message, along with the
|
|
1977
|
+
corresponding `ToolCall`. */
|
|
1978
|
+
class ToolResponse {
|
|
1979
|
+
}
|
|
1944
1980
|
/** Raw media bytes for function response.
|
|
1945
1981
|
|
|
1946
1982
|
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
@@ -4669,6 +4705,14 @@ function partToMldev$4(fromObject) {
|
|
|
4669
4705
|
if (fromVideoMetadata != null) {
|
|
4670
4706
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
4671
4707
|
}
|
|
4708
|
+
const fromToolCall = getValueByPath(fromObject, ['toolCall']);
|
|
4709
|
+
if (fromToolCall != null) {
|
|
4710
|
+
setValueByPath(toObject, ['toolCall'], fromToolCall);
|
|
4711
|
+
}
|
|
4712
|
+
const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
|
|
4713
|
+
if (fromToolResponse != null) {
|
|
4714
|
+
setValueByPath(toObject, ['toolResponse'], fromToolResponse);
|
|
4715
|
+
}
|
|
4672
4716
|
return toObject;
|
|
4673
4717
|
}
|
|
4674
4718
|
function safetySettingToMldev$1(fromObject) {
|
|
@@ -4700,6 +4744,10 @@ function toolConfigToMldev$2(fromObject) {
|
|
|
4700
4744
|
if (fromFunctionCallingConfig != null) {
|
|
4701
4745
|
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4702
4746
|
}
|
|
4747
|
+
const fromIncludeServerSideToolInvocations = getValueByPath(fromObject, ['includeServerSideToolInvocations']);
|
|
4748
|
+
if (fromIncludeServerSideToolInvocations != null) {
|
|
4749
|
+
setValueByPath(toObject, ['includeServerSideToolInvocations'], fromIncludeServerSideToolInvocations);
|
|
4750
|
+
}
|
|
4703
4751
|
return toObject;
|
|
4704
4752
|
}
|
|
4705
4753
|
function toolToMldev$4(fromObject) {
|
|
@@ -5522,6 +5570,24 @@ function contentToMldev$3(fromObject) {
|
|
|
5522
5570
|
}
|
|
5523
5571
|
return toObject;
|
|
5524
5572
|
}
|
|
5573
|
+
function contentToVertex$2(fromObject) {
|
|
5574
|
+
const toObject = {};
|
|
5575
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5576
|
+
if (fromParts != null) {
|
|
5577
|
+
let transformedList = fromParts;
|
|
5578
|
+
if (Array.isArray(transformedList)) {
|
|
5579
|
+
transformedList = transformedList.map((item) => {
|
|
5580
|
+
return partToVertex$2(item);
|
|
5581
|
+
});
|
|
5582
|
+
}
|
|
5583
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
5584
|
+
}
|
|
5585
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
5586
|
+
if (fromRole != null) {
|
|
5587
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
5588
|
+
}
|
|
5589
|
+
return toObject;
|
|
5590
|
+
}
|
|
5525
5591
|
function createCachedContentConfigToMldev(fromObject, parentObject) {
|
|
5526
5592
|
const toObject = {};
|
|
5527
5593
|
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
@@ -5590,7 +5656,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5590
5656
|
let transformedList = tContents(fromContents);
|
|
5591
5657
|
if (Array.isArray(transformedList)) {
|
|
5592
5658
|
transformedList = transformedList.map((item) => {
|
|
5593
|
-
return item;
|
|
5659
|
+
return contentToVertex$2(item);
|
|
5594
5660
|
});
|
|
5595
5661
|
}
|
|
5596
5662
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -5599,7 +5665,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5599
5665
|
'systemInstruction',
|
|
5600
5666
|
]);
|
|
5601
5667
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
5602
|
-
setValueByPath(parentObject, ['systemInstruction'], tContent(fromSystemInstruction));
|
|
5668
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$2(tContent(fromSystemInstruction)));
|
|
5603
5669
|
}
|
|
5604
5670
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5605
5671
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -5613,7 +5679,7 @@ function createCachedContentConfigToVertex(fromObject, parentObject) {
|
|
|
5613
5679
|
}
|
|
5614
5680
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
5615
5681
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
5616
|
-
setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
|
|
5682
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex$1(fromToolConfig));
|
|
5617
5683
|
}
|
|
5618
5684
|
const fromKmsKeyName = getValueByPath(fromObject, ['kmsKeyName']);
|
|
5619
5685
|
if (parentObject !== undefined && fromKmsKeyName != null) {
|
|
@@ -5973,6 +6039,80 @@ function partToMldev$3(fromObject) {
|
|
|
5973
6039
|
if (fromVideoMetadata != null) {
|
|
5974
6040
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
5975
6041
|
}
|
|
6042
|
+
const fromToolCall = getValueByPath(fromObject, ['toolCall']);
|
|
6043
|
+
if (fromToolCall != null) {
|
|
6044
|
+
setValueByPath(toObject, ['toolCall'], fromToolCall);
|
|
6045
|
+
}
|
|
6046
|
+
const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
|
|
6047
|
+
if (fromToolResponse != null) {
|
|
6048
|
+
setValueByPath(toObject, ['toolResponse'], fromToolResponse);
|
|
6049
|
+
}
|
|
6050
|
+
return toObject;
|
|
6051
|
+
}
|
|
6052
|
+
function partToVertex$2(fromObject) {
|
|
6053
|
+
const toObject = {};
|
|
6054
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
6055
|
+
'mediaResolution',
|
|
6056
|
+
]);
|
|
6057
|
+
if (fromMediaResolution != null) {
|
|
6058
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
6059
|
+
}
|
|
6060
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6061
|
+
'codeExecutionResult',
|
|
6062
|
+
]);
|
|
6063
|
+
if (fromCodeExecutionResult != null) {
|
|
6064
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
6065
|
+
}
|
|
6066
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
6067
|
+
'executableCode',
|
|
6068
|
+
]);
|
|
6069
|
+
if (fromExecutableCode != null) {
|
|
6070
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
6071
|
+
}
|
|
6072
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
6073
|
+
if (fromFileData != null) {
|
|
6074
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
6075
|
+
}
|
|
6076
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
6077
|
+
if (fromFunctionCall != null) {
|
|
6078
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
6079
|
+
}
|
|
6080
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
6081
|
+
'functionResponse',
|
|
6082
|
+
]);
|
|
6083
|
+
if (fromFunctionResponse != null) {
|
|
6084
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
6085
|
+
}
|
|
6086
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
6087
|
+
if (fromInlineData != null) {
|
|
6088
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
6089
|
+
}
|
|
6090
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
6091
|
+
if (fromText != null) {
|
|
6092
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
6093
|
+
}
|
|
6094
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
6095
|
+
if (fromThought != null) {
|
|
6096
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
6097
|
+
}
|
|
6098
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6099
|
+
'thoughtSignature',
|
|
6100
|
+
]);
|
|
6101
|
+
if (fromThoughtSignature != null) {
|
|
6102
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6103
|
+
}
|
|
6104
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
6105
|
+
'videoMetadata',
|
|
6106
|
+
]);
|
|
6107
|
+
if (fromVideoMetadata != null) {
|
|
6108
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
6109
|
+
}
|
|
6110
|
+
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
6111
|
+
throw new Error('toolCall parameter is not supported in Vertex AI.');
|
|
6112
|
+
}
|
|
6113
|
+
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
6114
|
+
throw new Error('toolResponse parameter is not supported in Vertex AI.');
|
|
6115
|
+
}
|
|
5976
6116
|
return toObject;
|
|
5977
6117
|
}
|
|
5978
6118
|
function toolConfigToMldev$1(fromObject) {
|
|
@@ -5989,6 +6129,30 @@ function toolConfigToMldev$1(fromObject) {
|
|
|
5989
6129
|
if (fromFunctionCallingConfig != null) {
|
|
5990
6130
|
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5991
6131
|
}
|
|
6132
|
+
const fromIncludeServerSideToolInvocations = getValueByPath(fromObject, ['includeServerSideToolInvocations']);
|
|
6133
|
+
if (fromIncludeServerSideToolInvocations != null) {
|
|
6134
|
+
setValueByPath(toObject, ['includeServerSideToolInvocations'], fromIncludeServerSideToolInvocations);
|
|
6135
|
+
}
|
|
6136
|
+
return toObject;
|
|
6137
|
+
}
|
|
6138
|
+
function toolConfigToVertex$1(fromObject) {
|
|
6139
|
+
const toObject = {};
|
|
6140
|
+
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
6141
|
+
'retrievalConfig',
|
|
6142
|
+
]);
|
|
6143
|
+
if (fromRetrievalConfig != null) {
|
|
6144
|
+
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
6145
|
+
}
|
|
6146
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
6147
|
+
'functionCallingConfig',
|
|
6148
|
+
]);
|
|
6149
|
+
if (fromFunctionCallingConfig != null) {
|
|
6150
|
+
setValueByPath(toObject, ['functionCallingConfig'], fromFunctionCallingConfig);
|
|
6151
|
+
}
|
|
6152
|
+
if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
|
|
6153
|
+
undefined) {
|
|
6154
|
+
throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
|
|
6155
|
+
}
|
|
5992
6156
|
return toObject;
|
|
5993
6157
|
}
|
|
5994
6158
|
function toolToMldev$3(fromObject) {
|
|
@@ -7476,6 +7640,24 @@ function contentToMldev$2(fromObject) {
|
|
|
7476
7640
|
}
|
|
7477
7641
|
return toObject;
|
|
7478
7642
|
}
|
|
7643
|
+
function contentToVertex$1(fromObject) {
|
|
7644
|
+
const toObject = {};
|
|
7645
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7646
|
+
if (fromParts != null) {
|
|
7647
|
+
let transformedList = fromParts;
|
|
7648
|
+
if (Array.isArray(transformedList)) {
|
|
7649
|
+
transformedList = transformedList.map((item) => {
|
|
7650
|
+
return partToVertex$1(item);
|
|
7651
|
+
});
|
|
7652
|
+
}
|
|
7653
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
7654
|
+
}
|
|
7655
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
7656
|
+
if (fromRole != null) {
|
|
7657
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
7658
|
+
}
|
|
7659
|
+
return toObject;
|
|
7660
|
+
}
|
|
7479
7661
|
function fileDataToMldev$2(fromObject) {
|
|
7480
7662
|
const toObject = {};
|
|
7481
7663
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
@@ -7883,7 +8065,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
7883
8065
|
'systemInstruction',
|
|
7884
8066
|
]);
|
|
7885
8067
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
7886
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], tContent(fromSystemInstruction));
|
|
8068
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$1(tContent(fromSystemInstruction)));
|
|
7887
8069
|
}
|
|
7888
8070
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
7889
8071
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -8183,6 +8365,80 @@ function partToMldev$2(fromObject) {
|
|
|
8183
8365
|
if (fromVideoMetadata != null) {
|
|
8184
8366
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
8185
8367
|
}
|
|
8368
|
+
const fromToolCall = getValueByPath(fromObject, ['toolCall']);
|
|
8369
|
+
if (fromToolCall != null) {
|
|
8370
|
+
setValueByPath(toObject, ['toolCall'], fromToolCall);
|
|
8371
|
+
}
|
|
8372
|
+
const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
|
|
8373
|
+
if (fromToolResponse != null) {
|
|
8374
|
+
setValueByPath(toObject, ['toolResponse'], fromToolResponse);
|
|
8375
|
+
}
|
|
8376
|
+
return toObject;
|
|
8377
|
+
}
|
|
8378
|
+
function partToVertex$1(fromObject) {
|
|
8379
|
+
const toObject = {};
|
|
8380
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
8381
|
+
'mediaResolution',
|
|
8382
|
+
]);
|
|
8383
|
+
if (fromMediaResolution != null) {
|
|
8384
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
8385
|
+
}
|
|
8386
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8387
|
+
'codeExecutionResult',
|
|
8388
|
+
]);
|
|
8389
|
+
if (fromCodeExecutionResult != null) {
|
|
8390
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
8391
|
+
}
|
|
8392
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
8393
|
+
'executableCode',
|
|
8394
|
+
]);
|
|
8395
|
+
if (fromExecutableCode != null) {
|
|
8396
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8397
|
+
}
|
|
8398
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
8399
|
+
if (fromFileData != null) {
|
|
8400
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
8401
|
+
}
|
|
8402
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8403
|
+
if (fromFunctionCall != null) {
|
|
8404
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8405
|
+
}
|
|
8406
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8407
|
+
'functionResponse',
|
|
8408
|
+
]);
|
|
8409
|
+
if (fromFunctionResponse != null) {
|
|
8410
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
8411
|
+
}
|
|
8412
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
8413
|
+
if (fromInlineData != null) {
|
|
8414
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
8415
|
+
}
|
|
8416
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
8417
|
+
if (fromText != null) {
|
|
8418
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
8419
|
+
}
|
|
8420
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
8421
|
+
if (fromThought != null) {
|
|
8422
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
8423
|
+
}
|
|
8424
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
8425
|
+
'thoughtSignature',
|
|
8426
|
+
]);
|
|
8427
|
+
if (fromThoughtSignature != null) {
|
|
8428
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8429
|
+
}
|
|
8430
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
8431
|
+
'videoMetadata',
|
|
8432
|
+
]);
|
|
8433
|
+
if (fromVideoMetadata != null) {
|
|
8434
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
8435
|
+
}
|
|
8436
|
+
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
8437
|
+
throw new Error('toolCall parameter is not supported in Vertex AI.');
|
|
8438
|
+
}
|
|
8439
|
+
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
8440
|
+
throw new Error('toolResponse parameter is not supported in Vertex AI.');
|
|
8441
|
+
}
|
|
8186
8442
|
return toObject;
|
|
8187
8443
|
}
|
|
8188
8444
|
function sessionResumptionConfigToMldev$1(fromObject) {
|
|
@@ -8551,7 +8807,7 @@ function citationMetadataFromMldev(fromObject, _rootObject) {
|
|
|
8551
8807
|
}
|
|
8552
8808
|
return toObject;
|
|
8553
8809
|
}
|
|
8554
|
-
function computeTokensParametersToVertex(apiClient, fromObject,
|
|
8810
|
+
function computeTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
8555
8811
|
const toObject = {};
|
|
8556
8812
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
8557
8813
|
if (fromModel != null) {
|
|
@@ -8562,7 +8818,7 @@ function computeTokensParametersToVertex(apiClient, fromObject, _rootObject) {
|
|
|
8562
8818
|
let transformedList = tContents(fromContents);
|
|
8563
8819
|
if (Array.isArray(transformedList)) {
|
|
8564
8820
|
transformedList = transformedList.map((item) => {
|
|
8565
|
-
return item;
|
|
8821
|
+
return contentToVertex(item);
|
|
8566
8822
|
});
|
|
8567
8823
|
}
|
|
8568
8824
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8631,6 +8887,24 @@ function contentToMldev$1(fromObject, rootObject) {
|
|
|
8631
8887
|
}
|
|
8632
8888
|
return toObject;
|
|
8633
8889
|
}
|
|
8890
|
+
function contentToVertex(fromObject, rootObject) {
|
|
8891
|
+
const toObject = {};
|
|
8892
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
8893
|
+
if (fromParts != null) {
|
|
8894
|
+
let transformedList = fromParts;
|
|
8895
|
+
if (Array.isArray(transformedList)) {
|
|
8896
|
+
transformedList = transformedList.map((item) => {
|
|
8897
|
+
return partToVertex(item);
|
|
8898
|
+
});
|
|
8899
|
+
}
|
|
8900
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
8901
|
+
}
|
|
8902
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
8903
|
+
if (fromRole != null) {
|
|
8904
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
8905
|
+
}
|
|
8906
|
+
return toObject;
|
|
8907
|
+
}
|
|
8634
8908
|
function controlReferenceConfigToVertex(fromObject, _rootObject) {
|
|
8635
8909
|
const toObject = {};
|
|
8636
8910
|
const fromControlType = getValueByPath(fromObject, ['controlType']);
|
|
@@ -8664,7 +8938,7 @@ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
8664
8938
|
'systemInstruction',
|
|
8665
8939
|
]);
|
|
8666
8940
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
8667
|
-
setValueByPath(parentObject, ['systemInstruction'], tContent(fromSystemInstruction));
|
|
8941
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
8668
8942
|
}
|
|
8669
8943
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
8670
8944
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -8717,7 +8991,7 @@ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
8717
8991
|
let transformedList = tContents(fromContents);
|
|
8718
8992
|
if (Array.isArray(transformedList)) {
|
|
8719
8993
|
transformedList = transformedList.map((item) => {
|
|
8720
|
-
return item;
|
|
8994
|
+
return contentToVertex(item);
|
|
8721
8995
|
});
|
|
8722
8996
|
}
|
|
8723
8997
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -9121,7 +9395,7 @@ function embedContentParametersPrivateToVertex(apiClient, fromObject, rootObject
|
|
|
9121
9395
|
if (discriminatorContent === 'EMBED_CONTENT') {
|
|
9122
9396
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
9123
9397
|
if (fromContent != null) {
|
|
9124
|
-
setValueByPath(toObject, ['content'], tContent(fromContent));
|
|
9398
|
+
setValueByPath(toObject, ['content'], contentToVertex(tContent(fromContent)));
|
|
9125
9399
|
}
|
|
9126
9400
|
}
|
|
9127
9401
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -9472,7 +9746,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
9472
9746
|
'systemInstruction',
|
|
9473
9747
|
]);
|
|
9474
9748
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
9475
|
-
setValueByPath(parentObject, ['systemInstruction'], tContent(fromSystemInstruction));
|
|
9749
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(tContent(fromSystemInstruction)));
|
|
9476
9750
|
}
|
|
9477
9751
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
9478
9752
|
if (fromTemperature != null) {
|
|
@@ -9584,7 +9858,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
9584
9858
|
}
|
|
9585
9859
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
9586
9860
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
9587
|
-
setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
|
|
9861
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex(fromToolConfig));
|
|
9588
9862
|
}
|
|
9589
9863
|
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
9590
9864
|
if (parentObject !== undefined && fromLabels != null) {
|
|
@@ -9673,7 +9947,7 @@ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
|
|
|
9673
9947
|
let transformedList = tContents(fromContents);
|
|
9674
9948
|
if (Array.isArray(transformedList)) {
|
|
9675
9949
|
transformedList = transformedList.map((item) => {
|
|
9676
|
-
return item;
|
|
9950
|
+
return contentToVertex(item);
|
|
9677
9951
|
});
|
|
9678
9952
|
}
|
|
9679
9953
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -11077,6 +11351,80 @@ function partToMldev$1(fromObject, rootObject) {
|
|
|
11077
11351
|
if (fromVideoMetadata != null) {
|
|
11078
11352
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
11079
11353
|
}
|
|
11354
|
+
const fromToolCall = getValueByPath(fromObject, ['toolCall']);
|
|
11355
|
+
if (fromToolCall != null) {
|
|
11356
|
+
setValueByPath(toObject, ['toolCall'], fromToolCall);
|
|
11357
|
+
}
|
|
11358
|
+
const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
|
|
11359
|
+
if (fromToolResponse != null) {
|
|
11360
|
+
setValueByPath(toObject, ['toolResponse'], fromToolResponse);
|
|
11361
|
+
}
|
|
11362
|
+
return toObject;
|
|
11363
|
+
}
|
|
11364
|
+
function partToVertex(fromObject, _rootObject) {
|
|
11365
|
+
const toObject = {};
|
|
11366
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
11367
|
+
'mediaResolution',
|
|
11368
|
+
]);
|
|
11369
|
+
if (fromMediaResolution != null) {
|
|
11370
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
11371
|
+
}
|
|
11372
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
11373
|
+
'codeExecutionResult',
|
|
11374
|
+
]);
|
|
11375
|
+
if (fromCodeExecutionResult != null) {
|
|
11376
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
11377
|
+
}
|
|
11378
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
11379
|
+
'executableCode',
|
|
11380
|
+
]);
|
|
11381
|
+
if (fromExecutableCode != null) {
|
|
11382
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
11383
|
+
}
|
|
11384
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
11385
|
+
if (fromFileData != null) {
|
|
11386
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
11387
|
+
}
|
|
11388
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11389
|
+
if (fromFunctionCall != null) {
|
|
11390
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
11391
|
+
}
|
|
11392
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
11393
|
+
'functionResponse',
|
|
11394
|
+
]);
|
|
11395
|
+
if (fromFunctionResponse != null) {
|
|
11396
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
11397
|
+
}
|
|
11398
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
11399
|
+
if (fromInlineData != null) {
|
|
11400
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
11401
|
+
}
|
|
11402
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
11403
|
+
if (fromText != null) {
|
|
11404
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
11405
|
+
}
|
|
11406
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
11407
|
+
if (fromThought != null) {
|
|
11408
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
11409
|
+
}
|
|
11410
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
11411
|
+
'thoughtSignature',
|
|
11412
|
+
]);
|
|
11413
|
+
if (fromThoughtSignature != null) {
|
|
11414
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
11415
|
+
}
|
|
11416
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
11417
|
+
'videoMetadata',
|
|
11418
|
+
]);
|
|
11419
|
+
if (fromVideoMetadata != null) {
|
|
11420
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
11421
|
+
}
|
|
11422
|
+
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
11423
|
+
throw new Error('toolCall parameter is not supported in Vertex AI.');
|
|
11424
|
+
}
|
|
11425
|
+
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
11426
|
+
throw new Error('toolResponse parameter is not supported in Vertex AI.');
|
|
11427
|
+
}
|
|
11080
11428
|
return toObject;
|
|
11081
11429
|
}
|
|
11082
11430
|
function productImageToVertex(fromObject, rootObject) {
|
|
@@ -11410,6 +11758,30 @@ function toolConfigToMldev(fromObject, rootObject) {
|
|
|
11410
11758
|
if (fromFunctionCallingConfig != null) {
|
|
11411
11759
|
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
11412
11760
|
}
|
|
11761
|
+
const fromIncludeServerSideToolInvocations = getValueByPath(fromObject, ['includeServerSideToolInvocations']);
|
|
11762
|
+
if (fromIncludeServerSideToolInvocations != null) {
|
|
11763
|
+
setValueByPath(toObject, ['includeServerSideToolInvocations'], fromIncludeServerSideToolInvocations);
|
|
11764
|
+
}
|
|
11765
|
+
return toObject;
|
|
11766
|
+
}
|
|
11767
|
+
function toolConfigToVertex(fromObject, _rootObject) {
|
|
11768
|
+
const toObject = {};
|
|
11769
|
+
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
11770
|
+
'retrievalConfig',
|
|
11771
|
+
]);
|
|
11772
|
+
if (fromRetrievalConfig != null) {
|
|
11773
|
+
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
11774
|
+
}
|
|
11775
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
11776
|
+
'functionCallingConfig',
|
|
11777
|
+
]);
|
|
11778
|
+
if (fromFunctionCallingConfig != null) {
|
|
11779
|
+
setValueByPath(toObject, ['functionCallingConfig'], fromFunctionCallingConfig);
|
|
11780
|
+
}
|
|
11781
|
+
if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
|
|
11782
|
+
undefined) {
|
|
11783
|
+
throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
|
|
11784
|
+
}
|
|
11413
11785
|
return toObject;
|
|
11414
11786
|
}
|
|
11415
11787
|
function toolToMldev$1(fromObject, rootObject) {
|
|
@@ -12099,7 +12471,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12099
12471
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12100
12472
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12101
12473
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12102
|
-
const SDK_VERSION = '1.
|
|
12474
|
+
const SDK_VERSION = '1.46.0'; // x-release-please-version
|
|
12103
12475
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12104
12476
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12105
12477
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -13458,7 +13830,7 @@ class Session {
|
|
|
13458
13830
|
}
|
|
13459
13831
|
}
|
|
13460
13832
|
const clientMessage = {
|
|
13461
|
-
toolResponse: { functionResponses: functionResponses },
|
|
13833
|
+
toolResponse: { 'functionResponses': functionResponses },
|
|
13462
13834
|
};
|
|
13463
13835
|
return clientMessage;
|
|
13464
13836
|
}
|
|
@@ -15788,6 +16160,14 @@ function partToMldev(fromObject) {
|
|
|
15788
16160
|
if (fromVideoMetadata != null) {
|
|
15789
16161
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
15790
16162
|
}
|
|
16163
|
+
const fromToolCall = getValueByPath(fromObject, ['toolCall']);
|
|
16164
|
+
if (fromToolCall != null) {
|
|
16165
|
+
setValueByPath(toObject, ['toolCall'], fromToolCall);
|
|
16166
|
+
}
|
|
16167
|
+
const fromToolResponse = getValueByPath(fromObject, ['toolResponse']);
|
|
16168
|
+
if (fromToolResponse != null) {
|
|
16169
|
+
setValueByPath(toObject, ['toolResponse'], fromToolResponse);
|
|
16170
|
+
}
|
|
15791
16171
|
return toObject;
|
|
15792
16172
|
}
|
|
15793
16173
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
@@ -19743,18 +20123,18 @@ const MAX_RETRY_COUNT = 3;
|
|
|
19743
20123
|
const INITIAL_RETRY_DELAY_MS = 1000;
|
|
19744
20124
|
const DELAY_MULTIPLIER = 2;
|
|
19745
20125
|
const X_GOOG_UPLOAD_STATUS_HEADER_FIELD = 'x-goog-upload-status';
|
|
19746
|
-
async function uploadBlob(file, uploadUrl, apiClient) {
|
|
20126
|
+
async function uploadBlob(file, uploadUrl, apiClient, httpOptions) {
|
|
19747
20127
|
var _a;
|
|
19748
|
-
const response = await uploadBlobInternal(file, uploadUrl, apiClient);
|
|
20128
|
+
const response = await uploadBlobInternal(file, uploadUrl, apiClient, httpOptions);
|
|
19749
20129
|
const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
|
|
19750
20130
|
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') {
|
|
19751
20131
|
throw new Error('Failed to upload file: Upload status is not finalized.');
|
|
19752
20132
|
}
|
|
19753
20133
|
return responseJson['file'];
|
|
19754
20134
|
}
|
|
19755
|
-
async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient) {
|
|
20135
|
+
async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient, httpOptions) {
|
|
19756
20136
|
var _a;
|
|
19757
|
-
const response = await uploadBlobInternal(file, uploadUrl, apiClient);
|
|
20137
|
+
const response = await uploadBlobInternal(file, uploadUrl, apiClient, httpOptions);
|
|
19758
20138
|
const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
|
|
19759
20139
|
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') {
|
|
19760
20140
|
throw new Error('Failed to upload file: Upload status is not finalized.');
|
|
@@ -19764,8 +20144,18 @@ async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient) {
|
|
|
19764
20144
|
Object.assign(typedResp, resp);
|
|
19765
20145
|
return typedResp;
|
|
19766
20146
|
}
|
|
19767
|
-
async function uploadBlobInternal(file, uploadUrl, apiClient) {
|
|
19768
|
-
var _a, _b;
|
|
20147
|
+
async function uploadBlobInternal(file, uploadUrl, apiClient, httpOptions) {
|
|
20148
|
+
var _a, _b, _c;
|
|
20149
|
+
let finalUrl = uploadUrl;
|
|
20150
|
+
const effectiveBaseUrl = (httpOptions === null || httpOptions === void 0 ? void 0 : httpOptions.baseUrl) || ((_a = apiClient.clientOptions.httpOptions) === null || _a === void 0 ? void 0 : _a.baseUrl);
|
|
20151
|
+
if (effectiveBaseUrl) {
|
|
20152
|
+
const baseUri = new URL(effectiveBaseUrl);
|
|
20153
|
+
const uploadUri = new URL(uploadUrl);
|
|
20154
|
+
uploadUri.protocol = baseUri.protocol;
|
|
20155
|
+
uploadUri.host = baseUri.host;
|
|
20156
|
+
uploadUri.port = baseUri.port;
|
|
20157
|
+
finalUrl = uploadUri.toString();
|
|
20158
|
+
}
|
|
19769
20159
|
let fileSize = 0;
|
|
19770
20160
|
let offset = 0;
|
|
19771
20161
|
let response = new HttpResponse(new Response());
|
|
@@ -19780,21 +20170,14 @@ async function uploadBlobInternal(file, uploadUrl, apiClient) {
|
|
|
19780
20170
|
let retryCount = 0;
|
|
19781
20171
|
let currentDelayMs = INITIAL_RETRY_DELAY_MS;
|
|
19782
20172
|
while (retryCount < MAX_RETRY_COUNT) {
|
|
20173
|
+
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) });
|
|
19783
20174
|
response = await apiClient.request({
|
|
19784
20175
|
path: '',
|
|
19785
20176
|
body: chunk,
|
|
19786
20177
|
httpMethod: 'POST',
|
|
19787
|
-
httpOptions: {
|
|
19788
|
-
apiVersion: '',
|
|
19789
|
-
baseUrl: uploadUrl,
|
|
19790
|
-
headers: {
|
|
19791
|
-
'X-Goog-Upload-Command': uploadCommand,
|
|
19792
|
-
'X-Goog-Upload-Offset': String(offset),
|
|
19793
|
-
'Content-Length': String(chunkSize),
|
|
19794
|
-
},
|
|
19795
|
-
},
|
|
20178
|
+
httpOptions: Object.assign(Object.assign({}, httpOptions), { apiVersion: '', baseUrl: finalUrl, headers: mergedHeaders }),
|
|
19796
20179
|
});
|
|
19797
|
-
if ((
|
|
20180
|
+
if ((_b = response === null || response === void 0 ? void 0 : response.headers) === null || _b === void 0 ? void 0 : _b[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) {
|
|
19798
20181
|
break;
|
|
19799
20182
|
}
|
|
19800
20183
|
retryCount++;
|
|
@@ -19804,7 +20187,7 @@ async function uploadBlobInternal(file, uploadUrl, apiClient) {
|
|
|
19804
20187
|
offset += chunkSize;
|
|
19805
20188
|
// The `x-goog-upload-status` header field can be `active`, `final` and
|
|
19806
20189
|
//`cancelled` in resposne.
|
|
19807
|
-
if (((
|
|
20190
|
+
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') {
|
|
19808
20191
|
break;
|
|
19809
20192
|
}
|
|
19810
20193
|
// TODO(b/401391430) Investigate why the upload status is not finalized
|
|
@@ -19824,17 +20207,17 @@ function sleep(ms) {
|
|
|
19824
20207
|
}
|
|
19825
20208
|
|
|
19826
20209
|
class BrowserUploader {
|
|
19827
|
-
async upload(file, uploadUrl, apiClient) {
|
|
20210
|
+
async upload(file, uploadUrl, apiClient, httpOptions) {
|
|
19828
20211
|
if (typeof file === 'string') {
|
|
19829
20212
|
throw new Error('File path is not supported in browser uploader.');
|
|
19830
20213
|
}
|
|
19831
|
-
return await uploadBlob(file, uploadUrl, apiClient);
|
|
20214
|
+
return await uploadBlob(file, uploadUrl, apiClient, httpOptions);
|
|
19832
20215
|
}
|
|
19833
|
-
async uploadToFileSearchStore(file, uploadUrl, apiClient) {
|
|
20216
|
+
async uploadToFileSearchStore(file, uploadUrl, apiClient, httpOptions) {
|
|
19834
20217
|
if (typeof file === 'string') {
|
|
19835
20218
|
throw new Error('File path is not supported in browser uploader.');
|
|
19836
20219
|
}
|
|
19837
|
-
return await uploadBlobToFileSearchStore(file, uploadUrl, apiClient);
|
|
20220
|
+
return await uploadBlobToFileSearchStore(file, uploadUrl, apiClient, httpOptions);
|
|
19838
20221
|
}
|
|
19839
20222
|
async stat(file) {
|
|
19840
20223
|
if (typeof file === 'string') {
|
|
@@ -20024,5 +20407,5 @@ class GoogleGenAI {
|
|
|
20024
20407
|
}
|
|
20025
20408
|
}
|
|
20026
20409
|
|
|
20027
|
-
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 };
|
|
20410
|
+
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 };
|
|
20028
20411
|
//# sourceMappingURL=index.mjs.map
|