@n8n/n8n-nodes-langchain 2.0.0 → 2.1.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/credentials/McpOAuth2Api.credentials.js +1 -2
- package/dist/credentials/McpOAuth2Api.credentials.js.map +1 -1
- package/dist/nodes/agents/Agent/Agent.node.js +4 -2
- package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
- package/dist/nodes/agents/Agent/AgentTool.node.js +4 -2
- package/dist/nodes/agents/Agent/AgentTool.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js +1 -1
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V2/AgentV2.node.js +1 -1
- package/dist/nodes/agents/Agent/V2/AgentV2.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V3/AgentToolV3.node.js +99 -0
- package/dist/nodes/agents/Agent/V3/AgentToolV3.node.js.map +1 -0
- package/dist/nodes/agents/Agent/V3/AgentV3.node.js +9 -2
- package/dist/nodes/agents/Agent/V3/AgentV3.node.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/SqlAgent/description.js +1 -1
- package/dist/nodes/agents/Agent/agents/SqlAgent/description.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js +1 -3
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/executeBatch.js +4 -0
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/executeBatch.js.map +1 -1
- package/dist/nodes/chains/ChainLLM/ChainLlm.node.js +1 -1
- package/dist/nodes/chains/ChainLLM/ChainLlm.node.js.map +1 -1
- package/dist/nodes/chains/ChainLLM/methods/config.js +10 -2
- package/dist/nodes/chains/ChainLLM/methods/config.js.map +1 -1
- package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js +11 -3
- package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js.map +1 -1
- package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js +9 -3
- package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js.map +1 -1
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js +3 -0
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js.map +1 -1
- package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js +66 -15
- package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js.map +1 -1
- package/dist/nodes/trigger/ChatTrigger/templates.js +1 -2
- package/dist/nodes/trigger/ChatTrigger/templates.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/file/index.js +2 -2
- package/dist/nodes/vendors/GoogleGemini/actions/file/index.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/createStore.operation.js +64 -0
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/createStore.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/deleteStore.operation.js +72 -0
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/deleteStore.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/index.js +94 -0
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/index.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/listStores.operation.js +75 -0
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/listStores.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/uploadToStore.operation.js +129 -0
- package/dist/nodes/vendors/GoogleGemini/actions/fileSearch/uploadToStore.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/node.type.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/router.js +4 -0
- package/dist/nodes/vendors/GoogleGemini/actions/router.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js +184 -11
- package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/versionDescription.js +10 -3
- package/dist/nodes/vendors/GoogleGemini/actions/versionDescription.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/helpers/interfaces.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/helpers/utils.js +131 -26
- package/dist/nodes/vendors/GoogleGemini/helpers/utils.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js.map +1 -1
- package/dist/types/credentials.json +1 -1
- package/dist/types/nodes.json +9 -8
- package/dist/utils/agent-execution/buildSteps.js +67 -8
- package/dist/utils/agent-execution/buildSteps.js.map +1 -1
- package/dist/utils/agent-execution/createEngineRequests.js +27 -5
- package/dist/utils/agent-execution/createEngineRequests.js.map +1 -1
- package/dist/utils/agent-execution/types.js +24 -0
- package/dist/utils/agent-execution/types.js.map +1 -1
- package/dist/utils/descriptions.js +21 -1
- package/dist/utils/descriptions.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var uploadToStore_operation_exports = {};
|
|
20
|
+
__export(uploadToStore_operation_exports, {
|
|
21
|
+
description: () => description,
|
|
22
|
+
execute: () => execute,
|
|
23
|
+
properties: () => properties
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(uploadToStore_operation_exports);
|
|
26
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
27
|
+
var import_utils = require("../../helpers/utils");
|
|
28
|
+
const properties = [
|
|
29
|
+
{
|
|
30
|
+
displayName: "File Search Store Name",
|
|
31
|
+
name: "fileSearchStoreName",
|
|
32
|
+
type: "string",
|
|
33
|
+
placeholder: "e.g. fileSearchStores/abc123",
|
|
34
|
+
description: "The full name of the File Search store to upload to (format: fileSearchStores/...)",
|
|
35
|
+
default: "",
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
displayName: "File Display Name",
|
|
40
|
+
name: "displayName",
|
|
41
|
+
type: "string",
|
|
42
|
+
placeholder: "e.g. My Document",
|
|
43
|
+
description: "A human-readable name for the file (will be visible in citations)",
|
|
44
|
+
default: "",
|
|
45
|
+
required: true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
displayName: "Input Type",
|
|
49
|
+
name: "inputType",
|
|
50
|
+
type: "options",
|
|
51
|
+
default: "url",
|
|
52
|
+
options: [
|
|
53
|
+
{
|
|
54
|
+
name: "File URL",
|
|
55
|
+
value: "url"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "Binary File",
|
|
59
|
+
value: "binary"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: "URL",
|
|
65
|
+
name: "fileUrl",
|
|
66
|
+
type: "string",
|
|
67
|
+
placeholder: "e.g. https://example.com/file.pdf",
|
|
68
|
+
description: "URL of the file to upload",
|
|
69
|
+
default: "",
|
|
70
|
+
displayOptions: {
|
|
71
|
+
show: {
|
|
72
|
+
inputType: ["url"]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: "Input Data Field Name",
|
|
78
|
+
name: "binaryPropertyName",
|
|
79
|
+
type: "string",
|
|
80
|
+
default: "data",
|
|
81
|
+
placeholder: "e.g. data",
|
|
82
|
+
hint: "The name of the input field containing the binary file data to be processed",
|
|
83
|
+
description: "Name of the binary property which contains the file",
|
|
84
|
+
displayOptions: {
|
|
85
|
+
show: {
|
|
86
|
+
inputType: ["binary"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
const displayOptions = {
|
|
92
|
+
show: {
|
|
93
|
+
operation: ["uploadToStore"],
|
|
94
|
+
resource: ["fileSearch"]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
98
|
+
async function execute(i) {
|
|
99
|
+
const fileSearchStoreName = this.getNodeParameter("fileSearchStoreName", i, "");
|
|
100
|
+
const displayName = this.getNodeParameter("displayName", i, "");
|
|
101
|
+
const inputType = this.getNodeParameter("inputType", i, "url");
|
|
102
|
+
let fileUrl;
|
|
103
|
+
if (inputType === "url") {
|
|
104
|
+
fileUrl = this.getNodeParameter("fileUrl", i, "");
|
|
105
|
+
}
|
|
106
|
+
const response = await import_utils.uploadToFileSearchStore.call(
|
|
107
|
+
this,
|
|
108
|
+
i,
|
|
109
|
+
fileSearchStoreName,
|
|
110
|
+
displayName,
|
|
111
|
+
fileUrl,
|
|
112
|
+
"application/octet-stream"
|
|
113
|
+
);
|
|
114
|
+
return [
|
|
115
|
+
{
|
|
116
|
+
json: response ?? {},
|
|
117
|
+
pairedItem: {
|
|
118
|
+
item: i
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
description,
|
|
126
|
+
execute,
|
|
127
|
+
properties
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=uploadToStore.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/fileSearch/uploadToStore.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { uploadToFileSearchStore } from '../../helpers/utils';\n\nexport const properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'File Search Store Name',\n\t\tname: 'fileSearchStoreName',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. fileSearchStores/abc123',\n\t\tdescription:\n\t\t\t'The full name of the File Search store to upload to (format: fileSearchStores/...)',\n\t\tdefault: '',\n\t\trequired: true,\n\t},\n\t{\n\t\tdisplayName: 'File Display Name',\n\t\tname: 'displayName',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. My Document',\n\t\tdescription: 'A human-readable name for the file (will be visible in citations)',\n\t\tdefault: '',\n\t\trequired: true,\n\t},\n\t{\n\t\tdisplayName: 'Input Type',\n\t\tname: 'inputType',\n\t\ttype: 'options',\n\t\tdefault: 'url',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'File URL',\n\t\t\t\tvalue: 'url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Binary File',\n\t\t\t\tvalue: 'binary',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'URL',\n\t\tname: 'fileUrl',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. https://example.com/file.pdf',\n\t\tdescription: 'URL of the file to upload',\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['url'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Data Field Name',\n\t\tname: 'binaryPropertyName',\n\t\ttype: 'string',\n\t\tdefault: 'data',\n\t\tplaceholder: 'e.g. data',\n\t\thint: 'The name of the input field containing the binary file data to be processed',\n\t\tdescription: 'Name of the binary property which contains the file',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['binary'],\n\t\t\t},\n\t\t},\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['uploadToStore'],\n\t\tresource: ['fileSearch'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst fileSearchStoreName = this.getNodeParameter('fileSearchStoreName', i, '') as string;\n\tconst displayName = this.getNodeParameter('displayName', i, '') as string;\n\tconst inputType = this.getNodeParameter('inputType', i, 'url') as string;\n\n\tlet fileUrl: string | undefined;\n\tif (inputType === 'url') {\n\t\tfileUrl = this.getNodeParameter('fileUrl', i, '') as string;\n\t}\n\n\tconst response = await uploadToFileSearchStore.call(\n\t\tthis,\n\t\ti,\n\t\tfileSearchStoreName,\n\t\tdisplayName,\n\t\tfileUrl,\n\t\t'application/octet-stream',\n\t);\n\n\treturn [\n\t\t{\n\t\t\tjson: response ?? {},\n\t\t\tpairedItem: {\n\t\t\t\titem: i,\n\t\t\t},\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAErC,mBAAwC;AAEjC,MAAM,aAAgC;AAAA,EAC5C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aACC;AAAA,IACD,SAAS;AAAA,IACT,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,aAAa;AAAA,I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,MAAM,qCAAwB;AAAA,IAC9C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,MACC,MAAM,YAAY,CAAC;AAAA,MACnB,YAAY;AAAA,QACX,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/actions/node.type.ts"],"sourcesContent":["import type { AllEntities } from 'n8n-workflow';\n\ntype NodeMap = {\n\ttext: 'message';\n\timage: 'analyze' | 'generate';\n\tvideo: 'analyze' | 'generate' | 'download';\n\taudio: 'transcribe' | 'analyze';\n\tdocument: 'analyze';\n\tfile: 'upload';\n};\n\nexport type GoogleGeminiType = AllEntities<NodeMap>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/actions/node.type.ts"],"sourcesContent":["import type { AllEntities } from 'n8n-workflow';\n\ntype NodeMap = {\n\ttext: 'message';\n\timage: 'analyze' | 'generate';\n\tvideo: 'analyze' | 'generate' | 'download';\n\taudio: 'transcribe' | 'analyze';\n\tdocument: 'analyze';\n\tfile: 'upload';\n\tfileSearch: 'createStore' | 'deleteStore' | 'listStores' | 'uploadToStore';\n};\n\nexport type GoogleGeminiType = AllEntities<NodeMap>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -35,6 +35,7 @@ var import_n8n_workflow = require("n8n-workflow");
|
|
|
35
35
|
var audio = __toESM(require("./audio"));
|
|
36
36
|
var document = __toESM(require("./document"));
|
|
37
37
|
var file = __toESM(require("./file"));
|
|
38
|
+
var fileSearch = __toESM(require("./fileSearch"));
|
|
38
39
|
var image = __toESM(require("./image"));
|
|
39
40
|
var text = __toESM(require("./text"));
|
|
40
41
|
var video = __toESM(require("./video"));
|
|
@@ -58,6 +59,9 @@ async function router() {
|
|
|
58
59
|
case "file":
|
|
59
60
|
execute = file[googleGeminiTypeData.operation].execute;
|
|
60
61
|
break;
|
|
62
|
+
case "fileSearch":
|
|
63
|
+
execute = fileSearch[googleGeminiTypeData.operation].execute;
|
|
64
|
+
break;
|
|
61
65
|
case "image":
|
|
62
66
|
execute = image[googleGeminiTypeData.operation].execute;
|
|
63
67
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/actions/router.ts"],"sourcesContent":["import { NodeOperationError, type IExecuteFunctions, type INodeExecutionData } from 'n8n-workflow';\n\nimport * as audio from './audio';\nimport * as document from './document';\nimport * as file from './file';\nimport * as image from './image';\nimport type { GoogleGeminiType } from './node.type';\nimport * as text from './text';\nimport * as video from './video';\n\nexport async function router(this: IExecuteFunctions) {\n\tconst returnData: INodeExecutionData[] = [];\n\n\tconst items = this.getInputData();\n\tconst resource = this.getNodeParameter('resource', 0);\n\tconst operation = this.getNodeParameter('operation', 0);\n\n\tconst googleGeminiTypeData = {\n\t\tresource,\n\t\toperation,\n\t} as GoogleGeminiType;\n\n\tlet execute;\n\tswitch (googleGeminiTypeData.resource) {\n\t\tcase 'audio':\n\t\t\texecute = audio[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'document':\n\t\t\texecute = document[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'file':\n\t\t\texecute = file[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'image':\n\t\t\texecute = image[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'text':\n\t\t\texecute = text[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'video':\n\t\t\texecute = video[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`The operation \"${operation}\" is not supported!`,\n\t\t\t);\n\t}\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\ttry {\n\t\t\tconst responseData = await execute.call(this, i);\n\t\t\treturnData.push(...responseData);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\treturnData.push({ json: { error: error.message }, pairedItem: { item: i } });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(this.getNode(), error, {\n\t\t\t\titemIndex: i,\n\t\t\t\tdescription: error.description,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn [returnData];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAoF;AAEpF,YAAuB;AACvB,eAA0B;AAC1B,WAAsB;AACtB,YAAuB;AAEvB,WAAsB;AACtB,YAAuB;AAEvB,eAAsB,SAAgC;AACrD,QAAM,aAAmC,CAAC;AAE1C,QAAM,QAAQ,KAAK,aAAa;AAChC,QAAM,WAAW,KAAK,iBAAiB,YAAY,CAAC;AACpD,QAAM,YAAY,KAAK,iBAAiB,aAAa,CAAC;AAEtD,QAAM,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,EACD;AAEA,MAAI;AACJ,UAAQ,qBAAqB,UAAU;AAAA,IACtC,KAAK;AACJ,gBAAU,MAAM,qBAAqB,SAAS,EAAE;AAChD;AAAA,IACD,KAAK;AACJ,gBAAU,SAAS,qBAAqB,SAAS,EAAE;AACnD;AAAA,IACD,KAAK;AACJ,gBAAU,KAAK,qBAAqB,SAAS,EAAE;AAC/C;AAAA,IACD,KAAK;AACJ,gBAAU,MAAM,qBAAqB,SAAS,EAAE;AAChD;AAAA,IACD,KAAK;AACJ,gBAAU,KAAK,qBAAqB,SAAS,EAAE;AAC/C;AAAA,IACD,KAAK;AACJ,gBAAU,MAAM,qBAAqB,SAAS,EAAE;AAChD;AAAA,IACD;AACC,YAAM,IAAI;AAAA,QACT,KAAK,QAAQ;AAAA,QACb,kBAAkB,SAAS;AAAA,MAC5B;AAAA,EACF;AAEA,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACtC,QAAI;AACH,YAAM,eAAe,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC/C,iBAAW,KAAK,GAAG,YAAY;AAAA,IAChC,SAAS,OAAO;AACf,UAAI,KAAK,eAAe,GAAG;AAC1B,mBAAW,KAAK,EAAE,MAAM,EAAE,OAAO,MAAM,QAAQ,GAAG,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;AAC3E;AAAA,MACD;AAEA,YAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,OAAO;AAAA,QACnD,WAAW;AAAA,QACX,aAAa,MAAM;AAAA,MACpB,CAAC;AAAA,IACF;AAAA,EACD;AAEA,SAAO,CAAC,UAAU;AACnB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/actions/router.ts"],"sourcesContent":["import { NodeOperationError, type IExecuteFunctions, type INodeExecutionData } from 'n8n-workflow';\n\nimport * as audio from './audio';\nimport * as document from './document';\nimport * as file from './file';\nimport * as fileSearch from './fileSearch';\nimport * as image from './image';\nimport type { GoogleGeminiType } from './node.type';\nimport * as text from './text';\nimport * as video from './video';\n\nexport async function router(this: IExecuteFunctions) {\n\tconst returnData: INodeExecutionData[] = [];\n\n\tconst items = this.getInputData();\n\tconst resource = this.getNodeParameter('resource', 0);\n\tconst operation = this.getNodeParameter('operation', 0);\n\n\tconst googleGeminiTypeData = {\n\t\tresource,\n\t\toperation,\n\t} as GoogleGeminiType;\n\n\tlet execute;\n\tswitch (googleGeminiTypeData.resource) {\n\t\tcase 'audio':\n\t\t\texecute = audio[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'document':\n\t\t\texecute = document[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'file':\n\t\t\texecute = file[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'fileSearch':\n\t\t\texecute = fileSearch[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'image':\n\t\t\texecute = image[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'text':\n\t\t\texecute = text[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'video':\n\t\t\texecute = video[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`The operation \"${operation}\" is not supported!`,\n\t\t\t);\n\t}\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\ttry {\n\t\t\tconst responseData = await execute.call(this, i);\n\t\t\treturnData.push(...responseData);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\treturnData.push({ json: { error: error.message }, pairedItem: { item: i } });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(this.getNode(), error, {\n\t\t\t\titemIndex: i,\n\t\t\t\tdescription: error.description,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn [returnData];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAoF;AAEpF,YAAuB;AACvB,eAA0B;AAC1B,WAAsB;AACtB,iBAA4B;AAC5B,YAAuB;AAEvB,WAAsB;AACtB,YAAuB;AAEvB,eAAsB,SAAgC;AACrD,QAAM,aAAmC,CAAC;AAE1C,QAAM,QAAQ,KAAK,aAAa;AAChC,QAAM,WAAW,KAAK,iBAAiB,YAAY,CAAC;AACpD,QAAM,YAAY,KAAK,iBAAiB,aAAa,CAAC;AAEtD,QAAM,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,EACD;AAEA,MAAI;AACJ,UAAQ,qBAAqB,UAAU;AAAA,IACtC,KAAK;AACJ,gBAAU,MAAM,qBAAqB,SAAS,EAAE;AAChD;AAAA,IACD,KAAK;AACJ,gBAAU,SAAS,qBAAqB,SAAS,EAAE;AACnD;AAAA,IACD,KAAK;AACJ,gBAAU,KAAK,qBAAqB,SAAS,EAAE;AAC/C;AAAA,IACD,KAAK;AACJ,gBAAU,WAAW,qBAAqB,SAAS,EAAE;AACrD;AAAA,IACD,KAAK;AACJ,gBAAU,MAAM,qBAAqB,SAAS,EAAE;AAChD;AAAA,IACD,KAAK;AACJ,gBAAU,KAAK,qBAAqB,SAAS,EAAE;AAC/C;AAAA,IACD,KAAK;AACJ,gBAAU,MAAM,qBAAqB,SAAS,EAAE;AAChD;AAAA,IACD;AACC,YAAM,IAAI;AAAA,QACT,KAAK,QAAQ;AAAA,QACb,kBAAkB,SAAS;AAAA,MAC5B;AAAA,EACF;AAEA,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACtC,QAAI;AACH,YAAM,eAAe,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC/C,iBAAW,KAAK,GAAG,YAAY;AAAA,IAChC,SAAS,OAAO;AACf,UAAI,KAAK,eAAe,GAAG;AAC1B,mBAAW,KAAK,EAAE,MAAM,EAAE,OAAO,MAAM,QAAQ,GAAG,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;AAC3E;AAAA,MACD;AAEA,YAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,OAAO;AAAA,QACnD,WAAW;AAAA,QACX,aAAa,MAAM;AAAA,MACpB,CAAC;AAAA,IACF;AAAA,EACD;AAEA,SAAO,CAAC,UAAU;AACnB;","names":[]}
|
|
@@ -32,10 +32,9 @@ __export(message_operation_exports, {
|
|
|
32
32
|
execute: () => execute
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(message_operation_exports);
|
|
35
|
+
var import_helpers = require("../../../../../utils/helpers");
|
|
35
36
|
var import_n8n_workflow = require("n8n-workflow");
|
|
36
|
-
var import_n8n_workflow2 = require("n8n-workflow");
|
|
37
37
|
var import_zod_to_json_schema = __toESM(require("zod-to-json-schema"));
|
|
38
|
-
var import_helpers = require("../../../../../utils/helpers");
|
|
39
38
|
var import_transport = require("../../transport");
|
|
40
39
|
var import_descriptions = require("../descriptions");
|
|
41
40
|
const properties = [
|
|
@@ -103,6 +102,93 @@ const properties = [
|
|
|
103
102
|
description: "Whether to attempt to return the response in JSON format",
|
|
104
103
|
default: false
|
|
105
104
|
},
|
|
105
|
+
{
|
|
106
|
+
displayName: "Built-in Tools",
|
|
107
|
+
name: "builtInTools",
|
|
108
|
+
placeholder: "Add Built-in Tool",
|
|
109
|
+
type: "collection",
|
|
110
|
+
default: {},
|
|
111
|
+
displayOptions: {
|
|
112
|
+
show: {
|
|
113
|
+
"@version": [{ _cnd: { gte: 1.1 } }]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
options: [
|
|
117
|
+
{
|
|
118
|
+
displayName: "Google Search",
|
|
119
|
+
name: "googleSearch",
|
|
120
|
+
type: "boolean",
|
|
121
|
+
default: true,
|
|
122
|
+
description: "Whether to allow the model to search the web using Google Search to get real-time information"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
displayName: "Google Maps",
|
|
126
|
+
name: "googleMaps",
|
|
127
|
+
type: "collection",
|
|
128
|
+
default: { latitude: "", longitude: "" },
|
|
129
|
+
options: [
|
|
130
|
+
{
|
|
131
|
+
displayName: "Latitude",
|
|
132
|
+
name: "latitude",
|
|
133
|
+
type: "number",
|
|
134
|
+
default: "",
|
|
135
|
+
description: "The latitude coordinate for location-based queries",
|
|
136
|
+
typeOptions: {
|
|
137
|
+
numberPrecision: 6
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
displayName: "Longitude",
|
|
142
|
+
name: "longitude",
|
|
143
|
+
type: "number",
|
|
144
|
+
default: "",
|
|
145
|
+
description: "The longitude coordinate for location-based queries",
|
|
146
|
+
typeOptions: {
|
|
147
|
+
numberPrecision: 6
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
displayName: "URL Context",
|
|
154
|
+
name: "urlContext",
|
|
155
|
+
type: "boolean",
|
|
156
|
+
default: true,
|
|
157
|
+
description: "Whether to allow the model to read and analyze content from specific URLs"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
displayName: "File Search",
|
|
161
|
+
name: "fileSearch",
|
|
162
|
+
type: "collection",
|
|
163
|
+
default: { fileSearchStoreNames: "[]" },
|
|
164
|
+
options: [
|
|
165
|
+
{
|
|
166
|
+
displayName: "File Search Store Names",
|
|
167
|
+
name: "fileSearchStoreNames",
|
|
168
|
+
description: "The file search store names to use for the file search. File search stores are managed via Google AI Studio.",
|
|
169
|
+
type: "json",
|
|
170
|
+
default: "[]",
|
|
171
|
+
required: true
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
displayName: "Metadata Filter",
|
|
175
|
+
name: "metadataFilter",
|
|
176
|
+
type: "string",
|
|
177
|
+
default: "",
|
|
178
|
+
description: 'Use metadata filter to search within a subset of documents. Example: author="Robert Graves".',
|
|
179
|
+
placeholder: 'e.g. author="John Doe"'
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
displayName: "Code Execution",
|
|
185
|
+
name: "codeExecution",
|
|
186
|
+
type: "boolean",
|
|
187
|
+
default: true,
|
|
188
|
+
description: "Whether to allow the model to execute code it generates to produce a response. Supported only by certain models."
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
},
|
|
106
192
|
{
|
|
107
193
|
displayName: "Options",
|
|
108
194
|
name: "options",
|
|
@@ -110,6 +196,18 @@ const properties = [
|
|
|
110
196
|
type: "collection",
|
|
111
197
|
default: {},
|
|
112
198
|
options: [
|
|
199
|
+
{
|
|
200
|
+
displayName: "Include Merged Response",
|
|
201
|
+
name: "includeMergedResponse",
|
|
202
|
+
type: "boolean",
|
|
203
|
+
default: false,
|
|
204
|
+
description: "Whether to include a single output string merging all text parts of the response",
|
|
205
|
+
displayOptions: {
|
|
206
|
+
show: {
|
|
207
|
+
"@version": [{ _cnd: { gte: 1.1 } }]
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
113
211
|
{
|
|
114
212
|
displayName: "System Message",
|
|
115
213
|
name: "systemMessage",
|
|
@@ -122,7 +220,12 @@ const properties = [
|
|
|
122
220
|
name: "codeExecution",
|
|
123
221
|
type: "boolean",
|
|
124
222
|
default: false,
|
|
125
|
-
description: "Whether to allow the model to execute code it generates to produce a response. Supported only by certain models."
|
|
223
|
+
description: "Whether to allow the model to execute code it generates to produce a response. Supported only by certain models.",
|
|
224
|
+
displayOptions: {
|
|
225
|
+
show: {
|
|
226
|
+
"@version": [{ _cnd: { eq: 1 } }]
|
|
227
|
+
}
|
|
228
|
+
}
|
|
126
229
|
},
|
|
127
230
|
{
|
|
128
231
|
displayName: "Frequency Penalty",
|
|
@@ -238,7 +341,7 @@ const displayOptions = {
|
|
|
238
341
|
resource: ["text"]
|
|
239
342
|
}
|
|
240
343
|
};
|
|
241
|
-
const description = (0,
|
|
344
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
242
345
|
function getToolCalls(response) {
|
|
243
346
|
return response.candidates.flatMap((c) => c.content.parts).filter((p) => "functionCall" in p);
|
|
244
347
|
}
|
|
@@ -248,9 +351,11 @@ async function execute(i) {
|
|
|
248
351
|
const simplify = this.getNodeParameter("simplify", i, true);
|
|
249
352
|
const jsonOutput = this.getNodeParameter("jsonOutput", i, false);
|
|
250
353
|
const options = this.getNodeParameter("options", i, {});
|
|
354
|
+
const builtInTools = this.getNodeParameter("builtInTools", i, {});
|
|
251
355
|
(0, import_n8n_workflow.validateNodeParameters)(
|
|
252
356
|
options,
|
|
253
357
|
{
|
|
358
|
+
includeMergedResponse: { type: "boolean", required: false },
|
|
254
359
|
systemMessage: { type: "string", required: false },
|
|
255
360
|
codeExecution: { type: "boolean", required: false },
|
|
256
361
|
frequencyPenalty: { type: "number", required: false },
|
|
@@ -298,10 +403,70 @@ async function execute(i) {
|
|
|
298
403
|
if (!tools[0].functionDeclarations?.length) {
|
|
299
404
|
tools.pop();
|
|
300
405
|
}
|
|
301
|
-
if (
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
406
|
+
if (this.getNode().typeVersion === 1) {
|
|
407
|
+
if (options.codeExecution) {
|
|
408
|
+
tools.push({
|
|
409
|
+
codeExecution: {}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
let toolConfig;
|
|
414
|
+
if (this.getNode().typeVersion >= 1.1) {
|
|
415
|
+
if (builtInTools) {
|
|
416
|
+
if (builtInTools.googleSearch) {
|
|
417
|
+
tools.push({
|
|
418
|
+
googleSearch: {}
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
const googleMapsOptions = builtInTools.googleMaps;
|
|
422
|
+
if (googleMapsOptions) {
|
|
423
|
+
tools.push({
|
|
424
|
+
googleMaps: {}
|
|
425
|
+
});
|
|
426
|
+
const latitude = googleMapsOptions.latitude;
|
|
427
|
+
const longitude = googleMapsOptions.longitude;
|
|
428
|
+
if (latitude !== void 0 && latitude !== "" && longitude !== void 0 && longitude !== "") {
|
|
429
|
+
toolConfig = {
|
|
430
|
+
retrievalConfig: {
|
|
431
|
+
latLng: {
|
|
432
|
+
latitude: Number(latitude),
|
|
433
|
+
longitude: Number(longitude)
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (builtInTools.urlContext) {
|
|
440
|
+
tools.push({
|
|
441
|
+
urlContext: {}
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
const fileSearchOptions = builtInTools.fileSearch;
|
|
445
|
+
if (fileSearchOptions) {
|
|
446
|
+
const fileSearchStoreNamesRaw = fileSearchOptions.fileSearchStoreNames;
|
|
447
|
+
const metadataFilter = fileSearchOptions.metadataFilter;
|
|
448
|
+
let fileSearchStoreNames;
|
|
449
|
+
if (fileSearchStoreNamesRaw) {
|
|
450
|
+
const parsed = (0, import_n8n_workflow.jsonParse)(fileSearchStoreNamesRaw, {
|
|
451
|
+
errorMessage: "Failed to parse file search store names"
|
|
452
|
+
});
|
|
453
|
+
if (Array.isArray(parsed)) {
|
|
454
|
+
fileSearchStoreNames = parsed;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
tools.push({
|
|
458
|
+
fileSearch: {
|
|
459
|
+
...fileSearchStoreNames && { fileSearchStoreNames },
|
|
460
|
+
...metadataFilter && { metadataFilter }
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
if (builtInTools.codeExecution) {
|
|
465
|
+
tools.push({
|
|
466
|
+
codeExecution: {}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
}
|
|
305
470
|
}
|
|
306
471
|
const contents = messages.map((m) => ({
|
|
307
472
|
parts: [{ text: m.content }],
|
|
@@ -311,7 +476,8 @@ async function execute(i) {
|
|
|
311
476
|
tools,
|
|
312
477
|
contents,
|
|
313
478
|
generationConfig,
|
|
314
|
-
systemInstruction: options.systemMessage ? { parts: [{ text: options.systemMessage }] } : void 0
|
|
479
|
+
systemInstruction: options.systemMessage ? { parts: [{ text: options.systemMessage }] } : void 0,
|
|
480
|
+
...toolConfig && { toolConfig }
|
|
315
481
|
};
|
|
316
482
|
let response = await import_transport.apiRequest.call(this, "POST", `/v1beta/${model}:generateContent`, {
|
|
317
483
|
body
|
|
@@ -353,15 +519,22 @@ async function execute(i) {
|
|
|
353
519
|
toolCalls = getToolCalls(response);
|
|
354
520
|
currentIteration++;
|
|
355
521
|
}
|
|
522
|
+
const candidates = options.includeMergedResponse ? response.candidates.map((candidate) => ({
|
|
523
|
+
...candidate,
|
|
524
|
+
mergedResponse: candidate.content.parts.filter((part) => "text" in part).map((part) => part.text).join("")
|
|
525
|
+
})) : response.candidates;
|
|
356
526
|
if (simplify) {
|
|
357
|
-
return
|
|
527
|
+
return candidates.map((candidate) => ({
|
|
358
528
|
json: candidate,
|
|
359
529
|
pairedItem: { item: i }
|
|
360
530
|
}));
|
|
361
531
|
}
|
|
362
532
|
return [
|
|
363
533
|
{
|
|
364
|
-
json: {
|
|
534
|
+
json: {
|
|
535
|
+
...response,
|
|
536
|
+
candidates
|
|
537
|
+
},
|
|
365
538
|
pairedItem: { item: i }
|
|
366
539
|
}
|
|
367
540
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/text/message.operation.ts"],"sourcesContent":["import {\n\ttype IDataObject,\n\ttype IExecuteFunctions,\n\ttype INodeExecutionData,\n\ttype INodeProperties,\n\tvalidateNodeParameters,\n} from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\nimport zodToJsonSchema from 'zod-to-json-schema';\n\nimport { getConnectedTools } from '@utils/helpers';\n\nimport type {\n\tGenerateContentRequest,\n\tGenerateContentResponse,\n\tContent,\n\tTool,\n\tGenerateContentGenerationConfig,\n} from '../../helpers/interfaces';\nimport { apiRequest } from '../../transport';\nimport { modelRLC } from '../descriptions';\n\nconst properties: INodeProperties[] = [\n\tmodelRLC('modelSearch'),\n\t{\n\t\tdisplayName: 'Messages',\n\t\tname: 'messages',\n\t\ttype: 'fixedCollection',\n\t\ttypeOptions: {\n\t\t\tsortable: true,\n\t\t\tmultipleValues: true,\n\t\t},\n\t\tplaceholder: 'Add Message',\n\t\tdefault: { values: [{ content: '' }] },\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Values',\n\t\t\t\tname: 'values',\n\t\t\t\tvalues: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Prompt',\n\t\t\t\t\t\tname: 'content',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The content of the message to be send',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tplaceholder: 'e.g. Hello, how can you help me?',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\trows: 2,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Role',\n\t\t\t\t\t\tname: 'role',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"Role in shaping the model's response, it tells the model how it should behave and interact with the user\",\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'User',\n\t\t\t\t\t\t\t\tvalue: 'user',\n\t\t\t\t\t\t\t\tdescription: 'Send a message as a user and get a response from the model',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Model',\n\t\t\t\t\t\t\t\tvalue: 'model',\n\t\t\t\t\t\t\t\tdescription: 'Tell the model to adopt a specific tone or personality',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdefault: 'user',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Simplify Output',\n\t\tname: 'simplify',\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t\tdescription: 'Whether to return a simplified version of the response instead of the raw data',\n\t},\n\t{\n\t\tdisplayName: 'Output Content as JSON',\n\t\tname: 'jsonOutput',\n\t\ttype: 'boolean',\n\t\tdescription: 'Whether to attempt to return the response in JSON format',\n\t\tdefault: false,\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\tplaceholder: 'Add Option',\n\t\ttype: 'collection',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'System Message',\n\t\t\t\tname: 'systemMessage',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. You are a helpful assistant',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Code Execution',\n\t\t\t\tname: 'codeExecution',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to allow the model to execute code it generates to produce a response. Supported only by certain models.',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Frequency Penalty',\n\t\t\t\tname: 'frequencyPenalty',\n\t\t\t\tdefault: 0,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim\",\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: -2,\n\t\t\t\t\tmaxValue: 2,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Maximum Number of Tokens',\n\t\t\t\tname: 'maxOutputTokens',\n\t\t\t\tdefault: 16,\n\t\t\t\tdescription: 'The maximum number of tokens to generate in the completion',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Number of Completions',\n\t\t\t\tname: 'candidateCount',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription: 'How many completions to generate for each prompt',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t\tmaxValue: 8, // Google Gemini supports up to 8 candidates\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Presence Penalty',\n\t\t\t\tname: 'presencePenalty',\n\t\t\t\tdefault: 0,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics\",\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: -2,\n\t\t\t\t\tmaxValue: 2,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Output Randomness (Temperature)',\n\t\t\t\tname: 'temperature',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription:\n\t\t\t\t\t'Controls the randomness of the output. Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 0,\n\t\t\t\t\tmaxValue: 2,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Output Randomness (Top P)',\n\t\t\t\tname: 'topP',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription: 'The maximum cumulative probability of tokens to consider when sampling',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 0,\n\t\t\t\t\tmaxValue: 1,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Output Randomness (Top K)',\n\t\t\t\tname: 'topK',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription: 'The maximum number of tokens to consider when sampling',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Thinking Budget',\n\t\t\t\tname: 'thinkingBudget',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: undefined,\n\t\t\t\tdescription:\n\t\t\t\t\t'Controls reasoning tokens for thinking models. Set to 0 to disable automatic thinking. Set to -1 for dynamic thinking. Leave empty for auto mode.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: -1,\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Max Tool Calls Iterations',\n\t\t\t\tname: 'maxToolsIterations',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 15,\n\t\t\t\tdescription:\n\t\t\t\t\t'The maximum number of tool iteration cycles the LLM will run before stopping. A single iteration can contain multiple tool calls. Set to 0 for no limit',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 0,\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['message'],\n\t\tresource: ['text'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nfunction getToolCalls(response: GenerateContentResponse) {\n\treturn response.candidates.flatMap((c) => c.content.parts).filter((p) => 'functionCall' in p);\n}\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst model = this.getNodeParameter('modelId', i, '', { extractValue: true }) as string;\n\tconst messages = this.getNodeParameter('messages.values', i, []) as Array<{\n\t\tcontent: string;\n\t\trole: string;\n\t}>;\n\tconst simplify = this.getNodeParameter('simplify', i, true) as boolean;\n\tconst jsonOutput = this.getNodeParameter('jsonOutput', i, false) as boolean;\n\tconst options = this.getNodeParameter('options', i, {});\n\tvalidateNodeParameters(\n\t\toptions,\n\t\t{\n\t\t\tsystemMessage: { type: 'string', required: false },\n\t\t\tcodeExecution: { type: 'boolean', required: false },\n\t\t\tfrequencyPenalty: { type: 'number', required: false },\n\t\t\tmaxOutputTokens: { type: 'number', required: false },\n\t\t\tcandidateCount: { type: 'number', required: false },\n\t\t\tpresencePenalty: { type: 'number', required: false },\n\t\t\ttemperature: { type: 'number', required: false },\n\t\t\ttopP: { type: 'number', required: false },\n\t\t\ttopK: { type: 'number', required: false },\n\t\t\tthinkingBudget: { type: 'number', required: false },\n\t\t\tmaxToolsIterations: { type: 'number', required: false },\n\t\t},\n\t\tthis.getNode(),\n\t);\n\n\tconst generationConfig: GenerateContentGenerationConfig = {\n\t\tfrequencyPenalty: options.frequencyPenalty,\n\t\tmaxOutputTokens: options.maxOutputTokens,\n\t\tcandidateCount: options.candidateCount,\n\t\tpresencePenalty: options.presencePenalty,\n\t\ttemperature: options.temperature,\n\t\ttopP: options.topP,\n\t\ttopK: options.topK,\n\t\tresponseMimeType: jsonOutput ? 'application/json' : undefined,\n\t};\n\n\t// Add thinkingConfig if thinkingBudget is specified\n\tif (options.thinkingBudget !== undefined) {\n\t\tgenerationConfig.thinkingConfig = {\n\t\t\tthinkingBudget: options.thinkingBudget,\n\t\t};\n\t}\n\n\tconst nodeInputs = this.getNodeInputs();\n\tconst availableTools = nodeInputs.some((i) => i.type === 'ai_tool')\n\t\t? await getConnectedTools(this, true)\n\t\t: [];\n\tconst tools: Tool[] = [\n\t\t{\n\t\t\tfunctionDeclarations: availableTools.map((t) => ({\n\t\t\t\tname: t.name,\n\t\t\t\tdescription: t.description,\n\t\t\t\tparameters: {\n\t\t\t\t\t...zodToJsonSchema(t.schema, { target: 'openApi3' }),\n\t\t\t\t\t// Google Gemini API throws an error if `additionalProperties` field is present\n\t\t\t\t\tadditionalProperties: undefined,\n\t\t\t\t},\n\t\t\t})),\n\t\t},\n\t];\n\tif (!tools[0].functionDeclarations?.length) {\n\t\ttools.pop();\n\t}\n\n\tif (options.codeExecution) {\n\t\ttools.push({\n\t\t\tcodeExecution: {},\n\t\t});\n\t}\n\n\tconst contents: Content[] = messages.map((m) => ({\n\t\tparts: [{ text: m.content }],\n\t\trole: m.role,\n\t}));\n\tconst body: GenerateContentRequest = {\n\t\ttools,\n\t\tcontents,\n\t\tgenerationConfig,\n\t\tsystemInstruction: options.systemMessage\n\t\t\t? { parts: [{ text: options.systemMessage }] }\n\t\t\t: undefined,\n\t};\n\n\tlet response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:generateContent`, {\n\t\tbody,\n\t})) as GenerateContentResponse;\n\n\tconst maxToolsIterations = this.getNodeParameter('options.maxToolsIterations', i, 15) as number;\n\tconst abortSignal = this.getExecutionCancelSignal();\n\tlet currentIteration = 1;\n\tlet toolCalls = getToolCalls(response);\n\twhile (toolCalls.length) {\n\t\tif (\n\t\t\t(maxToolsIterations > 0 && currentIteration >= maxToolsIterations) ||\n\t\t\tabortSignal?.aborted\n\t\t) {\n\t\t\tbreak;\n\t\t}\n\n\t\tcontents.push(...response.candidates.map((c) => c.content));\n\n\t\tfor (const { functionCall } of toolCalls) {\n\t\t\tlet toolResponse;\n\t\t\tfor (const availableTool of availableTools) {\n\t\t\t\tif (availableTool.name === functionCall.name) {\n\t\t\t\t\ttoolResponse = (await availableTool.invoke(functionCall.args)) as IDataObject;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontents.push({\n\t\t\t\tparts: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfunctionResponse: {\n\t\t\t\t\t\t\tid: functionCall.id,\n\t\t\t\t\t\t\tname: functionCall.name,\n\t\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\t\tresult: toolResponse,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\trole: 'tool',\n\t\t\t});\n\t\t}\n\n\t\tresponse = (await apiRequest.call(this, 'POST', `/v1beta/${model}:generateContent`, {\n\t\t\tbody,\n\t\t})) as GenerateContentResponse;\n\t\ttoolCalls = getToolCalls(response);\n\t\tcurrentIteration++;\n\t}\n\n\tif (simplify) {\n\t\treturn response.candidates.map((candidate) => ({\n\t\t\tjson: candidate,\n\t\t\tpairedItem: { item: i },\n\t\t}));\n\t}\n\n\treturn [\n\t\t{\n\t\t\tjson: { ...response },\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAMO;AACP,IAAAA,uBAAqC;AACrC,gCAA4B;AAE5B,qBAAkC;AASlC,uBAA2B;AAC3B,0B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AAO;AAAA,UACN;AAAA,YACC,kBAAkB;AAAA,cACjB,IAAI,aAAa;AAAA,cACjB,MAAM,aAAa;AAAA,cACnB,UAAU;AAAA,gBACT,QAAQ;AAAA,cACT;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,MAAM;AAAA,MACP,CAAC;AAAA,IACF;AAEA,eAAY,MAAM,4BAAW,KAAK,MAAM,QAAQ,WAAW,KAAK,oBAAoB;AAAA,MACnF;AAAA,IACD,CAAC;AACD,gBAAY,aAAa,QAAQ;AACjC;AAAA,EACD;AAEA,MAAI,UAAU;AACb,WAAO,SAAS,WAAW,IAAI,CAAC,eAAe;AAAA,MAC9C,MAAM;AAAA,MACN,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB,EAAE;AAAA,EACH;AAEA,SAAO;AAAA,IACN;AAAA,MACC,MAAM,EAAE,GAAG,SAAS;AAAA,MACpB,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB;AAAA,EACD;AACD;","names":["import_n8n_workflow","i","zodToJsonSchema"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/text/message.operation.ts"],"sourcesContent":["import { getConnectedTools } from '@utils/helpers';\nimport {\n\ttype IDataObject,\n\ttype IExecuteFunctions,\n\ttype INodeExecutionData,\n\ttype INodeProperties,\n\tjsonParse,\n\tupdateDisplayOptions,\n\tvalidateNodeParameters,\n} from 'n8n-workflow';\nimport zodToJsonSchema from 'zod-to-json-schema';\n\nimport type {\n\tGenerateContentRequest,\n\tGenerateContentResponse,\n\tContent,\n\tTool,\n\tGenerateContentGenerationConfig,\n\tBuiltInTools,\n} from '../../helpers/interfaces';\nimport { apiRequest } from '../../transport';\nimport { modelRLC } from '../descriptions';\n\nconst properties: INodeProperties[] = [\n\tmodelRLC('modelSearch'),\n\t{\n\t\tdisplayName: 'Messages',\n\t\tname: 'messages',\n\t\ttype: 'fixedCollection',\n\t\ttypeOptions: {\n\t\t\tsortable: true,\n\t\t\tmultipleValues: true,\n\t\t},\n\t\tplaceholder: 'Add Message',\n\t\tdefault: { values: [{ content: '' }] },\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Values',\n\t\t\t\tname: 'values',\n\t\t\t\tvalues: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Prompt',\n\t\t\t\t\t\tname: 'content',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The content of the message to be send',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tplaceholder: 'e.g. Hello, how can you help me?',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\trows: 2,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Role',\n\t\t\t\t\t\tname: 'role',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"Role in shaping the model's response, it tells the model how it should behave and interact with the user\",\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'User',\n\t\t\t\t\t\t\t\tvalue: 'user',\n\t\t\t\t\t\t\t\tdescription: 'Send a message as a user and get a response from the model',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Model',\n\t\t\t\t\t\t\t\tvalue: 'model',\n\t\t\t\t\t\t\t\tdescription: 'Tell the model to adopt a specific tone or personality',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdefault: 'user',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Simplify Output',\n\t\tname: 'simplify',\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t\tdescription: 'Whether to return a simplified version of the response instead of the raw data',\n\t},\n\t{\n\t\tdisplayName: 'Output Content as JSON',\n\t\tname: 'jsonOutput',\n\t\ttype: 'boolean',\n\t\tdescription: 'Whether to attempt to return the response in JSON format',\n\t\tdefault: false,\n\t},\n\t{\n\t\tdisplayName: 'Built-in Tools',\n\t\tname: 'builtInTools',\n\t\tplaceholder: 'Add Built-in Tool',\n\t\ttype: 'collection',\n\t\tdefault: {},\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'@version': [{ _cnd: { gte: 1.1 } }],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Google Search',\n\t\t\t\tname: 'googleSearch',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: true,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to allow the model to search the web using Google Search to get real-time information',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Google Maps',\n\t\t\t\tname: 'googleMaps',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdefault: { latitude: '', longitude: '' },\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Latitude',\n\t\t\t\t\t\tname: 'latitude',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tdescription: 'The latitude coordinate for location-based queries',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tnumberPrecision: 6,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Longitude',\n\t\t\t\t\t\tname: 'longitude',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tdescription: 'The longitude coordinate for location-based queries',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tnumberPrecision: 6,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'URL Context',\n\t\t\t\tname: 'urlContext',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: true,\n\t\t\t\tdescription: 'Whether to allow the model to read and analyze content from specific URLs',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'File Search',\n\t\t\t\tname: 'fileSearch',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdefault: { fileSearchStoreNames: '[]' },\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'File Search Store Names',\n\t\t\t\t\t\tname: 'fileSearchStoreNames',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'The file search store names to use for the file search. File search stores are managed via Google AI Studio.',\n\t\t\t\t\t\ttype: 'json',\n\t\t\t\t\t\tdefault: '[]',\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Metadata Filter',\n\t\t\t\t\t\tname: 'metadataFilter',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Use metadata filter to search within a subset of documents. Example: author=\"Robert Graves\".',\n\t\t\t\t\t\tplaceholder: 'e.g. author=\"John Doe\"',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Code Execution',\n\t\t\t\tname: 'codeExecution',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: true,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to allow the model to execute code it generates to produce a response. Supported only by certain models.',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\tplaceholder: 'Add Option',\n\t\ttype: 'collection',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Include Merged Response',\n\t\t\t\tname: 'includeMergedResponse',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to include a single output string merging all text parts of the response',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.1 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'System Message',\n\t\t\t\tname: 'systemMessage',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. You are a helpful assistant',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Code Execution',\n\t\t\t\tname: 'codeExecution',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to allow the model to execute code it generates to produce a response. Supported only by certain models.',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { eq: 1 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Frequency Penalty',\n\t\t\t\tname: 'frequencyPenalty',\n\t\t\t\tdefault: 0,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim\",\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: -2,\n\t\t\t\t\tmaxValue: 2,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Maximum Number of Tokens',\n\t\t\t\tname: 'maxOutputTokens',\n\t\t\t\tdefault: 16,\n\t\t\t\tdescription: 'The maximum number of tokens to generate in the completion',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Number of Completions',\n\t\t\t\tname: 'candidateCount',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription: 'How many completions to generate for each prompt',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t\tmaxValue: 8, // Google Gemini supports up to 8 candidates\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Presence Penalty',\n\t\t\t\tname: 'presencePenalty',\n\t\t\t\tdefault: 0,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics\",\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: -2,\n\t\t\t\t\tmaxValue: 2,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Output Randomness (Temperature)',\n\t\t\t\tname: 'temperature',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription:\n\t\t\t\t\t'Controls the randomness of the output. Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 0,\n\t\t\t\t\tmaxValue: 2,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Output Randomness (Top P)',\n\t\t\t\tname: 'topP',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription: 'The maximum cumulative probability of tokens to consider when sampling',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 0,\n\t\t\t\t\tmaxValue: 1,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Output Randomness (Top K)',\n\t\t\t\tname: 'topK',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription: 'The maximum number of tokens to consider when sampling',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Thinking Budget',\n\t\t\t\tname: 'thinkingBudget',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: undefined,\n\t\t\t\tdescription:\n\t\t\t\t\t'Controls reasoning tokens for thinking models. Set to 0 to disable automatic thinking. Set to -1 for dynamic thinking. Leave empty for auto mode.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: -1,\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Max Tool Calls Iterations',\n\t\t\t\tname: 'maxToolsIterations',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 15,\n\t\t\t\tdescription:\n\t\t\t\t\t'The maximum number of tool iteration cycles the LLM will run before stopping. A single iteration can contain multiple tool calls. Set to 0 for no limit',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 0,\n\t\t\t\t\tnumberPrecision: 0,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['message'],\n\t\tresource: ['text'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nfunction getToolCalls(response: GenerateContentResponse) {\n\treturn response.candidates.flatMap((c) => c.content.parts).filter((p) => 'functionCall' in p);\n}\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst model = this.getNodeParameter('modelId', i, '', { extractValue: true }) as string;\n\tconst messages = this.getNodeParameter('messages.values', i, []) as Array<{\n\t\tcontent: string;\n\t\trole: string;\n\t}>;\n\tconst simplify = this.getNodeParameter('simplify', i, true) as boolean;\n\tconst jsonOutput = this.getNodeParameter('jsonOutput', i, false) as boolean;\n\tconst options = this.getNodeParameter('options', i, {});\n\tconst builtInTools = this.getNodeParameter('builtInTools', i, {}) as BuiltInTools;\n\tvalidateNodeParameters(\n\t\toptions,\n\t\t{\n\t\t\tincludeMergedResponse: { type: 'boolean', required: false },\n\t\t\tsystemMessage: { type: 'string', required: false },\n\t\t\tcodeExecution: { type: 'boolean', required: false },\n\t\t\tfrequencyPenalty: { type: 'number', required: false },\n\t\t\tmaxOutputTokens: { type: 'number', required: false },\n\t\t\tcandidateCount: { type: 'number', required: false },\n\t\t\tpresencePenalty: { type: 'number', required: false },\n\t\t\ttemperature: { type: 'number', required: false },\n\t\t\ttopP: { type: 'number', required: false },\n\t\t\ttopK: { type: 'number', required: false },\n\t\t\tthinkingBudget: { type: 'number', required: false },\n\t\t\tmaxToolsIterations: { type: 'number', required: false },\n\t\t},\n\t\tthis.getNode(),\n\t);\n\n\tconst generationConfig: GenerateContentGenerationConfig = {\n\t\tfrequencyPenalty: options.frequencyPenalty,\n\t\tmaxOutputTokens: options.maxOutputTokens,\n\t\tcandidateCount: options.candidateCount,\n\t\tpresencePenalty: options.presencePenalty,\n\t\ttemperature: options.temperature,\n\t\ttopP: options.topP,\n\t\ttopK: options.topK,\n\t\tresponseMimeType: jsonOutput ? 'application/json' : undefined,\n\t};\n\n\t// Add thinkingConfig if thinkingBudget is specified\n\tif (options.thinkingBudget !== undefined) {\n\t\tgenerationConfig.thinkingConfig = {\n\t\t\tthinkingBudget: options.thinkingBudget,\n\t\t};\n\t}\n\n\tconst nodeInputs = this.getNodeInputs();\n\tconst availableTools = nodeInputs.some((i) => i.type === 'ai_tool')\n\t\t? await getConnectedTools(this, true)\n\t\t: [];\n\tconst tools: Tool[] = [\n\t\t{\n\t\t\tfunctionDeclarations: availableTools.map((t) => ({\n\t\t\t\tname: t.name,\n\t\t\t\tdescription: t.description,\n\t\t\t\tparameters: {\n\t\t\t\t\t...zodToJsonSchema(t.schema, { target: 'openApi3' }),\n\t\t\t\t\t// Google Gemini API throws an error if `additionalProperties` field is present\n\t\t\t\t\tadditionalProperties: undefined,\n\t\t\t\t},\n\t\t\t})),\n\t\t},\n\t];\n\tif (!tools[0].functionDeclarations?.length) {\n\t\ttools.pop();\n\t}\n\n\tif (this.getNode().typeVersion === 1) {\n\t\tif (options.codeExecution) {\n\t\t\ttools.push({\n\t\t\t\tcodeExecution: {},\n\t\t\t});\n\t\t}\n\t}\n\n\t// Add built-in tools and build toolConfig\n\tlet toolConfig: GenerateContentRequest['toolConfig'];\n\tif (this.getNode().typeVersion >= 1.1) {\n\t\tif (builtInTools) {\n\t\t\tif (builtInTools.googleSearch) {\n\t\t\t\ttools.push({\n\t\t\t\t\tgoogleSearch: {},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst googleMapsOptions = builtInTools.googleMaps;\n\t\t\tif (googleMapsOptions) {\n\t\t\t\ttools.push({\n\t\t\t\t\tgoogleMaps: {},\n\t\t\t\t});\n\n\t\t\t\t// Build toolConfig with retrievalConfig if latitude/longitude are provided\n\t\t\t\tconst latitude = googleMapsOptions.latitude;\n\t\t\t\tconst longitude = googleMapsOptions.longitude;\n\t\t\t\tif (\n\t\t\t\t\tlatitude !== undefined &&\n\t\t\t\t\tlatitude !== '' &&\n\t\t\t\t\tlongitude !== undefined &&\n\t\t\t\t\tlongitude !== ''\n\t\t\t\t) {\n\t\t\t\t\ttoolConfig = {\n\t\t\t\t\t\tretrievalConfig: {\n\t\t\t\t\t\t\tlatLng: {\n\t\t\t\t\t\t\t\tlatitude: Number(latitude),\n\t\t\t\t\t\t\t\tlongitude: Number(longitude),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (builtInTools.urlContext) {\n\t\t\t\ttools.push({\n\t\t\t\t\turlContext: {},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst fileSearchOptions = builtInTools.fileSearch;\n\t\t\tif (fileSearchOptions) {\n\t\t\t\tconst fileSearchStoreNamesRaw = fileSearchOptions.fileSearchStoreNames;\n\t\t\t\tconst metadataFilter = fileSearchOptions.metadataFilter;\n\t\t\t\tlet fileSearchStoreNames: string[] | undefined;\n\t\t\t\tif (fileSearchStoreNamesRaw) {\n\t\t\t\t\tconst parsed = jsonParse(fileSearchStoreNamesRaw, {\n\t\t\t\t\t\terrorMessage: 'Failed to parse file search store names',\n\t\t\t\t\t});\n\t\t\t\t\tif (Array.isArray(parsed)) {\n\t\t\t\t\t\tfileSearchStoreNames = parsed;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttools.push({\n\t\t\t\t\tfileSearch: {\n\t\t\t\t\t\t...(fileSearchStoreNames && { fileSearchStoreNames }),\n\t\t\t\t\t\t...(metadataFilter && { metadataFilter }),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (builtInTools.codeExecution) {\n\t\t\t\ttools.push({\n\t\t\t\t\tcodeExecution: {},\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tconst contents: Content[] = messages.map((m) => ({\n\t\tparts: [{ text: m.content }],\n\t\trole: m.role,\n\t}));\n\tconst body: GenerateContentRequest = {\n\t\ttools,\n\t\tcontents,\n\t\tgenerationConfig,\n\t\tsystemInstruction: options.systemMessage\n\t\t\t? { parts: [{ text: options.systemMessage }] }\n\t\t\t: undefined,\n\t\t...(toolConfig && { toolConfig }),\n\t};\n\n\tlet response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:generateContent`, {\n\t\tbody,\n\t})) as GenerateContentResponse;\n\n\tconst maxToolsIterations = this.getNodeParameter('options.maxToolsIterations', i, 15) as number;\n\tconst abortSignal = this.getExecutionCancelSignal();\n\tlet currentIteration = 1;\n\tlet toolCalls = getToolCalls(response);\n\twhile (toolCalls.length) {\n\t\tif (\n\t\t\t(maxToolsIterations > 0 && currentIteration >= maxToolsIterations) ||\n\t\t\tabortSignal?.aborted\n\t\t) {\n\t\t\tbreak;\n\t\t}\n\n\t\tcontents.push(...response.candidates.map((c) => c.content));\n\n\t\tfor (const { functionCall } of toolCalls) {\n\t\t\tlet toolResponse;\n\t\t\tfor (const availableTool of availableTools) {\n\t\t\t\tif (availableTool.name === functionCall.name) {\n\t\t\t\t\ttoolResponse = (await availableTool.invoke(functionCall.args)) as IDataObject;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontents.push({\n\t\t\t\tparts: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfunctionResponse: {\n\t\t\t\t\t\t\tid: functionCall.id,\n\t\t\t\t\t\t\tname: functionCall.name,\n\t\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\t\tresult: toolResponse,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\trole: 'tool',\n\t\t\t});\n\t\t}\n\n\t\tresponse = (await apiRequest.call(this, 'POST', `/v1beta/${model}:generateContent`, {\n\t\t\tbody,\n\t\t})) as GenerateContentResponse;\n\t\ttoolCalls = getToolCalls(response);\n\t\tcurrentIteration++;\n\t}\n\n\tconst candidates = options.includeMergedResponse\n\t\t? response.candidates.map((candidate) => ({\n\t\t\t\t...candidate,\n\t\t\t\tmergedResponse: candidate.content.parts\n\t\t\t\t\t.filter((part) => 'text' in part)\n\t\t\t\t\t.map((part) => (part as { text: string }).text)\n\t\t\t\t\t.join(''),\n\t\t\t}))\n\t\t: response.candidates;\n\n\tif (simplify) {\n\t\treturn candidates.map((candidate) => ({\n\t\t\tjson: candidate,\n\t\t\tpairedItem: { item: i },\n\t\t}));\n\t}\n\n\treturn [\n\t\t{\n\t\t\tjson: {\n\t\t\t\t...response,\n\t\t\t\tcandidates,\n\t\t\t},\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAkC;AAClC,0BAQO;AACP,gCAA4B;AAU5B,uBAA2B;AAC3B,0BAAyB;AAEzB,MAAM,aAAgC;A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AA,EACV,EAAE,IACD,SAAS;AAEZ,MAAI,UAAU;AACb,WAAO,WAAW,IAAI,CAAC,eAAe;AAAA,MACrC,MAAM;AAAA,MACN,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB,EAAE;AAAA,EACH;AAEA,SAAO;AAAA,IACN;AAAA,MACC,MAAM;AAAA,QACL,GAAG;AAAA,QACH;AAAA,MACD;AAAA,MACA,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB;AAAA,EACD;AACD;","names":["i","zodToJsonSchema"]}
|
|
@@ -35,6 +35,7 @@ var import_n8n_workflow = require("n8n-workflow");
|
|
|
35
35
|
var audio = __toESM(require("./audio"));
|
|
36
36
|
var document = __toESM(require("./document"));
|
|
37
37
|
var file = __toESM(require("./file"));
|
|
38
|
+
var fileSearch = __toESM(require("./fileSearch"));
|
|
38
39
|
var image = __toESM(require("./image"));
|
|
39
40
|
var text = __toESM(require("./text"));
|
|
40
41
|
var video = __toESM(require("./video"));
|
|
@@ -43,7 +44,8 @@ const versionDescription = {
|
|
|
43
44
|
name: "googleGemini",
|
|
44
45
|
icon: "file:gemini.svg",
|
|
45
46
|
group: ["transform"],
|
|
46
|
-
version: 1,
|
|
47
|
+
version: [1, 1.1],
|
|
48
|
+
defaultVersion: 1.1,
|
|
47
49
|
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
|
|
48
50
|
description: "Interact with Google Gemini AI models",
|
|
49
51
|
defaults: {
|
|
@@ -98,13 +100,17 @@ const versionDescription = {
|
|
|
98
100
|
value: "document"
|
|
99
101
|
},
|
|
100
102
|
{
|
|
101
|
-
name: "File",
|
|
102
|
-
value: "
|
|
103
|
+
name: "File Search",
|
|
104
|
+
value: "fileSearch"
|
|
103
105
|
},
|
|
104
106
|
{
|
|
105
107
|
name: "Image",
|
|
106
108
|
value: "image"
|
|
107
109
|
},
|
|
110
|
+
{
|
|
111
|
+
name: "Media File",
|
|
112
|
+
value: "file"
|
|
113
|
+
},
|
|
108
114
|
{
|
|
109
115
|
name: "Text",
|
|
110
116
|
value: "text"
|
|
@@ -119,6 +125,7 @@ const versionDescription = {
|
|
|
119
125
|
...audio.description,
|
|
120
126
|
...document.description,
|
|
121
127
|
...file.description,
|
|
128
|
+
...fileSearch.description,
|
|
122
129
|
...image.description,
|
|
123
130
|
...text.description,
|
|
124
131
|
...video.description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/actions/versionDescription.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport { NodeConnectionTypes, type INodeTypeDescription } from 'n8n-workflow';\n\nimport * as audio from './audio';\nimport * as document from './document';\nimport * as file from './file';\nimport * as image from './image';\nimport * as text from './text';\nimport * as video from './video';\n\nexport const versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Google Gemini',\n\tname: 'googleGemini',\n\ticon: 'file:gemini.svg',\n\tgroup: ['transform'],\n\tversion: 1,\n\tsubtitle: '={{ $parameter[\"operation\"] + \": \" + $parameter[\"resource\"] }}',\n\tdescription: 'Interact with Google Gemini AI models',\n\tdefaults: {\n\t\tname: 'Google Gemini',\n\t},\n\tusableAsTool: true,\n\tcodex: {\n\t\talias: ['LangChain', 'video', 'document', 'audio', 'transcribe', 'assistant'],\n\t\tcategories: ['AI'],\n\t\tsubcategories: {\n\t\t\tAI: ['Agents', 'Miscellaneous', 'Root Nodes'],\n\t\t},\n\t\tresources: {\n\t\t\tprimaryDocumentation: [\n\t\t\t\t{\n\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.googlegemini/',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tinputs: `={{\n\t\t(() => {\n\t\t\tconst resource = $parameter.resource;\n\t \tconst operation = $parameter.operation;\n\t\t\tif (resource === 'text' && operation === 'message') {\n\t\t\t\treturn [{ type: 'main' }, { type: 'ai_tool', displayName: 'Tools' }];\n\t\t\t}\n\n\t\t\treturn ['main'];\n\t\t})()\n\t}}`,\n\toutputs: [NodeConnectionTypes.Main],\n\tcredentials: [\n\t\t{\n\t\t\tname: 'googlePalmApi',\n\t\t\trequired: true,\n\t\t},\n\t],\n\tproperties: [\n\t\t{\n\t\t\tdisplayName: 'Resource',\n\t\t\tname: 'resource',\n\t\t\ttype: 'options',\n\t\t\tnoDataExpression: true,\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Audio',\n\t\t\t\t\tvalue: 'audio',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Document',\n\t\t\t\t\tvalue: 'document',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'File',\n\t\t\t\t\tvalue: '
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/actions/versionDescription.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport { NodeConnectionTypes, type INodeTypeDescription } from 'n8n-workflow';\n\nimport * as audio from './audio';\nimport * as document from './document';\nimport * as file from './file';\nimport * as fileSearch from './fileSearch';\nimport * as image from './image';\nimport * as text from './text';\nimport * as video from './video';\n\nexport const versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Google Gemini',\n\tname: 'googleGemini',\n\ticon: 'file:gemini.svg',\n\tgroup: ['transform'],\n\tversion: [1, 1.1],\n\tdefaultVersion: 1.1,\n\tsubtitle: '={{ $parameter[\"operation\"] + \": \" + $parameter[\"resource\"] }}',\n\tdescription: 'Interact with Google Gemini AI models',\n\tdefaults: {\n\t\tname: 'Google Gemini',\n\t},\n\tusableAsTool: true,\n\tcodex: {\n\t\talias: ['LangChain', 'video', 'document', 'audio', 'transcribe', 'assistant'],\n\t\tcategories: ['AI'],\n\t\tsubcategories: {\n\t\t\tAI: ['Agents', 'Miscellaneous', 'Root Nodes'],\n\t\t},\n\t\tresources: {\n\t\t\tprimaryDocumentation: [\n\t\t\t\t{\n\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.googlegemini/',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tinputs: `={{\n\t\t(() => {\n\t\t\tconst resource = $parameter.resource;\n\t \tconst operation = $parameter.operation;\n\t\t\tif (resource === 'text' && operation === 'message') {\n\t\t\t\treturn [{ type: 'main' }, { type: 'ai_tool', displayName: 'Tools' }];\n\t\t\t}\n\n\t\t\treturn ['main'];\n\t\t})()\n\t}}`,\n\toutputs: [NodeConnectionTypes.Main],\n\tcredentials: [\n\t\t{\n\t\t\tname: 'googlePalmApi',\n\t\t\trequired: true,\n\t\t},\n\t],\n\tproperties: [\n\t\t{\n\t\t\tdisplayName: 'Resource',\n\t\t\tname: 'resource',\n\t\t\ttype: 'options',\n\t\t\tnoDataExpression: true,\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Audio',\n\t\t\t\t\tvalue: 'audio',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Document',\n\t\t\t\t\tvalue: 'document',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'File Search',\n\t\t\t\t\tvalue: 'fileSearch',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Image',\n\t\t\t\t\tvalue: 'image',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Media File',\n\t\t\t\t\tvalue: 'file',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Text',\n\t\t\t\t\tvalue: 'text',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Video',\n\t\t\t\t\tvalue: 'video',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'text',\n\t\t},\n\t\t...audio.description,\n\t\t...document.description,\n\t\t...file.description,\n\t\t...fileSearch.description,\n\t\t...image.description,\n\t\t...text.description,\n\t\t...video.description,\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AA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