@n8n/n8n-nodes-langchain 1.111.1 → 1.112.1
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/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js +8 -2
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js.map +1 -1
- package/dist/nodes/llms/LmChatGoogleGemini/LmChatGoogleGemini.node.js +3 -1
- package/dist/nodes/llms/LmChatGoogleGemini/LmChatGoogleGemini.node.js.map +1 -1
- package/dist/nodes/llms/LmChatGoogleVertex/LmChatGoogleVertex.node.js +19 -4
- package/dist/nodes/llms/LmChatGoogleVertex/LmChatGoogleVertex.node.js.map +1 -1
- package/dist/nodes/llms/LmChatGoogleVertex/error-handling.js +1 -1
- package/dist/nodes/llms/LmChatGoogleVertex/error-handling.js.map +1 -1
- package/dist/nodes/llms/gemini-common/additional-options.js +98 -80
- package/dist/nodes/llms/gemini-common/additional-options.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/audio/transcribe.operation.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/file/upload.operation.js +11 -28
- package/dist/nodes/vendors/GoogleGemini/actions/file/upload.operation.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/image/generate.operation.js +2 -1
- package/dist/nodes/vendors/GoogleGemini/actions/image/generate.operation.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js +35 -1
- package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/helpers/baseAnalyze.js +6 -0
- package/dist/nodes/vendors/GoogleGemini/helpers/baseAnalyze.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/helpers/interfaces.js +12 -0
- package/dist/nodes/vendors/GoogleGemini/helpers/interfaces.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/helpers/utils.js +76 -0
- package/dist/nodes/vendors/GoogleGemini/helpers/utils.js.map +1 -1
- package/dist/types/nodes.json +2 -2
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/file/upload.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/file/upload.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { transferFile } from '../../helpers/utils';\n\nexport const properties: INodeProperties[] = [\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: ['upload'],\n\t\tresource: ['file'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\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 transferFile.call(this, i, fileUrl, 'application/octet-stream');\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,mBAA6B;AAEtB,MAAM,aAAgC;AAAA,EAC5C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,KAAK;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,QAAQ;AAAA,MACrB;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,QAAQ;AAAA,IACpB,UAAU,CAAC,MAAM;AAAA,EAClB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,QAAM,YAAY,KAAK,iBAAiB,aAAa,GAAG,KAAK;AAE7D,MAAI;AACJ,MAAI,cAAc,OAAO;AACxB,cAAU,KAAK,iBAAiB,WAAW,GAAG,EAAE;AAAA,EACjD;AAEA,QAAM,WAAW,MAAM,0BAAa,KAAK,MAAM,GAAG,SAAS,0BAA0B;AACrF,SAAO;AAAA,IACN;AAAA,MACC,MAAM;AAAA,MACN,YAAY;AAAA,QACX,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
|
|
@@ -23,6 +23,7 @@ __export(generate_operation_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(generate_operation_exports);
|
|
25
25
|
var import_n8n_workflow = require("n8n-workflow");
|
|
26
|
+
var import_interfaces = require("../../helpers/interfaces");
|
|
26
27
|
var import_transport = require("../../transport");
|
|
27
28
|
var import_descriptions = require("../descriptions");
|
|
28
29
|
const properties = [
|
|
@@ -82,7 +83,7 @@ async function execute(i) {
|
|
|
82
83
|
);
|
|
83
84
|
if (model.includes("gemini")) {
|
|
84
85
|
const generationConfig = {
|
|
85
|
-
responseModalities: [
|
|
86
|
+
responseModalities: [import_interfaces.Modality.IMAGE, import_interfaces.Modality.TEXT]
|
|
86
87
|
};
|
|
87
88
|
const body = {
|
|
88
89
|
contents: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/image/generate.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { NodeOperationError, updateDisplayOptions } from 'n8n-workflow';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/image/generate.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { NodeOperationError, updateDisplayOptions } from 'n8n-workflow';\n\nimport {\n\ttype GenerateContentRequest,\n\ttype GenerateContentResponse,\n\ttype ImagenResponse,\n\tModality,\n} from '../../helpers/interfaces';\nimport { apiRequest } from '../../transport';\nimport { modelRLC } from '../descriptions';\n\nconst properties: INodeProperties[] = [\n\tmodelRLC('imageGenerationModelSearch'),\n\t{\n\t\tdisplayName: 'Prompt',\n\t\tname: 'prompt',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. A cute cat eating a dinosaur',\n\t\tdescription: 'A text description of the desired image(s)',\n\t\tdefault: '',\n\t\ttypeOptions: {\n\t\t\trows: 2,\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: 'Number of Images',\n\t\t\t\tname: 'sampleCount',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription:\n\t\t\t\t\t'Number of images to generate. Not supported by Gemini models, supported by Imagen models.',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Put Output in Field',\n\t\t\t\tname: 'binaryPropertyOutput',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: 'data',\n\t\t\t\thint: 'The name of the output field to put the binary file data in',\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['generate'],\n\t\tresource: ['image'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst model = this.getNodeParameter('modelId', i, '', { extractValue: true }) as string;\n\tconst prompt = this.getNodeParameter('prompt', i, '') as string;\n\tconst binaryPropertyOutput = this.getNodeParameter(\n\t\t'options.binaryPropertyOutput',\n\t\ti,\n\t\t'data',\n\t) as string;\n\n\tif (model.includes('gemini')) {\n\t\tconst generationConfig = {\n\t\t\tresponseModalities: [Modality.IMAGE, Modality.TEXT],\n\t\t};\n\t\tconst body: GenerateContentRequest = {\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\trole: 'user',\n\t\t\t\t\tparts: [{ text: prompt }],\n\t\t\t\t},\n\t\t\t],\n\t\t\tgenerationConfig,\n\t\t};\n\n\t\tconst response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:generateContent`, {\n\t\t\tbody,\n\t\t})) as GenerateContentResponse;\n\t\tconst promises = response.candidates.map(async (candidate) => {\n\t\t\tconst imagePart = candidate.content.parts.find((part) => 'inlineData' in part);\n\t\t\tconst buffer = Buffer.from(imagePart?.inlineData.data ?? '', 'base64');\n\t\t\tconst binaryData = await this.helpers.prepareBinaryData(\n\t\t\t\tbuffer,\n\t\t\t\t'image.png',\n\t\t\t\timagePart?.inlineData.mimeType,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tbinary: {\n\t\t\t\t\t[binaryPropertyOutput]: binaryData,\n\t\t\t\t},\n\t\t\t\tjson: {\n\t\t\t\t\t...binaryData,\n\t\t\t\t\tdata: undefined,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t};\n\t\t});\n\n\t\treturn await Promise.all(promises);\n\t} else if (model.includes('imagen') || model.includes('flash-image')) {\n\t\t// Imagen models use a different endpoint and request/response structure\n\t\tconst sampleCount = this.getNodeParameter('options.sampleCount', i, 1) as number;\n\t\tconst body = {\n\t\t\tinstances: [\n\t\t\t\t{\n\t\t\t\t\tprompt,\n\t\t\t\t},\n\t\t\t],\n\t\t\tparameters: {\n\t\t\t\tsampleCount,\n\t\t\t},\n\t\t};\n\t\tconst response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:predict`, {\n\t\t\tbody,\n\t\t})) as ImagenResponse;\n\n\t\tconst promises = response.predictions.map(async (prediction) => {\n\t\t\tconst buffer = Buffer.from(prediction.bytesBase64Encoded ?? '', 'base64');\n\t\t\tconst binaryData = await this.helpers.prepareBinaryData(\n\t\t\t\tbuffer,\n\t\t\t\t'image.png',\n\t\t\t\tprediction.mimeType,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tbinary: {\n\t\t\t\t\t[binaryPropertyOutput]: binaryData,\n\t\t\t\t},\n\t\t\t\tjson: {\n\t\t\t\t\t...binaryData,\n\t\t\t\t\tdata: undefined,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t};\n\t\t});\n\n\t\treturn await Promise.all(promises);\n\t}\n\n\tthrow new NodeOperationError(\n\t\tthis.getNode(),\n\t\t`Model ${model} is not supported for image generation`,\n\t\t{\n\t\t\tdescription: 'Please check the model ID and try again.',\n\t\t},\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAyD;AAEzD,wBAKO;AACP,uBAA2B;AAC3B,0BAAyB;AAEzB,MAAM,aAAgC;AAAA,MACrC,8BAAS,4BAA4B;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,MACR;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aACC;AAAA,QACD,MAAM;AAAA,QACN,aAAa;AAAA,UACZ,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA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,YAAY,EAAE,MAAM,EAAE;AAAA,MACvB;AAAA,IACD,CAAC;AAED,WAAO,MAAM,QAAQ,IAAI,QAAQ;AAAA,EAClC,WAAW,MAAM,SAAS,QAAQ,KAAK,MAAM,SAAS,aAAa,GAAG;AAErE,UAAM,cAAc,KAAK,iBAAiB,uBAAuB,GAAG,CAAC;AACrE,UAAM,OAAO;AAAA,MACZ,WAAW;AAAA,QACV;AAAA,UACC;AAAA,QACD;AAAA,MACD;AAAA,MACA,YAAY;AAAA,QACX;AAAA,MACD;AAAA,IACD;AACA,UAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,QAAQ,WAAW,KAAK,YAAY;AAAA,MACjF;AAAA,IACD,CAAC;AAED,UAAM,WAAW,SAAS,YAAY,IAAI,OAAO,eAAe;AAC/D,YAAM,SAAS,OAAO,KAAK,WAAW,sBAAsB,IAAI,QAAQ;AACxE,YAAM,aAAa,MAAM,KAAK,QAAQ;AAAA,QACrC;AAAA,QACA;AAAA,QACA,WAAW;AAAA,MACZ;AACA,aAAO;AAAA,QACN,QAAQ;AAAA,UACP,CAAC,oBAAoB,GAAG;AAAA,QACzB;AAAA,QACA,MAAM;AAAA,UACL,GAAG;AAAA,UACH,MAAM;AAAA,QACP;AAAA,QACA,YAAY,EAAE,MAAM,EAAE;AAAA,MACvB;AAAA,IACD,CAAC;AAED,WAAO,MAAM,QAAQ,IAAI,QAAQ;AAAA,EAClC;AAEA,QAAM,IAAI;AAAA,IACT,KAAK,QAAQ;AAAA,IACb,SAAS,KAAK;AAAA,IACd;AAAA,MACC,aAAa;AAAA,IACd;AAAA,EACD;AACD;","names":[]}
|
|
@@ -33,6 +33,7 @@ __export(message_operation_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(message_operation_exports);
|
|
35
35
|
var import_n8n_workflow = require("n8n-workflow");
|
|
36
|
+
var import_n8n_workflow2 = require("n8n-workflow");
|
|
36
37
|
var import_zod_to_json_schema = __toESM(require("zod-to-json-schema"));
|
|
37
38
|
var import_helpers = require("../../../../../utils/helpers");
|
|
38
39
|
var import_transport = require("../../transport");
|
|
@@ -206,6 +207,17 @@ const properties = [
|
|
|
206
207
|
numberPrecision: 0
|
|
207
208
|
}
|
|
208
209
|
},
|
|
210
|
+
{
|
|
211
|
+
displayName: "Thinking Budget",
|
|
212
|
+
name: "thinkingBudget",
|
|
213
|
+
type: "number",
|
|
214
|
+
default: void 0,
|
|
215
|
+
description: "Controls reasoning tokens for thinking models. Set to 0 to disable automatic thinking. Set to -1 for dynamic thinking. Leave empty for auto mode.",
|
|
216
|
+
typeOptions: {
|
|
217
|
+
minValue: -1,
|
|
218
|
+
numberPrecision: 0
|
|
219
|
+
}
|
|
220
|
+
},
|
|
209
221
|
{
|
|
210
222
|
displayName: "Max Tool Calls Iterations",
|
|
211
223
|
name: "maxToolsIterations",
|
|
@@ -226,7 +238,7 @@ const displayOptions = {
|
|
|
226
238
|
resource: ["text"]
|
|
227
239
|
}
|
|
228
240
|
};
|
|
229
|
-
const description = (0,
|
|
241
|
+
const description = (0, import_n8n_workflow2.updateDisplayOptions)(displayOptions, properties);
|
|
230
242
|
function getToolCalls(response) {
|
|
231
243
|
return response.candidates.flatMap((c) => c.content.parts).filter((p) => "functionCall" in p);
|
|
232
244
|
}
|
|
@@ -236,6 +248,23 @@ async function execute(i) {
|
|
|
236
248
|
const simplify = this.getNodeParameter("simplify", i, true);
|
|
237
249
|
const jsonOutput = this.getNodeParameter("jsonOutput", i, false);
|
|
238
250
|
const options = this.getNodeParameter("options", i, {});
|
|
251
|
+
(0, import_n8n_workflow.validateNodeParameters)(
|
|
252
|
+
options,
|
|
253
|
+
{
|
|
254
|
+
systemMessage: { type: "string", required: false },
|
|
255
|
+
codeExecution: { type: "boolean", required: false },
|
|
256
|
+
frequencyPenalty: { type: "number", required: false },
|
|
257
|
+
maxOutputTokens: { type: "number", required: false },
|
|
258
|
+
candidateCount: { type: "number", required: false },
|
|
259
|
+
presencePenalty: { type: "number", required: false },
|
|
260
|
+
temperature: { type: "number", required: false },
|
|
261
|
+
topP: { type: "number", required: false },
|
|
262
|
+
topK: { type: "number", required: false },
|
|
263
|
+
thinkingBudget: { type: "number", required: false },
|
|
264
|
+
maxToolsIterations: { type: "number", required: false }
|
|
265
|
+
},
|
|
266
|
+
this.getNode()
|
|
267
|
+
);
|
|
239
268
|
const generationConfig = {
|
|
240
269
|
frequencyPenalty: options.frequencyPenalty,
|
|
241
270
|
maxOutputTokens: options.maxOutputTokens,
|
|
@@ -246,6 +275,11 @@ async function execute(i) {
|
|
|
246
275
|
topK: options.topK,
|
|
247
276
|
responseMimeType: jsonOutput ? "application/json" : void 0
|
|
248
277
|
};
|
|
278
|
+
if (options.thinkingBudget !== void 0) {
|
|
279
|
+
generationConfig.thinkingConfig = {
|
|
280
|
+
thinkingBudget: options.thinkingBudget
|
|
281
|
+
};
|
|
282
|
+
}
|
|
249
283
|
const nodeInputs = this.getNodeInputs();
|
|
250
284
|
const availableTools = nodeInputs.some((i2) => i2.type === "ai_tool") ? await (0, import_helpers.getConnectedTools)(this, true) : [];
|
|
251
285
|
const tools = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/text/message.operation.ts"],"sourcesContent":["import type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\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 { GenerateContentResponse, Content, Tool } 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: '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\n\tconst generationConfig = {\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\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 = {\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;AAMA,0BAAqC;AACrC,gCAA4B;AAE5B,qBAAkC;AAGlC,uBAA2B;AAC3B,0BAAyB;AAEzB,MAAM,aAAgC;AAAA,MACrC,8BAAS,aAAa;AAAA,EACtB;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,MACZ,UAAU;AAAA,MACV,gBAAgB;AAAA,IACjB;AAAA,IACA,aAAa;AAAA,IACb,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,EAAE;AAAA,IACrC,SAAS;AAAA,MACR;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,QAAQ;AAAA,UACP;AAAA,YACC,aAAa;AAAA,YACb,MAAM;AAAA,YACN,MAAM;AAAA,YACN,aAAa;AAAA,YACb,SAAS;AAAA,YACT,aAAa;AAAA,YACb,aAAa;AAAA,cACZ,MAAM;AAAA,YACP;AAAA,UACD;AAAA,UACA;AAAA,YACC,aAAa;AAAA,YACb,MAAM;AAAA,YACN,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,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":["i","zodToJsonSchema"]}
|
|
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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,aAAa,MAAM;AAC7C,yBAAgB,MAAM,cAAc,OAAO,aAAa,IAAI;AAAA,QAC7D;AAAA,MACD;AAEA,eAAS,KAAK;AAAA,QACb,OAAO;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"]}
|
|
@@ -21,6 +21,7 @@ __export(baseAnalyze_exports, {
|
|
|
21
21
|
baseAnalyze: () => baseAnalyze
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(baseAnalyze_exports);
|
|
24
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
24
25
|
var import_utils = require("./utils");
|
|
25
26
|
var import_transport = require("../transport");
|
|
26
27
|
async function baseAnalyze(i, urlsPropertyName, fallbackMimeType) {
|
|
@@ -29,6 +30,11 @@ async function baseAnalyze(i, urlsPropertyName, fallbackMimeType) {
|
|
|
29
30
|
const text = this.getNodeParameter("text", i, "");
|
|
30
31
|
const simplify = this.getNodeParameter("simplify", i, true);
|
|
31
32
|
const options = this.getNodeParameter("options", i, {});
|
|
33
|
+
(0, import_n8n_workflow.validateNodeParameters)(
|
|
34
|
+
options,
|
|
35
|
+
{ maxOutputTokens: { type: "number", required: false } },
|
|
36
|
+
this.getNode()
|
|
37
|
+
);
|
|
32
38
|
const generationConfig = {
|
|
33
39
|
maxOutputTokens: options.maxOutputTokens
|
|
34
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/helpers/baseAnalyze.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/helpers/baseAnalyze.ts"],"sourcesContent":["import {\n\tvalidateNodeParameters,\n\ttype IExecuteFunctions,\n\ttype INodeExecutionData,\n} from 'n8n-workflow';\n\nimport type { Content, GenerateContentResponse } from './interfaces';\nimport { downloadFile, uploadFile } from './utils';\nimport { apiRequest } from '../transport';\n\nexport async function baseAnalyze(\n\tthis: IExecuteFunctions,\n\ti: number,\n\turlsPropertyName: string,\n\tfallbackMimeType: string,\n): Promise<INodeExecutionData[]> {\n\tconst model = this.getNodeParameter('modelId', i, '', { extractValue: true }) as string;\n\tconst inputType = this.getNodeParameter('inputType', i, 'url') as string;\n\tconst text = this.getNodeParameter('text', i, '') as string;\n\tconst simplify = this.getNodeParameter('simplify', i, true) as boolean;\n\tconst options = this.getNodeParameter('options', i, {});\n\tvalidateNodeParameters(\n\t\toptions,\n\t\t{ maxOutputTokens: { type: 'number', required: false } },\n\t\tthis.getNode(),\n\t);\n\tconst generationConfig = {\n\t\tmaxOutputTokens: options.maxOutputTokens,\n\t};\n\n\tlet contents: Content[];\n\tif (inputType === 'url') {\n\t\tconst urls = this.getNodeParameter(urlsPropertyName, i, '') as string;\n\t\tconst filesDataPromises = urls\n\t\t\t.split(',')\n\t\t\t.map((url) => url.trim())\n\t\t\t.filter((url) => url)\n\t\t\t.map(async (url) => {\n\t\t\t\tif (url.startsWith('https://generativelanguage.googleapis.com')) {\n\t\t\t\t\tconst { mimeType } = (await apiRequest.call(this, 'GET', '', {\n\t\t\t\t\t\toption: { url },\n\t\t\t\t\t})) as { mimeType: string };\n\t\t\t\t\treturn { fileUri: url, mimeType };\n\t\t\t\t} else {\n\t\t\t\t\tconst { fileContent, mimeType } = await downloadFile.call(this, url, fallbackMimeType);\n\t\t\t\t\treturn await uploadFile.call(this, fileContent, mimeType);\n\t\t\t\t}\n\t\t\t});\n\n\t\tconst filesData = await Promise.all(filesDataPromises);\n\t\tcontents = [\n\t\t\t{\n\t\t\t\trole: 'user',\n\t\t\t\tparts: filesData.map((fileData) => ({\n\t\t\t\t\tfileData,\n\t\t\t\t})),\n\t\t\t},\n\t\t];\n\t} else {\n\t\tconst binaryPropertyNames = this.getNodeParameter('binaryPropertyName', i, 'data');\n\t\tconst promises = binaryPropertyNames\n\t\t\t.split(',')\n\t\t\t.map((binaryPropertyName) => binaryPropertyName.trim())\n\t\t\t.filter((binaryPropertyName) => binaryPropertyName)\n\t\t\t.map(async (binaryPropertyName) => {\n\t\t\t\tconst binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);\n\t\t\t\tconst buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);\n\t\t\t\treturn await uploadFile.call(this, buffer, binaryData.mimeType);\n\t\t\t});\n\n\t\tconst filesData = await Promise.all(promises);\n\t\tcontents = [\n\t\t\t{\n\t\t\t\trole: 'user',\n\t\t\t\tparts: filesData.map((fileData) => ({\n\t\t\t\t\tfileData,\n\t\t\t\t})),\n\t\t\t},\n\t\t];\n\t}\n\n\tcontents[0].parts.push({ text });\n\n\tconst body = {\n\t\tcontents,\n\t\tgenerationConfig,\n\t};\n\n\tconst response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:generateContent`, {\n\t\tbody,\n\t})) as GenerateContentResponse;\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: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[]}
|
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
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
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -13,5 +17,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
17
|
};
|
|
14
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
19
|
var interfaces_exports = {};
|
|
20
|
+
__export(interfaces_exports, {
|
|
21
|
+
Modality: () => import_genai.Modality
|
|
22
|
+
});
|
|
16
23
|
module.exports = __toCommonJS(interfaces_exports);
|
|
24
|
+
var import_genai = require("@google/genai");
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
Modality
|
|
28
|
+
});
|
|
17
29
|
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/helpers/interfaces.ts"],"sourcesContent":["import type { IDataObject } from 'n8n-workflow';\n\nexport interface GenerateContentResponse {\n\tcandidates: Array<{\n\t\tcontent: Content;\n\t}>;\n}\n\nexport interface Content {\n\tparts: Part[];\n\trole: string;\n}\n\nexport type Part =\n\t| { text: string }\n\t| {\n\t\t\tinlineData: {\n\t\t\t\tmimeType: string;\n\t\t\t\tdata: string;\n\t\t\t};\n\t }\n\t| {\n\t\t\tfunctionCall: {\n\t\t\t\tid?: string;\n\t\t\t\tname: string;\n\t\t\t\targs?: IDataObject;\n\t\t\t};\n\t }\n\t| {\n\t\t\tfunctionResponse: {\n\t\t\t\tid?: string;\n\t\t\t\tname: string;\n\t\t\t\tresponse: IDataObject;\n\t\t\t};\n\t }\n\t| {\n\t\t\tfileData?: {\n\t\t\t\tmimeType?: string;\n\t\t\t\tfileUri?: string;\n\t\t\t};\n\t };\n\nexport interface ImagenResponse {\n\tpredictions: Array<{\n\t\tbytesBase64Encoded: string;\n\t\tmimeType: string;\n\t}>;\n}\n\nexport interface VeoResponse {\n\tname: string;\n\tdone: boolean;\n\terror?: {\n\t\tmessage: string;\n\t};\n\tresponse: {\n\t\tgenerateVideoResponse: {\n\t\t\tgeneratedSamples: Array<{\n\t\t\t\tvideo: {\n\t\t\t\t\turi: string;\n\t\t\t\t};\n\t\t\t}>;\n\t\t};\n\t};\n}\n\nexport interface Tool {\n\tfunctionDeclarations?: Array<{\n\t\tname: string;\n\t\tdescription: string;\n\t\tparameters: IDataObject;\n\t}>;\n\tcodeExecution?: object;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/helpers/interfaces.ts"],"sourcesContent":["import type {\n\tGenerateContentConfig,\n\tGenerationConfig,\n\tGenerateContentParameters,\n} from '@google/genai';\nimport type { IDataObject } from 'n8n-workflow';\nexport { Modality } from '@google/genai';\n\n/* type created based on: https://ai.google.dev/api/generate-content#generationconfig */\nexport type GenerateContentGenerationConfig = Pick<\n\tGenerationConfig,\n\t| 'stopSequences'\n\t| 'responseMimeType'\n\t| 'responseSchema'\n\t| 'responseJsonSchema'\n\t| 'responseModalities'\n\t| 'candidateCount'\n\t| 'maxOutputTokens'\n\t| 'temperature'\n\t| 'topP'\n\t| 'topK'\n\t| 'seed'\n\t| 'presencePenalty'\n\t| 'frequencyPenalty'\n\t| 'responseLogprobs'\n\t| 'logprobs'\n\t| 'speechConfig'\n\t| 'thinkingConfig'\n\t| 'mediaResolution'\n>;\n\n/* Type created based on: https://ai.google.dev/api/generate-content#method:-models.streamgeneratecontent */\nexport interface GenerateContentRequest extends IDataObject {\n\tcontents: GenerateContentParameters['contents'];\n\ttools?: GenerateContentConfig['tools'];\n\ttoolConfig?: GenerateContentConfig['toolConfig'];\n\tsystemInstruction?: GenerateContentConfig['systemInstruction'];\n\tsafetySettings?: GenerateContentConfig['safetySettings'];\n\tgenerationConfig?: GenerateContentGenerationConfig;\n\tcachedContent?: string;\n}\n\nexport interface GenerateContentResponse {\n\tcandidates: Array<{\n\t\tcontent: Content;\n\t}>;\n}\n\nexport interface Content {\n\tparts: Part[];\n\trole: string;\n}\n\nexport type Part =\n\t| { text: string }\n\t| {\n\t\t\tinlineData: {\n\t\t\t\tmimeType: string;\n\t\t\t\tdata: string;\n\t\t\t};\n\t }\n\t| {\n\t\t\tfunctionCall: {\n\t\t\t\tid?: string;\n\t\t\t\tname: string;\n\t\t\t\targs?: IDataObject;\n\t\t\t};\n\t }\n\t| {\n\t\t\tfunctionResponse: {\n\t\t\t\tid?: string;\n\t\t\t\tname: string;\n\t\t\t\tresponse: IDataObject;\n\t\t\t};\n\t }\n\t| {\n\t\t\tfileData?: {\n\t\t\t\tmimeType?: string;\n\t\t\t\tfileUri?: string;\n\t\t\t};\n\t };\n\nexport interface ImagenResponse {\n\tpredictions: Array<{\n\t\tbytesBase64Encoded: string;\n\t\tmimeType: string;\n\t}>;\n}\n\nexport interface VeoResponse {\n\tname: string;\n\tdone: boolean;\n\terror?: {\n\t\tmessage: string;\n\t};\n\tresponse: {\n\t\tgenerateVideoResponse: {\n\t\t\tgeneratedSamples: Array<{\n\t\t\t\tvideo: {\n\t\t\t\t\turi: string;\n\t\t\t\t};\n\t\t\t}>;\n\t\t};\n\t};\n}\n\nexport interface Tool {\n\tfunctionDeclarations?: Array<{\n\t\tname: string;\n\t\tdescription: string;\n\t\tparameters: IDataObject;\n\t}>;\n\tcodeExecution?: object;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,mBAAyB;","names":[]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,15 +17,26 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var utils_exports = {};
|
|
20
30
|
__export(utils_exports, {
|
|
21
31
|
downloadFile: () => downloadFile,
|
|
32
|
+
transferFile: () => transferFile,
|
|
22
33
|
uploadFile: () => uploadFile
|
|
23
34
|
});
|
|
24
35
|
module.exports = __toCommonJS(utils_exports);
|
|
25
36
|
var import_n8n_workflow = require("n8n-workflow");
|
|
26
37
|
var import_transport = require("../transport");
|
|
38
|
+
var import_axios = __toESM(require("axios"));
|
|
39
|
+
const CHUNK_SIZE = 256 * 1024;
|
|
27
40
|
async function downloadFile(url, fallbackMimeType, qs) {
|
|
28
41
|
const downloadResponse = await this.helpers.httpRequest({
|
|
29
42
|
method: "GET",
|
|
@@ -83,9 +96,72 @@ async function uploadFile(fileContent, mimeType) {
|
|
|
83
96
|
}
|
|
84
97
|
return { fileUri: uploadResponse.file.uri, mimeType: uploadResponse.file.mimeType };
|
|
85
98
|
}
|
|
99
|
+
async function transferFile(i, downloadUrl, fallbackMimeType, qs) {
|
|
100
|
+
let stream;
|
|
101
|
+
let mimeType;
|
|
102
|
+
if (downloadUrl) {
|
|
103
|
+
const downloadResponse = await import_axios.default.get(downloadUrl, {
|
|
104
|
+
params: qs,
|
|
105
|
+
responseType: "stream"
|
|
106
|
+
});
|
|
107
|
+
mimeType = downloadResponse.headers["content-type"]?.split(";")?.[0] ?? fallbackMimeType;
|
|
108
|
+
stream = downloadResponse.data;
|
|
109
|
+
} else {
|
|
110
|
+
const binaryPropertyName = this.getNodeParameter("binaryPropertyName", i, "data");
|
|
111
|
+
if (!binaryPropertyName) {
|
|
112
|
+
throw new import_n8n_workflow.NodeOperationError(this.getNode(), "Binary property name is required", {
|
|
113
|
+
description: "Error uploading file"
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
|
117
|
+
if (!binaryData.id) {
|
|
118
|
+
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
119
|
+
return await uploadFile.call(this, buffer, binaryData.mimeType);
|
|
120
|
+
} else {
|
|
121
|
+
stream = await this.helpers.getBinaryStream(binaryData.id, CHUNK_SIZE);
|
|
122
|
+
mimeType = binaryData.mimeType;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const uploadInitResponse = await import_transport.apiRequest.call(this, "POST", "/upload/v1beta/files", {
|
|
126
|
+
headers: {
|
|
127
|
+
"X-Goog-Upload-Protocol": "resumable",
|
|
128
|
+
"X-Goog-Upload-Command": "start",
|
|
129
|
+
"X-Goog-Upload-Header-Content-Type": mimeType,
|
|
130
|
+
"Content-Type": "application/json"
|
|
131
|
+
},
|
|
132
|
+
option: { returnFullResponse: true }
|
|
133
|
+
});
|
|
134
|
+
const uploadUrl = uploadInitResponse.headers["x-goog-upload-url"];
|
|
135
|
+
if (!uploadUrl) {
|
|
136
|
+
throw new import_n8n_workflow.NodeOperationError(this.getNode(), "Failed to get upload URL");
|
|
137
|
+
}
|
|
138
|
+
const uploadResponse = await this.helpers.httpRequest({
|
|
139
|
+
method: "POST",
|
|
140
|
+
url: uploadUrl,
|
|
141
|
+
headers: {
|
|
142
|
+
"X-Goog-Upload-Offset": "0",
|
|
143
|
+
"X-Goog-Upload-Command": "upload, finalize",
|
|
144
|
+
"Content-Type": mimeType
|
|
145
|
+
},
|
|
146
|
+
body: stream,
|
|
147
|
+
returnFullResponse: true
|
|
148
|
+
});
|
|
149
|
+
let file = uploadResponse.body.file;
|
|
150
|
+
while (file.state !== "ACTIVE" && file.state !== "FAILED") {
|
|
151
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
152
|
+
file = await import_transport.apiRequest.call(this, "GET", `/v1beta/${file.name}`);
|
|
153
|
+
}
|
|
154
|
+
if (file.state === "FAILED") {
|
|
155
|
+
throw new import_n8n_workflow.NodeOperationError(this.getNode(), file.error?.message ?? "Unknown error", {
|
|
156
|
+
description: "Error uploading file"
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return { fileUri: file.uri, mimeType: file.mimeType };
|
|
160
|
+
}
|
|
86
161
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
162
|
0 && (module.exports = {
|
|
88
163
|
downloadFile,
|
|
164
|
+
transferFile,
|
|
89
165
|
uploadFile
|
|
90
166
|
});
|
|
91
167
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/helpers/utils.ts"],"sourcesContent":["import type { IDataObject, IExecuteFunctions } from 'n8n-workflow';\nimport { NodeOperationError } from 'n8n-workflow';\n\nimport { apiRequest } from '../transport';\n\ninterface File {\n\tname: string;\n\turi: string;\n\tmimeType: string;\n\tstate: string;\n\terror?: { message: string };\n}\n\nexport async function downloadFile(\n\tthis: IExecuteFunctions,\n\turl: string,\n\tfallbackMimeType?: string,\n\tqs?: IDataObject,\n) {\n\tconst downloadResponse = (await this.helpers.httpRequest({\n\t\tmethod: 'GET',\n\t\turl,\n\t\tqs,\n\t\treturnFullResponse: true,\n\t\tencoding: 'arraybuffer',\n\t})) as { body: ArrayBuffer; headers: IDataObject };\n\n\tconst mimeType =\n\t\t(downloadResponse.headers?.['content-type'] as string)?.split(';')?.[0] ?? fallbackMimeType;\n\tconst fileContent = Buffer.from(downloadResponse.body);\n\treturn {\n\t\tfileContent,\n\t\tmimeType,\n\t};\n}\n\nexport async function uploadFile(this: IExecuteFunctions, fileContent: Buffer, mimeType: string) {\n\tconst numBytes = fileContent.length.toString();\n\tconst uploadInitResponse = (await apiRequest.call(this, 'POST', '/upload/v1beta/files', {\n\t\theaders: {\n\t\t\t'X-Goog-Upload-Protocol': 'resumable',\n\t\t\t'X-Goog-Upload-Command': 'start',\n\t\t\t'X-Goog-Upload-Header-Content-Length': numBytes,\n\t\t\t'X-Goog-Upload-Header-Content-Type': mimeType,\n\t\t\t'Content-Type': 'application/json',\n\t\t},\n\t\toption: {\n\t\t\treturnFullResponse: true,\n\t\t},\n\t})) as { headers: IDataObject };\n\tconst uploadUrl = uploadInitResponse.headers['x-goog-upload-url'] as string;\n\n\tconst uploadResponse = (await this.helpers.httpRequest({\n\t\tmethod: 'POST',\n\t\turl: uploadUrl,\n\t\theaders: {\n\t\t\t'Content-Length': numBytes,\n\t\t\t'X-Goog-Upload-Offset': '0',\n\t\t\t'X-Goog-Upload-Command': 'upload, finalize',\n\t\t},\n\t\tbody: fileContent,\n\t})) as { file: File };\n\n\twhile (uploadResponse.file.state !== 'ACTIVE' && uploadResponse.file.state !== 'FAILED') {\n\t\tawait new Promise((resolve) => setTimeout(resolve, 1000));\n\t\tuploadResponse.file = (await apiRequest.call(\n\t\t\tthis,\n\t\t\t'GET',\n\t\t\t`/v1beta/${uploadResponse.file.name}`,\n\t\t)) as File;\n\t}\n\n\tif (uploadResponse.file.state === 'FAILED') {\n\t\tthrow new NodeOperationError(\n\t\t\tthis.getNode(),\n\t\t\tuploadResponse.file.error?.message ?? 'Unknown error',\n\t\t\t{\n\t\t\t\tdescription: 'Error uploading file',\n\t\t\t},\n\t\t);\n\t}\n\n\treturn { fileUri: uploadResponse.file.uri, mimeType: uploadResponse.file.mimeType };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/helpers/utils.ts"],"sourcesContent":["import type { IDataObject, IExecuteFunctions } from 'n8n-workflow';\nimport { NodeOperationError } from 'n8n-workflow';\n\nimport { apiRequest } from '../transport';\n\nimport axios from 'axios';\nimport type Stream from 'node:stream';\n\ninterface File {\n\tname: string;\n\turi: string;\n\tmimeType: string;\n\tstate: string;\n\terror?: { message: string };\n}\n\nconst CHUNK_SIZE = 256 * 1024;\n\nexport async function downloadFile(\n\tthis: IExecuteFunctions,\n\turl: string,\n\tfallbackMimeType?: string,\n\tqs?: IDataObject,\n) {\n\tconst downloadResponse = (await this.helpers.httpRequest({\n\t\tmethod: 'GET',\n\t\turl,\n\t\tqs,\n\t\treturnFullResponse: true,\n\t\tencoding: 'arraybuffer',\n\t})) as { body: ArrayBuffer; headers: IDataObject };\n\n\tconst mimeType =\n\t\t(downloadResponse.headers?.['content-type'] as string)?.split(';')?.[0] ?? fallbackMimeType;\n\tconst fileContent = Buffer.from(downloadResponse.body);\n\treturn {\n\t\tfileContent,\n\t\tmimeType,\n\t};\n}\n\nexport async function uploadFile(this: IExecuteFunctions, fileContent: Buffer, mimeType: string) {\n\tconst numBytes = fileContent.length.toString();\n\tconst uploadInitResponse = (await apiRequest.call(this, 'POST', '/upload/v1beta/files', {\n\t\theaders: {\n\t\t\t'X-Goog-Upload-Protocol': 'resumable',\n\t\t\t'X-Goog-Upload-Command': 'start',\n\t\t\t'X-Goog-Upload-Header-Content-Length': numBytes,\n\t\t\t'X-Goog-Upload-Header-Content-Type': mimeType,\n\t\t\t'Content-Type': 'application/json',\n\t\t},\n\t\toption: {\n\t\t\treturnFullResponse: true,\n\t\t},\n\t})) as { headers: IDataObject };\n\tconst uploadUrl = uploadInitResponse.headers['x-goog-upload-url'] as string;\n\n\tconst uploadResponse = (await this.helpers.httpRequest({\n\t\tmethod: 'POST',\n\t\turl: uploadUrl,\n\t\theaders: {\n\t\t\t'Content-Length': numBytes,\n\t\t\t'X-Goog-Upload-Offset': '0',\n\t\t\t'X-Goog-Upload-Command': 'upload, finalize',\n\t\t},\n\t\tbody: fileContent,\n\t})) as { file: File };\n\n\twhile (uploadResponse.file.state !== 'ACTIVE' && uploadResponse.file.state !== 'FAILED') {\n\t\tawait new Promise((resolve) => setTimeout(resolve, 1000));\n\t\tuploadResponse.file = (await apiRequest.call(\n\t\t\tthis,\n\t\t\t'GET',\n\t\t\t`/v1beta/${uploadResponse.file.name}`,\n\t\t)) as File;\n\t}\n\n\tif (uploadResponse.file.state === 'FAILED') {\n\t\tthrow new NodeOperationError(\n\t\t\tthis.getNode(),\n\t\t\tuploadResponse.file.error?.message ?? 'Unknown error',\n\t\t\t{\n\t\t\t\tdescription: 'Error uploading file',\n\t\t\t},\n\t\t);\n\t}\n\n\treturn { fileUri: uploadResponse.file.uri, mimeType: uploadResponse.file.mimeType };\n}\n\nexport async function transferFile(\n\tthis: IExecuteFunctions,\n\ti: number,\n\tdownloadUrl?: string,\n\tfallbackMimeType?: string,\n\tqs?: IDataObject,\n) {\n\tlet stream: Stream;\n\tlet mimeType: string;\n\n\tif (downloadUrl) {\n\t\tconst downloadResponse = await axios.get(downloadUrl, {\n\t\t\tparams: qs,\n\t\t\tresponseType: 'stream',\n\t\t});\n\n\t\tmimeType = downloadResponse.headers['content-type']?.split(';')?.[0] ?? fallbackMimeType;\n\t\tstream = downloadResponse.data;\n\t} else {\n\t\tconst binaryPropertyName = this.getNodeParameter('binaryPropertyName', i, 'data');\n\t\tif (!binaryPropertyName) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'Binary property name is required', {\n\t\t\t\tdescription: 'Error uploading file',\n\t\t\t});\n\t\t}\n\t\tconst binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);\n\t\tif (!binaryData.id) {\n\t\t\tconst buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);\n\t\t\treturn await uploadFile.call(this, buffer, binaryData.mimeType);\n\t\t} else {\n\t\t\tstream = await this.helpers.getBinaryStream(binaryData.id, CHUNK_SIZE);\n\t\t\tmimeType = binaryData.mimeType;\n\t\t}\n\t}\n\n\tconst uploadInitResponse = (await apiRequest.call(this, 'POST', '/upload/v1beta/files', {\n\t\theaders: {\n\t\t\t'X-Goog-Upload-Protocol': 'resumable',\n\t\t\t'X-Goog-Upload-Command': 'start',\n\t\t\t'X-Goog-Upload-Header-Content-Type': mimeType,\n\t\t\t'Content-Type': 'application/json',\n\t\t},\n\t\toption: { returnFullResponse: true },\n\t})) as { headers: IDataObject };\n\n\tconst uploadUrl = uploadInitResponse.headers['x-goog-upload-url'] as string;\n\tif (!uploadUrl) {\n\t\tthrow new NodeOperationError(this.getNode(), 'Failed to get upload URL');\n\t}\n\n\tconst uploadResponse = (await this.helpers.httpRequest({\n\t\tmethod: 'POST',\n\t\turl: uploadUrl,\n\t\theaders: {\n\t\t\t'X-Goog-Upload-Offset': '0',\n\t\t\t'X-Goog-Upload-Command': 'upload, finalize',\n\t\t\t'Content-Type': mimeType,\n\t\t},\n\t\tbody: stream,\n\t\treturnFullResponse: true,\n\t})) as { body: { file: File } };\n\n\tlet file = uploadResponse.body.file;\n\n\twhile (file.state !== 'ACTIVE' && file.state !== 'FAILED') {\n\t\tawait new Promise((resolve) => setTimeout(resolve, 1000));\n\t\tfile = (await apiRequest.call(this, 'GET', `/v1beta/${file.name}`)) as File;\n\t}\n\n\tif (file.state === 'FAILED') {\n\t\tthrow new NodeOperationError(this.getNode(), file.error?.message ?? 'Unknown error', {\n\t\t\tdescription: 'Error uploading file',\n\t\t});\n\t}\n\n\treturn { fileUri: file.uri, mimeType: file.mimeType };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAmC;AAEnC,uBAA2B;AAE3B,mBAAkB;AAWlB,MAAM,aAAa,MAAM;AAEzB,eAAsB,aAErB,KACA,kBACA,IACC;AACD,QAAM,mBAAoB,MAAM,KAAK,QAAQ,YAAY;AAAA,IACxD,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,UAAU;AAAA,EACX,CAAC;AAED,QAAM,WACJ,iBAAiB,UAAU,cAAc,GAAc,MAAM,GAAG,IAAI,CAAC,KAAK;AAC5E,QAAM,cAAc,OAAO,KAAK,iBAAiB,IAAI;AACrD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAEA,eAAsB,WAAoC,aAAqB,UAAkB;AAChG,QAAM,WAAW,YAAY,OAAO,SAAS;AAC7C,QAAM,qBAAsB,MAAM,4BAAW,KAAK,MAAM,QAAQ,wBAAwB;AAAA,IACvF,SAAS;AAAA,MACR,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,uCAAuC;AAAA,MACvC,qCAAqC;AAAA,MACrC,gBAAgB;AAAA,IACjB;AAAA,IACA,QAAQ;AAAA,MACP,oBAAoB;AAAA,IACrB;AAAA,EACD,CAAC;AACD,QAAM,YAAY,mBAAmB,QAAQ,mBAAmB;AAEhE,QAAM,iBAAkB,MAAM,KAAK,QAAQ,YAAY;AAAA,IACtD,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,SAAS;AAAA,MACR,kBAAkB;AAAA,MAClB,wBAAwB;AAAA,MACxB,yBAAyB;AAAA,IAC1B;AAAA,IACA,MAAM;AAAA,EACP,CAAC;AAED,SAAO,eAAe,KAAK,UAAU,YAAY,eA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