n8n-nodes-ai-agent-langfuse 0.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/README.md +149 -0
- package/dist/credentials/LangfuseApi.credentials.d.ts +10 -0
- package/dist/credentials/LangfuseApi.credentials.js +58 -0
- package/dist/credentials/LangfuseApi.credentials.js.map +1 -0
- package/dist/credentials/LangfuseApi.icon.svg +9 -0
- package/dist/nodes/AgentWithLangfuse/AgentWithLangfuse.icon.svg +7 -0
- package/dist/nodes/AgentWithLangfuse/AgentWithLangfuse.node.d.ts +5 -0
- package/dist/nodes/AgentWithLangfuse/AgentWithLangfuse.node.js +173 -0
- package/dist/nodes/AgentWithLangfuse/AgentWithLangfuse.node.js.map +1 -0
- package/dist/nodes/AgentWithLangfuse/AgentWithLangfuseDark.icon.svg +10 -0
- package/dist/nodes/AgentWithLangfuse/AgentWithLangfuseLight.icon.svg +10 -0
- package/dist/nodes/AgentWithLangfuse/V2/description.d.ts +4 -0
- package/dist/nodes/AgentWithLangfuse/V2/description.js +46 -0
- package/dist/nodes/AgentWithLangfuse/V2/description.js.map +1 -0
- package/dist/nodes/AgentWithLangfuse/V2/execute.d.ts +2 -0
- package/dist/nodes/AgentWithLangfuse/V2/execute.js +142 -0
- package/dist/nodes/AgentWithLangfuse/V2/execute.js.map +1 -0
- package/dist/nodes/AgentWithLangfuse/V2/utils.d.ts +2 -0
- package/dist/nodes/AgentWithLangfuse/V2/utils.js +70 -0
- package/dist/nodes/AgentWithLangfuse/V2/utils.js.map +1 -0
- package/dist/package.json +68 -0
- package/dist/src/types/types.d.ts +6 -0
- package/dist/src/types/types.js +3 -0
- package/dist/src/types/types.js.map +1 -0
- package/dist/src/utils/N8nOutputParser.d.ts +5 -0
- package/dist/src/utils/N8nOutputParser.js +14 -0
- package/dist/src/utils/N8nOutputParser.js.map +1 -0
- package/dist/src/utils/N8nTool.d.ts +10 -0
- package/dist/src/utils/N8nTool.js +86 -0
- package/dist/src/utils/N8nTool.js.map +1 -0
- package/dist/src/utils/common.d.ts +28 -0
- package/dist/src/utils/common.js +197 -0
- package/dist/src/utils/common.js.map +1 -0
- package/dist/src/utils/descriptions.d.ts +17 -0
- package/dist/src/utils/descriptions.js +135 -0
- package/dist/src/utils/descriptions.js.map +1 -0
- package/dist/src/utils/helpers.d.ts +24 -0
- package/dist/src/utils/helpers.js +221 -0
- package/dist/src/utils/helpers.js.map +1 -0
- package/dist/src/utils/options.d.ts +2 -0
- package/dist/src/utils/options.js +38 -0
- package/dist/src/utils/options.js.map +1 -0
- package/dist/src/utils/output_parsers/N8nStructuredOutputParser.d.ts +12 -0
- package/dist/src/utils/output_parsers/N8nStructuredOutputParser.js +105 -0
- package/dist/src/utils/output_parsers/N8nStructuredOutputParser.js.map +1 -0
- package/dist/src/utils/prompt.d.ts +1 -0
- package/dist/src/utils/prompt.js +5 -0
- package/dist/src/utils/prompt.js.map +1 -0
- package/dist/src/utils/sharedFields.d.ts +8 -0
- package/dist/src/utils/sharedFields.js +150 -0
- package/dist/src/utils/sharedFields.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.js +0 -0
- package/package.json +68 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.metadataFilterField = void 0;
|
|
4
|
+
exports.getTemplateNoticeField = getTemplateNoticeField;
|
|
5
|
+
exports.getBatchingOptionFields = getBatchingOptionFields;
|
|
6
|
+
exports.getConnectionHintNoticeField = getConnectionHintNoticeField;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
exports.metadataFilterField = {
|
|
9
|
+
displayName: 'Metadata Filter',
|
|
10
|
+
name: 'metadata',
|
|
11
|
+
type: 'fixedCollection',
|
|
12
|
+
description: 'Metadata to filter the document by',
|
|
13
|
+
typeOptions: {
|
|
14
|
+
multipleValues: true,
|
|
15
|
+
},
|
|
16
|
+
default: {},
|
|
17
|
+
placeholder: 'Add filter field',
|
|
18
|
+
options: [
|
|
19
|
+
{
|
|
20
|
+
name: 'metadataValues',
|
|
21
|
+
displayName: 'Fields to Set',
|
|
22
|
+
values: [
|
|
23
|
+
{
|
|
24
|
+
displayName: 'Name',
|
|
25
|
+
name: 'name',
|
|
26
|
+
type: 'string',
|
|
27
|
+
default: '',
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Value',
|
|
32
|
+
name: 'value',
|
|
33
|
+
type: 'string',
|
|
34
|
+
default: '',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
function getTemplateNoticeField(templateId) {
|
|
41
|
+
return {
|
|
42
|
+
displayName: `Save time with an <a href="/templates/${templateId}" target="_blank">example</a> of how this node works`,
|
|
43
|
+
name: 'notice',
|
|
44
|
+
type: 'notice',
|
|
45
|
+
default: '',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function getBatchingOptionFields(displayOptions, defaultBatchSize = 5) {
|
|
49
|
+
return {
|
|
50
|
+
displayName: 'Batch Processing',
|
|
51
|
+
name: 'batching',
|
|
52
|
+
type: 'collection',
|
|
53
|
+
placeholder: 'Add Batch Processing Option',
|
|
54
|
+
description: 'Batch processing options for rate limiting',
|
|
55
|
+
default: {},
|
|
56
|
+
options: [
|
|
57
|
+
{
|
|
58
|
+
displayName: 'Batch Size',
|
|
59
|
+
name: 'batchSize',
|
|
60
|
+
default: defaultBatchSize,
|
|
61
|
+
type: 'number',
|
|
62
|
+
description: 'How many items to process in parallel. This is useful for rate limiting, but might impact the log output ordering.',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
displayName: 'Delay Between Batches',
|
|
66
|
+
name: 'delayBetweenBatches',
|
|
67
|
+
default: 0,
|
|
68
|
+
type: 'number',
|
|
69
|
+
description: 'Delay in milliseconds between batches. This is useful for rate limiting.',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
displayOptions,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const connectionsString = {
|
|
76
|
+
[n8n_workflow_1.NodeConnectionTypes.AiAgent]: {
|
|
77
|
+
connection: '',
|
|
78
|
+
locale: 'AI Agent',
|
|
79
|
+
},
|
|
80
|
+
[n8n_workflow_1.NodeConnectionTypes.AiChain]: {
|
|
81
|
+
connection: '',
|
|
82
|
+
locale: 'AI Chain',
|
|
83
|
+
},
|
|
84
|
+
[n8n_workflow_1.NodeConnectionTypes.AiDocument]: {
|
|
85
|
+
connection: n8n_workflow_1.NodeConnectionTypes.AiDocument,
|
|
86
|
+
locale: 'Document Loader',
|
|
87
|
+
},
|
|
88
|
+
[n8n_workflow_1.NodeConnectionTypes.AiVectorStore]: {
|
|
89
|
+
connection: n8n_workflow_1.NodeConnectionTypes.AiVectorStore,
|
|
90
|
+
locale: 'Vector Store',
|
|
91
|
+
},
|
|
92
|
+
[n8n_workflow_1.NodeConnectionTypes.AiRetriever]: {
|
|
93
|
+
connection: n8n_workflow_1.NodeConnectionTypes.AiRetriever,
|
|
94
|
+
locale: 'Vector Store Retriever',
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
function determineArticle(nextWord) {
|
|
98
|
+
const vowels = /^[aeiouAEIOU]/;
|
|
99
|
+
return vowels.test(nextWord) ? 'an' : 'a';
|
|
100
|
+
}
|
|
101
|
+
const getConnectionParameterString = (connectionType) => {
|
|
102
|
+
if (connectionType === '')
|
|
103
|
+
return "data-action-parameter-creatorview='AI'";
|
|
104
|
+
return `data-action-parameter-connectiontype='${connectionType}'`;
|
|
105
|
+
};
|
|
106
|
+
const getAhref = (connectionType) => `<a class="test" data-action='openSelectiveNodeCreator'${getConnectionParameterString(connectionType.connection)}'>${connectionType.locale}</a>`;
|
|
107
|
+
function getConnectionHintNoticeField(connectionTypes) {
|
|
108
|
+
const groupedConnections = new Map();
|
|
109
|
+
connectionTypes.forEach((connectionType) => {
|
|
110
|
+
var _a;
|
|
111
|
+
const connectionString = connectionsString[connectionType].connection;
|
|
112
|
+
const localeString = connectionsString[connectionType].locale;
|
|
113
|
+
if (!groupedConnections.has(connectionString)) {
|
|
114
|
+
groupedConnections.set(connectionString, [localeString]);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
(_a = groupedConnections.get(connectionString)) === null || _a === void 0 ? void 0 : _a.push(localeString);
|
|
118
|
+
});
|
|
119
|
+
let displayName;
|
|
120
|
+
if (groupedConnections.size === 1) {
|
|
121
|
+
const [[connection, locales]] = Array.from(groupedConnections);
|
|
122
|
+
displayName = `This node must be connected to ${determineArticle(locales[0])} ${locales[0]
|
|
123
|
+
.toLowerCase()
|
|
124
|
+
.replace(/^ai /, 'AI ')}. <a data-action='openSelectiveNodeCreator' ${getConnectionParameterString(connection)}>Insert one</a>`;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const ahrefs = Array.from(groupedConnections, ([connection, locales]) => {
|
|
128
|
+
const locale = locales.length > 1
|
|
129
|
+
? locales
|
|
130
|
+
.map((localeString, index, { length }) => {
|
|
131
|
+
return ((index === 0 ? `${determineArticle(localeString)} ` : '') +
|
|
132
|
+
(index < length - 1 ? `${localeString} or ` : localeString));
|
|
133
|
+
})
|
|
134
|
+
.join('')
|
|
135
|
+
: `${determineArticle(locales[0])} ${locales[0]}`;
|
|
136
|
+
return getAhref({ connection, locale });
|
|
137
|
+
});
|
|
138
|
+
displayName = `This node needs to be connected to ${ahrefs.join(' or ')}.`;
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
displayName,
|
|
142
|
+
name: 'notice',
|
|
143
|
+
type: 'notice',
|
|
144
|
+
default: '',
|
|
145
|
+
typeOptions: {
|
|
146
|
+
containerClass: 'ndv-connection-hint-notice',
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=sharedFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedFields.js","sourceRoot":"","sources":["../../../src/utils/sharedFields.ts"],"names":[],"mappings":";;;AAoCA,wDAOC;AAED,0DA8BC;AAiDD,oEA8DC;AA1LD,+CAAmD;AAGtC,QAAA,mBAAmB,GAAoB;IAChD,WAAW,EAAE,iBAAiB;IAC9B,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,oCAAoC;IACjD,WAAW,EAAE;QACT,cAAc,EAAE,IAAI;KACvB;IACD,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,kBAAkB;IAC/B,OAAO,EAAE;QACL;YACI,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,eAAe;YAC5B,MAAM,EAAE;gBACJ;oBACI,WAAW,EAAE,MAAM;oBACnB,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;oBACX,QAAQ,EAAE,IAAI;iBACjB;gBACD;oBACI,WAAW,EAAE,OAAO;oBACpB,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;iBACd;aACJ;SACJ;KACJ;CACJ,CAAC;AAEF,SAAgB,sBAAsB,CAAC,UAAkB;IACrD,OAAO;QACH,WAAW,EAAE,yCAAyC,UAAU,sDAAsD;QACtH,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACd,CAAC;AACN,CAAC;AAED,SAAgB,uBAAuB,CACnC,cAA2C,EAC3C,mBAA2B,CAAC;IAE5B,OAAO;QACH,WAAW,EAAE,kBAAkB;QAC/B,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,6BAA6B;QAC1C,WAAW,EAAE,4CAA4C;QACzD,OAAO,EAAE,EAAE;QACX,OAAO,EAAE;YACL;gBACI,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,OAAO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