@n8n/n8n-nodes-langchain 1.115.1 → 1.116.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/AnthropicApi.credentials.js +39 -8
- package/dist/credentials/AnthropicApi.credentials.js.map +1 -1
- package/dist/credentials/LemonadeApi.credentials.js +70 -0
- package/dist/credentials/LemonadeApi.credentials.js.map +1 -0
- package/dist/known/credentials.json +9 -0
- package/dist/known/nodes.json +12 -0
- package/dist/nodes/agents/Agent/Agent.node.js +1 -2
- package/dist/nodes/agents/Agent/Agent.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/agents/Agent/agents/ToolsAgent/V3/description.js +13 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/description.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js +49 -30
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js.map +1 -1
- package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js +3 -0
- package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js.map +1 -1
- package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js +87 -0
- package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsLemonade/lemonade.svg +53 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +17 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +12 -8
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
- package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js +106 -0
- package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js.map +1 -0
- package/dist/nodes/llms/LMChatLemonade/lemonade.svg +53 -0
- package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js +6 -5
- package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js.map +1 -1
- package/dist/nodes/llms/LMLemonade/LmLemonade.node.js +107 -0
- package/dist/nodes/llms/LMLemonade/LmLemonade.node.js.map +1 -0
- package/dist/nodes/llms/LMLemonade/description.js +147 -0
- package/dist/nodes/llms/LMLemonade/description.js.map +1 -0
- package/dist/nodes/llms/LMLemonade/lemonade.svg +53 -0
- package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js +3 -0
- package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js.map +1 -1
- package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js +14 -1
- package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +107 -47
- package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js +2 -1
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js.map +1 -1
- package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js +43 -4
- package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js.map +1 -1
- package/dist/nodes/vendors/Anthropic/transport/index.js +9 -5
- package/dist/nodes/vendors/Anthropic/transport/index.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/OpenAi.node.js +50 -11
- package/dist/nodes/vendors/OpenAi/OpenAi.node.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/helpers/binary-data.js +3 -3
- package/dist/nodes/vendors/OpenAi/helpers/binary-data.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/helpers/description.js +75 -0
- package/dist/nodes/vendors/OpenAi/helpers/description.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/interfaces.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js +34 -0
- package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/polling.js +52 -0
- package/dist/nodes/vendors/OpenAi/helpers/polling.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/utils.js +27 -0
- package/dist/nodes/vendors/OpenAi/helpers/utils.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/methods/listSearch.js +10 -6
- package/dist/nodes/vendors/OpenAi/methods/listSearch.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js +110 -0
- package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/create.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/create.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/deleteAssistant.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/deleteAssistant.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/list.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/message.operation.js +5 -5
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/update.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/update.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/generate.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/transcribe.operation.js +2 -2
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/transcribe.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/translate.operation.js +2 -2
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/translate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/deleteFile.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/file/deleteFile.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/list.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/file/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/upload.operation.js +2 -2
- package/dist/nodes/vendors/OpenAi/v1/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/analyze.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/generate.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/image/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/router.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/router.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/classify.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/text/classify.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/message.operation.js +4 -4
- package/dist/nodes/vendors/OpenAi/v1/actions/text/message.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js +116 -0
- package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js +197 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js +96 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js +121 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js +111 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js +120 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js +60 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js +94 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js +60 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js +75 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js +279 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js +84 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js +84 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js +92 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js +130 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js +211 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js +464 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js +319 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js +84 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js +17 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/router.js +111 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/router.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js +102 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js +277 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js +86 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/message.operation.js +345 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/message.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js +777 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js +199 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js +64 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js.map +1 -0
- package/dist/types/credentials.json +2 -1
- package/dist/types/nodes.json +10 -6
- package/dist/utils/helpers.js +22 -2
- package/dist/utils/helpers.js.map +1 -1
- package/package.json +16 -12
- package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/deleteAssistant.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/list.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/generate.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/transcribe.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/translate.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/descriptions.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/deleteFile.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/list.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/upload.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/image/analyze.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/image/generate.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/image/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/node.type.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/router.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/text/classify.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/text/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/text/message.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/versionDescription.js +0 -160
- package/dist/nodes/vendors/OpenAi/actions/versionDescription.js.map +0 -1
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/descriptions.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/node.type.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/index.js +0 -0
|
@@ -41,16 +41,39 @@ class AnthropicApi {
|
|
|
41
41
|
type: "string",
|
|
42
42
|
default: "https://api.anthropic.com",
|
|
43
43
|
description: "Override the default base URL for the API"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
displayName: "Add Custom Header",
|
|
47
|
+
name: "header",
|
|
48
|
+
type: "boolean",
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: "Header Name",
|
|
53
|
+
name: "headerName",
|
|
54
|
+
type: "string",
|
|
55
|
+
displayOptions: {
|
|
56
|
+
show: {
|
|
57
|
+
header: [true]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
default: ""
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: "Header Value",
|
|
64
|
+
name: "headerValue",
|
|
65
|
+
type: "string",
|
|
66
|
+
typeOptions: {
|
|
67
|
+
password: true
|
|
68
|
+
},
|
|
69
|
+
displayOptions: {
|
|
70
|
+
show: {
|
|
71
|
+
header: [true]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
default: ""
|
|
44
75
|
}
|
|
45
76
|
];
|
|
46
|
-
this.authenticate = {
|
|
47
|
-
type: "generic",
|
|
48
|
-
properties: {
|
|
49
|
-
headers: {
|
|
50
|
-
"x-api-key": "={{$credentials.apiKey}}"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
77
|
this.test = {
|
|
55
78
|
request: {
|
|
56
79
|
baseURL: "={{$credentials?.url}}",
|
|
@@ -67,6 +90,14 @@ class AnthropicApi {
|
|
|
67
90
|
}
|
|
68
91
|
};
|
|
69
92
|
}
|
|
93
|
+
async authenticate(credentials, requestOptions) {
|
|
94
|
+
requestOptions.headers ??= {};
|
|
95
|
+
requestOptions.headers["x-api-key"] = credentials.apiKey;
|
|
96
|
+
if (credentials.header && typeof credentials.headerName === "string" && credentials.headerName && typeof credentials.headerValue === "string") {
|
|
97
|
+
requestOptions.headers[credentials.headerName] = credentials.headerValue;
|
|
98
|
+
}
|
|
99
|
+
return requestOptions;
|
|
100
|
+
}
|
|
70
101
|
}
|
|
71
102
|
// Annotate the CommonJS export names for ESM import in node:
|
|
72
103
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../credentials/AnthropicApi.credentials.ts"],"sourcesContent":["import type {\n\
|
|
1
|
+
{"version":3,"sources":["../../credentials/AnthropicApi.credentials.ts"],"sourcesContent":["import type {\n\tICredentialDataDecryptedObject,\n\tICredentialTestRequest,\n\tICredentialType,\n\tIHttpRequestOptions,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class AnthropicApi implements ICredentialType {\n\tname = 'anthropicApi';\n\n\tdisplayName = 'Anthropic';\n\n\tdocumentationUrl = 'anthropic';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'API Key',\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},\n\t\t{\n\t\t\tdisplayName: 'Base URL',\n\t\t\tname: 'url',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'https://api.anthropic.com',\n\t\t\tdescription: 'Override the default base URL for the API',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Add Custom Header',\n\t\t\tname: 'header',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Header Name',\n\t\t\tname: 'headerName',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\theader: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Header Value',\n\t\t\tname: 'headerValue',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\theader: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t},\n\t];\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{$credentials?.url}}',\n\t\t\turl: '/v1/messages',\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'anthropic-version': '2023-06-01',\n\t\t\t},\n\t\t\tbody: {\n\t\t\t\tmodel: 'claude-3-haiku-20240307',\n\t\t\t\tmessages: [{ role: 'user', content: 'Hey' }],\n\t\t\t\tmax_tokens: 1,\n\t\t\t},\n\t\t},\n\t};\n\n\tasync authenticate(\n\t\tcredentials: ICredentialDataDecryptedObject,\n\t\trequestOptions: IHttpRequestOptions,\n\t): Promise<IHttpRequestOptions> {\n\t\trequestOptions.headers ??= {};\n\n\t\trequestOptions.headers['x-api-key'] = credentials.apiKey;\n\n\t\tif (\n\t\t\tcredentials.header &&\n\t\t\ttypeof credentials.headerName === 'string' &&\n\t\t\tcredentials.headerName &&\n\t\t\ttypeof credentials.headerValue === 'string'\n\t\t) {\n\t\t\trequestOptions.headers[credentials.headerName] = credentials.headerValue;\n\t\t}\n\n\t\treturn requestOptions;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,MAAM,aAAwC;AAAA,EAA9C;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,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,gBAAgB;AAAA,UACf,MAAM;AAAA,YACL,QAAQ,CAAC,IAAI;AAAA,UACd;AAAA,QACD;AAAA,QACA,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,UACZ,UAAU;AAAA,QACX;AAAA,QACA,gBAAgB;AAAA,UACf,MAAM;AAAA,YACL,QAAQ,CAAC,IAAI;AAAA,UACd;AAAA,QACD;AAAA,QACA,SAAS;AAAA,MACV;AAAA,IACD;AAEA,gBAA+B;AAAA,MAC9B,SAAS;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,UACR,qBAAqB;AAAA,QACtB;AAAA,QACA,MAAM;AAAA,UACL,OAAO;AAAA,UACP,UAAU,CAAC,EAAE,MAAM,QAAQ,SAAS,MAAM,CAAC;AAAA,UAC3C,YAAY;AAAA,QACb;AAAA,MACD;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,aACL,aACA,gBAC+B;AAC/B,mBAAe,YAAY,CAAC;AAE5B,mBAAe,QAAQ,WAAW,IAAI,YAAY;AAElD,QACC,YAAY,UACZ,OAAO,YAAY,eAAe,YAClC,YAAY,cACZ,OAAO,YAAY,gBAAgB,UAClC;AACD,qBAAe,QAAQ,YAAY,UAAU,IAAI,YAAY;AAAA,IAC9D;AAEA,WAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 LemonadeApi_credentials_exports = {};
|
|
20
|
+
__export(LemonadeApi_credentials_exports, {
|
|
21
|
+
LemonadeApi: () => LemonadeApi
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(LemonadeApi_credentials_exports);
|
|
24
|
+
class LemonadeApi {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.name = "lemonadeApi";
|
|
27
|
+
this.displayName = "Lemonade";
|
|
28
|
+
this.documentationUrl = "lemonade";
|
|
29
|
+
this.properties = [
|
|
30
|
+
{
|
|
31
|
+
displayName: "Base URL",
|
|
32
|
+
name: "baseUrl",
|
|
33
|
+
required: true,
|
|
34
|
+
type: "string",
|
|
35
|
+
default: "http://localhost:8000/api/v1"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
displayName: "API Key",
|
|
39
|
+
hint: "Optional API key for Lemonade server authentication. Not required for default Lemonade installation",
|
|
40
|
+
name: "apiKey",
|
|
41
|
+
type: "string",
|
|
42
|
+
typeOptions: { password: true },
|
|
43
|
+
default: "",
|
|
44
|
+
required: false
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
this.test = {
|
|
48
|
+
request: {
|
|
49
|
+
baseURL: "={{ $credentials.baseUrl }}",
|
|
50
|
+
url: "/models",
|
|
51
|
+
method: "GET"
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async authenticate(credentials, requestOptions) {
|
|
56
|
+
const apiKey = credentials.apiKey;
|
|
57
|
+
if (apiKey && apiKey.trim() !== "") {
|
|
58
|
+
requestOptions.headers = {
|
|
59
|
+
...requestOptions.headers,
|
|
60
|
+
Authorization: `Bearer ${apiKey}`
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return requestOptions;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
LemonadeApi
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=LemonadeApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../credentials/LemonadeApi.credentials.ts"],"sourcesContent":["import type {\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n\tIHttpRequestOptions,\n\tICredentialDataDecryptedObject,\n} from 'n8n-workflow';\n\nexport type LemonadeApiCredentialsType = {\n\tbaseUrl: string;\n\tapiKey?: string;\n};\n\nexport class LemonadeApi implements ICredentialType {\n\tname = 'lemonadeApi';\n\n\tdisplayName = 'Lemonade';\n\n\tdocumentationUrl = 'lemonade';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Base URL',\n\t\t\tname: 'baseUrl',\n\t\t\trequired: true,\n\t\t\ttype: 'string',\n\t\t\tdefault: 'http://localhost:8000/api/v1',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'API Key',\n\t\t\thint: 'Optional API key for Lemonade server authentication. Not required for default Lemonade installation',\n\t\t\tname: 'apiKey',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: { password: true },\n\t\t\tdefault: '',\n\t\t\trequired: false,\n\t\t},\n\t];\n\n\tasync authenticate(\n\t\tcredentials: ICredentialDataDecryptedObject,\n\t\trequestOptions: IHttpRequestOptions,\n\t): Promise<IHttpRequestOptions> {\n\t\t// Only add Authorization header if API key is provided and not empty\n\t\tconst apiKey = credentials.apiKey as string | undefined;\n\t\tif (apiKey && apiKey.trim() !== '') {\n\t\t\trequestOptions.headers = {\n\t\t\t\t...requestOptions.headers,\n\t\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t\t};\n\t\t}\n\t\treturn requestOptions;\n\t}\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{ $credentials.baseUrl }}',\n\t\t\turl: '/models',\n\t\t\tmethod: 'GET',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,MAAM,YAAuC;AAAA,EAA7C;AACN,gBAAO;AAEP,uBAAc;AAEd,4BAAmB;AAEnB,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,UAAU;AAAA,QACV,MAAM;AAAA,QACN,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa,EAAE,UAAU,KAAK;AAAA,QAC9B,SAAS;AAAA,QACT,UAAU;AAAA,MACX;AAAA,IACD;AAiBA,gBAA+B;AAAA,MAC9B,SAAS;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,QACL,QAAQ;AAAA,MACT;AAAA,IACD;AAAA;AAAA,EArBA,MAAM,aACL,aACA,gBAC+B;AAE/B,UAAM,SAAS,YAAY;AAC3B,QAAI,UAAU,OAAO,KAAK,MAAM,IAAI;AACnC,qBAAe,UAAU;AAAA,QACxB,GAAG,eAAe;AAAA,QAClB,eAAe,UAAU,MAAM;AAAA,MAChC;AAAA,IACD;AACA,WAAO;AAAA,EACR;AASD;","names":[]}
|
|
@@ -88,6 +88,15 @@
|
|
|
88
88
|
"lmChatMistralCloud"
|
|
89
89
|
]
|
|
90
90
|
},
|
|
91
|
+
"lemonadeApi": {
|
|
92
|
+
"className": "LemonadeApi",
|
|
93
|
+
"sourcePath": "dist/credentials/LemonadeApi.credentials.js",
|
|
94
|
+
"supportedNodes": [
|
|
95
|
+
"embeddingsLemonade",
|
|
96
|
+
"lmChatLemonade",
|
|
97
|
+
"lmLemonade"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
91
100
|
"ollamaApi": {
|
|
92
101
|
"className": "OllamaApi",
|
|
93
102
|
"sourcePath": "dist/credentials/OllamaApi.credentials.js",
|
package/dist/known/nodes.json
CHANGED
|
@@ -103,6 +103,10 @@
|
|
|
103
103
|
"className": "EmbeddingsOpenAi",
|
|
104
104
|
"sourcePath": "dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js"
|
|
105
105
|
},
|
|
106
|
+
"embeddingsLemonade": {
|
|
107
|
+
"className": "EmbeddingsLemonade",
|
|
108
|
+
"sourcePath": "dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js"
|
|
109
|
+
},
|
|
106
110
|
"embeddingsOllama": {
|
|
107
111
|
"className": "EmbeddingsOllama",
|
|
108
112
|
"sourcePath": "dist/nodes/embeddings/EmbeddingsOllama/EmbeddingsOllama.node.js"
|
|
@@ -143,6 +147,10 @@
|
|
|
143
147
|
"className": "LmChatMistralCloud",
|
|
144
148
|
"sourcePath": "dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js"
|
|
145
149
|
},
|
|
150
|
+
"lmChatLemonade": {
|
|
151
|
+
"className": "LmChatLemonade",
|
|
152
|
+
"sourcePath": "dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js"
|
|
153
|
+
},
|
|
146
154
|
"lmChatOllama": {
|
|
147
155
|
"className": "LmChatOllama",
|
|
148
156
|
"sourcePath": "dist/nodes/llms/LMChatOllama/LmChatOllama.node.js"
|
|
@@ -171,6 +179,10 @@
|
|
|
171
179
|
"className": "LmCohere",
|
|
172
180
|
"sourcePath": "dist/nodes/llms/LMCohere/LmCohere.node.js"
|
|
173
181
|
},
|
|
182
|
+
"lmLemonade": {
|
|
183
|
+
"className": "LmLemonade",
|
|
184
|
+
"sourcePath": "dist/nodes/llms/LMLemonade/LmLemonade.node.js"
|
|
185
|
+
},
|
|
174
186
|
"lmOllama": {
|
|
175
187
|
"className": "LmOllama",
|
|
176
188
|
"sourcePath": "dist/nodes/llms/LMOllama/LmOllama.node.js"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../nodes/agents/Agent/Agent.node.ts"],"sourcesContent":["import type { INodeTypeBaseDescription, IVersionedNodeType } from 'n8n-workflow';\nimport { VersionedNodeType } from 'n8n-workflow';\n\nimport { AgentV1 } from './V1/AgentV1.node';\nimport { AgentV2 } from './V2/AgentV2.node';\nimport { AgentV3 } from './V3/AgentV3.node';\n\nexport class Agent extends VersionedNodeType {\n\tconstructor() {\n\t\tconst baseDescription: INodeTypeBaseDescription = {\n\t\t\tdisplayName: 'AI Agent',\n\t\t\tname: 'agent',\n\t\t\ticon: 'fa:robot',\n\t\t\ticonColor: 'black',\n\t\t\tgroup: ['transform'],\n\t\t\tdescription: 'Generates an action plan and executes it. Can use external tools.',\n\t\t\tcodex: {\n\t\t\t\talias: ['LangChain', 'Chat', 'Conversational', 'Plan and Execute', 'ReAct', 'Tools'],\n\t\t\t\tcategories: ['AI'],\n\t\t\t\tsubcategories: {\n\t\t\t\t\tAI: ['Agents', 'Root Nodes'],\n\t\t\t\t},\n\t\t\t\tresources: {\n\t\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/',\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\
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/agents/Agent/Agent.node.ts"],"sourcesContent":["import type { INodeTypeBaseDescription, IVersionedNodeType } from 'n8n-workflow';\nimport { VersionedNodeType } from 'n8n-workflow';\n\nimport { AgentV1 } from './V1/AgentV1.node';\nimport { AgentV2 } from './V2/AgentV2.node';\nimport { AgentV3 } from './V3/AgentV3.node';\n\nexport class Agent extends VersionedNodeType {\n\tconstructor() {\n\t\tconst baseDescription: INodeTypeBaseDescription = {\n\t\t\tdisplayName: 'AI Agent',\n\t\t\tname: 'agent',\n\t\t\ticon: 'fa:robot',\n\t\t\ticonColor: 'black',\n\t\t\tgroup: ['transform'],\n\t\t\tdescription: 'Generates an action plan and executes it. Can use external tools.',\n\t\t\tcodex: {\n\t\t\t\talias: ['LangChain', 'Chat', 'Conversational', 'Plan and Execute', 'ReAct', 'Tools'],\n\t\t\t\tcategories: ['AI'],\n\t\t\t\tsubcategories: {\n\t\t\t\t\tAI: ['Agents', 'Root Nodes'],\n\t\t\t\t},\n\t\t\t\tresources: {\n\t\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/',\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\tdefaultVersion: 3,\n\t\t};\n\n\t\tconst nodeVersions: IVersionedNodeType['nodeVersions'] = {\n\t\t\t1: new AgentV1(baseDescription),\n\t\t\t1.1: new AgentV1(baseDescription),\n\t\t\t1.2: new AgentV1(baseDescription),\n\t\t\t1.3: new AgentV1(baseDescription),\n\t\t\t1.4: new AgentV1(baseDescription),\n\t\t\t1.5: new AgentV1(baseDescription),\n\t\t\t1.6: new AgentV1(baseDescription),\n\t\t\t1.7: new AgentV1(baseDescription),\n\t\t\t1.8: new AgentV1(baseDescription),\n\t\t\t1.9: new AgentV1(baseDescription),\n\t\t\t2: new AgentV2(baseDescription),\n\t\t\t2.1: new AgentV2(baseDescription),\n\t\t\t2.2: new AgentV2(baseDescription),\n\t\t\t3: new AgentV3(baseDescription),\n\t\t\t// IMPORTANT Reminder to update AgentTool\n\t\t};\n\n\t\tsuper(nodeVersions, baseDescription);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAkC;AAElC,qBAAwB;AACxB,qBAAwB;AACxB,qBAAwB;AAEjB,MAAM,cAAc,sCAAkB;AAAA,EAC5C,cAAc;AACb,UAAM,kBAA4C;AAAA,MACjD,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,aAAa;AAAA,MACb,OAAO;AAAA,QACN,OAAO,CAAC,aAAa,QAAQ,kBAAkB,oBAAoB,SAAS,OAAO;AAAA,QACnF,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,UAAU,YAAY;AAAA,QAC5B;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MACA,gBAAgB;AAAA,IACjB;AAEA,UAAM,eAAmD;AAAA,MACxD,GAAG,IAAI,uBAAQ,eAAe;AAAA,MAC9B,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,GAAG,IAAI,uBAAQ,eAAe;AAAA,MAC9B,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,KAAK,IAAI,uBAAQ,eAAe;AAAA,MAChC,GAAG,IAAI,uBAAQ,eAAe;AAAA;AAAA,IAE/B;AAEA,UAAM,cAAc,eAAe;AAAA,EACpC;AACD;","names":[]}
|
|
@@ -71,6 +71,7 @@ function getInputs(agent, hasOutputParser) {
|
|
|
71
71
|
"@n8n/n8n-nodes-langchain.lmChatAnthropic",
|
|
72
72
|
"@n8n/n8n-nodes-langchain.lmChatAwsBedrock",
|
|
73
73
|
"@n8n/n8n-nodes-langchain.lmChatGroq",
|
|
74
|
+
"@n8n/n8n-nodes-langchain.lmChatLemonade",
|
|
74
75
|
"@n8n/n8n-nodes-langchain.lmChatOllama",
|
|
75
76
|
"@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
|
76
77
|
"@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
|
|
@@ -104,6 +105,7 @@ function getInputs(agent, hasOutputParser) {
|
|
|
104
105
|
"@n8n/n8n-nodes-langchain.lmChatAnthropic",
|
|
105
106
|
"@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
|
|
106
107
|
"@n8n/n8n-nodes-langchain.lmChatAwsBedrock",
|
|
108
|
+
"@n8n/n8n-nodes-langchain.lmChatLemonade",
|
|
107
109
|
"@n8n/n8n-nodes-langchain.lmChatMistralCloud",
|
|
108
110
|
"@n8n/n8n-nodes-langchain.lmChatOllama",
|
|
109
111
|
"@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
|
@@ -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.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\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\tdisplayName: 'Get started faster with our',\n\t\t\t\t\tname: 'preBuiltAgentsCallout',\n\t\t\t\t\ttype: 'callout',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\tcalloutAction: {\n\t\t\t\t\t\t\tlabel: 'pre-built agents',\n\t\t\t\t\t\t\ticon: 'bot',\n\t\t\t\t\t\t\ttype: 'openPreBuiltAgentsCollection',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tdefault: '',\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 \"${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A,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.lmChatLemonade',\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.lmChatLemonade',\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\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\tdisplayName: 'Get started faster with our',\n\t\t\t\t\tname: 'preBuiltAgentsCallout',\n\t\t\t\t\ttype: 'callout',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\tcalloutAction: {\n\t\t\t\t\t\t\tlabel: 'pre-built agents',\n\t\t\t\t\t\t\ticon: 'bot',\n\t\t\t\t\t\t\ttype: 'openPreBuiltAgentsCollection',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tdefault: '',\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+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S,oBAAoB;AAAA,EAC9F;AACD;","names":["import_description","import_execute"]}
|
|
@@ -30,13 +30,25 @@ const enableStreaminOption = {
|
|
|
30
30
|
default: true,
|
|
31
31
|
description: "Whether this agent will stream the response in real-time as it generates text"
|
|
32
32
|
};
|
|
33
|
+
const maxTokensFromMemoryOption = {
|
|
34
|
+
displayName: "Max Tokens To Read From Memory",
|
|
35
|
+
name: "maxTokensFromMemory",
|
|
36
|
+
type: "hidden",
|
|
37
|
+
default: 0,
|
|
38
|
+
description: "The maximum number of tokens to read from the chat memory history. Set to 0 to read all history."
|
|
39
|
+
};
|
|
33
40
|
const toolsAgentProperties = {
|
|
34
41
|
displayName: "Options",
|
|
35
42
|
name: "options",
|
|
36
43
|
type: "collection",
|
|
37
44
|
default: {},
|
|
38
45
|
placeholder: "Add Option",
|
|
39
|
-
options: [
|
|
46
|
+
options: [
|
|
47
|
+
...import_options.commonOptions,
|
|
48
|
+
enableStreaminOption,
|
|
49
|
+
(0, import_sharedFields.getBatchingOptionFields)(void 0, 1),
|
|
50
|
+
maxTokensFromMemoryOption
|
|
51
|
+
]
|
|
40
52
|
};
|
|
41
53
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
54
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../nodes/agents/Agent/agents/ToolsAgent/V3/description.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport { getBatchingOptionFields } from '@utils/sharedFields';\n\nimport { commonOptions } from '../options';\n\nconst enableStreaminOption: INodeProperties = {\n\tdisplayName: 'Enable Streaming',\n\tname: 'enableStreaming',\n\ttype: 'boolean',\n\tdefault: true,\n\tdescription: 'Whether this agent will stream the response in real-time as it generates text',\n};\n\nexport const toolsAgentProperties: INodeProperties = {\n\tdisplayName: 'Options',\n\tname: 'options',\n\ttype: 'collection',\n\tdefault: {},\n\tplaceholder: 'Add Option',\n\toptions: [...commonOptions
|
|
1
|
+
{"version":3,"sources":["../../../../../../../nodes/agents/Agent/agents/ToolsAgent/V3/description.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport { getBatchingOptionFields } from '@utils/sharedFields';\n\nimport { commonOptions } from '../options';\n\nconst enableStreaminOption: INodeProperties = {\n\tdisplayName: 'Enable Streaming',\n\tname: 'enableStreaming',\n\ttype: 'boolean',\n\tdefault: true,\n\tdescription: 'Whether this agent will stream the response in real-time as it generates text',\n};\n\nconst maxTokensFromMemoryOption: INodeProperties = {\n\tdisplayName: 'Max Tokens To Read From Memory',\n\tname: 'maxTokensFromMemory',\n\ttype: 'hidden',\n\tdefault: 0,\n\tdescription:\n\t\t'The maximum number of tokens to read from the chat memory history. Set to 0 to read all history.',\n};\n\nexport const toolsAgentProperties: INodeProperties = {\n\tdisplayName: 'Options',\n\tname: 'options',\n\ttype: 'collection',\n\tdefault: {},\n\tplaceholder: 'Add Option',\n\toptions: [\n\t\t...commonOptions,\n\t\tenableStreaminOption,\n\t\tgetBatchingOptionFields(undefined, 1),\n\t\tmaxTokensFromMemoryOption,\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAAwC;AAExC,qBAA8B;AAE9B,MAAM,uBAAwC;AAAA,EAC7C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AACd;AAEA,MAAM,4BAA6C;AAAA,EAClD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aACC;AACF;AAEO,MAAM,uBAAwC;AAAA,EACpD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS,CAAC;AAAA,EACV,aAAa;AAAA,EACb,SAAS;AAAA,IACR,GAAG;AAAA,IACH;AAAA,QACA,6CAAwB,QAAW,CAAC;AAAA,IACpC;AAAA,EACD;AACD;","names":[]}
|
|
@@ -33,30 +33,30 @@ __export(execute_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(execute_exports);
|
|
34
34
|
var import_messages = require("@langchain/core/messages");
|
|
35
35
|
var import_runnables = require("@langchain/core/runnables");
|
|
36
|
-
var import_helpers = require("../../../../../../utils/helpers");
|
|
37
|
-
var import_N8nOutputParser = require("../../../../../../utils/output_parsers/N8nOutputParser");
|
|
38
36
|
var import_agents = require("langchain/agents");
|
|
39
37
|
var import_omit = __toESM(require("lodash/omit"));
|
|
40
38
|
var import_n8n_workflow = require("n8n-workflow");
|
|
41
39
|
var import_node_assert = __toESM(require("node:assert"));
|
|
40
|
+
var import_helpers = require("../../../../../../utils/helpers");
|
|
41
|
+
var import_N8nOutputParser = require("../../../../../../utils/output_parsers/N8nOutputParser");
|
|
42
42
|
var import_common = require("../common");
|
|
43
43
|
var import_prompt = require("../prompt");
|
|
44
|
-
function createEngineRequests(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
async function createEngineRequests(toolCalls, itemIndex, tools) {
|
|
45
|
+
return toolCalls.map((toolCall) => {
|
|
46
|
+
const foundTool = tools.find((tool) => tool.name === toolCall.tool);
|
|
47
|
+
if (!foundTool) return;
|
|
48
|
+
const nodeName = foundTool.metadata?.sourceNodeName;
|
|
49
|
+
const input = foundTool.metadata?.isFromToolkit ? { ...toolCall.toolInput, tool: toolCall.tool } : toolCall.toolInput;
|
|
50
|
+
return {
|
|
51
|
+
nodeName,
|
|
52
|
+
input,
|
|
53
|
+
type: import_n8n_workflow.NodeConnectionTypes.AiTool,
|
|
54
|
+
id: toolCall.toolCallId,
|
|
55
|
+
metadata: {
|
|
56
|
+
itemIndex
|
|
57
|
+
}
|
|
58
|
+
};
|
|
48
59
|
});
|
|
49
|
-
return toolCalls.map((toolCall) => ({
|
|
50
|
-
nodeName: connectedSubnodes.find(
|
|
51
|
-
(node) => (0, import_n8n_workflow.nodeNameToToolName)(node.name) === toolCall.tool
|
|
52
|
-
)?.name ?? toolCall.tool,
|
|
53
|
-
input: toolCall.toolInput,
|
|
54
|
-
type: import_n8n_workflow.NodeConnectionTypes.AiTool,
|
|
55
|
-
id: toolCall.toolCallId,
|
|
56
|
-
metadata: {
|
|
57
|
-
itemIndex
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
60
60
|
}
|
|
61
61
|
function createAgentSequence(model, tools, prompt, _options, outputParser, memory, fallbackModel) {
|
|
62
62
|
const agent = (0, import_agents.createToolCallingAgent)({
|
|
@@ -173,6 +173,9 @@ function buildSteps(response, itemIndex) {
|
|
|
173
173
|
const steps = [];
|
|
174
174
|
if (response) {
|
|
175
175
|
const responses = response?.actionResponses ?? [];
|
|
176
|
+
if (response.metadata?.previousRequests) {
|
|
177
|
+
steps.push(...response.metadata.previousRequests);
|
|
178
|
+
}
|
|
176
179
|
for (const tool of responses) {
|
|
177
180
|
if (tool.action?.metadata?.itemIndex !== itemIndex) continue;
|
|
178
181
|
const toolInput = {
|
|
@@ -254,7 +257,10 @@ async function toolsAgentExecute(response) {
|
|
|
254
257
|
}
|
|
255
258
|
const outputParser2 = await (0, import_N8nOutputParser.getOptionalOutputParser)(this, itemIndex);
|
|
256
259
|
const tools = await (0, import_common.getTools)(this, outputParser2);
|
|
257
|
-
const options = this.getNodeParameter("options", itemIndex
|
|
260
|
+
const options = this.getNodeParameter("options", itemIndex);
|
|
261
|
+
if (options.enableStreaming === void 0) {
|
|
262
|
+
options.enableStreaming = true;
|
|
263
|
+
}
|
|
258
264
|
const messages = await (0, import_common.prepareMessages)(this, itemIndex, {
|
|
259
265
|
systemMessage: options.systemMessage,
|
|
260
266
|
passthroughBinaryImages: options.passthroughBinaryImages ?? true,
|
|
@@ -281,8 +287,7 @@ async function toolsAgentExecute(response) {
|
|
|
281
287
|
if ("isStreaming" in this && options.enableStreaming && isStreamingAvailable && this.getNode().typeVersion >= 2.1) {
|
|
282
288
|
let chatHistory = void 0;
|
|
283
289
|
if (memory) {
|
|
284
|
-
|
|
285
|
-
chatHistory = memoryVariables["chat_history"];
|
|
290
|
+
chatHistory = await loadChatHistory(memory, model, options.maxTokensFromMemory);
|
|
286
291
|
}
|
|
287
292
|
const eventStream = executor.streamEvents(
|
|
288
293
|
{
|
|
@@ -303,7 +308,7 @@ async function toolsAgentExecute(response) {
|
|
|
303
308
|
input
|
|
304
309
|
);
|
|
305
310
|
if (result.toolCalls && result.toolCalls.length > 0) {
|
|
306
|
-
const actions = createEngineRequests(
|
|
311
|
+
const actions = await createEngineRequests(result.toolCalls, itemIndex, tools);
|
|
307
312
|
return {
|
|
308
313
|
actions,
|
|
309
314
|
metadata: { previousRequests: buildSteps(response, itemIndex) }
|
|
@@ -313,16 +318,15 @@ async function toolsAgentExecute(response) {
|
|
|
313
318
|
} else {
|
|
314
319
|
let chatHistory = void 0;
|
|
315
320
|
if (memory) {
|
|
316
|
-
|
|
317
|
-
chatHistory = memoryVariables["chat_history"];
|
|
321
|
+
chatHistory = await loadChatHistory(memory, model, options.maxTokensFromMemory);
|
|
318
322
|
}
|
|
319
|
-
const
|
|
323
|
+
const modelResponse = await executor.invoke({
|
|
320
324
|
...invokeParams,
|
|
321
325
|
chat_history: chatHistory
|
|
322
326
|
});
|
|
323
|
-
if ("returnValues" in
|
|
324
|
-
if (memory && input &&
|
|
325
|
-
let fullOutput =
|
|
327
|
+
if ("returnValues" in modelResponse) {
|
|
328
|
+
if (memory && input && modelResponse.returnValues.output) {
|
|
329
|
+
let fullOutput = modelResponse.returnValues.output;
|
|
326
330
|
if (steps.length > 0) {
|
|
327
331
|
const toolContext = steps.map(
|
|
328
332
|
(step) => `Tool: ${step.action.tool}, Input: ${JSON.stringify(step.action.toolInput)}, Result: ${step.observation}`
|
|
@@ -331,16 +335,16 @@ async function toolsAgentExecute(response) {
|
|
|
331
335
|
}
|
|
332
336
|
await memory.saveContext({ input }, { output: fullOutput });
|
|
333
337
|
}
|
|
334
|
-
const result = { ...
|
|
338
|
+
const result = { ...modelResponse.returnValues };
|
|
335
339
|
if (options.returnIntermediateSteps && steps.length > 0) {
|
|
336
340
|
result.intermediateSteps = steps;
|
|
337
341
|
}
|
|
338
342
|
return result;
|
|
339
343
|
}
|
|
340
|
-
const actions = createEngineRequests(
|
|
344
|
+
const actions = await createEngineRequests(modelResponse, itemIndex, tools);
|
|
341
345
|
return {
|
|
342
346
|
actions,
|
|
343
|
-
metadata: { previousRequests: buildSteps(
|
|
347
|
+
metadata: { previousRequests: buildSteps(response, itemIndex) }
|
|
344
348
|
};
|
|
345
349
|
}
|
|
346
350
|
});
|
|
@@ -400,6 +404,21 @@ async function toolsAgentExecute(response) {
|
|
|
400
404
|
}
|
|
401
405
|
return [returnData];
|
|
402
406
|
}
|
|
407
|
+
async function loadChatHistory(memory, model, maxTokensFromMemory) {
|
|
408
|
+
const memoryVariables = await memory.loadMemoryVariables({});
|
|
409
|
+
let chatHistory = memoryVariables["chat_history"];
|
|
410
|
+
if (maxTokensFromMemory) {
|
|
411
|
+
chatHistory = await (0, import_messages.trimMessages)(chatHistory, {
|
|
412
|
+
strategy: "last",
|
|
413
|
+
maxTokens: maxTokensFromMemory,
|
|
414
|
+
tokenCounter: model,
|
|
415
|
+
includeSystem: true,
|
|
416
|
+
startOn: "human",
|
|
417
|
+
allowPartial: true
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
return chatHistory;
|
|
421
|
+
}
|
|
403
422
|
// Annotate the CommonJS export names for ESM import in node:
|
|
404
423
|
0 && (module.exports = {
|
|
405
424
|
toolsAgentExecute
|