cloudassist-ai-provider 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +326 -9
- package/dist/index.js +2187 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -34
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.ts +262 -4
- package/dist/internal/index.js +1850 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +79 -29
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/convert-json-schema-to-openapi-schema.d.ts +0 -6
- package/dist/convert-json-schema-to-openapi-schema.d.ts.map +0 -1
- package/dist/convert-json-schema-to-openapi-schema.js +0 -108
- package/dist/convert-json-schema-to-openapi-schema.test.d.ts +0 -2
- package/dist/convert-json-schema-to-openapi-schema.test.d.ts.map +0 -1
- package/dist/convert-json-schema-to-openapi-schema.test.js +0 -630
- package/dist/convert-to-google-generative-ai-messages.d.ts +0 -7
- package/dist/convert-to-google-generative-ai-messages.d.ts.map +0 -1
- package/dist/convert-to-google-generative-ai-messages.js +0 -195
- package/dist/convert-to-google-generative-ai-messages.test.d.ts +0 -2
- package/dist/convert-to-google-generative-ai-messages.test.d.ts.map +0 -1
- package/dist/convert-to-google-generative-ai-messages.test.js +0 -456
- package/dist/get-model-path.d.ts +0 -2
- package/dist/get-model-path.d.ts.map +0 -1
- package/dist/get-model-path.js +0 -3
- package/dist/get-model-path.test.d.ts +0 -2
- package/dist/get-model-path.test.d.ts.map +0 -1
- package/dist/get-model-path.test.js +0 -11
- package/dist/google-error.d.ts +0 -12
- package/dist/google-error.d.ts.map +0 -1
- package/dist/google-error.js +0 -13
- package/dist/google-generative-ai-embedding-model.d.ts +0 -21
- package/dist/google-generative-ai-embedding-model.d.ts.map +0 -1
- package/dist/google-generative-ai-embedding-model.js +0 -88
- package/dist/google-generative-ai-embedding-model.test.d.ts +0 -2
- package/dist/google-generative-ai-embedding-model.test.d.ts.map +0 -1
- package/dist/google-generative-ai-embedding-model.test.js +0 -148
- package/dist/google-generative-ai-embedding-options.d.ts +0 -8
- package/dist/google-generative-ai-embedding-options.d.ts.map +0 -1
- package/dist/google-generative-ai-embedding-options.js +0 -33
- package/dist/google-generative-ai-image-model.d.ts +0 -31
- package/dist/google-generative-ai-image-model.d.ts.map +0 -1
- package/dist/google-generative-ai-image-model.js +0 -96
- package/dist/google-generative-ai-image-model.test.d.ts +0 -2
- package/dist/google-generative-ai-image-model.test.d.ts.map +0 -1
- package/dist/google-generative-ai-image-model.test.js +0 -252
- package/dist/google-generative-ai-image-settings.d.ts +0 -8
- package/dist/google-generative-ai-image-settings.d.ts.map +0 -1
- package/dist/google-generative-ai-image-settings.js +0 -1
- package/dist/google-generative-ai-language-model.d.ts +0 -183
- package/dist/google-generative-ai-language-model.d.ts.map +0 -1
- package/dist/google-generative-ai-language-model.js +0 -1001
- package/dist/google-generative-ai-language-model.test.d.ts +0 -2
- package/dist/google-generative-ai-language-model.test.d.ts.map +0 -1
- package/dist/google-generative-ai-language-model.test.js +0 -3463
- package/dist/google-generative-ai-options.d.ts +0 -37
- package/dist/google-generative-ai-options.d.ts.map +0 -1
- package/dist/google-generative-ai-options.js +0 -149
- package/dist/google-generative-ai-prompt.d.ts +0 -52
- package/dist/google-generative-ai-prompt.d.ts.map +0 -1
- package/dist/google-generative-ai-prompt.js +0 -1
- package/dist/google-prepare-tools.d.ts +0 -27
- package/dist/google-prepare-tools.d.ts.map +0 -1
- package/dist/google-prepare-tools.js +0 -219
- package/dist/google-prepare-tools.test.d.ts +0 -2
- package/dist/google-prepare-tools.test.d.ts.map +0 -1
- package/dist/google-prepare-tools.test.js +0 -447
- package/dist/google-provider.d.ts +0 -65
- package/dist/google-provider.d.ts.map +0 -1
- package/dist/google-provider.js +0 -74
- package/dist/google-provider.test.d.ts +0 -2
- package/dist/google-provider.test.d.ts.map +0 -1
- package/dist/google-provider.test.js +0 -234
- package/dist/google-supported-file-url.d.ts +0 -2
- package/dist/google-supported-file-url.d.ts.map +0 -1
- package/dist/google-supported-file-url.js +0 -13
- package/dist/google-supported-file-url.test.d.ts +0 -2
- package/dist/google-supported-file-url.test.d.ts.map +0 -1
- package/dist/google-supported-file-url.test.js +0 -45
- package/dist/google-tools.d.ts +0 -76
- package/dist/google-tools.d.ts.map +0 -1
- package/dist/google-tools.js +0 -65
- package/dist/index.d.ts.map +0 -1
- package/dist/internal/index.d.ts.map +0 -1
- package/dist/map-google-generative-ai-finish-reason.d.ts +0 -6
- package/dist/map-google-generative-ai-finish-reason.d.ts.map +0 -1
- package/dist/map-google-generative-ai-finish-reason.js +0 -22
- package/dist/tool/code-execution.d.ts +0 -17
- package/dist/tool/code-execution.d.ts.map +0 -1
- package/dist/tool/code-execution.js +0 -25
- package/dist/tool/enterprise-web-search.d.ts +0 -2
- package/dist/tool/enterprise-web-search.d.ts.map +0 -1
- package/dist/tool/enterprise-web-search.js +0 -8
- package/dist/tool/file-search.d.ts +0 -16
- package/dist/tool/file-search.d.ts.map +0 -1
- package/dist/tool/file-search.js +0 -33
- package/dist/tool/google-maps.d.ts +0 -2
- package/dist/tool/google-maps.d.ts.map +0 -1
- package/dist/tool/google-maps.js +0 -9
- package/dist/tool/google-search.d.ts +0 -14
- package/dist/tool/google-search.d.ts.map +0 -1
- package/dist/tool/google-search.js +0 -15
- package/dist/tool/url-context.d.ts +0 -2
- package/dist/tool/url-context.d.ts.map +0 -1
- package/dist/tool/url-context.js +0 -7
- package/dist/tool/vertex-rag-store.d.ts +0 -16
- package/dist/tool/vertex-rag-store.d.ts.map +0 -1
- package/dist/tool/vertex-rag-store.js +0 -17
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -3
package/dist/internal/index.mjs
CHANGED
|
@@ -349,13 +349,14 @@ function prepareTools({
|
|
|
349
349
|
|
|
350
350
|
// src/convert-to-google-generative-ai-messages.ts
|
|
351
351
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
352
|
-
var _a, _b;
|
|
352
|
+
var _a, _b, _c;
|
|
353
353
|
const systemInstructionParts = [];
|
|
354
354
|
const contents = [];
|
|
355
355
|
let systemMessagesAllowed = true;
|
|
356
356
|
const isGemmaModel = (_a = options == null ? void 0 : options.isGemmaModel) != null ? _a : false;
|
|
357
357
|
const modelId = (_b = options == null ? void 0 : options.modelId) != null ? _b : "";
|
|
358
358
|
const includeToolCallId = isClaudeModel(modelId);
|
|
359
|
+
const providerKey = (_c = options == null ? void 0 : options.providerKey) != null ? _c : "google";
|
|
359
360
|
for (const { role, content } of prompt) {
|
|
360
361
|
switch (role) {
|
|
361
362
|
case "system": {
|
|
@@ -403,8 +404,8 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
403
404
|
contents.push({
|
|
404
405
|
role: "model",
|
|
405
406
|
parts: content.map((part) => {
|
|
406
|
-
var _a2, _b2,
|
|
407
|
-
const thoughtSignature = ((_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2
|
|
407
|
+
var _a2, _b2, _c2;
|
|
408
|
+
const thoughtSignature = ((_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerKey]) == null ? void 0 : _b2.thoughtSignature) != null ? String((_c2 = part.providerOptions[providerKey]) == null ? void 0 : _c2.thoughtSignature) : void 0;
|
|
408
409
|
switch (part.type) {
|
|
409
410
|
case "text": {
|
|
410
411
|
return part.text.length === 0 ? void 0 : {
|
|
@@ -713,6 +714,19 @@ function mapGoogleGenerativeAIFinishReason({
|
|
|
713
714
|
}
|
|
714
715
|
}
|
|
715
716
|
|
|
717
|
+
// src/provider-key.ts
|
|
718
|
+
var ALLOWED_PROVIDER_KEYS = [
|
|
719
|
+
"antigravity",
|
|
720
|
+
"gemini-cli",
|
|
721
|
+
"cloudassist",
|
|
722
|
+
"google"
|
|
723
|
+
];
|
|
724
|
+
function getProviderKey(providerOptions) {
|
|
725
|
+
return ALLOWED_PROVIDER_KEYS.find(
|
|
726
|
+
(key) => (providerOptions == null ? void 0 : providerOptions[key]) !== void 0
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
|
|
716
730
|
// src/google-generative-ai-language-model.ts
|
|
717
731
|
var GoogleGenerativeAILanguageModel = class {
|
|
718
732
|
constructor(modelId, config) {
|
|
@@ -746,8 +760,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
746
760
|
}) {
|
|
747
761
|
var _a;
|
|
748
762
|
const warnings = [];
|
|
763
|
+
const providerKey = getProviderKey(providerOptions);
|
|
749
764
|
const googleOptions = await parseProviderOptions({
|
|
750
|
-
provider: "google",
|
|
765
|
+
provider: providerKey != null ? providerKey : "google",
|
|
751
766
|
providerOptions,
|
|
752
767
|
schema: googleGenerativeAIProviderOptions
|
|
753
768
|
});
|
|
@@ -762,7 +777,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
762
777
|
const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
|
|
763
778
|
const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
|
|
764
779
|
prompt,
|
|
765
|
-
{ isGemmaModel, modelId: this.modelId }
|
|
780
|
+
{ isGemmaModel, modelId: this.modelId, providerKey }
|
|
766
781
|
);
|
|
767
782
|
const {
|
|
768
783
|
tools: googleTools2,
|
|
@@ -824,12 +839,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
824
839
|
requestType: googleOptions == null ? void 0 : googleOptions.requestType,
|
|
825
840
|
userAgent: googleOptions == null ? void 0 : googleOptions.userAgent,
|
|
826
841
|
requestId: googleOptions == null ? void 0 : googleOptions.requestId
|
|
827
|
-
}
|
|
842
|
+
},
|
|
843
|
+
providerKey
|
|
828
844
|
};
|
|
829
845
|
}
|
|
830
846
|
async doGenerate(options) {
|
|
831
847
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
832
|
-
const { args, warnings, cloudAssistOptions } = await this.getArgs(options);
|
|
848
|
+
const { args, warnings, cloudAssistOptions, providerKey } = await this.getArgs(options);
|
|
833
849
|
const wrappedRequest = {
|
|
834
850
|
project: cloudAssistOptions.projectId,
|
|
835
851
|
model: this.modelId,
|
|
@@ -900,7 +916,11 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
900
916
|
content.push({
|
|
901
917
|
type: "text",
|
|
902
918
|
text: currentTextContent,
|
|
903
|
-
providerMetadata: currentTextThoughtSignature ? {
|
|
919
|
+
providerMetadata: currentTextThoughtSignature ? {
|
|
920
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
921
|
+
thoughtSignature: currentTextThoughtSignature
|
|
922
|
+
}
|
|
923
|
+
} : void 0
|
|
904
924
|
});
|
|
905
925
|
currentTextContent = "";
|
|
906
926
|
currentTextThoughtSignature = void 0;
|
|
@@ -910,7 +930,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
910
930
|
type: "reasoning",
|
|
911
931
|
text: currentReasoningContent,
|
|
912
932
|
providerMetadata: currentReasoningThoughtSignature ? {
|
|
913
|
-
google: {
|
|
933
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
914
934
|
thoughtSignature: currentReasoningThoughtSignature
|
|
915
935
|
}
|
|
916
936
|
} : void 0
|
|
@@ -947,7 +967,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
947
967
|
type: "text",
|
|
948
968
|
text: currentTextContent,
|
|
949
969
|
providerMetadata: currentTextThoughtSignature ? {
|
|
950
|
-
google: {
|
|
970
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
951
971
|
thoughtSignature: currentTextThoughtSignature
|
|
952
972
|
}
|
|
953
973
|
} : void 0
|
|
@@ -966,7 +986,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
966
986
|
type: "reasoning",
|
|
967
987
|
text: currentReasoningContent,
|
|
968
988
|
providerMetadata: currentReasoningThoughtSignature ? {
|
|
969
|
-
google: {
|
|
989
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
970
990
|
thoughtSignature: currentReasoningThoughtSignature
|
|
971
991
|
}
|
|
972
992
|
} : void 0
|
|
@@ -985,7 +1005,11 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
985
1005
|
content.push({
|
|
986
1006
|
type: "text",
|
|
987
1007
|
text: currentTextContent,
|
|
988
|
-
providerMetadata: currentTextThoughtSignature ? {
|
|
1008
|
+
providerMetadata: currentTextThoughtSignature ? {
|
|
1009
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1010
|
+
thoughtSignature: currentTextThoughtSignature
|
|
1011
|
+
}
|
|
1012
|
+
} : void 0
|
|
989
1013
|
});
|
|
990
1014
|
currentTextContent = "";
|
|
991
1015
|
currentTextThoughtSignature = void 0;
|
|
@@ -995,7 +1019,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
995
1019
|
type: "reasoning",
|
|
996
1020
|
text: currentReasoningContent,
|
|
997
1021
|
providerMetadata: currentReasoningThoughtSignature ? {
|
|
998
|
-
google: {
|
|
1022
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
999
1023
|
thoughtSignature: currentReasoningThoughtSignature
|
|
1000
1024
|
}
|
|
1001
1025
|
} : void 0
|
|
@@ -1009,14 +1033,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1009
1033
|
toolCallId,
|
|
1010
1034
|
toolName: part.functionCall.name,
|
|
1011
1035
|
input: JSON.stringify(part.functionCall.args),
|
|
1012
|
-
providerMetadata: part.thoughtSignature ? {
|
|
1036
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1037
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1038
|
+
thoughtSignature: part.thoughtSignature
|
|
1039
|
+
}
|
|
1040
|
+
} : void 0
|
|
1013
1041
|
});
|
|
1014
1042
|
} else if ("inlineData" in part) {
|
|
1015
1043
|
if (currentTextContent) {
|
|
1016
1044
|
content.push({
|
|
1017
1045
|
type: "text",
|
|
1018
1046
|
text: currentTextContent,
|
|
1019
|
-
providerMetadata: currentTextThoughtSignature ? {
|
|
1047
|
+
providerMetadata: currentTextThoughtSignature ? {
|
|
1048
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1049
|
+
thoughtSignature: currentTextThoughtSignature
|
|
1050
|
+
}
|
|
1051
|
+
} : void 0
|
|
1020
1052
|
});
|
|
1021
1053
|
currentTextContent = "";
|
|
1022
1054
|
currentTextThoughtSignature = void 0;
|
|
@@ -1026,7 +1058,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1026
1058
|
type: "reasoning",
|
|
1027
1059
|
text: currentReasoningContent,
|
|
1028
1060
|
providerMetadata: currentReasoningThoughtSignature ? {
|
|
1029
|
-
google: {
|
|
1061
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1030
1062
|
thoughtSignature: currentReasoningThoughtSignature
|
|
1031
1063
|
}
|
|
1032
1064
|
} : void 0
|
|
@@ -1055,14 +1087,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1055
1087
|
content.push({
|
|
1056
1088
|
type: "text",
|
|
1057
1089
|
text: currentTextContent,
|
|
1058
|
-
providerMetadata: currentTextThoughtSignature ? {
|
|
1090
|
+
providerMetadata: currentTextThoughtSignature ? {
|
|
1091
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1092
|
+
thoughtSignature: currentTextThoughtSignature
|
|
1093
|
+
}
|
|
1094
|
+
} : void 0
|
|
1059
1095
|
});
|
|
1060
1096
|
}
|
|
1061
1097
|
if (currentReasoningContent) {
|
|
1062
1098
|
content.push({
|
|
1063
1099
|
type: "reasoning",
|
|
1064
1100
|
text: currentReasoningContent,
|
|
1065
|
-
providerMetadata: currentReasoningThoughtSignature ? {
|
|
1101
|
+
providerMetadata: currentReasoningThoughtSignature ? {
|
|
1102
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1103
|
+
thoughtSignature: currentReasoningThoughtSignature
|
|
1104
|
+
}
|
|
1105
|
+
} : void 0
|
|
1066
1106
|
});
|
|
1067
1107
|
}
|
|
1068
1108
|
const sources = (_h = extractSources({
|
|
@@ -1084,7 +1124,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1084
1124
|
},
|
|
1085
1125
|
warnings,
|
|
1086
1126
|
providerMetadata: {
|
|
1087
|
-
google: {
|
|
1127
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1088
1128
|
promptFeedback: promptFeedback != null ? promptFeedback : null,
|
|
1089
1129
|
groundingMetadata: groundingMetadata != null ? groundingMetadata : null,
|
|
1090
1130
|
urlContextMetadata: urlContextMetadata != null ? urlContextMetadata : null,
|
|
@@ -1100,7 +1140,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1100
1140
|
}
|
|
1101
1141
|
async doStream(options) {
|
|
1102
1142
|
var _a, _b;
|
|
1103
|
-
const { args, warnings, cloudAssistOptions } = await this.getArgs(options);
|
|
1143
|
+
const { args, warnings, cloudAssistOptions, providerKey } = await this.getArgs(options);
|
|
1104
1144
|
const wrappedRequest = {
|
|
1105
1145
|
project: cloudAssistOptions.projectId,
|
|
1106
1146
|
model: this.modelId,
|
|
@@ -1226,7 +1266,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1226
1266
|
type: "reasoning-start",
|
|
1227
1267
|
id: currentReasoningBlockId,
|
|
1228
1268
|
providerMetadata: part.thoughtSignature ? {
|
|
1229
|
-
google: {
|
|
1269
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1230
1270
|
thoughtSignature: part.thoughtSignature
|
|
1231
1271
|
}
|
|
1232
1272
|
} : void 0
|
|
@@ -1237,7 +1277,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1237
1277
|
id: currentReasoningBlockId,
|
|
1238
1278
|
delta: part.text,
|
|
1239
1279
|
providerMetadata: part.thoughtSignature ? {
|
|
1240
|
-
|
|
1280
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1281
|
+
thoughtSignature: part.thoughtSignature
|
|
1282
|
+
}
|
|
1241
1283
|
} : void 0
|
|
1242
1284
|
});
|
|
1243
1285
|
} else {
|
|
@@ -1254,7 +1296,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1254
1296
|
type: "text-start",
|
|
1255
1297
|
id: currentTextBlockId,
|
|
1256
1298
|
providerMetadata: part.thoughtSignature ? {
|
|
1257
|
-
google: {
|
|
1299
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1258
1300
|
thoughtSignature: part.thoughtSignature
|
|
1259
1301
|
}
|
|
1260
1302
|
} : void 0
|
|
@@ -1265,7 +1307,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1265
1307
|
id: currentTextBlockId,
|
|
1266
1308
|
delta: part.text,
|
|
1267
1309
|
providerMetadata: part.thoughtSignature ? {
|
|
1268
|
-
|
|
1310
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1311
|
+
thoughtSignature: part.thoughtSignature
|
|
1312
|
+
}
|
|
1269
1313
|
} : void 0
|
|
1270
1314
|
});
|
|
1271
1315
|
}
|
|
@@ -1280,7 +1324,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1280
1324
|
const toolCallDeltas = getToolCallsFromParts({
|
|
1281
1325
|
parts: content.parts,
|
|
1282
1326
|
generateId: generateId2,
|
|
1283
|
-
useToolCallId
|
|
1327
|
+
useToolCallId,
|
|
1328
|
+
providerKey
|
|
1284
1329
|
});
|
|
1285
1330
|
if (toolCallDeltas != null) {
|
|
1286
1331
|
for (const toolCall of toolCallDeltas) {
|
|
@@ -1318,7 +1363,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1318
1363
|
hasToolCalls
|
|
1319
1364
|
});
|
|
1320
1365
|
providerMetadata = {
|
|
1321
|
-
google: {
|
|
1366
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1322
1367
|
promptFeedback: (_j = responseData.promptFeedback) != null ? _j : null,
|
|
1323
1368
|
groundingMetadata: (_k = candidate.groundingMetadata) != null ? _k : null,
|
|
1324
1369
|
urlContextMetadata: (_l = candidate.urlContextMetadata) != null ? _l : null,
|
|
@@ -1326,7 +1371,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1326
1371
|
}
|
|
1327
1372
|
};
|
|
1328
1373
|
if (usageMetadata != null) {
|
|
1329
|
-
providerMetadata
|
|
1374
|
+
providerMetadata[providerKey != null ? providerKey : "google"].usageMetadata = usageMetadata;
|
|
1330
1375
|
}
|
|
1331
1376
|
}
|
|
1332
1377
|
},
|
|
@@ -1360,7 +1405,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1360
1405
|
function getToolCallsFromParts({
|
|
1361
1406
|
parts,
|
|
1362
1407
|
generateId: generateId2,
|
|
1363
|
-
useToolCallId = false
|
|
1408
|
+
useToolCallId = false,
|
|
1409
|
+
providerKey
|
|
1364
1410
|
}) {
|
|
1365
1411
|
const functionCallParts = parts == null ? void 0 : parts.filter(
|
|
1366
1412
|
(part) => "functionCall" in part
|
|
@@ -1371,7 +1417,11 @@ function getToolCallsFromParts({
|
|
|
1371
1417
|
toolCallId: useToolCallId && part.functionCall.id ? part.functionCall.id : generateId2(),
|
|
1372
1418
|
toolName: part.functionCall.name,
|
|
1373
1419
|
args: JSON.stringify(part.functionCall.args),
|
|
1374
|
-
providerMetadata: part.thoughtSignature ? {
|
|
1420
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1421
|
+
[providerKey != null ? providerKey : "google"]: {
|
|
1422
|
+
thoughtSignature: part.thoughtSignature
|
|
1423
|
+
}
|
|
1424
|
+
} : void 0
|
|
1375
1425
|
}));
|
|
1376
1426
|
}
|
|
1377
1427
|
function extractSources({
|