@n8n/n8n-nodes-langchain 1.104.0 → 1.105.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/VercelAiGatewayApi.credentials.js +81 -0
- package/dist/credentials/VercelAiGatewayApi.credentials.js.map +1 -0
- package/dist/known/credentials.json +7 -0
- package/dist/known/nodes.json +4 -0
- package/dist/nodes/ModelSelector/ModelSelector.node.js +13 -0
- package/dist/nodes/ModelSelector/ModelSelector.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js +2 -0
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js.map +1 -1
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js +85 -1
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js.map +1 -1
- package/dist/nodes/llms/LmChatVercelAiGateway/LmChatVercelAiGateway.node.js +248 -0
- package/dist/nodes/llms/LmChatVercelAiGateway/LmChatVercelAiGateway.node.js.map +1 -0
- package/dist/nodes/llms/LmChatVercelAiGateway/vercel.dark.svg +1 -0
- package/dist/nodes/llms/LmChatVercelAiGateway/vercel.svg +6 -0
- package/dist/nodes/trigger/ChatTrigger/error.js +2 -2
- package/dist/nodes/trigger/ChatTrigger/error.js.map +1 -1
- package/dist/nodes/trigger/ChatTrigger/templates.js +1 -1
- package/dist/nodes/trigger/ChatTrigger/templates.js.map +1 -1
- package/dist/nodes/vendors/Anthropic/actions/versionDescription.js +1 -1
- package/dist/nodes/vendors/Anthropic/actions/versionDescription.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/actions/video/generate.operation.js +2 -2
- package/dist/nodes/vendors/GoogleGemini/actions/video/generate.operation.js.map +1 -1
- package/dist/types/credentials.json +1 -0
- package/dist/types/nodes.json +6 -5
- package/dist/utils/output_parsers/N8nStructuredOutputParser.js +1 -1
- package/dist/utils/output_parsers/N8nStructuredOutputParser.js.map +1 -1
- package/package.json +8 -5
|
@@ -0,0 +1,81 @@
|
|
|
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 VercelAiGatewayApi_credentials_exports = {};
|
|
20
|
+
__export(VercelAiGatewayApi_credentials_exports, {
|
|
21
|
+
VercelAiGatewayApi: () => VercelAiGatewayApi
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(VercelAiGatewayApi_credentials_exports);
|
|
24
|
+
class VercelAiGatewayApi {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.name = "vercelAiGatewayApi";
|
|
27
|
+
this.displayName = "Vercel AI Gateway";
|
|
28
|
+
this.documentationUrl = "vercelaigateway";
|
|
29
|
+
this.properties = [
|
|
30
|
+
{
|
|
31
|
+
displayName: "API Key or OIDC Token",
|
|
32
|
+
name: "apiKey",
|
|
33
|
+
type: "string",
|
|
34
|
+
typeOptions: { password: true },
|
|
35
|
+
required: true,
|
|
36
|
+
default: "",
|
|
37
|
+
description: "Your credentials for the Vercel AI Gateway"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
displayName: "Base URL",
|
|
41
|
+
name: "url",
|
|
42
|
+
type: "string",
|
|
43
|
+
required: true,
|
|
44
|
+
default: "https://ai-gateway.vercel.sh/v1",
|
|
45
|
+
description: "The base URL for your Vercel AI Gateway instance",
|
|
46
|
+
placeholder: "https://ai-gateway.vercel.sh/v1"
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
this.authenticate = {
|
|
50
|
+
type: "generic",
|
|
51
|
+
properties: {
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: "=Bearer {{$credentials.apiKey}}",
|
|
54
|
+
"http-referer": "https://n8n.io/",
|
|
55
|
+
"x-title": "n8n"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
this.test = {
|
|
60
|
+
request: {
|
|
61
|
+
baseURL: "={{ $credentials.url }}",
|
|
62
|
+
url: "/chat/completions",
|
|
63
|
+
method: "POST",
|
|
64
|
+
headers: {
|
|
65
|
+
"http-referer": "https://n8n.io/",
|
|
66
|
+
"x-title": "n8n"
|
|
67
|
+
},
|
|
68
|
+
body: {
|
|
69
|
+
model: "openai/gpt-4.1-nano",
|
|
70
|
+
messages: [{ role: "user", content: "test" }],
|
|
71
|
+
max_tokens: 1
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
VercelAiGatewayApi
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=VercelAiGatewayApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../credentials/VercelAiGatewayApi.credentials.ts"],"sourcesContent":["import type {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class VercelAiGatewayApi implements ICredentialType {\n\tname = 'vercelAiGatewayApi';\n\n\tdisplayName = 'Vercel AI Gateway';\n\n\tdocumentationUrl = 'vercelaigateway';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'API Key or OIDC Token',\n\t\t\tname: 'apiKey',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: { password: true },\n\t\t\trequired: true,\n\t\t\tdefault: '',\n\t\t\tdescription: 'Your credentials for the Vercel AI Gateway',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Base URL',\n\t\t\tname: 'url',\n\t\t\ttype: 'string',\n\t\t\trequired: true,\n\t\t\tdefault: 'https://ai-gateway.vercel.sh/v1',\n\t\t\tdescription: 'The base URL for your Vercel AI Gateway instance',\n\t\t\tplaceholder: 'https://ai-gateway.vercel.sh/v1',\n\t\t},\n\t];\n\n\tauthenticate: IAuthenticateGeneric = {\n\t\ttype: 'generic',\n\t\tproperties: {\n\t\t\theaders: {\n\t\t\t\tAuthorization: '=Bearer {{$credentials.apiKey}}',\n\t\t\t\t'http-referer': 'https://n8n.io/',\n\t\t\t\t'x-title': 'n8n',\n\t\t\t},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{ $credentials.url }}',\n\t\t\turl: '/chat/completions',\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'http-referer': 'https://n8n.io/',\n\t\t\t\t'x-title': 'n8n',\n\t\t\t},\n\t\t\tbody: {\n\t\t\t\tmodel: 'openai/gpt-4.1-nano',\n\t\t\t\tmessages: [{ role: 'user', content: 'test' }],\n\t\t\t\tmax_tokens: 1,\n\t\t\t},\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,mBAA8C;AAAA,EAApD;AACN,gBAAO;AAEP,uBAAc;AAEd,4BAAmB;AAEnB,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa,EAAE,UAAU,KAAK;AAAA,QAC9B,UAAU;AAAA,QACV,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,UAAU;AAAA,QACV,SAAS;AAAA,QACT,aAAa;AAAA,QACb,aAAa;AAAA,MACd;AAAA,IACD;AAEA,wBAAqC;AAAA,MACpC,MAAM;AAAA,MACN,YAAY;AAAA,QACX,SAAS;AAAA,UACR,eAAe;AAAA,UACf,gBAAgB;AAAA,UAChB,WAAW;AAAA,QACZ;AAAA,MACD;AAAA,IACD;AAEA,gBAA+B;AAAA,MAC9B,SAAS;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,UACR,gBAAgB;AAAA,UAChB,WAAW;AAAA,QACZ;AAAA,QACA,MAAM;AAAA,UACL,OAAO;AAAA,UACP,UAAU,CAAC,EAAE,MAAM,QAAQ,SAAS,OAAO,CAAC;AAAA,UAC5C,YAAY;AAAA,QACb;AAAA,MACD;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
@@ -134,6 +134,13 @@
|
|
|
134
134
|
"toolSerpApi"
|
|
135
135
|
]
|
|
136
136
|
},
|
|
137
|
+
"vercelAiGatewayApi": {
|
|
138
|
+
"className": "VercelAiGatewayApi",
|
|
139
|
+
"sourcePath": "dist/credentials/VercelAiGatewayApi.credentials.js",
|
|
140
|
+
"supportedNodes": [
|
|
141
|
+
"lmChatVercelAiGateway"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
137
144
|
"weaviateApi": {
|
|
138
145
|
"className": "WeaviateApi",
|
|
139
146
|
"sourcePath": "dist/credentials/WeaviateApi.credentials.js",
|
package/dist/known/nodes.json
CHANGED
|
@@ -147,6 +147,10 @@
|
|
|
147
147
|
"className": "LmChatOpenRouter",
|
|
148
148
|
"sourcePath": "dist/nodes/llms/LmChatOpenRouter/LmChatOpenRouter.node.js"
|
|
149
149
|
},
|
|
150
|
+
"lmChatVercelAiGateway": {
|
|
151
|
+
"className": "LmChatVercelAiGateway",
|
|
152
|
+
"sourcePath": "dist/nodes/llms/LmChatVercelAiGateway/LmChatVercelAiGateway.node.js"
|
|
153
|
+
},
|
|
150
154
|
"lmChatXAiGrok": {
|
|
151
155
|
"className": "LmChatXAiGrok",
|
|
152
156
|
"sourcePath": "dist/nodes/llms/LmChatXAiGrok/LmChatXAiGrok.node.js"
|
|
@@ -51,6 +51,19 @@ class ModelSelector {
|
|
|
51
51
|
return configuredInputs(parameters)
|
|
52
52
|
})($parameter)
|
|
53
53
|
}}`,
|
|
54
|
+
codex: {
|
|
55
|
+
categories: ["AI"],
|
|
56
|
+
subcategories: {
|
|
57
|
+
AI: ["Language Models"]
|
|
58
|
+
},
|
|
59
|
+
resources: {
|
|
60
|
+
primaryDocumentation: [
|
|
61
|
+
{
|
|
62
|
+
url: "https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.modelselector/"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
54
67
|
outputs: [import_n8n_workflow.NodeConnectionTypes.AiLanguageModel],
|
|
55
68
|
requiredInputs: 1,
|
|
56
69
|
properties: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/ModelSelector/ModelSelector.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-param-description-wrong-for-dynamic-options */\n/* eslint-disable n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options */\nimport type { BaseCallbackHandler, CallbackHandlerMethods } from '@langchain/core/callbacks/base';\nimport type { Callbacks } from '@langchain/core/callbacks/manager';\nimport type { BaseChatModel } from '@langchain/core/language_models/chat_models';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n\ttype ILoadOptionsFunctions,\n\tNodeOperationError,\n} from 'n8n-workflow';\n\nimport { numberInputsProperty, configuredInputs } from './helpers';\nimport { N8nLlmTracing } from '../llms/N8nLlmTracing';\nimport { N8nNonEstimatingTracing } from '../llms/N8nNonEstimatingTracing';\n\ninterface ModeleSelectionRule {\n\tmodelIndex: number;\n\tconditions: {\n\t\toptions: {\n\t\t\tcaseSensitive: boolean;\n\t\t\ttypeValidation: 'strict' | 'loose';\n\t\t\tleftValue: string;\n\t\t\tversion: 1 | 2;\n\t\t};\n\t\tconditions: Array<{\n\t\t\tid: string;\n\t\t\tleftValue: string;\n\t\t\trightValue: string;\n\t\t\toperator: {\n\t\t\t\ttype: string;\n\t\t\t\toperation: string;\n\t\t\t\tname: string;\n\t\t\t};\n\t\t}>;\n\t\tcombinator: 'and' | 'or';\n\t};\n}\n\nfunction getCallbacksArray(\n\tcallbacks: Callbacks | undefined,\n): Array<BaseCallbackHandler | CallbackHandlerMethods> {\n\tif (!callbacks) return [];\n\n\tif (Array.isArray(callbacks)) {\n\t\treturn callbacks;\n\t}\n\n\t// If it's a CallbackManager, extract its handlers\n\treturn callbacks.handlers || [];\n}\n\nexport class ModelSelector implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Model Selector',\n\t\tname: 'modelSelector',\n\t\ticon: 'fa:map-signs',\n\t\ticonColor: 'green',\n\t\tdefaults: {\n\t\t\tname: 'Model Selector',\n\t\t},\n\t\tversion: 1,\n\t\tgroup: ['transform'],\n\t\tdescription:\n\t\t\t'Use this node to select one of the connected models to this node based on workflow data',\n\t\tinputs: `={{\n\t\t\t\t((parameters) => {\n\t\t\t\t\t${configuredInputs.toString()};\n\t\t\t\t\treturn configuredInputs(parameters)\n\t\t\t\t})($parameter)\n\t\t\t}}`,\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\trequiredInputs: 1,\n\t\tproperties: [\n\t\t\tnumberInputsProperty,\n\t\t\t{\n\t\t\t\tdisplayName: 'Rules',\n\t\t\t\tname: 'rules',\n\t\t\t\tplaceholder: 'Add Rule',\n\t\t\t\ttype: 'fixedCollection',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\tsortable: true,\n\t\t\t\t},\n\t\t\t\tdescription: 'Rules to map workflow data to specific models',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Rule',\n\t\t\t\t\t\tname: 'rule',\n\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Model',\n\t\t\t\t\t\t\t\tname: 'modelIndex',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdescription: 'Choose model input from the list',\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\t\tplaceholder: 'Choose model input from the list',\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tloadOptionsMethod: 'getModels',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Conditions',\n\t\t\t\t\t\t\t\tname: 'conditions',\n\t\t\t\t\t\t\t\tplaceholder: 'Add Condition',\n\t\t\t\t\t\t\t\ttype: 'filter',\n\t\t\t\t\t\t\t\tdefault: {},\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tfilter: {\n\t\t\t\t\t\t\t\t\t\tcaseSensitive: true,\n\t\t\t\t\t\t\t\t\t\ttypeValidation: 'strict',\n\t\t\t\t\t\t\t\t\t\tversion: 2,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: 'Conditions that must be met to select this model',\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\t\t],\n\t};\n\n\tmethods = {\n\t\tloadOptions: {\n\t\t\tasync getModels(this: ILoadOptionsFunctions) {\n\t\t\t\tconst numberInputs = this.getCurrentNodeParameter('numberInputs') as number;\n\n\t\t\t\treturn Array.from({ length: numberInputs ?? 2 }, (_, i) => ({\n\t\t\t\t\tvalue: i + 1,\n\t\t\t\t\tname: `Model ${(i + 1).toString()}`,\n\t\t\t\t}));\n\t\t\t},\n\t\t},\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst models = (await this.getInputConnectionData(\n\t\t\tNodeConnectionTypes.AiLanguageModel,\n\t\t\titemIndex,\n\t\t)) as unknown[];\n\n\t\tif (!models || models.length === 0) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'No models connected', {\n\t\t\t\titemIndex,\n\t\t\t\tdescription: 'No models found in input connections',\n\t\t\t});\n\t\t}\n\t\tmodels.reverse();\n\n\t\tconst rules = this.getNodeParameter('rules.rule', itemIndex, []) as ModeleSelectionRule[];\n\n\t\tif (!rules || rules.length === 0) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'No rules defined', {\n\t\t\t\titemIndex,\n\t\t\t\tdescription: 'At least one rule must be defined to select a model',\n\t\t\t});\n\t\t}\n\n\t\tfor (let i = 0; i < rules.length; i++) {\n\t\t\tconst rule = rules[i];\n\t\t\tconst modelIndex = rule.modelIndex;\n\n\t\t\tif (modelIndex <= 0 || modelIndex > models.length) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), `Invalid model index ${modelIndex}`, {\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription: `Model index must be between 1 and ${models.length}`,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst conditionsMet = this.getNodeParameter(`rules.rule[${i}].conditions`, itemIndex, false, {\n\t\t\t\textractValue: true,\n\t\t\t}) as boolean;\n\n\t\t\tif (conditionsMet) {\n\t\t\t\tconst selectedModel = models[modelIndex - 1] as BaseChatModel;\n\n\t\t\t\tconst originalCallbacks = getCallbacksArray(selectedModel.callbacks);\n\n\t\t\t\tfor (const currentCallback of originalCallbacks) {\n\t\t\t\t\tif (currentCallback instanceof N8nLlmTracing) {\n\t\t\t\t\t\tcurrentCallback.setParentRunIndex(this.getNextRunIndex());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst modelSelectorTracing = new N8nNonEstimatingTracing(this);\n\t\t\t\tselectedModel.callbacks = [...originalCallbacks, modelSelectorTracing];\n\n\t\t\t\treturn {\n\t\t\t\t\tresponse: selectedModel,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tthrow new NodeOperationError(this.getNode(), 'No matching rule found', {\n\t\t\titemIndex,\n\t\t\tdescription: 'None of the defined rules matched the workflow data',\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,0BAQO;AAEP,qBAAuD;AACvD,2BAA8B;AAC9B,qCAAwC;AAyBxC,SAAS,kBACR,WACsD;AACtD,MAAI,CAAC,UAAW,QAAO,CAAC;AAExB,MAAI,MAAM,QAAQ,SAAS,GAAG;AAC7B,WAAO;AAAA,EACR;AAGA,SAAO,UAAU,YAAY,CAAC;AAC/B;AAEO,MAAM,cAAmC;AAAA,EAAzC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,SAAS;AAAA,MACT,OAAO,CAAC,WAAW;AAAA,MACnB,aACC;AAAA,MACD,QAAQ;AAAA;AAAA,OAEH,gCAAiB,SAAS,CAAC;AAAA;AAAA;AAAA;AAAA,MAIhC,SAAS,CAAC,wCAAoB,eAAe;AAAA,MAC7C,gBAAgB;AAAA,MAChB,YAAY;AAAA,QACX;AAAA,QACA;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,UACb,MAAM;AAA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* eslint-disable n8n-nodes-base/node-param-description-wrong-for-dynamic-options */\n/* eslint-disable n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options */\nimport type { BaseCallbackHandler, CallbackHandlerMethods } from '@langchain/core/callbacks/base';\nimport type { Callbacks } from '@langchain/core/callbacks/manager';\nimport type { BaseChatModel } from '@langchain/core/language_models/chat_models';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n\ttype ILoadOptionsFunctions,\n\tNodeOperationError,\n} from 'n8n-workflow';\n\nimport { numberInputsProperty, configuredInputs } from './helpers';\nimport { N8nLlmTracing } from '../llms/N8nLlmTracing';\nimport { N8nNonEstimatingTracing } from '../llms/N8nNonEstimatingTracing';\n\ninterface ModeleSelectionRule {\n\tmodelIndex: number;\n\tconditions: {\n\t\toptions: {\n\t\t\tcaseSensitive: boolean;\n\t\t\ttypeValidation: 'strict' | 'loose';\n\t\t\tleftValue: string;\n\t\t\tversion: 1 | 2;\n\t\t};\n\t\tconditions: Array<{\n\t\t\tid: string;\n\t\t\tleftValue: string;\n\t\t\trightValue: string;\n\t\t\toperator: {\n\t\t\t\ttype: string;\n\t\t\t\toperation: string;\n\t\t\t\tname: string;\n\t\t\t};\n\t\t}>;\n\t\tcombinator: 'and' | 'or';\n\t};\n}\n\nfunction getCallbacksArray(\n\tcallbacks: Callbacks | undefined,\n): Array<BaseCallbackHandler | CallbackHandlerMethods> {\n\tif (!callbacks) return [];\n\n\tif (Array.isArray(callbacks)) {\n\t\treturn callbacks;\n\t}\n\n\t// If it's a CallbackManager, extract its handlers\n\treturn callbacks.handlers || [];\n}\n\nexport class ModelSelector implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Model Selector',\n\t\tname: 'modelSelector',\n\t\ticon: 'fa:map-signs',\n\t\ticonColor: 'green',\n\t\tdefaults: {\n\t\t\tname: 'Model Selector',\n\t\t},\n\t\tversion: 1,\n\t\tgroup: ['transform'],\n\t\tdescription:\n\t\t\t'Use this node to select one of the connected models to this node based on workflow data',\n\t\tinputs: `={{\n\t\t\t\t((parameters) => {\n\t\t\t\t\t${configuredInputs.toString()};\n\t\t\t\t\treturn configuredInputs(parameters)\n\t\t\t\t})($parameter)\n\t\t\t}}`,\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Language Models'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.modelselector/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\trequiredInputs: 1,\n\t\tproperties: [\n\t\t\tnumberInputsProperty,\n\t\t\t{\n\t\t\t\tdisplayName: 'Rules',\n\t\t\t\tname: 'rules',\n\t\t\t\tplaceholder: 'Add Rule',\n\t\t\t\ttype: 'fixedCollection',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\tsortable: true,\n\t\t\t\t},\n\t\t\t\tdescription: 'Rules to map workflow data to specific models',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Rule',\n\t\t\t\t\t\tname: 'rule',\n\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Model',\n\t\t\t\t\t\t\t\tname: 'modelIndex',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdescription: 'Choose model input from the list',\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\t\tplaceholder: 'Choose model input from the list',\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tloadOptionsMethod: 'getModels',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Conditions',\n\t\t\t\t\t\t\t\tname: 'conditions',\n\t\t\t\t\t\t\t\tplaceholder: 'Add Condition',\n\t\t\t\t\t\t\t\ttype: 'filter',\n\t\t\t\t\t\t\t\tdefault: {},\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tfilter: {\n\t\t\t\t\t\t\t\t\t\tcaseSensitive: true,\n\t\t\t\t\t\t\t\t\t\ttypeValidation: 'strict',\n\t\t\t\t\t\t\t\t\t\tversion: 2,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: 'Conditions that must be met to select this model',\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\t\t],\n\t};\n\n\tmethods = {\n\t\tloadOptions: {\n\t\t\tasync getModels(this: ILoadOptionsFunctions) {\n\t\t\t\tconst numberInputs = this.getCurrentNodeParameter('numberInputs') as number;\n\n\t\t\t\treturn Array.from({ length: numberInputs ?? 2 }, (_, i) => ({\n\t\t\t\t\tvalue: i + 1,\n\t\t\t\t\tname: `Model ${(i + 1).toString()}`,\n\t\t\t\t}));\n\t\t\t},\n\t\t},\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst models = (await this.getInputConnectionData(\n\t\t\tNodeConnectionTypes.AiLanguageModel,\n\t\t\titemIndex,\n\t\t)) as unknown[];\n\n\t\tif (!models || models.length === 0) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'No models connected', {\n\t\t\t\titemIndex,\n\t\t\t\tdescription: 'No models found in input connections',\n\t\t\t});\n\t\t}\n\t\tmodels.reverse();\n\n\t\tconst rules = this.getNodeParameter('rules.rule', itemIndex, []) as ModeleSelectionRule[];\n\n\t\tif (!rules || rules.length === 0) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'No rules defined', {\n\t\t\t\titemIndex,\n\t\t\t\tdescription: 'At least one rule must be defined to select a model',\n\t\t\t});\n\t\t}\n\n\t\tfor (let i = 0; i < rules.length; i++) {\n\t\t\tconst rule = rules[i];\n\t\t\tconst modelIndex = rule.modelIndex;\n\n\t\t\tif (modelIndex <= 0 || modelIndex > models.length) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), `Invalid model index ${modelIndex}`, {\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription: `Model index must be between 1 and ${models.length}`,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst conditionsMet = this.getNodeParameter(`rules.rule[${i}].conditions`, itemIndex, false, {\n\t\t\t\textractValue: true,\n\t\t\t}) as boolean;\n\n\t\t\tif (conditionsMet) {\n\t\t\t\tconst selectedModel = models[modelIndex - 1] as BaseChatModel;\n\n\t\t\t\tconst originalCallbacks = getCallbacksArray(selectedModel.callbacks);\n\n\t\t\t\tfor (const currentCallback of originalCallbacks) {\n\t\t\t\t\tif (currentCallback instanceof N8nLlmTracing) {\n\t\t\t\t\t\tcurrentCallback.setParentRunIndex(this.getNextRunIndex());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst modelSelectorTracing = new N8nNonEstimatingTracing(this);\n\t\t\t\tselectedModel.callbacks = [...originalCallbacks, modelSelectorTracing];\n\n\t\t\t\treturn {\n\t\t\t\t\tresponse: selectedModel,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tthrow new NodeOperationError(this.getNode(), 'No matching rule found', {\n\t\t\titemIndex,\n\t\t\tdescription: 'None of the defined rules matched the workflow data',\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,0BAQO;AAEP,qBAAuD;AACvD,2BAA8B;AAC9B,qCAAwC;AAyBxC,SAAS,kBACR,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,QAAQ;AAClD,cAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,uBAAuB,UAAU,IAAI;AAAA,UACjF;AAAA,UACA,aAAa,qCAAqC,OAAO,MAAM;AAAA,QAChE,CAAC;AAAA,MACF;AAEA,YAAM,gBAAgB,KAAK,iBAAiB,cAAc,CAAC,gBAAgB,WAAW,OAAO;AAAA,QAC5F,cAAc;AAAA,MACf,CAAC;AAED,UAAI,eAAe;AAClB,cAAM,gBAAgB,OAAO,aAAa,CAAC;AAE3C,cAAM,oBAAoB,kBAAkB,cAAc,SAAS;AAEnE,mBAAW,mBAAmB,mBAAmB;AAChD,cAAI,2BAA2B,oCAAe;AAC7C,4BAAgB,kBAAkB,KAAK,gBAAgB,CAAC;AAAA,UACzD;AAAA,QACD;AACA,cAAM,uBAAuB,IAAI,uDAAwB,IAAI;AAC7D,sBAAc,YAAY,CAAC,GAAG,mBAAmB,oBAAoB;AAErE,eAAO;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,IACD;AAEA,UAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,0BAA0B;AAAA,MACtE;AAAA,MACA,aAAa;AAAA,IACd,CAAC;AAAA,EACF;AACD;","names":[]}
|
|
@@ -79,6 +79,7 @@ function getInputs(agent, hasOutputParser) {
|
|
|
79
79
|
"@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
|
|
80
80
|
"@n8n/n8n-nodes-langchain.lmChatDeepSeek",
|
|
81
81
|
"@n8n/n8n-nodes-langchain.lmChatOpenRouter",
|
|
82
|
+
"@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
|
|
82
83
|
"@n8n/n8n-nodes-langchain.lmChatXAiGrok",
|
|
83
84
|
"@n8n/n8n-nodes-langchain.modelSelector"
|
|
84
85
|
]
|
|
@@ -111,6 +112,7 @@ function getInputs(agent, hasOutputParser) {
|
|
|
111
112
|
"@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
|
|
112
113
|
"@n8n/n8n-nodes-langchain.lmChatDeepSeek",
|
|
113
114
|
"@n8n/n8n-nodes-langchain.lmChatOpenRouter",
|
|
115
|
+
"@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
|
|
114
116
|
"@n8n/n8n-nodes-langchain.lmChatXAiGrok"
|
|
115
117
|
]
|
|
116
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/agents/Agent/V1/AgentV1.node.ts"],"sourcesContent":["import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\nimport type {\n\tINodeInputConfiguration,\n\tINodeInputFilter,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeType,\n\tINodeTypeDescription,\n\tINodeProperties,\n\tNodeConnectionType,\n\tINodeTypeBaseDescription,\n} from 'n8n-workflow';\n\nimport { promptTypeOptions, textFromPreviousNode, textInput } from '@utils/descriptions';\n\nimport { conversationalAgentProperties } from '../agents/ConversationalAgent/description';\nimport { conversationalAgentExecute } from '../agents/ConversationalAgent/execute';\nimport { openAiFunctionsAgentProperties } from '../agents/OpenAiFunctionsAgent/description';\nimport { openAiFunctionsAgentExecute } from '../agents/OpenAiFunctionsAgent/execute';\nimport { planAndExecuteAgentProperties } from '../agents/PlanAndExecuteAgent/description';\nimport { planAndExecuteAgentExecute } from '../agents/PlanAndExecuteAgent/execute';\nimport { reActAgentAgentProperties } from '../agents/ReActAgent/description';\nimport { reActAgentAgentExecute } from '../agents/ReActAgent/execute';\nimport { sqlAgentAgentProperties } from '../agents/SqlAgent/description';\nimport { sqlAgentAgentExecute } from '../agents/SqlAgent/execute';\nimport { toolsAgentProperties } from '../agents/ToolsAgent/V1/description';\nimport { toolsAgentExecute } from '../agents/ToolsAgent/V1/execute';\n\n// Function used in the inputs expression to figure out which inputs to\n// display based on the agent type\nfunction getInputs(\n\tagent:\n\t\t| 'toolsAgent'\n\t\t| 'conversationalAgent'\n\t\t| 'openAiFunctionsAgent'\n\t\t| 'planAndExecuteAgent'\n\t\t| 'reActAgent'\n\t\t| 'sqlAgent',\n\thasOutputParser?: boolean,\n): Array<NodeConnectionType | INodeInputConfiguration> {\n\tinterface SpecialInput {\n\t\ttype: NodeConnectionType;\n\t\tfilter?: INodeInputFilter;\n\t\trequired?: boolean;\n\t}\n\n\tconst getInputData = (\n\t\tinputs: SpecialInput[],\n\t): Array<NodeConnectionType | INodeInputConfiguration> => {\n\t\tconst displayNames: { [key: string]: string } = {\n\t\t\tai_languageModel: 'Model',\n\t\t\tai_memory: 'Memory',\n\t\t\tai_tool: 'Tool',\n\t\t\tai_outputParser: 'Output Parser',\n\t\t};\n\n\t\treturn inputs.map(({ type, filter }) => {\n\t\t\tconst isModelType = type === ('ai_languageModel' as NodeConnectionType);\n\t\t\tlet displayName = type in displayNames ? displayNames[type] : undefined;\n\t\t\tif (\n\t\t\t\tisModelType &&\n\t\t\t\t['openAiFunctionsAgent', 'toolsAgent', 'conversationalAgent'].includes(agent)\n\t\t\t) {\n\t\t\t\tdisplayName = 'Chat Model';\n\t\t\t}\n\t\t\tconst input: INodeInputConfiguration = {\n\t\t\t\ttype,\n\t\t\t\tdisplayName,\n\t\t\t\trequired: isModelType,\n\t\t\t\tmaxConnections: ['ai_languageModel', 'ai_memory', 'ai_outputParser'].includes(type)\n\t\t\t\t\t? 1\n\t\t\t\t\t: undefined,\n\t\t\t};\n\n\t\t\tif (filter) {\n\t\t\t\tinput.filter = filter;\n\t\t\t}\n\n\t\t\treturn input;\n\t\t});\n\t};\n\n\tlet specialInputs: SpecialInput[] = [];\n\n\tif (agent === 'conversationalAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t\tfilter: {\n\t\t\t\t\tnodes: [\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAnthropic',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAwsBedrock',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGroq',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOllama',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGoogleGemini',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGoogleVertex',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatMistralCloud',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAzureOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatDeepSeek',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenRouter',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatXAiGrok',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.modelSelector',\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_memory',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'toolsAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t\tfilter: {\n\t\t\t\t\tnodes: [\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAnthropic',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAzureOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAwsBedrock',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatMistralCloud',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOllama',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGroq',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGoogleVertex',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGoogleGemini',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatDeepSeek',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenRouter',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatXAiGrok',\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_memory',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'openAiFunctionsAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t\tfilter: {\n\t\t\t\t\tnodes: [\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAzureOpenAi',\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_memory',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'reActAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'sqlAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_memory',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'planAndExecuteAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t}\n\n\tif (hasOutputParser === false) {\n\t\tspecialInputs = specialInputs.filter((input) => input.type !== 'ai_outputParser');\n\t}\n\treturn ['main', ...getInputData(specialInputs)];\n}\n\nconst agentTypeProperty: INodeProperties = {\n\tdisplayName: 'Agent',\n\tname: 'agent',\n\ttype: 'options',\n\tnoDataExpression: true,\n\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\toptions: [\n\t\t{\n\t\t\tname: 'Tools Agent',\n\t\t\tvalue: 'toolsAgent',\n\t\t\tdescription:\n\t\t\t\t'Utilizes structured tool schemas for precise and reliable tool selection and execution. Recommended for complex tasks requiring accurate and consistent tool usage, but only usable with models that support tool calling.',\n\t\t},\n\t\t{\n\t\t\tname: 'Conversational Agent',\n\t\t\tvalue: 'conversationalAgent',\n\t\t\tdescription:\n\t\t\t\t'Describes tools in the system prompt and parses JSON responses for tool calls. More flexible but potentially less reliable than the Tools Agent. Suitable for simpler interactions or with models not supporting structured schemas.',\n\t\t},\n\t\t{\n\t\t\tname: 'OpenAI Functions Agent',\n\t\t\tvalue: 'openAiFunctionsAgent',\n\t\t\tdescription:\n\t\t\t\t\"Leverages OpenAI's function calling capabilities to precisely select and execute tools. Excellent for tasks requiring structured outputs when working with OpenAI models.\",\n\t\t},\n\t\t{\n\t\t\tname: 'Plan and Execute Agent',\n\t\t\tvalue: 'planAndExecuteAgent',\n\t\t\tdescription:\n\t\t\t\t'Creates a high-level plan for complex tasks and then executes each step. Suitable for multi-stage problems or when a strategic approach is needed.',\n\t\t},\n\t\t{\n\t\t\tname: 'ReAct Agent',\n\t\t\tvalue: 'reActAgent',\n\t\t\tdescription:\n\t\t\t\t'Combines reasoning and action in an iterative process. Effective for tasks that require careful analysis and step-by-step problem-solving.',\n\t\t},\n\t\t{\n\t\t\tname: 'SQL Agent',\n\t\t\tvalue: 'sqlAgent',\n\t\t\tdescription:\n\t\t\t\t'Specializes in interacting with SQL databases. Ideal for data analysis tasks, generating queries, or extracting insights from structured data.',\n\t\t},\n\t],\n\tdefault: '',\n};\n\nexport class AgentV1 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\tversion: [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9],\n\t\t\t...baseDescription,\n\t\t\tdefaults: {\n\t\t\t\tname: 'AI Agent',\n\t\t\t\tcolor: '#404040',\n\t\t\t},\n\t\t\tinputs: `={{\n\t\t\t\t((agent, hasOutputParser) => {\n\t\t\t\t\t${getInputs.toString()};\n\t\t\t\t\treturn getInputs(agent, hasOutputParser)\n\t\t\t\t})($parameter.agent, $parameter.hasOutputParser === undefined || $parameter.hasOutputParser === true)\n\t\t\t}}`,\n\t\t\toutputs: [NodeConnectionTypes.Main],\n\t\t\tcredentials: [\n\t\t\t\t{\n\t\t\t\t\tname: 'mySql',\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttestedBy: 'mysqlConnectionTest',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t\t'/dataSource': ['mysql'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'postgres',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t\t'/dataSource': ['postgres'],\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\tproperties: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName:\n\t\t\t\t\t\t'Tip: Get a feel for agents with our quick <a href=\"https://docs.n8n.io/advanced-ai/intro-tutorial/\" target=\"_blank\">tutorial</a> or see an <a href=\"/templates/1954\" target=\"_blank\">example</a> of how this node works',\n\t\t\t\t\tname: 'aiAgentStarterCallout',\n\t\t\t\t\ttype: 'callout',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tagent: ['conversationalAgent', 'toolsAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName:\n\t\t\t\t\t\t\"This node is using Agent that has been deprecated. Please switch to using 'Tools Agent' instead.\",\n\t\t\t\t\tname: 'deprecated',\n\t\t\t\t\ttype: 'notice',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tagent: [\n\t\t\t\t\t\t\t\t'conversationalAgent',\n\t\t\t\t\t\t\t\t'openAiFunctionsAgent',\n\t\t\t\t\t\t\t\t'planAndExecuteAgent',\n\t\t\t\t\t\t\t\t'reActAgent',\n\t\t\t\t\t\t\t\t'sqlAgent',\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\t// Make Conversational Agent the default agent for versions 1.5 and below\n\t\t\t\t{\n\t\t\t\t\t...agentTypeProperty,\n\t\t\t\t\toptions: agentTypeProperty?.options?.filter(\n\t\t\t\t\t\t(o) => 'value' in o && o.value !== 'toolsAgent',\n\t\t\t\t\t),\n\t\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { lte: 1.5 } }] } },\n\t\t\t\t\tdefault: 'conversationalAgent',\n\t\t\t\t},\n\t\t\t\t// Make Tools Agent the default agent for versions 1.6 and 1.7\n\t\t\t\t{\n\t\t\t\t\t...agentTypeProperty,\n\t\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { between: { from: 1.6, to: 1.7 } } }] } },\n\t\t\t\t\tdefault: 'toolsAgent',\n\t\t\t\t},\n\t\t\t\t// Make Tools Agent the only agent option for versions 1.8 and above\n\t\t\t\t{\n\t\t\t\t\t...agentTypeProperty,\n\t\t\t\t\ttype: 'hidden',\n\t\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { gte: 1.8 } }] } },\n\t\t\t\t\tdefault: 'toolsAgent',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...promptTypeOptions,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t'@version': [{ _cnd: { lte: 1.2 } }],\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...textFromPreviousNode,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: { promptType: ['auto'], '@version': [{ _cnd: { gte: 1.7 } }] },\n\t\t\t\t\t\t// SQL Agent has data source and credentials parameters so we need to include this input there manually\n\t\t\t\t\t\t// to preserve the order\n\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...textInput,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tpromptType: ['define'],\n\t\t\t\t\t\t},\n\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName:\n\t\t\t\t\t\t'For more reliable structured output parsing, consider using the Tools agent',\n\t\t\t\t\tname: 'notice',\n\t\t\t\t\ttype: 'notice',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\thasOutputParser: [true],\n\t\t\t\t\t\t\tagent: [\n\t\t\t\t\t\t\t\t'conversationalAgent',\n\t\t\t\t\t\t\t\t'reActAgent',\n\t\t\t\t\t\t\t\t'planAndExecuteAgent',\n\t\t\t\t\t\t\t\t'openAiFunctionsAgent',\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\t{\n\t\t\t\t\tdisplayName: 'Require Specific Output Format',\n\t\t\t\t\tname: 'hasOutputParser',\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: false,\n\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t'@version': [{ _cnd: { lte: 1.2 } }],\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: `Connect an <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='${NodeConnectionTypes.AiOutputParser}'>output parser</a> on the canvas to specify the output format you require`,\n\t\t\t\t\tname: 'notice',\n\t\t\t\t\ttype: 'notice',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\thasOutputParser: [true],\n\t\t\t\t\t\t\tagent: ['toolsAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\n\t\t\t\t...toolsAgentProperties,\n\t\t\t\t...conversationalAgentProperties,\n\t\t\t\t...openAiFunctionsAgentProperties,\n\t\t\t\t...reActAgentAgentProperties,\n\t\t\t\t...sqlAgentAgentProperties,\n\t\t\t\t...planAndExecuteAgentProperties,\n\t\t\t],\n\t\t};\n\t}\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst agentType = this.getNodeParameter('agent', 0, '') as string;\n\t\tconst nodeVersion = this.getNode().typeVersion;\n\n\t\tif (agentType === 'conversationalAgent') {\n\t\t\treturn await conversationalAgentExecute.call(this, nodeVersion);\n\t\t} else if (agentType === 'toolsAgent') {\n\t\t\treturn await toolsAgentExecute.call(this);\n\t\t} else if (agentType === 'openAiFunctionsAgent') {\n\t\t\treturn await openAiFunctionsAgentExecute.call(this, nodeVersion);\n\t\t} else if (agentType === 'reActAgent') {\n\t\t\treturn await reActAgentAgentExecute.call(this, nodeVersion);\n\t\t} else if (agentType === 'sqlAgent') {\n\t\t\treturn await sqlAgentAgentExecute.call(this);\n\t\t} else if (agentType === 'planAndExecuteAgent') {\n\t\t\treturn await planAndExecuteAgentExecute.call(this, nodeVersion);\n\t\t}\n\n\t\tthrow new NodeOperationError(this.getNode(), `The agent type \"${agentType}\" is not supported`);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAwD;AAaxD,0BAAmE;AAEnE,yBAA8C;AAC9C,qBAA2C;AAC3C,IAAAA,sBAA+C;AAC/C,IAAAC,kBAA4C;AAC5C,IAAAD,sBAA8C;AAC9C,IAAAC,kBAA2C;AAC3C,IAAAD,sBAA0C;AAC1C,IAAAC,kBAAuC;AACvC,IAAAD,sBAAwC;AACxC,IAAAC,kBAAqC;AACrC,IAAAD,sBAAqC;AACrC,IAAAC,kBAAkC;AAIlC,SAAS,UACR,OAOA,iBACsD;AAOtD,QAAM,eAAe,CACpB,WACyD;AACzD,UAAM,eAA0C;AAAA,MAC/C,kBAAkB;AAAA,MAClB,WAAW;AAAA,MACX,SAAS;AAAA,MACT,iBAAiB;AAAA,IAClB;AAEA,WAAO,OAAO,IAAI,CAAC,EAAE,MAAM,OAAO,MAAM;AACvC,YAAM,cAAc,SAAU;AAC9B,UAAI,cAAc,QAAQ,eAAe,aAAa,IAAI,IAAI;AAC9D,UACC,eACA,CAAC,wBAAwB,cAAc,qBAAqB,EAAE,SAAS,KAAK,GAC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cAAc;AACtC,aAAO,MAAM,kCAAkB,KAAK,IAAI;AAAA,IACzC,WAAW,cAAc,wBAAwB;AAChD,aAAO,MAAM,4CAA4B,KAAK,MAAM,WAAW;AAAA,IAChE,WAAW,cAAc,cAAc;AACtC,aAAO,MAAM,uCAAuB,KAAK,MAAM,WAAW;AAAA,IAC3D,WAAW,cAAc,YAAY;AACpC,aAAO,MAAM,qCAAqB,KAAK,IAAI;AAAA,IAC5C,WAAW,cAAc,uBAAuB;AAC/C,aAAO,MAAM,2CAA2B,KAAK,MAAM,WAAW;AAAA,IAC/D;AAEA,UAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,mBAAmB,SAAS,oBAAoB;AAAA,EAC9F;AACD;","names":["import_description","import_execute"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/agents/Agent/V1/AgentV1.node.ts"],"sourcesContent":["import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\nimport type {\n\tINodeInputConfiguration,\n\tINodeInputFilter,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeType,\n\tINodeTypeDescription,\n\tINodeProperties,\n\tNodeConnectionType,\n\tINodeTypeBaseDescription,\n} from 'n8n-workflow';\n\nimport { promptTypeOptions, textFromPreviousNode, textInput } from '@utils/descriptions';\n\nimport { conversationalAgentProperties } from '../agents/ConversationalAgent/description';\nimport { conversationalAgentExecute } from '../agents/ConversationalAgent/execute';\nimport { openAiFunctionsAgentProperties } from '../agents/OpenAiFunctionsAgent/description';\nimport { openAiFunctionsAgentExecute } from '../agents/OpenAiFunctionsAgent/execute';\nimport { planAndExecuteAgentProperties } from '../agents/PlanAndExecuteAgent/description';\nimport { planAndExecuteAgentExecute } from '../agents/PlanAndExecuteAgent/execute';\nimport { reActAgentAgentProperties } from '../agents/ReActAgent/description';\nimport { reActAgentAgentExecute } from '../agents/ReActAgent/execute';\nimport { sqlAgentAgentProperties } from '../agents/SqlAgent/description';\nimport { sqlAgentAgentExecute } from '../agents/SqlAgent/execute';\nimport { toolsAgentProperties } from '../agents/ToolsAgent/V1/description';\nimport { toolsAgentExecute } from '../agents/ToolsAgent/V1/execute';\n\n// Function used in the inputs expression to figure out which inputs to\n// display based on the agent type\nfunction getInputs(\n\tagent:\n\t\t| 'toolsAgent'\n\t\t| 'conversationalAgent'\n\t\t| 'openAiFunctionsAgent'\n\t\t| 'planAndExecuteAgent'\n\t\t| 'reActAgent'\n\t\t| 'sqlAgent',\n\thasOutputParser?: boolean,\n): Array<NodeConnectionType | INodeInputConfiguration> {\n\tinterface SpecialInput {\n\t\ttype: NodeConnectionType;\n\t\tfilter?: INodeInputFilter;\n\t\trequired?: boolean;\n\t}\n\n\tconst getInputData = (\n\t\tinputs: SpecialInput[],\n\t): Array<NodeConnectionType | INodeInputConfiguration> => {\n\t\tconst displayNames: { [key: string]: string } = {\n\t\t\tai_languageModel: 'Model',\n\t\t\tai_memory: 'Memory',\n\t\t\tai_tool: 'Tool',\n\t\t\tai_outputParser: 'Output Parser',\n\t\t};\n\n\t\treturn inputs.map(({ type, filter }) => {\n\t\t\tconst isModelType = type === ('ai_languageModel' as NodeConnectionType);\n\t\t\tlet displayName = type in displayNames ? displayNames[type] : undefined;\n\t\t\tif (\n\t\t\t\tisModelType &&\n\t\t\t\t['openAiFunctionsAgent', 'toolsAgent', 'conversationalAgent'].includes(agent)\n\t\t\t) {\n\t\t\t\tdisplayName = 'Chat Model';\n\t\t\t}\n\t\t\tconst input: INodeInputConfiguration = {\n\t\t\t\ttype,\n\t\t\t\tdisplayName,\n\t\t\t\trequired: isModelType,\n\t\t\t\tmaxConnections: ['ai_languageModel', 'ai_memory', 'ai_outputParser'].includes(type)\n\t\t\t\t\t? 1\n\t\t\t\t\t: undefined,\n\t\t\t};\n\n\t\t\tif (filter) {\n\t\t\t\tinput.filter = filter;\n\t\t\t}\n\n\t\t\treturn input;\n\t\t});\n\t};\n\n\tlet specialInputs: SpecialInput[] = [];\n\n\tif (agent === 'conversationalAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t\tfilter: {\n\t\t\t\t\tnodes: [\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAnthropic',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAwsBedrock',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGroq',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOllama',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGoogleGemini',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGoogleVertex',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatMistralCloud',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAzureOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatDeepSeek',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenRouter',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatVercelAiGateway',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatXAiGrok',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.modelSelector',\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_memory',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'toolsAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t\tfilter: {\n\t\t\t\t\tnodes: [\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAnthropic',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAzureOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAwsBedrock',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatMistralCloud',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOllama',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGroq',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGoogleVertex',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatGoogleGemini',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatDeepSeek',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenRouter',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatVercelAiGateway',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatXAiGrok',\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_memory',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'openAiFunctionsAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t\tfilter: {\n\t\t\t\t\tnodes: [\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatOpenAi',\n\t\t\t\t\t\t'@n8n/n8n-nodes-langchain.lmChatAzureOpenAi',\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_memory',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'reActAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'sqlAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_memory',\n\t\t\t},\n\t\t];\n\t} else if (agent === 'planAndExecuteAgent') {\n\t\tspecialInputs = [\n\t\t\t{\n\t\t\t\ttype: 'ai_languageModel',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_tool',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'ai_outputParser',\n\t\t\t},\n\t\t];\n\t}\n\n\tif (hasOutputParser === false) {\n\t\tspecialInputs = specialInputs.filter((input) => input.type !== 'ai_outputParser');\n\t}\n\treturn ['main', ...getInputData(specialInputs)];\n}\n\nconst agentTypeProperty: INodeProperties = {\n\tdisplayName: 'Agent',\n\tname: 'agent',\n\ttype: 'options',\n\tnoDataExpression: true,\n\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\toptions: [\n\t\t{\n\t\t\tname: 'Tools Agent',\n\t\t\tvalue: 'toolsAgent',\n\t\t\tdescription:\n\t\t\t\t'Utilizes structured tool schemas for precise and reliable tool selection and execution. Recommended for complex tasks requiring accurate and consistent tool usage, but only usable with models that support tool calling.',\n\t\t},\n\t\t{\n\t\t\tname: 'Conversational Agent',\n\t\t\tvalue: 'conversationalAgent',\n\t\t\tdescription:\n\t\t\t\t'Describes tools in the system prompt and parses JSON responses for tool calls. More flexible but potentially less reliable than the Tools Agent. Suitable for simpler interactions or with models not supporting structured schemas.',\n\t\t},\n\t\t{\n\t\t\tname: 'OpenAI Functions Agent',\n\t\t\tvalue: 'openAiFunctionsAgent',\n\t\t\tdescription:\n\t\t\t\t\"Leverages OpenAI's function calling capabilities to precisely select and execute tools. Excellent for tasks requiring structured outputs when working with OpenAI models.\",\n\t\t},\n\t\t{\n\t\t\tname: 'Plan and Execute Agent',\n\t\t\tvalue: 'planAndExecuteAgent',\n\t\t\tdescription:\n\t\t\t\t'Creates a high-level plan for complex tasks and then executes each step. Suitable for multi-stage problems or when a strategic approach is needed.',\n\t\t},\n\t\t{\n\t\t\tname: 'ReAct Agent',\n\t\t\tvalue: 'reActAgent',\n\t\t\tdescription:\n\t\t\t\t'Combines reasoning and action in an iterative process. Effective for tasks that require careful analysis and step-by-step problem-solving.',\n\t\t},\n\t\t{\n\t\t\tname: 'SQL Agent',\n\t\t\tvalue: 'sqlAgent',\n\t\t\tdescription:\n\t\t\t\t'Specializes in interacting with SQL databases. Ideal for data analysis tasks, generating queries, or extracting insights from structured data.',\n\t\t},\n\t],\n\tdefault: '',\n};\n\nexport class AgentV1 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\tversion: [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9],\n\t\t\t...baseDescription,\n\t\t\tdefaults: {\n\t\t\t\tname: 'AI Agent',\n\t\t\t\tcolor: '#404040',\n\t\t\t},\n\t\t\tinputs: `={{\n\t\t\t\t((agent, hasOutputParser) => {\n\t\t\t\t\t${getInputs.toString()};\n\t\t\t\t\treturn getInputs(agent, hasOutputParser)\n\t\t\t\t})($parameter.agent, $parameter.hasOutputParser === undefined || $parameter.hasOutputParser === true)\n\t\t\t}}`,\n\t\t\toutputs: [NodeConnectionTypes.Main],\n\t\t\tcredentials: [\n\t\t\t\t{\n\t\t\t\t\tname: 'mySql',\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttestedBy: 'mysqlConnectionTest',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t\t'/dataSource': ['mysql'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'postgres',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t\t'/dataSource': ['postgres'],\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\tproperties: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName:\n\t\t\t\t\t\t'Tip: Get a feel for agents with our quick <a href=\"https://docs.n8n.io/advanced-ai/intro-tutorial/\" target=\"_blank\">tutorial</a> or see an <a href=\"/templates/1954\" target=\"_blank\">example</a> of how this node works',\n\t\t\t\t\tname: 'aiAgentStarterCallout',\n\t\t\t\t\ttype: 'callout',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tagent: ['conversationalAgent', 'toolsAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName:\n\t\t\t\t\t\t\"This node is using Agent that has been deprecated. Please switch to using 'Tools Agent' instead.\",\n\t\t\t\t\tname: 'deprecated',\n\t\t\t\t\ttype: 'notice',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tagent: [\n\t\t\t\t\t\t\t\t'conversationalAgent',\n\t\t\t\t\t\t\t\t'openAiFunctionsAgent',\n\t\t\t\t\t\t\t\t'planAndExecuteAgent',\n\t\t\t\t\t\t\t\t'reActAgent',\n\t\t\t\t\t\t\t\t'sqlAgent',\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\t// Make Conversational Agent the default agent for versions 1.5 and below\n\t\t\t\t{\n\t\t\t\t\t...agentTypeProperty,\n\t\t\t\t\toptions: agentTypeProperty?.options?.filter(\n\t\t\t\t\t\t(o) => 'value' in o && o.value !== 'toolsAgent',\n\t\t\t\t\t),\n\t\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { lte: 1.5 } }] } },\n\t\t\t\t\tdefault: 'conversationalAgent',\n\t\t\t\t},\n\t\t\t\t// Make Tools Agent the default agent for versions 1.6 and 1.7\n\t\t\t\t{\n\t\t\t\t\t...agentTypeProperty,\n\t\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { between: { from: 1.6, to: 1.7 } } }] } },\n\t\t\t\t\tdefault: 'toolsAgent',\n\t\t\t\t},\n\t\t\t\t// Make Tools Agent the only agent option for versions 1.8 and above\n\t\t\t\t{\n\t\t\t\t\t...agentTypeProperty,\n\t\t\t\t\ttype: 'hidden',\n\t\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { gte: 1.8 } }] } },\n\t\t\t\t\tdefault: 'toolsAgent',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...promptTypeOptions,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t'@version': [{ _cnd: { lte: 1.2 } }],\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...textFromPreviousNode,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: { promptType: ['auto'], '@version': [{ _cnd: { gte: 1.7 } }] },\n\t\t\t\t\t\t// SQL Agent has data source and credentials parameters so we need to include this input there manually\n\t\t\t\t\t\t// to preserve the order\n\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...textInput,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tpromptType: ['define'],\n\t\t\t\t\t\t},\n\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName:\n\t\t\t\t\t\t'For more reliable structured output parsing, consider using the Tools agent',\n\t\t\t\t\tname: 'notice',\n\t\t\t\t\ttype: 'notice',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\thasOutputParser: [true],\n\t\t\t\t\t\t\tagent: [\n\t\t\t\t\t\t\t\t'conversationalAgent',\n\t\t\t\t\t\t\t\t'reActAgent',\n\t\t\t\t\t\t\t\t'planAndExecuteAgent',\n\t\t\t\t\t\t\t\t'openAiFunctionsAgent',\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\t{\n\t\t\t\t\tdisplayName: 'Require Specific Output Format',\n\t\t\t\t\tname: 'hasOutputParser',\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: false,\n\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t'@version': [{ _cnd: { lte: 1.2 } }],\n\t\t\t\t\t\t\tagent: ['sqlAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: `Connect an <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='${NodeConnectionTypes.AiOutputParser}'>output parser</a> on the canvas to specify the output format you require`,\n\t\t\t\t\tname: 'notice',\n\t\t\t\t\ttype: 'notice',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\thasOutputParser: [true],\n\t\t\t\t\t\t\tagent: ['toolsAgent'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\n\t\t\t\t...toolsAgentProperties,\n\t\t\t\t...conversationalAgentProperties,\n\t\t\t\t...openAiFunctionsAgentProperties,\n\t\t\t\t...reActAgentAgentProperties,\n\t\t\t\t...sqlAgentAgentProperties,\n\t\t\t\t...planAndExecuteAgentProperties,\n\t\t\t],\n\t\t};\n\t}\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst agentType = this.getNodeParameter('agent', 0, '') as string;\n\t\tconst nodeVersion = this.getNode().typeVersion;\n\n\t\tif (agentType === 'conversationalAgent') {\n\t\t\treturn await conversationalAgentExecute.call(this, nodeVersion);\n\t\t} else if (agentType === 'toolsAgent') {\n\t\t\treturn await toolsAgentExecute.call(this);\n\t\t} else if (agentType === 'openAiFunctionsAgent') {\n\t\t\treturn await openAiFunctionsAgentExecute.call(this, nodeVersion);\n\t\t} else if (agentType === 'reActAgent') {\n\t\t\treturn await reActAgentAgentExecute.call(this, nodeVersion);\n\t\t} else if (agentType === 'sqlAgent') {\n\t\t\treturn await sqlAgentAgentExecute.call(this);\n\t\t} else if (agentType === 'planAndExecuteAgent') {\n\t\t\treturn await planAndExecuteAgentExecute.call(this, nodeVersion);\n\t\t}\n\n\t\tthrow new NodeOperationError(this.getNode(), `The agent type \"${agentType}\" is not supported`);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAwD;AAaxD,0BAAmE;AAEnE,yBAA8C;AAC9C,qBAA2C;AAC3C,IAAAA,sBAA+C;AAC/C,IAAAC,kBAA4C;AAC5C,IAAAD,sBAA8C;AAC9C,IAAAC,kBAA2C;AAC3C,IAAAD,sBAA0C;AAC1C,IAAAC,kBAAuC;AACvC,IAAAD,sBAAwC;AACxC,IAAAC,kBAAqC;AACrC,IAAAD,sBAAqC;AACrC,IAAAC,kBAAkC;AAIlC,SAA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A,YACrB;AAAA,UACD;AAAA,QACD;AAAA,QAEA,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM,UAAkE;AACvE,UAAM,YAAY,KAAK,iBAAiB,SAAS,GAAG,EAAE;AACtD,UAAM,cAAc,KAAK,QAAQ,EAAE;AAEnC,QAAI,cAAc,uBAAuB;AACxC,aAAO,MAAM,0CAA2B,KAAK,MAAM,WAAW;AAAA,IAC/D,WAAW,cAAc,cAAc;AACtC,aAAO,MAAM,kCAAkB,KAAK,IAAI;AAAA,IACzC,WAAW,cAAc,wBAAwB;AAChD,aAAO,MAAM,4CAA4B,KAAK,MAAM,WAAW;AAAA,IAChE,WAAW,cAAc,cAAc;AACtC,aAAO,MAAM,uCAAuB,KAAK,MAAM,WAAW;AAAA,IAC3D,WAAW,cAAc,YAAY;AACpC,aAAO,MAAM,qCAAqB,KAAK,IAAI;AAAA,IAC5C,WAAW,cAAc,uBAAuB;AAC/C,aAAO,MAAM,2CAA2B,KAAK,MAAM,WAAW;AAAA,IAC/D;AAEA,UAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,mBAAmB,SAAS,oBAAoB;AAAA,EAC9F;AACD;","names":["import_description","import_execute"]}
|
|
@@ -34,7 +34,7 @@ class LmChatAwsBedrock {
|
|
|
34
34
|
name: "lmChatAwsBedrock",
|
|
35
35
|
icon: "file:bedrock.svg",
|
|
36
36
|
group: ["transform"],
|
|
37
|
-
version: 1,
|
|
37
|
+
version: [1, 1.1],
|
|
38
38
|
description: "Language Model AWS Bedrock",
|
|
39
39
|
defaults: {
|
|
40
40
|
name: "AWS Bedrock Chat Model"
|
|
@@ -68,6 +68,30 @@ class LmChatAwsBedrock {
|
|
|
68
68
|
},
|
|
69
69
|
properties: [
|
|
70
70
|
(0, import_sharedFields.getConnectionHintNoticeField)([import_n8n_workflow.NodeConnectionTypes.AiChain, import_n8n_workflow.NodeConnectionTypes.AiChain]),
|
|
71
|
+
{
|
|
72
|
+
displayName: "Model Source",
|
|
73
|
+
name: "modelSource",
|
|
74
|
+
type: "options",
|
|
75
|
+
displayOptions: {
|
|
76
|
+
show: {
|
|
77
|
+
"@version": [{ _cnd: { gte: 1.1 } }]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
options: [
|
|
81
|
+
{
|
|
82
|
+
name: "On-Demand Models",
|
|
83
|
+
value: "onDemand",
|
|
84
|
+
description: "Standard foundation models with on-demand pricing"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "Inference Profiles",
|
|
88
|
+
value: "inferenceProfile",
|
|
89
|
+
description: "Cross-region inference profiles (required for models like Claude Sonnet 4 and others)"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
default: "onDemand",
|
|
93
|
+
description: "Choose between on-demand foundation models or inference profiles"
|
|
94
|
+
},
|
|
71
95
|
{
|
|
72
96
|
displayName: "Model",
|
|
73
97
|
name: "model",
|
|
@@ -75,7 +99,13 @@ class LmChatAwsBedrock {
|
|
|
75
99
|
allowArbitraryValues: true,
|
|
76
100
|
// Hide issues when model name is specified in the expression and does not match any of the options
|
|
77
101
|
description: 'The model which will generate the completion. <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html">Learn more</a>.',
|
|
102
|
+
displayOptions: {
|
|
103
|
+
hide: {
|
|
104
|
+
modelSource: ["inferenceProfile"]
|
|
105
|
+
}
|
|
106
|
+
},
|
|
78
107
|
typeOptions: {
|
|
108
|
+
loadOptionsDependsOn: ["modelSource"],
|
|
79
109
|
loadOptions: {
|
|
80
110
|
routing: {
|
|
81
111
|
request: {
|
|
@@ -117,6 +147,60 @@ class LmChatAwsBedrock {
|
|
|
117
147
|
},
|
|
118
148
|
default: ""
|
|
119
149
|
},
|
|
150
|
+
{
|
|
151
|
+
displayName: "Model",
|
|
152
|
+
name: "model",
|
|
153
|
+
type: "options",
|
|
154
|
+
allowArbitraryValues: true,
|
|
155
|
+
description: 'The inference profile which will generate the completion. <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-use.html">Learn more</a>.',
|
|
156
|
+
displayOptions: {
|
|
157
|
+
show: {
|
|
158
|
+
modelSource: ["inferenceProfile"]
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
typeOptions: {
|
|
162
|
+
loadOptionsDependsOn: ["modelSource"],
|
|
163
|
+
loadOptions: {
|
|
164
|
+
routing: {
|
|
165
|
+
request: {
|
|
166
|
+
method: "GET",
|
|
167
|
+
url: "/inference-profiles?maxResults=1000"
|
|
168
|
+
},
|
|
169
|
+
output: {
|
|
170
|
+
postReceive: [
|
|
171
|
+
{
|
|
172
|
+
type: "rootProperty",
|
|
173
|
+
properties: {
|
|
174
|
+
property: "inferenceProfileSummaries"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
type: "setKeyValue",
|
|
179
|
+
properties: {
|
|
180
|
+
name: "={{$responseItem.inferenceProfileName}}",
|
|
181
|
+
description: "={{$responseItem.description || $responseItem.inferenceProfileArn}}",
|
|
182
|
+
value: "={{$responseItem.inferenceProfileId}}"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
type: "sort",
|
|
187
|
+
properties: {
|
|
188
|
+
key: "name"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
routing: {
|
|
197
|
+
send: {
|
|
198
|
+
type: "body",
|
|
199
|
+
property: "model"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
default: ""
|
|
203
|
+
},
|
|
120
204
|
{
|
|
121
205
|
displayName: "Options",
|
|
122
206
|
name: "options",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.ts"],"sourcesContent":["import { ChatBedrockConverse } from '@langchain/aws';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { getProxyAgent } from '@utils/httpProxyAgent';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';\nimport { N8nLlmTracing } from '../N8nLlmTracing';\n\nexport class LmChatAwsBedrock implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'AWS Bedrock Chat Model',\n\n\t\tname: 'lmChatAwsBedrock',\n\t\ticon: 'file:bedrock.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'Language Model AWS Bedrock',\n\t\tdefaults: {\n\t\t\tname: 'AWS Bedrock Chat Model',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Language Models', 'Root Nodes'],\n\t\t\t\t'Language Models': ['Chat Models (Recommended)'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatawsbedrock/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\toutputNames: ['Model'],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'aws',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\trequestDefaults: {\n\t\t\tignoreHttpStatusErrors: true,\n\t\t\tbaseURL: '=https://bedrock.{{$credentials?.region ?? \"eu-central-1\"}}.amazonaws.com',\n\t\t},\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiChain]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tname: 'model',\n\t\t\t\ttype: 'options',\n\t\t\t\tallowArbitraryValues: true, // Hide issues when model name is specified in the expression and does not match any of the options\n\t\t\t\tdescription:\n\t\t\t\t\t'The model which will generate the completion. <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html\">Learn more</a>.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptions: {\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '/foundation-models?&byOutputModality=TEXT&byInferenceType=ON_DEMAND',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toutput: {\n\t\t\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: 'modelSummaries',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tname: '={{$responseItem.modelName}}',\n\t\t\t\t\t\t\t\t\t\t\tdescription: '={{$responseItem.modelArn}}',\n\t\t\t\t\t\t\t\t\t\t\tvalue: '={{$responseItem.modelId}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\trouting: {\n\t\t\t\t\tsend: {\n\t\t\t\t\t\ttype: 'body',\n\t\t\t\t\t\tproperty: 'model',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\tplaceholder: 'Add Option',\n\t\t\t\tdescription: 'Additional options to add',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Maximum Number of Tokens',\n\t\t\t\t\t\tname: 'maxTokensToSample',\n\t\t\t\t\t\tdefault: 2000,\n\t\t\t\t\t\tdescription: 'The maximum number of tokens to generate in the completion',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Sampling Temperature',\n\t\t\t\t\t\tname: 'temperature',\n\t\t\t\t\t\tdefault: 0.7,\n\t\t\t\t\t\ttypeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst credentials = await this.getCredentials('aws');\n\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as {\n\t\t\ttemperature: number;\n\t\t\tmaxTokensToSample: number;\n\t\t};\n\n\t\tconst model = new ChatBedrockConverse({\n\t\t\tregion: credentials.region as string,\n\t\t\tmodel: modelName,\n\t\t\ttemperature: options.temperature,\n\t\t\tmaxTokens: options.maxTokensToSample,\n\t\t\tclientConfig: {\n\t\t\t\thttpAgent: getProxyAgent(),\n\t\t\t},\n\t\t\tcredentials: {\n\t\t\t\tsecretAccessKey: credentials.secretAccessKey as string,\n\t\t\t\taccessKeyId: credentials.accessKeyId as string,\n\t\t\t\tsessionToken: credentials.sessionToken as string,\n\t\t\t},\n\t\t\tcallbacks: [new N8nLlmTracing(this)],\n\t\t\tonFailedAttempt: makeN8nLlmFailedAttemptHandler(this),\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: model,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,0BAMO;AAEP,4BAA8B;AAC9B,0BAA6C;AAE7C,wCAA+C;AAC/C,2BAA8B;AAEvB,MAAM,iBAAsC;AAAA,EAA5C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MAEb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,mBAAmB,YAAY;AAAA,UACpC,mBAAmB,CAAC,2BAA2B;AAAA,QAChD;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MAEA,QAAQ,CAAC;AAAA,MAET,SAAS,CAAC,wCAAoB,eAAe;AAAA,MAC7C,aAAa,CAAC,OAAO;AAAA,MACrB,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,iBAAiB;AAAA,QAChB,wBAAwB;AAAA,QACxB,SAA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AAAA,YACP;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,WAAuC,WAAwC;AACpF,UAAM,cAAc,MAAM,KAAK,eAAe,KAAK;AACnD,UAAM,YAAY,KAAK,iBAAiB,SAAS,SAAS;AAC1D,UAAM,UAAU,KAAK,iBAAiB,WAAW,WAAW,CAAC,CAAC;AAK9D,UAAM,QAAQ,IAAI,+BAAoB;AAAA,MACrC,QAAQ,YAAY;AAAA,MACpB,OAAO;AAAA,MACP,aAAa,QAAQ;AAAA,MACrB,WAAW,QAAQ;AAAA,MACnB,cAAc;AAAA,QACb,eAAW,qCAAc;AAAA,MAC1B;AAAA,MACA,aAAa;AAAA,QACZ,iBAAiB,YAAY;AAAA,QAC7B,aAAa,YAAY;AAAA,QACzB,cAAc,YAAY;AAAA,MAC3B;AAAA,MACA,WAAW,CAAC,IAAI,mCAAc,IAAI,CAAC;AAAA,MACnC,qBAAiB,kEAA+B,IAAI;AAAA,IACrD,CAAC;AAED,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.ts"],"sourcesContent":["import { ChatBedrockConverse } from '@langchain/aws';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { getProxyAgent } from '@utils/httpProxyAgent';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';\nimport { N8nLlmTracing } from '../N8nLlmTracing';\n\nexport class LmChatAwsBedrock implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'AWS Bedrock Chat Model',\n\n\t\tname: 'lmChatAwsBedrock',\n\t\ticon: 'file:bedrock.svg',\n\t\tgroup: ['transform'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Language Model AWS Bedrock',\n\t\tdefaults: {\n\t\t\tname: 'AWS Bedrock Chat Model',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Language Models', 'Root Nodes'],\n\t\t\t\t'Language Models': ['Chat Models (Recommended)'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatawsbedrock/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\toutputNames: ['Model'],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'aws',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\trequestDefaults: {\n\t\t\tignoreHttpStatusErrors: true,\n\t\t\tbaseURL: '=https://bedrock.{{$credentials?.region ?? \"eu-central-1\"}}.amazonaws.com',\n\t\t},\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiChain]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Model Source',\n\t\t\t\tname: 'modelSource',\n\t\t\t\ttype: 'options',\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\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'On-Demand Models',\n\t\t\t\t\t\tvalue: 'onDemand',\n\t\t\t\t\t\tdescription: 'Standard foundation models with on-demand pricing',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Inference Profiles',\n\t\t\t\t\t\tvalue: 'inferenceProfile',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Cross-region inference profiles (required for models like Claude Sonnet 4 and others)',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'onDemand',\n\t\t\t\tdescription: 'Choose between on-demand foundation models or inference profiles',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tname: 'model',\n\t\t\t\ttype: 'options',\n\t\t\t\tallowArbitraryValues: true, // Hide issues when model name is specified in the expression and does not match any of the options\n\t\t\t\tdescription:\n\t\t\t\t\t'The model which will generate the completion. <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html\">Learn more</a>.',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\thide: {\n\t\t\t\t\t\tmodelSource: ['inferenceProfile'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptionsDependsOn: ['modelSource'],\n\t\t\t\t\tloadOptions: {\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '/foundation-models?&byOutputModality=TEXT&byInferenceType=ON_DEMAND',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toutput: {\n\t\t\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: 'modelSummaries',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tname: '={{$responseItem.modelName}}',\n\t\t\t\t\t\t\t\t\t\t\tdescription: '={{$responseItem.modelArn}}',\n\t\t\t\t\t\t\t\t\t\t\tvalue: '={{$responseItem.modelId}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\trouting: {\n\t\t\t\t\tsend: {\n\t\t\t\t\t\ttype: 'body',\n\t\t\t\t\t\tproperty: 'model',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tname: 'model',\n\t\t\t\ttype: 'options',\n\t\t\t\tallowArbitraryValues: true,\n\t\t\t\tdescription:\n\t\t\t\t\t'The inference profile which will generate the completion. <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-use.html\">Learn more</a>.',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmodelSource: ['inferenceProfile'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptionsDependsOn: ['modelSource'],\n\t\t\t\t\tloadOptions: {\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '/inference-profiles?maxResults=1000',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toutput: {\n\t\t\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: 'inferenceProfileSummaries',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tname: '={{$responseItem.inferenceProfileName}}',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'={{$responseItem.description || $responseItem.inferenceProfileArn}}',\n\t\t\t\t\t\t\t\t\t\t\tvalue: '={{$responseItem.inferenceProfileId}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\trouting: {\n\t\t\t\t\tsend: {\n\t\t\t\t\t\ttype: 'body',\n\t\t\t\t\t\tproperty: 'model',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\tplaceholder: 'Add Option',\n\t\t\t\tdescription: 'Additional options to add',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Maximum Number of Tokens',\n\t\t\t\t\t\tname: 'maxTokensToSample',\n\t\t\t\t\t\tdefault: 2000,\n\t\t\t\t\t\tdescription: 'The maximum number of tokens to generate in the completion',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Sampling Temperature',\n\t\t\t\t\t\tname: 'temperature',\n\t\t\t\t\t\tdefault: 0.7,\n\t\t\t\t\t\ttypeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst credentials = await this.getCredentials('aws');\n\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as {\n\t\t\ttemperature: number;\n\t\t\tmaxTokensToSample: number;\n\t\t};\n\n\t\tconst model = new ChatBedrockConverse({\n\t\t\tregion: credentials.region as string,\n\t\t\tmodel: modelName,\n\t\t\ttemperature: options.temperature,\n\t\t\tmaxTokens: options.maxTokensToSample,\n\t\t\tclientConfig: {\n\t\t\t\thttpAgent: getProxyAgent(),\n\t\t\t},\n\t\t\tcredentials: {\n\t\t\t\tsecretAccessKey: credentials.secretAccessKey as string,\n\t\t\t\taccessKeyId: credentials.accessKeyId as string,\n\t\t\t\tsessionToken: credentials.sessionToken as string,\n\t\t\t},\n\t\t\tcallbacks: [new N8nLlmTracing(this)],\n\t\t\tonFailedAttempt: makeN8nLlmFailedAttemptHandler(this),\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: model,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,0BAMO;AAEP,4BAA8B;AAC9B,0BAA6C;AAE7C,wCAA+C;AAC/C,2BAA8B;AAEvB,MAAM,iBAAsC;AAAA,EAA5C;AACN,uBAAoC;AAAA,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