@n8n/n8n-nodes-langchain 1.89.0 → 1.90.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.
@@ -53,7 +53,7 @@ class OpenRouterApi {
53
53
  this.test = {
54
54
  request: {
55
55
  baseURL: "={{ $credentials.url }}",
56
- url: "/models"
56
+ url: "/key"
57
57
  }
58
58
  };
59
59
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../credentials/OpenRouterApi.credentials.ts"],"sourcesContent":["import type {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class OpenRouterApi implements ICredentialType {\n\tname = 'openRouterApi';\n\n\tdisplayName = 'OpenRouter';\n\n\tdocumentationUrl = 'openrouter';\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: 'hidden',\n\t\t\tdefault: 'https://openrouter.ai/api/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},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{ $credentials.url }}',\n\t\t\turl: '/models',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,cAAyC;AAAA,EAA/C;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,MACV;AAAA,IACD;AAEA,wBAAqC;AAAA,MACpC,MAAM;AAAA,MACN,YAAY;AAAA,QACX,SAAS;AAAA,UACR,eAAe;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAEA,gBAA+B;AAAA,MAC9B,SAAS;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,MACN;AAAA,IACD;AAAA;AACD;","names":[]}
1
+ {"version":3,"sources":["../../credentials/OpenRouterApi.credentials.ts"],"sourcesContent":["import type {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class OpenRouterApi implements ICredentialType {\n\tname = 'openRouterApi';\n\n\tdisplayName = 'OpenRouter';\n\n\tdocumentationUrl = 'openrouter';\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: 'hidden',\n\t\t\tdefault: 'https://openrouter.ai/api/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},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{ $credentials.url }}',\n\t\t\turl: '/key',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,cAAyC;AAAA,EAA/C;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,MACV;AAAA,IACD;AAEA,wBAAqC;AAAA,MACpC,MAAM;AAAA,MACN,YAAY;AAAA,QACX,SAAS;AAAA,UACR,eAAe;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAEA,gBAA+B;AAAA,MAC9B,SAAS;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,MACN;AAAA,IACD;AAAA;AACD;","names":[]}
@@ -110,7 +110,8 @@ class McpServer {
110
110
  return {
111
111
  name: tool.name,
112
112
  description: tool.description,
113
- inputSchema: (0, import_zod_to_json_schema.zodToJsonSchema)(tool.schema)
113
+ // Allow additional properties on tool call input
114
+ inputSchema: (0, import_zod_to_json_schema.zodToJsonSchema)(tool.schema, { removeAdditionalStrategy: "strict" })
114
115
  };
115
116
  })
116
117
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/mcp/McpTrigger/McpServer.ts"],"sourcesContent":["import type { Tool } from '@langchain/core/tools';\nimport { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';\nimport type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';\nimport {\n\tJSONRPCMessageSchema,\n\tListToolsRequestSchema,\n\tCallToolRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport type * as express from 'express';\nimport { OperationalError, type Logger } from 'n8n-workflow';\nimport { zodToJsonSchema } from 'zod-to-json-schema';\n\nimport { FlushingSSEServerTransport } from './FlushingSSEServerTransport';\nimport type { CompressionResponse } from './FlushingSSEServerTransport';\n\n/**\n * Parses the JSONRPC message and checks whether the method used was a tool\n * call. This is necessary in order to not have executions for listing tools\n * and other commands sent by the MCP client\n */\nfunction wasToolCall(body: string) {\n\ttry {\n\t\tconst message: unknown = JSON.parse(body);\n\t\tconst parsedMessage: JSONRPCMessage = JSONRPCMessageSchema.parse(message);\n\t\treturn (\n\t\t\t'method' in parsedMessage &&\n\t\t\t'id' in parsedMessage &&\n\t\t\tparsedMessage?.method === CallToolRequestSchema.shape.method.value\n\t\t);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport class McpServer {\n\tservers: { [sessionId: string]: Server } = {};\n\n\ttransports: { [sessionId: string]: FlushingSSEServerTransport } = {};\n\n\tlogger: Logger;\n\n\tprivate tools: { [sessionId: string]: Tool[] } = {};\n\n\tprivate resolveFunctions: { [sessionId: string]: CallableFunction } = {};\n\n\tconstructor(logger: Logger) {\n\t\tthis.logger = logger;\n\t\tthis.logger.debug('MCP Server created');\n\t}\n\n\tasync connectTransport(postUrl: string, resp: CompressionResponse): Promise<void> {\n\t\tconst transport = new FlushingSSEServerTransport(postUrl, resp);\n\t\tconst server = this.setUpServer();\n\t\tconst { sessionId } = transport;\n\t\tthis.transports[sessionId] = transport;\n\t\tthis.servers[sessionId] = server;\n\n\t\tresp.on('close', async () => {\n\t\t\tthis.logger.debug(`Deleting transport for ${sessionId}`);\n\t\t\tdelete this.tools[sessionId];\n\t\t\tdelete this.resolveFunctions[sessionId];\n\t\t\tdelete this.transports[sessionId];\n\t\t\tdelete this.servers[sessionId];\n\t\t});\n\n\t\tawait server.connect(transport);\n\n\t\t// Make sure we flush the compression middleware, so that it's not waiting for more content to be added to the buffer\n\t\tif (resp.flush) {\n\t\t\tresp.flush();\n\t\t}\n\t}\n\n\tasync handlePostMessage(req: express.Request, resp: CompressionResponse, connectedTools: Tool[]) {\n\t\tconst sessionId = req.query.sessionId as string;\n\t\tconst transport = this.transports[sessionId];\n\t\tthis.tools[sessionId] = connectedTools;\n\t\tif (transport) {\n\t\t\t// We need to add a promise here because the `handlePostMessage` will send something to the\n\t\t\t// MCP Server, that will run in a different context. This means that the return will happen\n\t\t\t// almost immediately, and will lead to marking the sub-node as \"running\" in the final execution\n\t\t\tawait new Promise(async (resolve) => {\n\t\t\t\tthis.resolveFunctions[sessionId] = resolve;\n\t\t\t\tawait transport.handlePostMessage(req, resp, req.rawBody.toString());\n\t\t\t});\n\t\t\tdelete this.resolveFunctions[sessionId];\n\t\t} else {\n\t\t\tthis.logger.warn(`No transport found for session ${sessionId}`);\n\t\t\tresp.status(401).send('No transport found for sessionId');\n\t\t}\n\n\t\tif (resp.flush) {\n\t\t\tresp.flush();\n\t\t}\n\n\t\tdelete this.tools[sessionId]; // Clean up to avoid keeping all tools in memory\n\n\t\treturn wasToolCall(req.rawBody.toString());\n\t}\n\n\tsetUpServer(): Server {\n\t\tconst server = new Server(\n\t\t\t{\n\t\t\t\tname: 'n8n-mcp-server',\n\t\t\t\tversion: '0.1.0',\n\t\t\t},\n\t\t\t{\n\t\t\t\tcapabilities: { tools: {} },\n\t\t\t},\n\t\t);\n\n\t\tserver.setRequestHandler(ListToolsRequestSchema, async (_, extra: RequestHandlerExtra) => {\n\t\t\tif (!extra.sessionId) {\n\t\t\t\tthrow new OperationalError('Require a sessionId for the listing of tools');\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttools: this.tools[extra.sessionId].map((tool) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: tool.name,\n\t\t\t\t\t\tdescription: tool.description,\n\t\t\t\t\t\tinputSchema: zodToJsonSchema(tool.schema),\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\t};\n\t\t});\n\n\t\tserver.setRequestHandler(CallToolRequestSchema, async (request, extra: RequestHandlerExtra) => {\n\t\t\tif (!request.params?.name || !request.params?.arguments) {\n\t\t\t\tthrow new OperationalError('Require a name and arguments for the tool call');\n\t\t\t}\n\t\t\tif (!extra.sessionId) {\n\t\t\t\tthrow new OperationalError('Require a sessionId for the tool call');\n\t\t\t}\n\n\t\t\tconst requestedTool: Tool | undefined = this.tools[extra.sessionId].find(\n\t\t\t\t(tool) => tool.name === request.params.name,\n\t\t\t);\n\t\t\tif (!requestedTool) {\n\t\t\t\tthrow new OperationalError('Tool not found');\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst result = await requestedTool.invoke(request.params.arguments);\n\n\t\t\t\tthis.resolveFunctions[extra.sessionId]();\n\n\t\t\t\tthis.logger.debug(`Got request for ${requestedTool.name}, and executed it.`);\n\n\t\t\t\tif (typeof result === 'object') {\n\t\t\t\t\treturn { content: [{ type: 'text', text: JSON.stringify(result) }] };\n\t\t\t\t}\n\t\t\t\tif (typeof result === 'string') {\n\t\t\t\t\treturn { content: [{ type: 'text', text: result }] };\n\t\t\t\t}\n\t\t\t\treturn { content: [{ type: 'text', text: String(result) }] };\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger.error(`Error while executing Tool ${requestedTool.name}: ${error}`);\n\t\t\t\treturn { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] };\n\t\t\t}\n\t\t});\n\n\t\tserver.onclose = () => {\n\t\t\tthis.logger.debug('Closing MCP Server');\n\t\t};\n\t\tserver.onerror = (error: unknown) => {\n\t\t\tthis.logger.error(`MCP Error: ${error}`);\n\t\t};\n\t\treturn server;\n\t}\n}\n\n/**\n * This singleton is shared across the instance, making sure we only have one server to worry about.\n * It needs to stay in memory to keep track of the long-lived connections.\n * It requires a logger at first creation to set everything up.\n */\nexport class McpServerSingleton {\n\tstatic #instance: McpServerSingleton;\n\n\tprivate _serverData: McpServer;\n\n\tprivate constructor(logger: Logger) {\n\t\tthis._serverData = new McpServer(logger);\n\t}\n\n\tstatic instance(logger: Logger): McpServer {\n\t\tif (!McpServerSingleton.#instance) {\n\t\t\tMcpServerSingleton.#instance = new McpServerSingleton(logger);\n\t\t\tlogger.debug('Created singleton for MC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oBAAmB;AAAA,EAKvB,YAAY,QAAgB;AACnC,SAAK,cAAc,IAAI,UAAU,MAAM;AAAA,EACxC;AAAA,EAEA,OAAO,SAAS,QAA2B;AAC1C,QAAI,CAAC,kCAAmB,YAAW;AAClC,wCAAmB,WAAY,IAAI,oBAAmB,MAAM;AAC5D,aAAO,MAAM,mCAAmC;AAAA,IACjD;AAEA,WAAO,kCAAmB,WAAU;AAAA,EACrC;AAAA,EAEA,IAAI,aAAa;AAChB,WAAO,KAAK;AAAA,EACb;AACD;AApBQ;AAAP,aADY,qBACL;AADD,IAAM,qBAAN;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/mcp/McpTrigger/McpServer.ts"],"sourcesContent":["import type { Tool } from '@langchain/core/tools';\nimport { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';\nimport type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';\nimport {\n\tJSONRPCMessageSchema,\n\tListToolsRequestSchema,\n\tCallToolRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport type * as express from 'express';\nimport { OperationalError, type Logger } from 'n8n-workflow';\nimport { zodToJsonSchema } from 'zod-to-json-schema';\n\nimport { FlushingSSEServerTransport } from './FlushingSSEServerTransport';\nimport type { CompressionResponse } from './FlushingSSEServerTransport';\n\n/**\n * Parses the JSONRPC message and checks whether the method used was a tool\n * call. This is necessary in order to not have executions for listing tools\n * and other commands sent by the MCP client\n */\nfunction wasToolCall(body: string) {\n\ttry {\n\t\tconst message: unknown = JSON.parse(body);\n\t\tconst parsedMessage: JSONRPCMessage = JSONRPCMessageSchema.parse(message);\n\t\treturn (\n\t\t\t'method' in parsedMessage &&\n\t\t\t'id' in parsedMessage &&\n\t\t\tparsedMessage?.method === CallToolRequestSchema.shape.method.value\n\t\t);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport class McpServer {\n\tservers: { [sessionId: string]: Server } = {};\n\n\ttransports: { [sessionId: string]: FlushingSSEServerTransport } = {};\n\n\tlogger: Logger;\n\n\tprivate tools: { [sessionId: string]: Tool[] } = {};\n\n\tprivate resolveFunctions: { [sessionId: string]: CallableFunction } = {};\n\n\tconstructor(logger: Logger) {\n\t\tthis.logger = logger;\n\t\tthis.logger.debug('MCP Server created');\n\t}\n\n\tasync connectTransport(postUrl: string, resp: CompressionResponse): Promise<void> {\n\t\tconst transport = new FlushingSSEServerTransport(postUrl, resp);\n\t\tconst server = this.setUpServer();\n\t\tconst { sessionId } = transport;\n\t\tthis.transports[sessionId] = transport;\n\t\tthis.servers[sessionId] = server;\n\n\t\tresp.on('close', async () => {\n\t\t\tthis.logger.debug(`Deleting transport for ${sessionId}`);\n\t\t\tdelete this.tools[sessionId];\n\t\t\tdelete this.resolveFunctions[sessionId];\n\t\t\tdelete this.transports[sessionId];\n\t\t\tdelete this.servers[sessionId];\n\t\t});\n\n\t\tawait server.connect(transport);\n\n\t\t// Make sure we flush the compression middleware, so that it's not waiting for more content to be added to the buffer\n\t\tif (resp.flush) {\n\t\t\tresp.flush();\n\t\t}\n\t}\n\n\tasync handlePostMessage(req: express.Request, resp: CompressionResponse, connectedTools: Tool[]) {\n\t\tconst sessionId = req.query.sessionId as string;\n\t\tconst transport = this.transports[sessionId];\n\t\tthis.tools[sessionId] = connectedTools;\n\t\tif (transport) {\n\t\t\t// We need to add a promise here because the `handlePostMessage` will send something to the\n\t\t\t// MCP Server, that will run in a different context. This means that the return will happen\n\t\t\t// almost immediately, and will lead to marking the sub-node as \"running\" in the final execution\n\t\t\tawait new Promise(async (resolve) => {\n\t\t\t\tthis.resolveFunctions[sessionId] = resolve;\n\t\t\t\tawait transport.handlePostMessage(req, resp, req.rawBody.toString());\n\t\t\t});\n\t\t\tdelete this.resolveFunctions[sessionId];\n\t\t} else {\n\t\t\tthis.logger.warn(`No transport found for session ${sessionId}`);\n\t\t\tresp.status(401).send('No transport found for sessionId');\n\t\t}\n\n\t\tif (resp.flush) {\n\t\t\tresp.flush();\n\t\t}\n\n\t\tdelete this.tools[sessionId]; // Clean up to avoid keeping all tools in memory\n\n\t\treturn wasToolCall(req.rawBody.toString());\n\t}\n\n\tsetUpServer(): Server {\n\t\tconst server = new Server(\n\t\t\t{\n\t\t\t\tname: 'n8n-mcp-server',\n\t\t\t\tversion: '0.1.0',\n\t\t\t},\n\t\t\t{\n\t\t\t\tcapabilities: { tools: {} },\n\t\t\t},\n\t\t);\n\n\t\tserver.setRequestHandler(ListToolsRequestSchema, async (_, extra: RequestHandlerExtra) => {\n\t\t\tif (!extra.sessionId) {\n\t\t\t\tthrow new OperationalError('Require a sessionId for the listing of tools');\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttools: this.tools[extra.sessionId].map((tool) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: tool.name,\n\t\t\t\t\t\tdescription: tool.description,\n\t\t\t\t\t\t// Allow additional properties on tool call input\n\t\t\t\t\t\tinputSchema: zodToJsonSchema(tool.schema, { removeAdditionalStrategy: 'strict' }),\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\t};\n\t\t});\n\n\t\tserver.setRequestHandler(CallToolRequestSchema, async (request, extra: RequestHandlerExtra) => {\n\t\t\tif (!request.params?.name || !request.params?.arguments) {\n\t\t\t\tthrow new OperationalError('Require a name and arguments for the tool call');\n\t\t\t}\n\t\t\tif (!extra.sessionId) {\n\t\t\t\tthrow new OperationalError('Require a sessionId for the tool call');\n\t\t\t}\n\n\t\t\tconst requestedTool: Tool | undefined = this.tools[extra.sessionId].find(\n\t\t\t\t(tool) => tool.name === request.params.name,\n\t\t\t);\n\t\t\tif (!requestedTool) {\n\t\t\t\tthrow new OperationalError('Tool not found');\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst result = await requestedTool.invoke(request.params.arguments);\n\n\t\t\t\tthis.resolveFunctions[extra.sessionId]();\n\n\t\t\t\tthis.logger.debug(`Got request for ${requestedTool.name}, and executed it.`);\n\n\t\t\t\tif (typeof result === 'object') {\n\t\t\t\t\treturn { content: [{ type: 'text', text: JSON.stringify(result) }] };\n\t\t\t\t}\n\t\t\t\tif (typeof result === 'string') {\n\t\t\t\t\treturn { content: [{ type: 'text', text: result }] };\n\t\t\t\t}\n\t\t\t\treturn { content: [{ type: 'text', text: String(result) }] };\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger.error(`Error while executing Tool ${requestedTool.name}: ${error}`);\n\t\t\t\treturn { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] };\n\t\t\t}\n\t\t});\n\n\t\tserver.onclose = () => {\n\t\t\tthis.logger.debug('Closing MCP Server');\n\t\t};\n\t\tserver.onerror = (error: unknown) => {\n\t\t\tthis.logger.error(`MCP Error: ${error}`);\n\t\t};\n\t\treturn server;\n\t}\n}\n\n/**\n * This singleton is shared across the instance, making sure we only have one server to worry about.\n * It needs to stay in memory to keep track of the long-lived connections.\n * It requires a logger at first creation to set everything up.\n */\nexport class McpServerSingleton {\n\tstatic #instance: McpServerSingleton;\n\n\tprivate _serverData: McpServer;\n\n\tprivate constructor(logger: Logger) {\n\t\tthis._serverData = new McpServer(logger);\n\t}\n\n\tstatic instance(logger: Logger): McpServer {\n\t\tif (!McpServerSingleton.#instance) {\n\t\t\tMcpServerSingleton.#instance = new McpServerSingleton(logger);\n\t\t\tlogger.debug('Created singleton for MCP Servers');\n\t\t}\n\n\t\treturn McpServerSingleton.#instance.serverData;\n\t}\n\n\tget serverData() {\n\t\treturn this._serverData;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuB;AAGvB,mBAIO;AAEP,0BAA8C;AAC9C,gCAAgC;AAEhC,wCAA2C;AAb3C;AAqBA,SAAS,YAAY,MAAc;AAClC,MAAI;AACH,UAAM,UAAmB,KAAK,MAAM,IAAI;AACxC,UAAM,gBAAgC,kCAAqB,MAAM,OAAO;AACxE,WACC,YAAY,iBACZ,QAAQ,i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N;","names":[]}
@@ -27,6 +27,7 @@ var import_PythonSandbox = require("n8n-nodes-base/dist/nodes/Code/PythonSandbox
27
27
  var import_Sandbox = require("n8n-nodes-base/dist/nodes/Code/Sandbox");
28
28
  var import_n8n_workflow = require("n8n-workflow");
29
29
  var import_descriptions = require("../../../utils/descriptions");
30
+ var import_helpers = require("../../../utils/helpers");
30
31
  var import_schemaParsing = require("../../../utils/schemaParsing");
31
32
  var import_sharedFields = require("../../../utils/sharedFields");
32
33
  class ToolCode {
@@ -37,7 +38,7 @@ class ToolCode {
37
38
  icon: "fa:code",
38
39
  iconColor: "black",
39
40
  group: ["transform"],
40
- version: [1, 1.1],
41
+ version: [1, 1.1, 1.2],
41
42
  description: "Write a tool in JS or Python",
42
43
  defaults: {
43
44
  name: "Code Tool"
@@ -91,7 +92,7 @@ class ToolCode {
91
92
  description: "The name of the function to be called, could contain letters, numbers, and underscores only",
92
93
  displayOptions: {
93
94
  show: {
94
- "@version": [{ _cnd: { gte: 1.1 } }]
95
+ "@version": [1.1]
95
96
  }
96
97
  }
97
98
  },
@@ -179,7 +180,8 @@ class ToolCode {
179
180
  async supplyData(itemIndex) {
180
181
  const node = this.getNode();
181
182
  const workflowMode = this.getMode();
182
- const name = this.getNodeParameter("name", itemIndex);
183
+ const { typeVersion } = node;
184
+ const name = typeVersion <= 1.1 ? this.getNodeParameter("name", itemIndex) : (0, import_helpers.nodeNameToToolName)(node);
183
185
  const description = this.getNodeParameter("description", itemIndex);
184
186
  const useSchema = this.getNodeParameter("specifyInputSchema", itemIndex);
185
187
  const language = this.getNodeParameter("language", itemIndex);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/tools/ToolCode/ToolCode.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { DynamicStructuredTool, DynamicTool } from '@langchain/core/tools';\nimport type { JSONSchema7 } from 'json-schema';\nimport { JavaScriptSandbox } from 'n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox';\nimport { PythonSandbox } from 'n8n-nodes-base/dist/nodes/Code/PythonSandbox';\nimport type { Sandbox } from 'n8n-nodes-base/dist/nodes/Code/Sandbox';\nimport { getSandboxContext } from 'n8n-nodes-base/dist/nodes/Code/Sandbox';\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tExecutionError,\n\tIDataObject,\n} from 'n8n-workflow';\nimport { jsonParse, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\nimport {\n\tbuildInputSchemaField,\n\tbuildJsonSchemaExampleField,\n\tschemaTypeField,\n} from '@utils/descriptions';\nimport { convertJsonSchemaToZod, generateSchema } from '@utils/schemaParsing';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport type { DynamicZodObject } from '../../../types/zod.types';\n\nexport class ToolCode implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Code Tool',\n\t\tname: 'toolCode',\n\t\ticon: 'fa:code',\n\t\ticonColor: 'black',\n\t\tgroup: ['transform'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Write a tool in JS or Python',\n\t\tdefaults: {\n\t\t\tname: 'Code Tool',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Recommended Tools'],\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.toolcode/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'See an example of a conversational agent with custom tool written in JavaScript <a href=\"/templates/1963\" target=\"_blank\">here</a>.',\n\t\t\t\tname: 'noticeTemplateExample',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Name',\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'My_Tool',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Name',\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. My_Tool',\n\t\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\t\tdescription:\n\t\t\t\t\t'The name of the function to be called, could contain letters, numbers, and underscores only',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.1 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Description',\n\t\t\t\tname: 'description',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder:\n\t\t\t\t\t'Call this tool to get a random color. The input should be a string with comma separted names of colors to exclude.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\tdisplayName: 'Language',\n\t\t\t\tname: 'language',\n\t\t\t\ttype: 'options',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'JavaScript',\n\t\t\t\t\t\tvalue: 'javaScript',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Python (Beta)',\n\t\t\t\t\t\tvalue: 'python',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'javaScript',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'JavaScript',\n\t\t\t\tname: 'jsCode',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tlanguage: ['javaScript'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\teditor: 'jsEditor',\n\t\t\t\t},\n\t\t\t\tdefault:\n\t\t\t\t\t'// Example: convert the incoming query to uppercase and return it\\nreturn query.toUpperCase()',\n\t\t\t\t// TODO: Add proper text here later\n\t\t\t\thint: 'You can access the input the tool receives via the input property \"query\". The returned value should be a single string.',\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-description-missing-final-period\n\t\t\t\tdescription: 'E.g. Converts any text to uppercase',\n\t\t\t\tnoDataExpression: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Python',\n\t\t\t\tname: 'pythonCode',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tlanguage: ['python'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\teditor: 'codeNodeEditor', // TODO: create a separate `pythonEditor` component\n\t\t\t\t\teditorLanguage: 'python',\n\t\t\t\t},\n\t\t\t\tdefault:\n\t\t\t\t\t'# Example: convert the incoming query to uppercase and return it\\nreturn query.upper()',\n\t\t\t\t// TODO: Add proper text here later\n\t\t\t\thint: 'You can access the input the tool receives via the input property \"query\". The returned value should be a single string.',\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-description-missing-final-period\n\t\t\t\tdescription: 'E.g. Converts any text to uppercase',\n\t\t\t\tnoDataExpression: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Specify Input Schema',\n\t\t\t\tname: 'specifyInputSchema',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to specify the schema for the function. This would require the LLM to provide the input in the correct format and would validate it against the schema.',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t\t{ ...schemaTypeField, displayOptions: { show: { specifyInputSchema: [true] } } },\n\t\t\tbuildJsonSchemaExampleField({ showExtraProps: { specifyInputSchema: [true] } }),\n\t\t\tbuildInputSchemaField({ showExtraProps: { specifyInputSchema: [true] } }),\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst node = this.getNode();\n\t\tconst workflowMode = this.getMode();\n\n\t\tconst name = this.getNodeParameter('name', itemIndex) as string;\n\t\tconst description = this.getNodeParameter('description', itemIndex) as string;\n\n\t\tconst useSchema = this.getNodeParameter('specifyInputSchema', itemIndex) as boolean;\n\n\t\tconst language = this.getNodeParameter('language', itemIndex) as string;\n\t\tlet code = '';\n\t\tif (language === 'javaScript') {\n\t\t\tcode = this.getNodeParameter('jsCode', itemIndex) as string;\n\t\t} else {\n\t\t\tcode = this.getNodeParameter('pythonCode', itemIndex) as string;\n\t\t}\n\n\t\tconst getSandbox = (query: string | IDataObject, index = 0) => {\n\t\t\tconst context = getSandboxContext.call(this, index);\n\t\t\tcontext.query = query;\n\n\t\t\tlet sandbox: Sandbox;\n\t\t\tif (language === 'javaScript') {\n\t\t\t\tsandbox = new JavaScriptSandbox(context, code, this.helpers);\n\t\t\t} else {\n\t\t\t\tsandbox = new PythonSandbox(context, code, this.helpers);\n\t\t\t}\n\n\t\t\tsandbox.on(\n\t\t\t\t'output',\n\t\t\t\tworkflowMode === 'manual'\n\t\t\t\t\t? this.sendMessageToUI.bind(this)\n\t\t\t\t\t: (...args: unknown[]) =>\n\t\t\t\t\t\t\tconsole.log(`[Workflow \"${this.getWorkflow().id}\"][Node \"${node.name}\"]`, ...args),\n\t\t\t);\n\t\t\treturn sandbox;\n\t\t};\n\n\t\tconst runFunction = async (query: string | IDataObject): Promise<string> => {\n\t\t\tconst sandbox = getSandbox(query, itemIndex);\n\t\t\treturn await sandbox.runCode<string>();\n\t\t};\n\n\t\tconst toolHandler = async (query: string | IDataObject): Promise<string> => {\n\t\t\tconst { index } = this.addInputData(NodeConnectionTypes.AiTool, [[{ json: { query } }]]);\n\n\t\t\tlet response: string = '';\n\t\t\tlet executionError: ExecutionError | undefined;\n\t\t\ttry {\n\t\t\t\tresponse = await runFunction(query);\n\t\t\t} catch (error: unknown) {\n\t\t\t\texecutionError = new NodeOperationError(this.getNode(), error as ExecutionError);\n\t\t\t\tresponse = `There was an error: \"${executionError.message}\"`;\n\t\t\t}\n\n\t\t\tif (typeof response === 'number') {\n\t\t\t\tresponse = (response as number).toString();\n\t\t\t}\n\n\t\t\tif (typeof response !== 'string') {\n\t\t\t\t// TODO: Do some more testing. Issues here should actually fail the workflow\n\t\t\t\texecutionError = new NodeOperationError(this.getNode(), 'Wrong output type returned', {\n\t\t\t\t\tdescription: `The response property should be a string, but it is an ${typeof response}`,\n\t\t\t\t});\n\t\t\t\tresponse = `There was an error: \"${executionError.message}\"`;\n\t\t\t}\n\n\t\t\tif (executionError) {\n\t\t\t\tvoid this.addOutputData(NodeConnectionTypes.AiTool, index, executionError);\n\t\t\t} else {\n\t\t\t\tvoid this.addOutputData(NodeConnectionTypes.AiTool, index, [[{ json: { response } }]]);\n\t\t\t}\n\n\t\t\treturn response;\n\t\t};\n\n\t\tconst commonToolOptions = {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tfunc: toolHandler,\n\t\t};\n\n\t\tlet tool: DynamicTool | DynamicStructuredTool | undefined = undefined;\n\n\t\tif (useSchema) {\n\t\t\ttry {\n\t\t\t\t// We initialize these even though one of them will always be empty\n\t\t\t\t// it makes it easier to navigate the ternary operator\n\t\t\t\tconst jsonExample = this.getNodeParameter('jsonSchemaExample', itemIndex, '') as string;\n\t\t\t\tconst inputSchema = this.getNodeParameter('inputSchema', itemIndex, '') as string;\n\n\t\t\t\tconst schemaType = this.getNodeParameter('schemaType', itemIndex) as 'fromJson' | 'manual';\n\t\t\t\tconst jsonSchema =\n\t\t\t\t\tschemaType === 'fromJson'\n\t\t\t\t\t\t? generateSchema(jsonExample)\n\t\t\t\t\t\t: jsonParse<JSONSchema7>(inputSchema);\n\n\t\t\t\tconst zodSchema = convertJsonSchemaToZod<DynamicZodObject>(jsonSchema);\n\n\t\t\t\ttool = new DynamicStructuredTool({\n\t\t\t\t\tschema: zodSchema,\n\t\t\t\t\t...commonToolOptions,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t'Error during parsing of JSON Schema. \\n ' + error,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\ttool = new DynamicTool(commonToolOptions);\n\t\t}\n\n\t\treturn {\n\t\t\tresponse: tool,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAmD;AAEnD,+BAAkC;AAClC,2BAA8B;AAE9B,qBAAkC;AASlC,0BAAmE;AAEnE,0BAIO;AACP,2BAAuD;AACvD,0BAA6C;AAItC,MAAM,SAA8B;AAAA,EAApC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS,CAAC,GAAG,GAAG;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OA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AY,SAAoB,SAAS;AAAA,MAC1C;AAEA,UAAI,OAAO,aAAa,UAAU;AAEjC,yBAAiB,IAAI,uCAAmB,KAAK,QAAQ,GAAG,8BAA8B;AAAA,UACrF,aAAa,0DAA0D,OAAO,QAAQ;AAAA,QACvF,CAAC;AACD,mBAAW,wBAAwB,eAAe,OAAO;AAAA,MAC1D;AAEA,UAAI,gBAAgB;AACnB,aAAK,KAAK,cAAc,wCAAoB,QAAQ,OAAO,cAAc;AAAA,MAC1E,OAAO;AACN,aAAK,KAAK,cAAc,wCAAoB,QAAQ,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AAAA,MACtF;AAEA,aAAO;AAAA,IACR;AAEA,UAAM,oBAAoB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,MAAM;AAAA,IACP;AAEA,QAAI,OAAwD;AAE5D,QAAI,WAAW;AACd,UAAI;AAGH,cAAM,cAAc,KAAK,iBAAiB,qBAAqB,WAAW,EAAE;AAC5E,cAAM,cAAc,KAAK,iBAAiB,eAAe,WAAW,EAAE;AAEtE,cAAM,aAAa,KAAK,iBAAiB,cAAc,SAAS;AAChE,cAAM,aACL,eAAe,iBACZ,qCAAe,WAAW,QAC1B,+BAAuB,WAAW;AAEtC,cAAM,gBAAY,6CAAyC,UAAU;AAErE,eAAO,IAAI,mCAAsB;AAAA,UAChC,QAAQ;AAAA,UACR,GAAG;AAAA,QACJ,CAAC;AAAA,MACF,SAAS,OAAO;AACf,cAAM,IAAI;AAAA,UACT,KAAK,QAAQ;AAAA,UACb,6CAA6C;AAAA,QAC9C;AAAA,MACD;AAAA,IACD,OAAO;AACN,aAAO,IAAI,yBAAY,iBAAiB;AAAA,IACzC;AAEA,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/tools/ToolCode/ToolCode.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { DynamicStructuredTool, DynamicTool } from '@langchain/core/tools';\nimport type { JSONSchema7 } from 'json-schema';\nimport { JavaScriptSandbox } from 'n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox';\nimport { PythonSandbox } from 'n8n-nodes-base/dist/nodes/Code/PythonSandbox';\nimport type { Sandbox } from 'n8n-nodes-base/dist/nodes/Code/Sandbox';\nimport { getSandboxContext } from 'n8n-nodes-base/dist/nodes/Code/Sandbox';\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tExecutionError,\n\tIDataObject,\n} from 'n8n-workflow';\nimport { jsonParse, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\nimport {\n\tbuildInputSchemaField,\n\tbuildJsonSchemaExampleField,\n\tschemaTypeField,\n} from '@utils/descriptions';\nimport { nodeNameToToolName } from '@utils/helpers';\nimport { convertJsonSchemaToZod, generateSchema } from '@utils/schemaParsing';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport type { DynamicZodObject } from '../../../types/zod.types';\n\nexport class ToolCode implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Code Tool',\n\t\tname: 'toolCode',\n\t\ticon: 'fa:code',\n\t\ticonColor: 'black',\n\t\tgroup: ['transform'],\n\t\tversion: [1, 1.1, 1.2],\n\t\tdescription: 'Write a tool in JS or Python',\n\t\tdefaults: {\n\t\t\tname: 'Code Tool',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Recommended Tools'],\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.toolcode/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'See an example of a conversational agent with custom tool written in JavaScript <a href=\"/templates/1963\" target=\"_blank\">here</a>.',\n\t\t\t\tname: 'noticeTemplateExample',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Name',\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'My_Tool',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Name',\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. My_Tool',\n\t\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\t\tdescription:\n\t\t\t\t\t'The name of the function to be called, could contain letters, numbers, and underscores only',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [1.1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Description',\n\t\t\t\tname: 'description',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder:\n\t\t\t\t\t'Call this tool to get a random color. The input should be a string with comma separted names of colors to exclude.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\tdisplayName: 'Language',\n\t\t\t\tname: 'language',\n\t\t\t\ttype: 'options',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'JavaScript',\n\t\t\t\t\t\tvalue: 'javaScript',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Python (Beta)',\n\t\t\t\t\t\tvalue: 'python',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'javaScript',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'JavaScript',\n\t\t\t\tname: 'jsCode',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tlanguage: ['javaScript'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\teditor: 'jsEditor',\n\t\t\t\t},\n\t\t\t\tdefault:\n\t\t\t\t\t'// Example: convert the incoming query to uppercase and return it\\nreturn query.toUpperCase()',\n\t\t\t\t// TODO: Add proper text here later\n\t\t\t\thint: 'You can access the input the tool receives via the input property \"query\". The returned value should be a single string.',\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-description-missing-final-period\n\t\t\t\tdescription: 'E.g. Converts any text to uppercase',\n\t\t\t\tnoDataExpression: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Python',\n\t\t\t\tname: 'pythonCode',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tlanguage: ['python'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\teditor: 'codeNodeEditor', // TODO: create a separate `pythonEditor` component\n\t\t\t\t\teditorLanguage: 'python',\n\t\t\t\t},\n\t\t\t\tdefault:\n\t\t\t\t\t'# Example: convert the incoming query to uppercase and return it\\nreturn query.upper()',\n\t\t\t\t// TODO: Add proper text here later\n\t\t\t\thint: 'You can access the input the tool receives via the input property \"query\". The returned value should be a single string.',\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-description-missing-final-period\n\t\t\t\tdescription: 'E.g. Converts any text to uppercase',\n\t\t\t\tnoDataExpression: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Specify Input Schema',\n\t\t\t\tname: 'specifyInputSchema',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to specify the schema for the function. This would require the LLM to provide the input in the correct format and would validate it against the schema.',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t\t{ ...schemaTypeField, displayOptions: { show: { specifyInputSchema: [true] } } },\n\t\t\tbuildJsonSchemaExampleField({ showExtraProps: { specifyInputSchema: [true] } }),\n\t\t\tbuildInputSchemaField({ showExtraProps: { specifyInputSchema: [true] } }),\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst node = this.getNode();\n\t\tconst workflowMode = this.getMode();\n\n\t\tconst { typeVersion } = node;\n\t\tconst name =\n\t\t\ttypeVersion <= 1.1\n\t\t\t\t? (this.getNodeParameter('name', itemIndex) as string)\n\t\t\t\t: nodeNameToToolName(node);\n\n\t\tconst description = this.getNodeParameter('description', itemIndex) as string;\n\n\t\tconst useSchema = this.getNodeParameter('specifyInputSchema', itemIndex) as boolean;\n\n\t\tconst language = this.getNodeParameter('language', itemIndex) as string;\n\t\tlet code = '';\n\t\tif (language === 'javaScript') {\n\t\t\tcode = this.getNodeParameter('jsCode', itemIndex) as string;\n\t\t} else {\n\t\t\tcode = this.getNodeParameter('pythonCode', itemIndex) as string;\n\t\t}\n\n\t\tconst getSandbox = (query: string | IDataObject, index = 0) => {\n\t\t\tconst context = getSandboxContext.call(this, index);\n\t\t\tcontext.query = query;\n\n\t\t\tlet sandbox: Sandbox;\n\t\t\tif (language === 'javaScript') {\n\t\t\t\tsandbox = new JavaScriptSandbox(context, code, this.helpers);\n\t\t\t} else {\n\t\t\t\tsandbox = new PythonSandbox(context, code, this.helpers);\n\t\t\t}\n\n\t\t\tsandbox.on(\n\t\t\t\t'output',\n\t\t\t\tworkflowMode === 'manual'\n\t\t\t\t\t? this.sendMessageToUI.bind(this)\n\t\t\t\t\t: (...args: unknown[]) =>\n\t\t\t\t\t\t\tconsole.log(`[Workflow \"${this.getWorkflow().id}\"][Node \"${node.name}\"]`, ...args),\n\t\t\t);\n\t\t\treturn sandbox;\n\t\t};\n\n\t\tconst runFunction = async (query: string | IDataObject): Promise<string> => {\n\t\t\tconst sandbox = getSandbox(query, itemIndex);\n\t\t\treturn await sandbox.runCode<string>();\n\t\t};\n\n\t\tconst toolHandler = async (query: string | IDataObject): Promise<string> => {\n\t\t\tconst { index } = this.addInputData(NodeConnectionTypes.AiTool, [[{ json: { query } }]]);\n\n\t\t\tlet response: string = '';\n\t\t\tlet executionError: ExecutionError | undefined;\n\t\t\ttry {\n\t\t\t\tresponse = await runFunction(query);\n\t\t\t} catch (error: unknown) {\n\t\t\t\texecutionError = new NodeOperationError(this.getNode(), error as ExecutionError);\n\t\t\t\tresponse = `There was an error: \"${executionError.message}\"`;\n\t\t\t}\n\n\t\t\tif (typeof response === 'number') {\n\t\t\t\tresponse = (response as number).toString();\n\t\t\t}\n\n\t\t\tif (typeof response !== 'string') {\n\t\t\t\t// TODO: Do some more testing. Issues here should actually fail the workflow\n\t\t\t\texecutionError = new NodeOperationError(this.getNode(), 'Wrong output type returned', {\n\t\t\t\t\tdescription: `The response property should be a string, but it is an ${typeof response}`,\n\t\t\t\t});\n\t\t\t\tresponse = `There was an error: \"${executionError.message}\"`;\n\t\t\t}\n\n\t\t\tif (executionError) {\n\t\t\t\tvoid this.addOutputData(NodeConnectionTypes.AiTool, index, executionError);\n\t\t\t} else {\n\t\t\t\tvoid this.addOutputData(NodeConnectionTypes.AiTool, index, [[{ json: { response } }]]);\n\t\t\t}\n\n\t\t\treturn response;\n\t\t};\n\n\t\tconst commonToolOptions = {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tfunc: toolHandler,\n\t\t};\n\n\t\tlet tool: DynamicTool | DynamicStructuredTool | undefined = undefined;\n\n\t\tif (useSchema) {\n\t\t\ttry {\n\t\t\t\t// We initialize these even though one of them will always be empty\n\t\t\t\t// it makes it easier to navigate the ternary operator\n\t\t\t\tconst jsonExample = this.getNodeParameter('jsonSchemaExample', itemIndex, '') as string;\n\t\t\t\tconst inputSchema = this.getNodeParameter('inputSchema', itemIndex, '') as string;\n\n\t\t\t\tconst schemaType = this.getNodeParameter('schemaType', itemIndex) as 'fromJson' | 'manual';\n\t\t\t\tconst jsonSchema =\n\t\t\t\t\tschemaType === 'fromJson'\n\t\t\t\t\t\t? generateSchema(jsonExample)\n\t\t\t\t\t\t: jsonParse<JSONSchema7>(inputSchema);\n\n\t\t\t\tconst zodSchema = convertJsonSchemaToZod<DynamicZodObject>(jsonSchema);\n\n\t\t\t\ttool = new DynamicStructuredTool({\n\t\t\t\t\tschema: zodSchema,\n\t\t\t\t\t...commonToolOptions,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t'Error during parsing of JSON Schema. \\n ' + error,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\ttool = new DynamicTool(commonToolOptions);\n\t\t}\n\n\t\treturn {\n\t\t\tresponse: tool,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAmD;AAEnD,+BAAkC;AAClC,2BAA8B;AAE9B,qBAAkC;AASlC,0BAAmE;AAEnE,0BAIO;AACP,qBAAmC;AACnC,2BAAuD;AACvD,0BAA6C;AAItC,MAAM,SAA8B;AAAA,EAApC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MA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AA,UACT,KAAK,QAAQ;AAAA,UACb,6CAA6C;AAAA,QAC9C;AAAA,MACD;AAAA,IACD,OAAO;AACN,aAAO,IAAI,yBAAY,iBAAiB;AAAA,IACzC;AAEA,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
@@ -55,6 +55,8 @@ class ToolHttpRequest {
55
55
  ]
56
56
  }
57
57
  },
58
+ // Replaced by a `usableAsTool` version of the standalone HttpRequest node
59
+ hidden: true,
58
60
  // eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
59
61
  inputs: [],
60
62
  // eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/tools/ToolHttpRequest/ToolHttpRequest.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { DynamicTool } from '@langchain/core/tools';\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tIHttpRequestMethods,\n\tIHttpRequestOptions,\n} from 'n8n-workflow';\nimport {\n\tNodeConnectionTypes,\n\tNodeOperationError,\n\ttryToParseAlphanumericString,\n} from 'n8n-workflow';\n\nimport { N8nTool } from '@utils/N8nTool';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport {\n\tauthenticationProperties,\n\tjsonInput,\n\toptimizeResponseProperties,\n\tparametersCollection,\n\tplaceholderDefinitionsCollection,\n\tspecifyBySelector,\n} from './descriptions';\nimport type { PlaceholderDefinition, ToolParameter } from './interfaces';\nimport {\n\tconfigureHttpRequestFunction,\n\tconfigureResponseOptimizer,\n\textractParametersFromText,\n\tprepareToolDescription,\n\tconfigureToolFunction,\n\tupdateParametersAndOptions,\n\tmakeToolInputSchema,\n} from './utils';\n\nexport class ToolHttpRequest implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'HTTP Request Tool',\n\t\tname: 'toolHttpRequest',\n\t\ticon: { light: 'file:httprequest.svg', dark: 'file:httprequest.dark.svg' },\n\t\tgroup: ['output'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Makes an HTTP request and returns the response data',\n\t\tsubtitle: '={{ $parameter.toolDescription }}',\n\t\tdefaults: {\n\t\t\tname: 'HTTP Request',\n\t\t},\n\t\tcredentials: [],\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Recommended Tools'],\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.toolhttprequest/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Description',\n\t\t\t\tname: 'toolDescription',\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription:\n\t\t\t\t\t'Explain to LLM what this tool does, better description would allow LLM to produce expected result',\n\t\t\t\tplaceholder: 'e.g. Get the current weather in the requested city',\n\t\t\t\tdefault: '',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Method',\n\t\t\t\tname: 'method',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'DELETE',\n\t\t\t\t\t\tvalue: 'DELETE',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'GET',\n\t\t\t\t\t\tvalue: 'GET',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'PATCH',\n\t\t\t\t\t\tvalue: 'PATCH',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'POST',\n\t\t\t\t\t\tvalue: 'POST',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'PUT',\n\t\t\t\t\t\tvalue: 'PUT',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'GET',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Tip: You can use a {placeholder} for any part of the request to be filled by the model. Provide more context about them in the placeholders section',\n\t\t\t\tname: 'placeholderNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'URL',\n\t\t\t\tname: 'url',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t\tplaceholder: 'e.g. http://www.example.com/{path}',\n\t\t\t},\n\t\t\t...authenticationProperties,\n\t\t\t//----------------------------------------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Send Query Parameters',\n\t\t\t\tname: 'sendQuery',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether the request has query params or not',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...specifyBySelector,\n\t\t\t\tdisplayName: 'Specify Query Parameters',\n\t\t\t\tname: 'specifyQuery',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendQuery: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...parametersCollection,\n\t\t\t\tdisplayName: 'Query Parameters',\n\t\t\t\tname: 'parametersQuery',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendQuery: [true],\n\t\t\t\t\t\tspecifyQuery: ['keypair'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...jsonInput,\n\t\t\t\tname: 'jsonQuery',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendQuery: [true],\n\t\t\t\t\t\tspecifyQuery: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t//----------------------------------------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Send Headers',\n\t\t\t\tname: 'sendHeaders',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether the request has headers or not',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...specifyBySelector,\n\t\t\t\tdisplayName: 'Specify Headers',\n\t\t\t\tname: 'specifyHeaders',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendHeaders: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...parametersCollection,\n\t\t\t\tdisplayName: 'Header Parameters',\n\t\t\t\tname: 'parametersHeaders',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendHeaders: [true],\n\t\t\t\t\t\tspecifyHeaders: ['keypair'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...jsonInput,\n\t\t\t\tname: 'jsonHeaders',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendHeaders: [true],\n\t\t\t\t\t\tspecifyHeaders: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t//----------------------------------------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Send Body',\n\t\t\t\tname: 'sendBody',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether the request has body or not',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...specifyBySelector,\n\t\t\t\tdisplayName: 'Specify Body',\n\t\t\t\tname: 'specifyBody',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendBody: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...parametersCollection,\n\t\t\t\tdisplayName: 'Body Parameters',\n\t\t\t\tname: 'parametersBody',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendBody: [true],\n\t\t\t\t\t\tspecifyBody: ['keypair'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...jsonInput,\n\t\t\t\tname: 'jsonBody',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendBody: [true],\n\t\t\t\t\t\tspecifyBody: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t//----------------------------------------------------------------\n\t\t\tplaceholderDefinitionsCollection,\n\t\t\t...optimizeResponseProperties,\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst name = this.getNode().name.replace(/ /g, '_');\n\t\ttry {\n\t\t\ttryToParseAlphanumericString(name);\n\t\t} catch (error) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'The name of this tool is not a valid alphanumeric string',\n\t\t\t\t{\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Only alphanumeric characters and underscores are allowed in the tool's name, and the name cannot start with a number\",\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tconst toolDescription = this.getNodeParameter('toolDescription', itemIndex) as string;\n\t\tconst sendQuery = this.getNodeParameter('sendQuery', itemIndex, false) as boolean;\n\t\tconst sendHeaders = this.getNodeParameter('sendHeaders', itemIndex, false) as boolean;\n\t\tconst sendBody = this.getNodeParameter('sendBody', itemIndex, false) as boolean;\n\n\t\tconst requestOptions: IHttpRequestOptions = {\n\t\t\tmethod: this.getNodeParameter('method', itemIndex, 'GET') as IHttpRequestMethods,\n\t\t\turl: this.getNodeParameter('url', itemIndex) as string,\n\t\t\tqs: {},\n\t\t\theaders: {\n\t\t\t\t// FIXME: This is a workaround to prevent the node from sending a default User-Agent (`n8n`) when the header is not set.\n\t\t\t\t// Needs to be replaced with a proper fix after NODE-1777 is resolved\n\t\t\t\t'User-Agent': undefined,\n\t\t\t},\n\t\t\tbody: {},\n\t\t\t// We will need a full response object later to extract the headers and check the response's content type.\n\t\t\treturnFullResponse: true,\n\t\t};\n\n\t\tconst authentication = this.getNodeParameter('authentication', itemIndex, 'none') as\n\t\t\t| 'predefinedCredentialType'\n\t\t\t| 'genericCredentialType'\n\t\t\t| 'none';\n\n\t\tif (authentication !== 'none') {\n\t\t\tconst domain = new URL(requestOptions.url).hostname;\n\t\t\tif (domain.includes('{') && domain.includes('}')) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\"Can't use a placeholder for the domain when using authentication\",\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'This is for security reasons, to prevent the model accidentally sending your credentials to an unauthorized domain',\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst httpRequest = await configureHttpRequestFunction(this, authentication, itemIndex);\n\t\tconst optimizeResponse = configureResponseOptimizer(this, itemIndex);\n\n\t\tconst rawRequestOptions: { [key: string]: string } = {\n\t\t\tqs: '',\n\t\t\theaders: '',\n\t\t\tbody: '',\n\t\t};\n\n\t\tconst placeholdersDefinitions = (\n\t\t\tthis.getNodeParameter(\n\t\t\t\t'placeholderDefinitions.values',\n\t\t\t\titemIndex,\n\t\t\t\t[],\n\t\t\t) as PlaceholderDefinition[]\n\t\t).map((p) => {\n\t\t\tif (p.name.startsWith('{') && p.name.endsWith('}')) {\n\t\t\t\tp.name = p.name.slice(1, -1);\n\t\t\t}\n\t\t\treturn p;\n\t\t});\n\n\t\tconst toolParameters: ToolParameter[] = [];\n\n\t\ttoolParameters.push(\n\t\t\t...extractParametersFromText(placeholdersDefinitions, requestOptions.url, 'path'),\n\t\t);\n\n\t\tif (sendQuery) {\n\t\t\tupdateParametersAndOptions({\n\t\t\t\tctx: this,\n\t\t\t\titemIndex,\n\t\t\t\ttoolParameters,\n\t\t\t\tplaceholdersDefinitions,\n\t\t\t\trequestOptions,\n\t\t\t\trawRequestOptions,\n\t\t\t\trequestOptionsProperty: 'qs',\n\t\t\t\tinputTypePropertyName: 'specifyQuery',\n\t\t\t\tjsonPropertyName: 'jsonQuery',\n\t\t\t\tparametersPropertyName: 'parametersQuery.values',\n\t\t\t});\n\t\t}\n\n\t\tif (sendHeaders) {\n\t\t\tupdateParametersAndOptions({\n\t\t\t\tctx: this,\n\t\t\t\titemIndex,\n\t\t\t\ttoolParameters,\n\t\t\t\tplaceholdersDefinitions,\n\t\t\t\trequestOptions,\n\t\t\t\trawRequestOptions,\n\t\t\t\trequestOptionsProperty: 'headers',\n\t\t\t\tinputTypePropertyName: 'specifyHeaders',\n\t\t\t\tjsonPropertyName: 'jsonHeaders',\n\t\t\t\tparametersPropertyName: 'parametersHeaders.values',\n\t\t\t});\n\t\t}\n\n\t\tif (sendBody) {\n\t\t\tupdateParametersAndOptions({\n\t\t\t\tctx: this,\n\t\t\t\titemIndex,\n\t\t\t\ttoolParameters,\n\t\t\t\tplaceholdersDefinitions,\n\t\t\t\trequestOptions,\n\t\t\t\trawRequestOptions,\n\t\t\t\trequestOptionsProperty: 'body',\n\t\t\t\tinputTypePropertyName: 'specifyBody',\n\t\t\t\tjsonPropertyName: 'jsonBody',\n\t\t\t\tparametersPropertyName: 'parametersBody.values',\n\t\t\t});\n\t\t}\n\n\t\tfor (const placeholder of placeholdersDefinitions) {\n\t\t\tif (!toolParameters.find((parameter) => parameter.name === placeholder.name)) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t`Misconfigured placeholder '${placeholder.name}'`,\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"This placeholder is defined in the 'Placeholder Definitions' but isn't used anywhere. Either remove the definition, or add the placeholder to a part of the request.\",\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst func = configureToolFunction(\n\t\t\tthis,\n\t\t\titemIndex,\n\t\t\ttoolParameters,\n\t\t\trequestOptions,\n\t\t\trawRequestOptions,\n\t\t\thttpRequest,\n\t\t\toptimizeResponse,\n\t\t);\n\n\t\tlet tool: DynamicTool | N8nTool;\n\n\t\t// If the node version is 1.1 or higher, we use the N8nTool wrapper:\n\t\t// it allows to use tool as a DynamicStructuredTool and have a fallback to DynamicTool\n\t\tif (this.getNode().typeVersion >= 1.1) {\n\t\t\tconst schema = makeToolInputSchema(toolParameters);\n\n\t\t\ttool = new N8nTool(this, {\n\t\t\t\tname,\n\t\t\t\tdescription: toolDescription,\n\t\t\t\tfunc,\n\t\t\t\tschema,\n\t\t\t});\n\t\t} else {\n\t\t\t// Keep the old behavior for nodes with version 1.0\n\t\t\tconst description = prepareToolDescription(toolDescription, toolParameters);\n\t\t\ttool = new DynamicTool({ name, description, func });\n\t\t}\n\n\t\treturn {\n\t\t\tresponse: tool,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAS5B,0BAIO;AAEP,qBAAwB;AACxB,0BAA6C;AAE7C,0BAOO;AAEP,mBA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ACD;AAEA,QAAI;AAIJ,QAAI,KAAK,QAAQ,EAAE,eAAe,KAAK;AACtC,YAAM,aAAS,kCAAoB,cAAc;AAEjD,aAAO,IAAI,uBAAQ,MAAM;AAAA,QACxB;AAAA,QACA,aAAa;AAAA,QACb;AAAA,QACA;AAAA,MACD,CAAC;AAAA,IACF,OAAO;AAEN,YAAM,kBAAc,qCAAuB,iBAAiB,cAAc;AAC1E,aAAO,IAAI,yBAAY,EAAE,MAAM,aAAa,KAAK,CAAC;AAAA,IACnD;AAEA,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/tools/ToolHttpRequest/ToolHttpRequest.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { DynamicTool } from '@langchain/core/tools';\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tIHttpRequestMethods,\n\tIHttpRequestOptions,\n} from 'n8n-workflow';\nimport {\n\tNodeConnectionTypes,\n\tNodeOperationError,\n\ttryToParseAlphanumericString,\n} from 'n8n-workflow';\n\nimport { N8nTool } from '@utils/N8nTool';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport {\n\tauthenticationProperties,\n\tjsonInput,\n\toptimizeResponseProperties,\n\tparametersCollection,\n\tplaceholderDefinitionsCollection,\n\tspecifyBySelector,\n} from './descriptions';\nimport type { PlaceholderDefinition, ToolParameter } from './interfaces';\nimport {\n\tconfigureHttpRequestFunction,\n\tconfigureResponseOptimizer,\n\textractParametersFromText,\n\tprepareToolDescription,\n\tconfigureToolFunction,\n\tupdateParametersAndOptions,\n\tmakeToolInputSchema,\n} from './utils';\n\nexport class ToolHttpRequest implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'HTTP Request Tool',\n\t\tname: 'toolHttpRequest',\n\t\ticon: { light: 'file:httprequest.svg', dark: 'file:httprequest.dark.svg' },\n\t\tgroup: ['output'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Makes an HTTP request and returns the response data',\n\t\tsubtitle: '={{ $parameter.toolDescription }}',\n\t\tdefaults: {\n\t\t\tname: 'HTTP Request',\n\t\t},\n\t\tcredentials: [],\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Recommended Tools'],\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.toolhttprequest/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// Replaced by a `usableAsTool` version of the standalone HttpRequest node\n\t\thidden: true,\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Description',\n\t\t\t\tname: 'toolDescription',\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription:\n\t\t\t\t\t'Explain to LLM what this tool does, better description would allow LLM to produce expected result',\n\t\t\t\tplaceholder: 'e.g. Get the current weather in the requested city',\n\t\t\t\tdefault: '',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Method',\n\t\t\t\tname: 'method',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'DELETE',\n\t\t\t\t\t\tvalue: 'DELETE',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'GET',\n\t\t\t\t\t\tvalue: 'GET',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'PATCH',\n\t\t\t\t\t\tvalue: 'PATCH',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'POST',\n\t\t\t\t\t\tvalue: 'POST',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'PUT',\n\t\t\t\t\t\tvalue: 'PUT',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'GET',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Tip: You can use a {placeholder} for any part of the request to be filled by the model. Provide more context about them in the placeholders section',\n\t\t\t\tname: 'placeholderNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'URL',\n\t\t\t\tname: 'url',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t\tplaceholder: 'e.g. http://www.example.com/{path}',\n\t\t\t},\n\t\t\t...authenticationProperties,\n\t\t\t//----------------------------------------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Send Query Parameters',\n\t\t\t\tname: 'sendQuery',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether the request has query params or not',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...specifyBySelector,\n\t\t\t\tdisplayName: 'Specify Query Parameters',\n\t\t\t\tname: 'specifyQuery',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendQuery: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...parametersCollection,\n\t\t\t\tdisplayName: 'Query Parameters',\n\t\t\t\tname: 'parametersQuery',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendQuery: [true],\n\t\t\t\t\t\tspecifyQuery: ['keypair'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...jsonInput,\n\t\t\t\tname: 'jsonQuery',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendQuery: [true],\n\t\t\t\t\t\tspecifyQuery: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t//----------------------------------------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Send Headers',\n\t\t\t\tname: 'sendHeaders',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether the request has headers or not',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...specifyBySelector,\n\t\t\t\tdisplayName: 'Specify Headers',\n\t\t\t\tname: 'specifyHeaders',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendHeaders: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...parametersCollection,\n\t\t\t\tdisplayName: 'Header Parameters',\n\t\t\t\tname: 'parametersHeaders',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendHeaders: [true],\n\t\t\t\t\t\tspecifyHeaders: ['keypair'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...jsonInput,\n\t\t\t\tname: 'jsonHeaders',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendHeaders: [true],\n\t\t\t\t\t\tspecifyHeaders: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t//----------------------------------------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Send Body',\n\t\t\t\tname: 'sendBody',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether the request has body or not',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...specifyBySelector,\n\t\t\t\tdisplayName: 'Specify Body',\n\t\t\t\tname: 'specifyBody',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendBody: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...parametersCollection,\n\t\t\t\tdisplayName: 'Body Parameters',\n\t\t\t\tname: 'parametersBody',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendBody: [true],\n\t\t\t\t\t\tspecifyBody: ['keypair'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t...jsonInput,\n\t\t\t\tname: 'jsonBody',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tsendBody: [true],\n\t\t\t\t\t\tspecifyBody: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t//----------------------------------------------------------------\n\t\t\tplaceholderDefinitionsCollection,\n\t\t\t...optimizeResponseProperties,\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst name = this.getNode().name.replace(/ /g, '_');\n\t\ttry {\n\t\t\ttryToParseAlphanumericString(name);\n\t\t} catch (error) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'The name of this tool is not a valid alphanumeric string',\n\t\t\t\t{\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Only alphanumeric characters and underscores are allowed in the tool's name, and the name cannot start with a number\",\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tconst toolDescription = this.getNodeParameter('toolDescription', itemIndex) as string;\n\t\tconst sendQuery = this.getNodeParameter('sendQuery', itemIndex, false) as boolean;\n\t\tconst sendHeaders = this.getNodeParameter('sendHeaders', itemIndex, false) as boolean;\n\t\tconst sendBody = this.getNodeParameter('sendBody', itemIndex, false) as boolean;\n\n\t\tconst requestOptions: IHttpRequestOptions = {\n\t\t\tmethod: this.getNodeParameter('method', itemIndex, 'GET') as IHttpRequestMethods,\n\t\t\turl: this.getNodeParameter('url', itemIndex) as string,\n\t\t\tqs: {},\n\t\t\theaders: {\n\t\t\t\t// FIXME: This is a workaround to prevent the node from sending a default User-Agent (`n8n`) when the header is not set.\n\t\t\t\t// Needs to be replaced with a proper fix after NODE-1777 is resolved\n\t\t\t\t'User-Agent': undefined,\n\t\t\t},\n\t\t\tbody: {},\n\t\t\t// We will need a full response object later to extract the headers and check the response's content type.\n\t\t\treturnFullResponse: true,\n\t\t};\n\n\t\tconst authentication = this.getNodeParameter('authentication', itemIndex, 'none') as\n\t\t\t| 'predefinedCredentialType'\n\t\t\t| 'genericCredentialType'\n\t\t\t| 'none';\n\n\t\tif (authentication !== 'none') {\n\t\t\tconst domain = new URL(requestOptions.url).hostname;\n\t\t\tif (domain.includes('{') && domain.includes('}')) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\"Can't use a placeholder for the domain when using authentication\",\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'This is for security reasons, to prevent the model accidentally sending your credentials to an unauthorized domain',\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst httpRequest = await configureHttpRequestFunction(this, authentication, itemIndex);\n\t\tconst optimizeResponse = configureResponseOptimizer(this, itemIndex);\n\n\t\tconst rawRequestOptions: { [key: string]: string } = {\n\t\t\tqs: '',\n\t\t\theaders: '',\n\t\t\tbody: '',\n\t\t};\n\n\t\tconst placeholdersDefinitions = (\n\t\t\tthis.getNodeParameter(\n\t\t\t\t'placeholderDefinitions.values',\n\t\t\t\titemIndex,\n\t\t\t\t[],\n\t\t\t) as PlaceholderDefinition[]\n\t\t).map((p) => {\n\t\t\tif (p.name.startsWith('{') && p.name.endsWith('}')) {\n\t\t\t\tp.name = p.name.slice(1, -1);\n\t\t\t}\n\t\t\treturn p;\n\t\t});\n\n\t\tconst toolParameters: ToolParameter[] = [];\n\n\t\ttoolParameters.push(\n\t\t\t...extractParametersFromText(placeholdersDefinitions, requestOptions.url, 'path'),\n\t\t);\n\n\t\tif (sendQuery) {\n\t\t\tupdateParametersAndOptions({\n\t\t\t\tctx: this,\n\t\t\t\titemIndex,\n\t\t\t\ttoolParameters,\n\t\t\t\tplaceholdersDefinitions,\n\t\t\t\trequestOptions,\n\t\t\t\trawRequestOptions,\n\t\t\t\trequestOptionsProperty: 'qs',\n\t\t\t\tinputTypePropertyName: 'specifyQuery',\n\t\t\t\tjsonPropertyName: 'jsonQuery',\n\t\t\t\tparametersPropertyName: 'parametersQuery.values',\n\t\t\t});\n\t\t}\n\n\t\tif (sendHeaders) {\n\t\t\tupdateParametersAndOptions({\n\t\t\t\tctx: this,\n\t\t\t\titemIndex,\n\t\t\t\ttoolParameters,\n\t\t\t\tplaceholdersDefinitions,\n\t\t\t\trequestOptions,\n\t\t\t\trawRequestOptions,\n\t\t\t\trequestOptionsProperty: 'headers',\n\t\t\t\tinputTypePropertyName: 'specifyHeaders',\n\t\t\t\tjsonPropertyName: 'jsonHeaders',\n\t\t\t\tparametersPropertyName: 'parametersHeaders.values',\n\t\t\t});\n\t\t}\n\n\t\tif (sendBody) {\n\t\t\tupdateParametersAndOptions({\n\t\t\t\tctx: this,\n\t\t\t\titemIndex,\n\t\t\t\ttoolParameters,\n\t\t\t\tplaceholdersDefinitions,\n\t\t\t\trequestOptions,\n\t\t\t\trawRequestOptions,\n\t\t\t\trequestOptionsProperty: 'body',\n\t\t\t\tinputTypePropertyName: 'specifyBody',\n\t\t\t\tjsonPropertyName: 'jsonBody',\n\t\t\t\tparametersPropertyName: 'parametersBody.values',\n\t\t\t});\n\t\t}\n\n\t\tfor (const placeholder of placeholdersDefinitions) {\n\t\t\tif (!toolParameters.find((parameter) => parameter.name === placeholder.name)) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t`Misconfigured placeholder '${placeholder.name}'`,\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"This placeholder is defined in the 'Placeholder Definitions' but isn't used anywhere. Either remove the definition, or add the placeholder to a part of the request.\",\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst func = configureToolFunction(\n\t\t\tthis,\n\t\t\titemIndex,\n\t\t\ttoolParameters,\n\t\t\trequestOptions,\n\t\t\trawRequestOptions,\n\t\t\thttpRequest,\n\t\t\toptimizeResponse,\n\t\t);\n\n\t\tlet tool: DynamicTool | N8nTool;\n\n\t\t// If the node version is 1.1 or higher, we use the N8nTool wrapper:\n\t\t// it allows to use tool as a DynamicStructuredTool and have a fallback to DynamicTool\n\t\tif (this.getNode().typeVersion >= 1.1) {\n\t\t\tconst schema = makeToolInputSchema(toolParameters);\n\n\t\t\ttool = new N8nTool(this, {\n\t\t\t\tname,\n\t\t\t\tdescription: toolDescription,\n\t\t\t\tfunc,\n\t\t\t\tschema,\n\t\t\t});\n\t\t} else {\n\t\t\t// Keep the old behavior for nodes with version 1.0\n\t\t\tconst description = prepareToolDescription(toolDescription, toolParameters);\n\t\t\ttool = new DynamicTool({ name, description, func });\n\t\t}\n\n\t\treturn {\n\t\t\tresponse: tool,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAS5B,0BAIO;AAEP,qBAAwB;AACxB,0BAA6C;AAE7C,0BAOO;AAE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;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAEA,QAAI;AAIJ,QAAI,KAAK,QAAQ,EAAE,eAAe,KAAK;AACtC,YAAM,aAAS,kCAAoB,cAAc;AAEjD,aAAO,IAAI,uBAAQ,MAAM;AAAA,QACxB;AAAA,QACA,aAAa;AAAA,QACb;AAAA,QACA;AAAA,MACD,CAAC;AAAA,IACF,OAAO;AAEN,YAAM,kBAAc,qCAAuB,iBAAiB,cAAc;AAC1E,aAAO,IAAI,yBAAY,EAAE,MAAM,aAAa,KAAK,CAAC;AAAA,IACnD;AAEA,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(ToolVectorStore_node_exports);
24
24
  var import_chains = require("langchain/chains");
25
25
  var import_tools = require("langchain/tools");
26
26
  var import_n8n_workflow = require("n8n-workflow");
27
+ var import_helpers = require("../../../utils/helpers");
27
28
  var import_logWrapper = require("../../../utils/logWrapper");
28
29
  var import_sharedFields = require("../../../utils/sharedFields");
29
30
  class ToolVectorStore {
@@ -34,7 +35,7 @@ class ToolVectorStore {
34
35
  icon: "fa:database",
35
36
  iconColor: "black",
36
37
  group: ["transform"],
37
- version: [1],
38
+ version: [1, 1.1],
38
39
  description: "Answer questions with a vector store",
39
40
  defaults: {
40
41
  name: "Answer questions with a vector store"
@@ -80,7 +81,12 @@ class ToolVectorStore {
80
81
  default: "",
81
82
  placeholder: "e.g. users_info",
82
83
  validateType: "string-alphanumeric",
83
- description: "Name of the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question."
84
+ description: "Name of the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.",
85
+ displayOptions: {
86
+ show: {
87
+ "@version": [1]
88
+ }
89
+ }
84
90
  },
85
91
  {
86
92
  displayName: "Description of Data",
@@ -104,7 +110,9 @@ class ToolVectorStore {
104
110
  };
105
111
  }
106
112
  async supplyData(itemIndex) {
107
- const name = this.getNodeParameter("name", itemIndex);
113
+ const node = this.getNode();
114
+ const { typeVersion } = node;
115
+ const name = typeVersion <= 1 ? this.getNodeParameter("name", itemIndex) : (0, import_helpers.nodeNameToToolName)(node);
108
116
  const toolDescription = this.getNodeParameter("description", itemIndex);
109
117
  const topK = this.getNodeParameter("topK", itemIndex, 4);
110
118
  const vectorStore = await this.getInputConnectionData(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/tools/ToolVectorStore/ToolVectorStore.node.ts"],"sourcesContent":["import type { BaseLanguageModel } from '@langchain/core/language_models/base';\nimport type { VectorStore } from '@langchain/core/vectorstores';\nimport { VectorDBQAChain } from 'langchain/chains';\nimport { VectorStoreQATool } from 'langchain/tools';\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nexport class ToolVectorStore implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Vector Store Question Answer Tool',\n\t\tname: 'toolVectorStore',\n\t\ticon: 'fa:database',\n\t\ticonColor: 'black',\n\t\tgroup: ['transform'],\n\t\tversion: [1],\n\t\tdescription: 'Answer questions with a vector store',\n\t\tdefaults: {\n\t\t\tname: 'Answer questions with a vector store',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Other Tools'],\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.toolvectorstore/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Vector Store',\n\t\t\t\tmaxConnections: 1,\n\t\t\t\ttype: NodeConnectionTypes.AiVectorStore,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tmaxConnections: 1,\n\t\t\t\ttype: NodeConnectionTypes.AiLanguageModel,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Data Name',\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. users_info',\n\t\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\t\tdescription:\n\t\t\t\t\t'Name of the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Description of Data',\n\t\t\t\tname: 'description',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: \"[Describe your data here, e.g. a user's name, email, etc.]\",\n\t\t\t\tdescription:\n\t\t\t\t\t'Describe the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Limit',\n\t\t\t\tname: 'topK',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 4,\n\t\t\t\tdescription: 'The maximum number of results to return',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst name = this.getNodeParameter('name', itemIndex) as string;\n\t\tconst toolDescription = this.getNodeParameter('description', itemIndex) as string;\n\t\tconst topK = this.getNodeParameter('topK', itemIndex, 4) as number;\n\n\t\tconst vectorStore = (await this.getInputConnectionData(\n\t\t\tNodeConnectionTypes.AiVectorStore,\n\t\t\titemIndex,\n\t\t)) as VectorStore;\n\n\t\tconst llm = (await this.getInputConnectionData(\n\t\t\tNodeConnectionTypes.AiLanguageModel,\n\t\t\t0,\n\t\t)) as BaseLanguageModel;\n\n\t\tconst description = VectorStoreQATool.getDescription(name, toolDescription);\n\t\tconst vectorStoreTool = new VectorStoreQATool(name, description, {\n\t\t\tllm,\n\t\t\tvectorStore,\n\t\t});\n\n\t\tvectorStoreTool.chain = VectorDBQAChain.fromLLM(llm, vectorStore, {\n\t\t\tk: topK,\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: logWrapper(vectorStoreTool, this),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAgC;AAChC,mBAAkC;AAOlC,0BAAoC;AAEpC,wBAA2B;AAC3B,0BAA6C;AAEtC,MAAM,gBAAqC;AAAA,EAA3C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS,CAAC,CAAC;AAAA,MACX,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,aAAa;AAAA,QACt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AoB;AAAA,MACpB;AAAA,IACD;AAEA,UAAM,cAAc,+BAAkB,eAAe,MAAM,eAAe;AAC1E,UAAM,kBAAkB,IAAI,+BAAkB,MAAM,aAAa;AAAA,MAChE;AAAA,MACA;AAAA,IACD,CAAC;AAED,oBAAgB,QAAQ,8BAAgB,QAAQ,KAAK,aAAa;AAAA,MACjE,GAAG;AAAA,IACJ,CAAC;AAED,WAAO;AAAA,MACN,cAAU,8BAAW,iBAAiB,IAAI;AAAA,IAC3C;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/tools/ToolVectorStore/ToolVectorStore.node.ts"],"sourcesContent":["import type { BaseLanguageModel } from '@langchain/core/language_models/base';\nimport type { VectorStore } from '@langchain/core/vectorstores';\nimport { VectorDBQAChain } from 'langchain/chains';\nimport { VectorStoreQATool } from 'langchain/tools';\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport { nodeNameToToolName } from '@utils/helpers';\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nexport class ToolVectorStore implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Vector Store Question Answer Tool',\n\t\tname: 'toolVectorStore',\n\t\ticon: 'fa:database',\n\t\ticonColor: 'black',\n\t\tgroup: ['transform'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Answer questions with a vector store',\n\t\tdefaults: {\n\t\t\tname: 'Answer questions with a vector store',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Tools'],\n\t\t\t\tTools: ['Other Tools'],\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.toolvectorstore/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Vector Store',\n\t\t\t\tmaxConnections: 1,\n\t\t\t\ttype: NodeConnectionTypes.AiVectorStore,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tmaxConnections: 1,\n\t\t\t\ttype: NodeConnectionTypes.AiLanguageModel,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong\n\t\toutputs: [NodeConnectionTypes.AiTool],\n\t\toutputNames: ['Tool'],\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Data Name',\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. users_info',\n\t\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\t\tdescription:\n\t\t\t\t\t'Name of the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Description of Data',\n\t\t\t\tname: 'description',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: \"[Describe your data here, e.g. a user's name, email, etc.]\",\n\t\t\t\tdescription:\n\t\t\t\t\t'Describe the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Limit',\n\t\t\t\tname: 'topK',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 4,\n\t\t\t\tdescription: 'The maximum number of results to return',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst node = this.getNode();\n\t\tconst { typeVersion } = node;\n\t\tconst name =\n\t\t\ttypeVersion <= 1\n\t\t\t\t? (this.getNodeParameter('name', itemIndex) as string)\n\t\t\t\t: nodeNameToToolName(node);\n\t\tconst toolDescription = this.getNodeParameter('description', itemIndex) as string;\n\t\tconst topK = this.getNodeParameter('topK', itemIndex, 4) as number;\n\n\t\tconst vectorStore = (await this.getInputConnectionData(\n\t\t\tNodeConnectionTypes.AiVectorStore,\n\t\t\titemIndex,\n\t\t)) as VectorStore;\n\n\t\tconst llm = (await this.getInputConnectionData(\n\t\t\tNodeConnectionTypes.AiLanguageModel,\n\t\t\t0,\n\t\t)) as BaseLanguageModel;\n\n\t\tconst description = VectorStoreQATool.getDescription(name, toolDescription);\n\t\tconst vectorStoreTool = new VectorStoreQATool(name, description, {\n\t\t\tllm,\n\t\t\tvectorStore,\n\t\t});\n\n\t\tvectorStoreTool.chain = VectorDBQAChain.fromLLM(llm, vectorStore, {\n\t\t\tk: topK,\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: logWrapper(vectorStoreTool, this),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAgC;AAChC,mBAAkC;AAOlC,0BAAoC;AAEpC,qBAAmC;AACnC,wBAA2B;AAC3B,0BAA6C;AAEtC,MAAM,gBAAqC;AAAA,EAA3C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,M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S;AAAA,UACT,aAAa;AAAA,QACd;AAAA,MACD;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,WAAuC,WAAwC;AACpF,UAAM,OAAO,KAAK,QAAQ;AAC1B,UAAM,EAAE,YAAY,IAAI;AACxB,UAAM,OACL,eAAe,IACX,KAAK,iBAAiB,QAAQ,SAAS,QACxC,mCAAmB,IAAI;AAC3B,UAAM,kBAAkB,KAAK,iBAAiB,eAAe,SAAS;AACtE,UAAM,OAAO,KAAK,iBAAiB,QAAQ,WAAW,CAAC;AAEvD,UAAM,cAAe,MAAM,KAAK;AAAA,MAC/B,wCAAoB;AAAA,MACpB;AAAA,IACD;AAEA,UAAM,MAAO,MAAM,KAAK;AAAA,MACvB,wCAAoB;AAAA,MACpB;AAAA,IACD;AAEA,UAAM,cAAc,+BAAkB,eAAe,MAAM,eAAe;AAC1E,UAAM,kBAAkB,IAAI,+BAAkB,MAAM,aAAa;AAAA,MAChE;AAAA,MACA;AAAA,IACD,CAAC;AAED,oBAAgB,QAAQ,8BAAgB,QAAQ,KAAK,aAAa;AAAA,MACjE,GAAG;AAAA,IACJ,CAAC;AAED,WAAO;AAAA,MACN,cAAU,8BAAW,iBAAiB,IAAI;AAAA,IAC3C;AAAA,EACD;AACD;","names":[]}
@@ -47,7 +47,7 @@ class ToolWorkflow extends import_n8n_workflow.VersionedNodeType {
47
47
  ]
48
48
  }
49
49
  },
50
- defaultVersion: 2.1
50
+ defaultVersion: 2.2
51
51
  };
52
52
  const nodeVersions = {
53
53
  1: new import_ToolWorkflowV1.ToolWorkflowV1(baseDescription),
@@ -55,7 +55,8 @@ class ToolWorkflow extends import_n8n_workflow.VersionedNodeType {
55
55
  1.2: new import_ToolWorkflowV1.ToolWorkflowV1(baseDescription),
56
56
  1.3: new import_ToolWorkflowV1.ToolWorkflowV1(baseDescription),
57
57
  2: new import_ToolWorkflowV2.ToolWorkflowV2(baseDescription),
58
- 2.1: new import_ToolWorkflowV2.ToolWorkflowV2(baseDescription)
58
+ 2.1: new import_ToolWorkflowV2.ToolWorkflowV2(baseDescription),
59
+ 2.2: new import_ToolWorkflowV2.ToolWorkflowV2(baseDescription)
59
60
  };
60
61
  super(nodeVersions, baseDescription);
61
62
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/tools/ToolWorkflow/ToolWorkflow.node.ts"],"sourcesContent":["import type { IVersionedNodeType, INodeTypeBaseDescription } from 'n8n-workflow';\nimport { VersionedNodeType } from 'n8n-workflow';\n\nimport { ToolWorkflowV1 } from './v1/ToolWorkflowV1.node';\nimport { ToolWorkflowV2 } from './v2/ToolWorkflowV2.node';\n\nexport class ToolWorkflow extends VersionedNodeType {\n\tconstructor() {\n\t\tconst baseDescription: INodeTypeBaseDescription = {\n\t\t\tdisplayName: 'Call n8n Sub-Workflow Tool',\n\t\t\tname: 'toolWorkflow',\n\t\t\ticon: 'fa:network-wired',\n\t\t\ticonColor: 'black',\n\t\t\tgroup: ['transform'],\n\t\t\tdescription:\n\t\t\t\t'Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.',\n\t\t\tcodex: {\n\t\t\t\tcategories: ['AI'],\n\t\t\t\tsubcategories: {\n\t\t\t\t\tAI: ['Tools'],\n\t\t\t\t\tTools: ['Recommended Tools'],\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/sub-nodes/n8n-nodes-langchain.toolworkflow/',\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: 2.1,\n\t\t};\n\n\t\tconst nodeVersions: IVersionedNodeType['nodeVersions'] = {\n\t\t\t1: new ToolWorkflowV1(baseDescription),\n\t\t\t1.1: new ToolWorkflowV1(baseDescription),\n\t\t\t1.2: new ToolWorkflowV1(baseDescription),\n\t\t\t1.3: new ToolWorkflowV1(baseDescription),\n\t\t\t2: new ToolWorkflowV2(baseDescription),\n\t\t\t2.1: new ToolWorkflowV2(baseDescription),\n\t\t};\n\t\tsuper(nodeVersions, baseDescription);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAkC;AAElC,4BAA+B;AAC/B,4BAA+B;AAExB,MAAM,qBAAqB,sCAAkB;AAAA,EACnD,cAAc;AACb,UAAM,kBAA4C;AAAA,MACjD,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,aACC;AAAA,MACD,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,mBAAmB;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,qCAAe,eAAe;AAAA,MACrC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,GAAG,IAAI,qCAAe,eAAe;AAAA,MACrC,KAAK,IAAI,qCAAe,eAAe;AAAA,IACxC;AACA,UAAM,cAAc,eAAe;AAAA,EACpC;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/tools/ToolWorkflow/ToolWorkflow.node.ts"],"sourcesContent":["import type { IVersionedNodeType, INodeTypeBaseDescription } from 'n8n-workflow';\nimport { VersionedNodeType } from 'n8n-workflow';\n\nimport { ToolWorkflowV1 } from './v1/ToolWorkflowV1.node';\nimport { ToolWorkflowV2 } from './v2/ToolWorkflowV2.node';\n\nexport class ToolWorkflow extends VersionedNodeType {\n\tconstructor() {\n\t\tconst baseDescription: INodeTypeBaseDescription = {\n\t\t\tdisplayName: 'Call n8n Sub-Workflow Tool',\n\t\t\tname: 'toolWorkflow',\n\t\t\ticon: 'fa:network-wired',\n\t\t\ticonColor: 'black',\n\t\t\tgroup: ['transform'],\n\t\t\tdescription:\n\t\t\t\t'Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.',\n\t\t\tcodex: {\n\t\t\t\tcategories: ['AI'],\n\t\t\t\tsubcategories: {\n\t\t\t\t\tAI: ['Tools'],\n\t\t\t\t\tTools: ['Recommended Tools'],\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/sub-nodes/n8n-nodes-langchain.toolworkflow/',\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: 2.2,\n\t\t};\n\n\t\tconst nodeVersions: IVersionedNodeType['nodeVersions'] = {\n\t\t\t1: new ToolWorkflowV1(baseDescription),\n\t\t\t1.1: new ToolWorkflowV1(baseDescription),\n\t\t\t1.2: new ToolWorkflowV1(baseDescription),\n\t\t\t1.3: new ToolWorkflowV1(baseDescription),\n\t\t\t2: new ToolWorkflowV2(baseDescription),\n\t\t\t2.1: new ToolWorkflowV2(baseDescription),\n\t\t\t2.2: new ToolWorkflowV2(baseDescription),\n\t\t};\n\t\tsuper(nodeVersions, baseDescription);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAkC;AAElC,4BAA+B;AAC/B,4BAA+B;AAExB,MAAM,qBAAqB,sCAAkB;AAAA,EACnD,cAAc;AACb,UAAM,kBAA4C;AAAA,MACjD,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO,CAAC,WAAW;AAAA,MACnB,aACC;AAAA,MACD,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,OAAO;AAAA,UACZ,OAAO,CAAC,mBAAmB;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,qCAAe,eAAe;AAAA,MACrC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,GAAG,IAAI,qCAAe,eAAe;AAAA,MACrC,KAAK,IAAI,qCAAe,eAAe;AAAA,MACvC,KAAK,IAAI,qCAAe,eAAe;AAAA,IACxC;AACA,UAAM,cAAc,eAAe;AAAA,EACpC;AACD;","names":[]}
@@ -21,6 +21,7 @@ __export(ToolWorkflowV2_node_exports, {
21
21
  ToolWorkflowV2: () => ToolWorkflowV2
22
22
  });
23
23
  module.exports = __toCommonJS(ToolWorkflowV2_node_exports);
24
+ var import_helpers = require("../../../../utils/helpers");
24
25
  var import_methods = require("./methods");
25
26
  var import_WorkflowToolService = require("./utils/WorkflowToolService");
26
27
  var import_versionDescription = require("./versionDescription");
@@ -35,9 +36,11 @@ class ToolWorkflowV2 {
35
36
  };
36
37
  }
37
38
  async supplyData(itemIndex) {
38
- const returnAllItems = this.getNode().typeVersion > 2;
39
+ const node = this.getNode();
40
+ const { typeVersion } = node;
41
+ const returnAllItems = typeVersion > 2;
39
42
  const workflowToolService = new import_WorkflowToolService.WorkflowToolService(this, { returnAllItems });
40
- const name = this.getNodeParameter("name", itemIndex);
43
+ const name = typeVersion <= 2.1 ? this.getNodeParameter("name", itemIndex) : (0, import_helpers.nodeNameToToolName)(node);
41
44
  const description = this.getNodeParameter("description", itemIndex);
42
45
  const tool = await workflowToolService.createTool({
43
46
  name,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.ts"],"sourcesContent":["import type {\n\tINodeTypeBaseDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tINodeType,\n\tINodeTypeDescription,\n} from 'n8n-workflow';\n\nimport { localResourceMapping } from './methods';\nimport { WorkflowToolService } from './utils/WorkflowToolService';\nimport { versionDescription } from './versionDescription';\n\nexport class ToolWorkflowV2 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\t...versionDescription,\n\t\t};\n\t}\n\n\tmethods = {\n\t\tlocalResourceMapping,\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst returnAllItems = this.getNode().typeVersion > 2;\n\n\t\tconst workflowToolService = new WorkflowToolService(this, { returnAllItems });\n\t\tconst name = this.getNodeParameter('name', itemIndex) as string;\n\t\tconst description = this.getNodeParameter('description', itemIndex) as string;\n\n\t\tconst tool = await workflowToolService.createTool({\n\t\t\tname,\n\t\t\tdescription,\n\t\t\titemIndex,\n\t\t});\n\n\t\treturn { response: tool };\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAAqC;AACrC,iCAAoC;AACpC,gCAAmC;AAE5B,MAAM,eAAoC;AAAA,EAGhD,YAAY,iBAA2C;AAOvD,mBAAU;AAAA,MACT;AAAA,IACD;AARC,SAAK,cAAc;AAAA,MAClB,GAAG;AAAA,MACH,GAAG;AAAA,IACJ;AAAA,EACD;AAAA,EAMA,MAAM,WAAuC,WAAwC;AACpF,UAAM,iBAAiB,KAAK,QAAQ,EAAE,cAAc;AAEpD,UAAM,sBAAsB,IAAI,+CAAoB,MAAM,EAAE,eAAe,CAAC;AAC5E,UAAM,OAAO,KAAK,iBAAiB,QAAQ,SAAS;AACpD,UAAM,cAAc,KAAK,iBAAiB,eAAe,SAAS;AAElE,UAAM,OAAO,MAAM,oBAAoB,WAAW;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAED,WAAO,EAAE,UAAU,KAAK;AAAA,EACzB;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../../nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.ts"],"sourcesContent":["import type {\n\tINodeTypeBaseDescription,\n\tISupplyDataFunctions,\n\tSupplyData,\n\tINodeType,\n\tINodeTypeDescription,\n} from 'n8n-workflow';\n\nimport { nodeNameToToolName } from '@utils/helpers';\n\nimport { localResourceMapping } from './methods';\nimport { WorkflowToolService } from './utils/WorkflowToolService';\nimport { versionDescription } from './versionDescription';\n\nexport class ToolWorkflowV2 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\t...versionDescription,\n\t\t};\n\t}\n\n\tmethods = {\n\t\tlocalResourceMapping,\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst node = this.getNode();\n\t\tconst { typeVersion } = node;\n\t\tconst returnAllItems = typeVersion > 2;\n\n\t\tconst workflowToolService = new WorkflowToolService(this, { returnAllItems });\n\t\tconst name =\n\t\t\ttypeVersion <= 2.1\n\t\t\t\t? (this.getNodeParameter('name', itemIndex) as string)\n\t\t\t\t: nodeNameToToolName(node);\n\t\tconst description = this.getNodeParameter('description', itemIndex) as string;\n\n\t\tconst tool = await workflowToolService.createTool({\n\t\t\tname,\n\t\t\tdescription,\n\t\t\titemIndex,\n\t\t});\n\n\t\treturn { response: tool };\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAAmC;AAEnC,qBAAqC;AACrC,iCAAoC;AACpC,gCAAmC;AAE5B,MAAM,eAAoC;AAAA,EAGhD,YAAY,iBAA2C;AAOvD,mBAAU;AAAA,MACT;AAAA,IACD;AARC,SAAK,cAAc;AAAA,MAClB,GAAG;AAAA,MACH,GAAG;AAAA,IACJ;AAAA,EACD;AAAA,EAMA,MAAM,WAAuC,WAAwC;AACpF,UAAM,OAAO,KAAK,QAAQ;AAC1B,UAAM,EAAE,YAAY,IAAI;AACxB,UAAM,iBAAiB,cAAc;AAErC,UAAM,sBAAsB,IAAI,+CAAoB,MAAM,EAAE,eAAe,CAAC;AAC5E,UAAM,OACL,eAAe,MACX,KAAK,iBAAiB,QAAQ,SAAS,QACxC,mCAAmB,IAAI;AAC3B,UAAM,cAAc,KAAK,iBAAiB,eAAe,SAAS;AAElE,UAAM,OAAO,MAAM,oBAAoB,WAAW;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAED,WAAO,EAAE,UAAU,KAAK;AAAA,EACzB;AACD;","names":[]}
@@ -31,7 +31,7 @@ const versionDescription = {
31
31
  defaults: {
32
32
  name: "Call n8n Workflow Tool"
33
33
  },
34
- version: [2, 2.1],
34
+ version: [2, 2.1, 2.2],
35
35
  inputs: [],
36
36
  outputs: [import_n8n_workflow.NodeConnectionTypes.AiTool],
37
37
  outputNames: ["Tool"],
@@ -50,7 +50,12 @@ const versionDescription = {
50
50
  default: "",
51
51
  placeholder: "e.g. My_Color_Tool",
52
52
  validateType: "string-alphanumeric",
53
- description: "The name of the function to be called, could contain letters, numbers, and underscores only"
53
+ description: "The name of the function to be called, could contain letters, numbers, and underscores only",
54
+ displayOptions: {
55
+ show: {
56
+ "@version": [{ _cnd: { lte: 2.1 } }]
57
+ }
58
+ }
54
59
  },
55
60
  {
56
61
  displayName: "Description",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../nodes/tools/ToolWorkflow/v2/versionDescription.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\n/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { NodeConnectionTypes, type INodeTypeDescription } from 'n8n-workflow';\n\nimport { getConnectionHintNoticeField } from '../../../../utils/sharedFields';\n\nexport const versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Call n8n Workflow Tool',\n\tname: 'toolWorkflow',\n\tgroup: ['transform'],\n\tdescription: 'Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.',\n\tdefaults: {\n\t\tname: 'Call n8n Workflow Tool',\n\t},\n\tversion: [2, 2.1],\n\tinputs: [],\n\toutputs: [NodeConnectionTypes.AiTool],\n\toutputNames: ['Tool'],\n\tproperties: [\n\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'See an example of a workflow to suggest meeting slots using AI <a href=\"/templates/1953\" target=\"_blank\">here</a>.',\n\t\t\tname: 'noticeTemplateExample',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Name',\n\t\t\tname: 'name',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'e.g. My_Color_Tool',\n\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\tdescription:\n\t\t\t\t'The name of the function to be called, could contain letters, numbers, and underscores only',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Description',\n\t\t\tname: 'description',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder:\n\t\t\t\t'Call this tool to get a random color. The input should be a string with comma separated names of colors to exclude.',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 3,\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'This tool will call the workflow you define below, and look in the last node for the response. The workflow needs to start with an Execute Workflow trigger',\n\t\t\tname: 'executeNotice',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t},\n\n\t\t{\n\t\t\tdisplayName: 'Source',\n\t\t\tname: 'source',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Database',\n\t\t\t\t\tvalue: 'database',\n\t\t\t\t\tdescription: 'Load the workflow from the database by ID',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Define Below',\n\t\t\t\t\tvalue: 'parameter',\n\t\t\t\t\tdescription: 'Pass the JSON code of a workflow',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'database',\n\t\t\tdescription: 'Where to get the workflow to execute from',\n\t\t},\n\n\t\t// ----------------------------------\n\t\t// source:database\n\t\t// ----------------------------------\n\t\t{\n\t\t\tdisplayName: 'Workflow',\n\t\t\tname: 'workflowId',\n\t\t\ttype: 'workflowSelector',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tsource: ['database'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t},\n\t\t// -----------------------------------------------\n\t\t// Resource mapper for workflow inputs\n\t\t// -----------------------------------------------\n\t\t{\n\t\t\tdisplayName: 'Workflow Inputs',\n\t\t\tname: 'workflowInputs',\n\t\t\ttype: 'resourceMapper',\n\t\t\tnoDataExpression: true,\n\t\t\tdefault: {\n\t\t\t\tmappingMode: 'defineBelow',\n\t\t\t\tvalue: null,\n\t\t\t},\n\t\t\trequired: true,\n\t\t\ttypeOptions: {\n\t\t\t\tloadOptionsDependsOn: ['workflowId.value'],\n\t\t\t\tresourceMapper: {\n\t\t\t\t\tlocalResourceMapperMethod: 'loadSubWorkflowInputs',\n\t\t\t\t\tvaluesLabel: 'Workflow Inputs',\n\t\t\t\t\tmode: 'map',\n\t\t\t\t\tfieldWords: {\n\t\t\t\t\t\tsingular: 'workflow input',\n\t\t\t\t\t\tplural: 'workflow inputs',\n\t\t\t\t\t},\n\t\t\t\t\taddAllFields: true,\n\t\t\t\t\tmultiKeyMatch: false,\n\t\t\t\t\tsupportAutoMap: false,\n\t\t\t\t},\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tsource: ['database'],\n\t\t\t\t},\n\t\t\t\thide: {\n\t\t\t\t\tworkflowId: [''],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t// ----------------------------------\n\t\t// source:parameter\n\t\t// ----------------------------------\n\t\t{\n\t\t\tdisplayName: 'Workflow JSON',\n\t\t\tname: 'workflowJson',\n\t\t\ttype: 'json',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 10,\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tsource: ['parameter'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '\\n\\n\\n\\n\\n\\n\\n\\n\\n',\n\t\t\trequired: true,\n\t\t\tdescription: 'The workflow JSON code to execute',\n\t\t},\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA+D;AAE/D,0BAA6C;AAEtC,MAAM,qBAA2C;AAAA,EACvD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,OAAO,CAAC,WAAW;AAAA,EACnB,aAAa;AAAA,EACb,UAAU;AAAA,IACT,MAAM;AAAA,EACP;AAAA,EACA,SAAS,CAAC,GAAG,GAAG;AAAA,EAChB,QAAQ,CAAC;AAAA,EACT,SAAS,CAAC,wCAAoB,MAAM;AAAA,EACpC,aAAa,CAAC,MAAM;AAAA,EACpB,YAAY;AAAA,QACX,kDAA6B,CAAC,wCAAoB,OAAO,CAAC;AAAA,IAC1D;AAAA,MACC,aACC;AAAA,MACD,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,cAAc;AAAA,MACd,aACC;AAAA,IACF;AAAA,IACA;AAAA,M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QACpB;AAAA,QACA,MAAM;AAAA,UACL,YAAY,CAAC,EAAE;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,QACZ,MAAM;AAAA,MACP;AAAA,MACA,gBAAgB;AAAA,QACf,MAAM;AAAA,UACL,QAAQ,CAAC,WAAW;AAAA,QACrB;AAAA,MACD;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,MACV,aAAa;AAAA,IACd;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../../nodes/tools/ToolWorkflow/v2/versionDescription.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\n/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport { NodeConnectionTypes, type INodeTypeDescription } from 'n8n-workflow';\n\nimport { getConnectionHintNoticeField } from '../../../../utils/sharedFields';\n\nexport const versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Call n8n Workflow Tool',\n\tname: 'toolWorkflow',\n\tgroup: ['transform'],\n\tdescription: 'Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.',\n\tdefaults: {\n\t\tname: 'Call n8n Workflow Tool',\n\t},\n\tversion: [2, 2.1, 2.2],\n\tinputs: [],\n\toutputs: [NodeConnectionTypes.AiTool],\n\toutputNames: ['Tool'],\n\tproperties: [\n\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'See an example of a workflow to suggest meeting slots using AI <a href=\"/templates/1953\" target=\"_blank\">here</a>.',\n\t\t\tname: 'noticeTemplateExample',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Name',\n\t\t\tname: 'name',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'e.g. My_Color_Tool',\n\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\tdescription:\n\t\t\t\t'The name of the function to be called, could contain letters, numbers, and underscores only',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\t'@version': [{ _cnd: { lte: 2.1 } }],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Description',\n\t\t\tname: 'description',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder:\n\t\t\t\t'Call this tool to get a random color. The input should be a string with comma separated names of colors to exclude.',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 3,\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'This tool will call the workflow you define below, and look in the last node for the response. The workflow needs to start with an Execute Workflow trigger',\n\t\t\tname: 'executeNotice',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t},\n\n\t\t{\n\t\t\tdisplayName: 'Source',\n\t\t\tname: 'source',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Database',\n\t\t\t\t\tvalue: 'database',\n\t\t\t\t\tdescription: 'Load the workflow from the database by ID',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Define Below',\n\t\t\t\t\tvalue: 'parameter',\n\t\t\t\t\tdescription: 'Pass the JSON code of a workflow',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'database',\n\t\t\tdescription: 'Where to get the workflow to execute from',\n\t\t},\n\n\t\t// ----------------------------------\n\t\t// source:database\n\t\t// ----------------------------------\n\t\t{\n\t\t\tdisplayName: 'Workflow',\n\t\t\tname: 'workflowId',\n\t\t\ttype: 'workflowSelector',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tsource: ['database'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t},\n\t\t// -----------------------------------------------\n\t\t// Resource mapper for workflow inputs\n\t\t// -----------------------------------------------\n\t\t{\n\t\t\tdisplayName: 'Workflow Inputs',\n\t\t\tname: 'workflowInputs',\n\t\t\ttype: 'resourceMapper',\n\t\t\tnoDataExpression: true,\n\t\t\tdefault: {\n\t\t\t\tmappingMode: 'defineBelow',\n\t\t\t\tvalue: null,\n\t\t\t},\n\t\t\trequired: true,\n\t\t\ttypeOptions: {\n\t\t\t\tloadOptionsDependsOn: ['workflowId.value'],\n\t\t\t\tresourceMapper: {\n\t\t\t\t\tlocalResourceMapperMethod: 'loadSubWorkflowInputs',\n\t\t\t\t\tvaluesLabel: 'Workflow Inputs',\n\t\t\t\t\tmode: 'map',\n\t\t\t\t\tfieldWords: {\n\t\t\t\t\t\tsingular: 'workflow input',\n\t\t\t\t\t\tplural: 'workflow inputs',\n\t\t\t\t\t},\n\t\t\t\t\taddAllFields: true,\n\t\t\t\t\tmultiKeyMatch: false,\n\t\t\t\t\tsupportAutoMap: false,\n\t\t\t\t},\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tsource: ['database'],\n\t\t\t\t},\n\t\t\t\thide: {\n\t\t\t\t\tworkflowId: [''],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t// ----------------------------------\n\t\t// source:parameter\n\t\t// ----------------------------------\n\t\t{\n\t\t\tdisplayName: 'Workflow JSON',\n\t\t\tname: 'workflowJson',\n\t\t\ttype: 'json',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 10,\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tsource: ['parameter'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '\\n\\n\\n\\n\\n\\n\\n\\n\\n',\n\t\t\trequired: true,\n\t\t\tdescription: 'The workflow JSON code to execute',\n\t\t},\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA+D;AA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AA;AAAA;AAAA;AAAA,IAKA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,QACf,MAAM;AAAA,UACL,QAAQ,CAAC,UAAU;AAAA,QACpB;AAAA,MACD;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,SAAS;AAAA,QACR,aAAa;AAAA,QACb,OAAO;AAAA,MACR;AAAA,MACA,UAAU;AAAA,MACV,aAAa;AAAA,QACZ,sBAAsB,CAAC,kBAAkB;AAAA,QACzC,gBAAgB;AAAA,UACf,2BAA2B;AAAA,UAC3B,aAAa;AAAA,UACb,MAAM;AAAA,UACN,YAAY;AAAA,YACX,UAAU;AAAA,YACV,QAAQ;AAAA,UACT;AAAA,UACA,cAAc;AAAA,UACd,eAAe;AAAA,UACf,gBAAgB;AAAA,QACjB;AAAA,MACD;AAAA,MACA,gBAAgB;AAAA,QACf,MAAM;AAAA,UACL,QAAQ,CAAC,UAAU;AAAA,QACpB;AAAA,QACA,MAAM;AAAA,UACL,YAAY,CAAC,EAAE;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,QACZ,MAAM;AAAA,MACP;AAAA,MACA,gBAAgB;AAAA,QACf,MAAM;AAAA,UACL,QAAQ,CAAC,WAAW;AAAA,QACrB;AAAA,MACD;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,MACV,aAAa;AAAA,IACd;AAAA,EACD;AACD;","names":[]}
@@ -10,7 +10,7 @@
10
10
  {"name":"milvusApi","displayName":"Milvus","documentationUrl":"milvus","properties":[{"displayName":"Base URL","name":"baseUrl","required":true,"type":"string","default":"http://localhost:19530"},{"displayName":"Username","name":"username","type":"string","default":""},{"displayName":"Password","name":"password","type":"string","typeOptions":{"password":true},"default":""}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.username}}:{{$credentials.password}}"}}},"test":{"request":{"baseURL":"={{ $credentials.baseUrl }}","url":"/v1/vector/collections","method":"GET"}},"supportedNodes":["vectorStoreMilvus"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreMilvus/milvus-icon-black.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreMilvus/milvus-icon-white.svg"}},
11
11
  {"name":"mistralCloudApi","displayName":"Mistral Cloud API","documentationUrl":"mistral","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"https://api.mistral.ai/v1","url":"/models","method":"GET"}},"supportedNodes":["embeddingsMistralCloud","lmChatMistralCloud"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsMistralCloud/mistral.svg"},
12
12
  {"name":"ollamaApi","displayName":"Ollama","documentationUrl":"ollama","properties":[{"displayName":"Base URL","name":"baseUrl","required":true,"type":"string","default":"http://localhost:11434"}],"test":{"request":{"baseURL":"={{ $credentials.baseUrl }}","url":"/","method":"GET"}},"supportedNodes":["embeddingsOllama","lmChatOllama","lmOllama"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsOllama/ollama.svg"},
13
- {"name":"openRouterApi","displayName":"OpenRouter","documentationUrl":"openrouter","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"hidden","default":"https://openrouter.ai/api/v1"}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{ $credentials.url }}","url":"/models"}},"supportedNodes":["lmChatOpenRouter"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatOpenRouter/openrouter.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatOpenRouter/openrouter.dark.svg"}},
13
+ {"name":"openRouterApi","displayName":"OpenRouter","documentationUrl":"openrouter","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"hidden","default":"https://openrouter.ai/api/v1"}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{ $credentials.url }}","url":"/key"}},"supportedNodes":["lmChatOpenRouter"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatOpenRouter/openrouter.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatOpenRouter/openrouter.dark.svg"}},
14
14
  {"name":"pineconeApi","displayName":"PineconeApi","documentationUrl":"pinecone","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"authenticate":{"type":"generic","properties":{"headers":{"Api-Key":"={{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"https://api.pinecone.io/indexes","headers":{"accept":"application/json; charset=utf-8"}}},"supportedNodes":["vectorStorePinecone","vectorStorePineconeInsert","vectorStorePineconeLoad"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStorePinecone/pinecone.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStorePinecone/pinecone.dark.svg"}},
15
15
  {"name":"qdrantApi","displayName":"QdrantApi","documentationUrl":"https://docs.n8n.io/integrations/builtin/credentials/qdrant/","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":false,"default":""},{"displayName":"Qdrant URL","name":"qdrantUrl","type":"string","required":true,"default":""}],"authenticate":{"type":"generic","properties":{"headers":{"api-key":"={{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{$credentials.qdrantUrl}}","url":"/collections"}},"supportedNodes":["vectorStoreQdrant"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreQdrant/qdrant.svg"},
16
16
  {"name":"searXngApi","displayName":"SearXNG","documentationUrl":"searxng","properties":[{"displayName":"API URL","name":"apiUrl","type":"string","default":"","required":true}],"supportedNodes":["toolSearXng"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/tools/ToolSearXng/searXng.svg"},
@@ -61,16 +61,16 @@
61
61
  {"displayName":"Recursive Character Text Splitter","name":"textSplitterRecursiveCharacterTextSplitter","icon":"fa:grip-lines-vertical","iconColor":"black","group":["transform"],"version":1,"description":"Split text into chunks by characters recursively, recommended for most use cases","defaults":{"name":"Recursive Character Text Splitter"},"codex":{"categories":["AI"],"subcategories":{"AI":["Text Splitters"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter/"}]}},"inputs":[],"outputs":["ai_textSplitter"],"outputNames":["Text Splitter"],"properties":[{"displayName":"This node must be connected to a document loader. <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='ai_document'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"Chunk Size","name":"chunkSize","type":"number","default":1000},{"displayName":"Chunk Overlap","name":"chunkOverlap","type":"number","default":0},{"displayName":"Options","name":"options","placeholder":"Add Option","description":"Additional options to add","type":"collection","default":{},"options":[{"displayName":"Split Code","name":"splitCode","default":"markdown","type":"options","options":[{"name":"cpp","value":"cpp"},{"name":"go","value":"go"},{"name":"java","value":"java"},{"name":"js","value":"js"},{"name":"php","value":"php"},{"name":"proto","value":"proto"},{"name":"python","value":"python"},{"name":"rst","value":"rst"},{"name":"ruby","value":"ruby"},{"name":"rust","value":"rust"},{"name":"scala","value":"scala"},{"name":"swift","value":"swift"},{"name":"markdown","value":"markdown"},{"name":"latex","value":"latex"},{"name":"html","value":"html"}]}]}]},
62
62
  {"displayName":"Token Splitter","name":"textSplitterTokenSplitter","icon":"fa:grip-lines-vertical","iconColor":"black","group":["transform"],"version":1,"description":"Split text into chunks by tokens","defaults":{"name":"Token Splitter"},"codex":{"categories":["AI"],"subcategories":{"AI":["Text Splitters"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.textsplittertokensplitter/"}]}},"inputs":[],"outputs":["ai_textSplitter"],"outputNames":["Text Splitter"],"properties":[{"displayName":"This node must be connected to a document loader. <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='ai_document'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"Chunk Size","name":"chunkSize","type":"number","default":1000},{"displayName":"Chunk Overlap","name":"chunkOverlap","type":"number","default":0}]},
63
63
  {"displayName":"Calculator","name":"toolCalculator","icon":"fa:calculator","iconColor":"black","group":["transform"],"version":1,"description":"Make it easier for AI agents to perform arithmetic","defaults":{"name":"Calculator"},"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Other Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolcalculator/"}]}},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}}]},
64
- {"displayName":"Code Tool","name":"toolCode","icon":"fa:code","iconColor":"black","group":["transform"],"version":[1,1.1],"description":"Write a tool in JS or Python","defaults":{"name":"Code Tool"},"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Recommended Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolcode/"}]}},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"See an example of a conversational agent with custom tool written in JavaScript <a href=\"/templates/1963\" target=\"_blank\">here</a>.","name":"noticeTemplateExample","type":"notice","default":""},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"My_Tool","displayOptions":{"show":{"@version":[1]}}},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"e.g. My_Tool","validateType":"string-alphanumeric","description":"The name of the function to be called, could contain letters, numbers, and underscores only","displayOptions":{"show":{"@version":[{"_cnd":{"gte":1.1}}]}}},{"displayName":"Description","name":"description","type":"string","default":"","placeholder":"Call this tool to get a random color. The input should be a string with comma separted names of colors to exclude.","typeOptions":{"rows":3}},{"displayName":"Language","name":"language","type":"options","noDataExpression":true,"options":[{"name":"JavaScript","value":"javaScript"},{"name":"Python (Beta)","value":"python"}],"default":"javaScript"},{"displayName":"JavaScript","name":"jsCode","type":"string","displayOptions":{"show":{"language":["javaScript"]}},"typeOptions":{"editor":"jsEditor"},"default":"// Example: convert the incoming query to uppercase and return it\nreturn query.toUpperCase()","hint":"You can access the input the tool receives via the input property \"query\". The returned value should be a single string.","description":"E.g. Converts any text to uppercase","noDataExpression":true},{"displayName":"Python","name":"pythonCode","type":"string","displayOptions":{"show":{"language":["python"]}},"typeOptions":{"editor":"codeNodeEditor","editorLanguage":"python"},"default":"# Example: convert the incoming query to uppercase and return it\nreturn query.upper()","hint":"You can access the input the tool receives via the input property \"query\". The returned value should be a single string.","description":"E.g. Converts any text to uppercase","noDataExpression":true},{"displayName":"Specify Input Schema","name":"specifyInputSchema","type":"boolean","description":"Whether to specify the schema for the function. This would require the LLM to provide the input in the correct format and would validate it against the schema.","noDataExpression":true,"default":false},{"displayName":"Schema Type","name":"schemaType","type":"options","noDataExpression":true,"options":[{"name":"Generate From JSON Example","value":"fromJson","description":"Generate a schema from an example JSON object"},{"name":"Define Below","value":"manual","description":"Define the JSON schema manually"}],"default":"fromJson","description":"How to specify the schema for the function","displayOptions":{"show":{"specifyInputSchema":[true]}}},{"displayName":"JSON Example","name":"jsonSchemaExample","type":"json","default":"{\n\t\"some_input\": \"some_value\"\n}","noDataExpression":true,"typeOptions":{"rows":10},"displayOptions":{"show":{"specifyInputSchema":[true],"schemaType":["fromJson"]}},"description":"Example JSON object to use to generate the schema"},{"displayName":"Input Schema","name":"inputSchema","type":"json","default":"{\n\"type\": \"object\",\n\"properties\": {\n\t\"some_input\": {\n\t\t\"type\": \"string\",\n\t\t\"description\": \"Some input to the function\"\n\t\t}\n\t}\n}","noDataExpression":true,"typeOptions":{"rows":10},"displayOptions":{"show":{"specifyInputSchema":[true],"schemaType":["manual"]}},"description":"Schema to use for the function"}]},
65
- {"displayName":"HTTP Request Tool","name":"toolHttpRequest","group":["output"],"version":[1,1.1],"description":"Makes an HTTP request and returns the response data","subtitle":"={{ $parameter.toolDescription }}","defaults":{"name":"HTTP Request"},"credentials":[],"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Recommended Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolhttprequest/"}]}},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"Description","name":"toolDescription","type":"string","description":"Explain to LLM what this tool does, better description would allow LLM to produce expected result","placeholder":"e.g. Get the current weather in the requested city","default":"","typeOptions":{"rows":3}},{"displayName":"Method","name":"method","type":"options","options":[{"name":"DELETE","value":"DELETE"},{"name":"GET","value":"GET"},{"name":"PATCH","value":"PATCH"},{"name":"POST","value":"POST"},{"name":"PUT","value":"PUT"}],"default":"GET"},{"displayName":"Tip: You can use a {placeholder} for any part of the request to be filled by the model. Provide more context about them in the placeholders section","name":"placeholderNotice","type":"notice","default":""},{"displayName":"URL","name":"url","type":"string","default":"","required":true,"placeholder":"e.g. http://www.example.com/{path}"},{"displayName":"Authentication","name":"authentication","description":"Select the type of authentication to use if needed, authentication would be done by n8n and your credentials will not be shared with the LLM","noDataExpression":true,"type":"options","options":[{"name":"None","value":"none"},{"name":"Predefined Credential Type","value":"predefinedCredentialType","description":"We've already implemented auth for many services so that you don't have to set it up manually"},{"name":"Generic Credential Type","value":"genericCredentialType","description":"Fully customizable. Choose between basic, header, OAuth2, etc."}],"default":"none"},{"displayName":"Credential Type","name":"nodeCredentialType","type":"credentialsSelect","noDataExpression":true,"required":true,"default":"","credentialTypes":["extends:oAuth2Api","extends:oAuth1Api","has:authenticate"],"displayOptions":{"show":{"authentication":["predefinedCredentialType"]}}},{"displayName":"Make sure you have specified the scope(s) for the Service Account in the credential","name":"googleApiWarning","type":"notice","default":"","displayOptions":{"show":{"nodeCredentialType":["googleApi"]}}},{"displayName":"Generic Auth Type","name":"genericAuthType","type":"credentialsSelect","required":true,"default":"","credentialTypes":["has:genericAuth"],"displayOptions":{"show":{"authentication":["genericCredentialType"]}}},{"displayName":"Send Query Parameters","name":"sendQuery","type":"boolean","default":false,"noDataExpression":true,"description":"Whether the request has query params or not"},{"displayName":"Specify Query Parameters","name":"specifyQuery","type":"options","options":[{"name":"Using Fields Below","value":"keypair"},{"name":"Using JSON Below","value":"json"},{"name":"Let Model Specify Entire Body","value":"model"}],"default":"keypair","displayOptions":{"show":{"sendQuery":[true]}}},{"displayName":"Query Parameters","name":"parametersQuery","type":"fixedCollection","typeOptions":{"multipleValues":true},"placeholder":"Add Parameter","default":{"values":[{"name":""}]},"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Name","name":"name","type":"string","default":""},{"displayName":"Value Provided","name":"valueProvider","type":"options","options":[{"name":"By Model (and is required)","value":"modelRequired"},{"name":"By Model (but is optional)","value":"modelOptional"},{"name":"Using Field Below","value":"fieldValue"}],"default":"modelRequired"},{"displayName":"Value","name":"value","type":"string","default":"","hint":"Use a {placeholder} for any data to be filled in by the model","displayOptions":{"show":{"valueProvider":["fieldValue"]}}}]}],"displayOptions":{"show":{"sendQuery":[true],"specifyQuery":["keypair"]}}},{"displayName":"JSON","name":"jsonQuery","type":"string","typeOptions":{"rows":5},"hint":"Use a {placeholder} for any data to be filled in by the model","default":"","displayOptions":{"show":{"sendQuery":[true],"specifyQuery":["json"]}}},{"displayName":"Send Headers","name":"sendHeaders","type":"boolean","default":false,"noDataExpression":true,"description":"Whether the request has headers or not"},{"displayName":"Specify Headers","name":"specifyHeaders","type":"options","options":[{"name":"Using Fields Below","value":"keypair"},{"name":"Using JSON Below","value":"json"},{"name":"Let Model Specify Entire Body","value":"model"}],"default":"keypair","displayOptions":{"show":{"sendHeaders":[true]}}},{"displayName":"Header Parameters","name":"parametersHeaders","type":"fixedCollection","typeOptions":{"multipleValues":true},"placeholder":"Add Parameter","default":{"values":[{"name":""}]},"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Name","name":"name","type":"string","default":""},{"displayName":"Value Provided","name":"valueProvider","type":"options","options":[{"name":"By Model (and is required)","value":"modelRequired"},{"name":"By Model (but is optional)","value":"modelOptional"},{"name":"Using Field Below","value":"fieldValue"}],"default":"modelRequired"},{"displayName":"Value","name":"value","type":"string","default":"","hint":"Use a {placeholder} for any data to be filled in by the model","displayOptions":{"show":{"valueProvider":["fieldValue"]}}}]}],"displayOptions":{"show":{"sendHeaders":[true],"specifyHeaders":["keypair"]}}},{"displayName":"JSON","name":"jsonHeaders","type":"string","typeOptions":{"rows":5},"hint":"Use a {placeholder} for any data to be filled in by the model","default":"","displayOptions":{"show":{"sendHeaders":[true],"specifyHeaders":["json"]}}},{"displayName":"Send Body","name":"sendBody","type":"boolean","default":false,"noDataExpression":true,"description":"Whether the request has body or not"},{"displayName":"Specify Body","name":"specifyBody","type":"options","options":[{"name":"Using Fields Below","value":"keypair"},{"name":"Using JSON Below","value":"json"},{"name":"Let Model Specify Entire Body","value":"model"}],"default":"keypair","displayOptions":{"show":{"sendBody":[true]}}},{"displayName":"Body Parameters","name":"parametersBody","type":"fixedCollection","typeOptions":{"multipleValues":true},"placeholder":"Add Parameter","default":{"values":[{"name":""}]},"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Name","name":"name","type":"string","default":""},{"displayName":"Value Provided","name":"valueProvider","type":"options","options":[{"name":"By Model (and is required)","value":"modelRequired"},{"name":"By Model (but is optional)","value":"modelOptional"},{"name":"Using Field Below","value":"fieldValue"}],"default":"modelRequired"},{"displayName":"Value","name":"value","type":"string","default":"","hint":"Use a {placeholder} for any data to be filled in by the model","displayOptions":{"show":{"valueProvider":["fieldValue"]}}}]}],"displayOptions":{"show":{"sendBody":[true],"specifyBody":["keypair"]}}},{"displayName":"JSON","name":"jsonBody","type":"string","typeOptions":{"rows":5},"hint":"Use a {placeholder} for any data to be filled in by the model","default":"","displayOptions":{"show":{"sendBody":[true],"specifyBody":["json"]}}},{"displayName":"Placeholder Definitions","name":"placeholderDefinitions","type":"fixedCollection","typeOptions":{"multipleValues":true},"placeholder":"Add Definition","default":[],"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Placeholder Name","name":"name","type":"string","default":""},{"displayName":"Description","name":"description","type":"string","default":""},{"displayName":"Type","name":"type","type":"options","options":[{"name":"Not Specified (Default)","value":"not specified"},{"name":"String","value":"string"},{"name":"Number","value":"number"},{"name":"Boolean","value":"boolean"},{"name":"JSON","value":"json"}],"default":"not specified"}]}]},{"displayName":"Optimize Response","name":"optimizeResponse","type":"boolean","default":false,"noDataExpression":true,"description":"Whether the optimize the tool response to reduce amount of data passed to the LLM that could lead to better result and reduce cost"},{"displayName":"Expected Response Type","name":"responseType","type":"options","displayOptions":{"show":{"optimizeResponse":[true]}},"options":[{"name":"JSON","value":"json"},{"name":"HTML","value":"html"},{"name":"Text","value":"text"}],"default":"json"},{"displayName":"Field Containing Data","name":"dataField","type":"string","default":"","placeholder":"e.g. records","description":"Specify the name of the field in the response containing the data","hint":"leave blank to use whole response","requiresDataPath":"single","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["json"]}}},{"displayName":"Include Fields","name":"fieldsToInclude","type":"options","description":"What fields response object should include","default":"all","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["json"]}},"options":[{"name":"All","value":"all","description":"Include all fields"},{"name":"Selected","value":"selected","description":"Include only fields specified below"},{"name":"Except","value":"except","description":"Exclude fields specified below"}]},{"displayName":"Fields","name":"fields","type":"string","default":"","placeholder":"e.g. field1,field2","description":"Comma-separated list of the field names. Supports dot notation. You can drag the selected fields from the input panel.","requiresDataPath":"multiple","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["json"]},"hide":{"fieldsToInclude":["all"]}}},{"displayName":"Selector (CSS)","name":"cssSelector","type":"string","description":"Select specific element(e.g. body) or multiple elements(e.g. div) of chosen type in the response HTML.","placeholder":"e.g. body","default":"body","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["html"]}}},{"displayName":"Return Only Content","name":"onlyContent","type":"boolean","default":false,"description":"Whether to return only content of html elements, stripping html tags and attributes","hint":"Uses less tokens and may be easier for model to understand","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["html"]}}},{"displayName":"Elements To Omit","name":"elementsToOmit","type":"string","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["html"],"onlyContent":[true]}},"default":"","placeholder":"e.g. img, .className, #ItemId","description":"Comma-separated list of selectors that would be excluded when extracting content"},{"displayName":"Truncate Response","name":"truncateResponse","type":"boolean","default":false,"hint":"Helps save tokens","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["text","html"]}}},{"displayName":"Max Response Characters","name":"maxLength","type":"number","default":1000,"typeOptions":{"minValue":1},"displayOptions":{"show":{"optimizeResponse":[true],"responseType":["text","html"],"truncateResponse":[true]}}}],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/tools/ToolHttpRequest/httprequest.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/tools/ToolHttpRequest/httprequest.dark.svg"}},
64
+ {"displayName":"Code Tool","name":"toolCode","icon":"fa:code","iconColor":"black","group":["transform"],"version":[1,1.1,1.2],"description":"Write a tool in JS or Python","defaults":{"name":"Code Tool"},"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Recommended Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolcode/"}]}},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"See an example of a conversational agent with custom tool written in JavaScript <a href=\"/templates/1963\" target=\"_blank\">here</a>.","name":"noticeTemplateExample","type":"notice","default":""},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"My_Tool","displayOptions":{"show":{"@version":[1]}}},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"e.g. My_Tool","validateType":"string-alphanumeric","description":"The name of the function to be called, could contain letters, numbers, and underscores only","displayOptions":{"show":{"@version":[1.1]}}},{"displayName":"Description","name":"description","type":"string","default":"","placeholder":"Call this tool to get a random color. The input should be a string with comma separted names of colors to exclude.","typeOptions":{"rows":3}},{"displayName":"Language","name":"language","type":"options","noDataExpression":true,"options":[{"name":"JavaScript","value":"javaScript"},{"name":"Python (Beta)","value":"python"}],"default":"javaScript"},{"displayName":"JavaScript","name":"jsCode","type":"string","displayOptions":{"show":{"language":["javaScript"]}},"typeOptions":{"editor":"jsEditor"},"default":"// Example: convert the incoming query to uppercase and return it\nreturn query.toUpperCase()","hint":"You can access the input the tool receives via the input property \"query\". The returned value should be a single string.","description":"E.g. Converts any text to uppercase","noDataExpression":true},{"displayName":"Python","name":"pythonCode","type":"string","displayOptions":{"show":{"language":["python"]}},"typeOptions":{"editor":"codeNodeEditor","editorLanguage":"python"},"default":"# Example: convert the incoming query to uppercase and return it\nreturn query.upper()","hint":"You can access the input the tool receives via the input property \"query\". The returned value should be a single string.","description":"E.g. Converts any text to uppercase","noDataExpression":true},{"displayName":"Specify Input Schema","name":"specifyInputSchema","type":"boolean","description":"Whether to specify the schema for the function. This would require the LLM to provide the input in the correct format and would validate it against the schema.","noDataExpression":true,"default":false},{"displayName":"Schema Type","name":"schemaType","type":"options","noDataExpression":true,"options":[{"name":"Generate From JSON Example","value":"fromJson","description":"Generate a schema from an example JSON object"},{"name":"Define Below","value":"manual","description":"Define the JSON schema manually"}],"default":"fromJson","description":"How to specify the schema for the function","displayOptions":{"show":{"specifyInputSchema":[true]}}},{"displayName":"JSON Example","name":"jsonSchemaExample","type":"json","default":"{\n\t\"some_input\": \"some_value\"\n}","noDataExpression":true,"typeOptions":{"rows":10},"displayOptions":{"show":{"specifyInputSchema":[true],"schemaType":["fromJson"]}},"description":"Example JSON object to use to generate the schema"},{"displayName":"Input Schema","name":"inputSchema","type":"json","default":"{\n\"type\": \"object\",\n\"properties\": {\n\t\"some_input\": {\n\t\t\"type\": \"string\",\n\t\t\"description\": \"Some input to the function\"\n\t\t}\n\t}\n}","noDataExpression":true,"typeOptions":{"rows":10},"displayOptions":{"show":{"specifyInputSchema":[true],"schemaType":["manual"]}},"description":"Schema to use for the function"}]},
65
+ {"displayName":"HTTP Request Tool","name":"toolHttpRequest","group":["output"],"version":[1,1.1],"description":"Makes an HTTP request and returns the response data","subtitle":"={{ $parameter.toolDescription }}","defaults":{"name":"HTTP Request"},"credentials":[],"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Recommended Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolhttprequest/"}]}},"hidden":true,"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"Description","name":"toolDescription","type":"string","description":"Explain to LLM what this tool does, better description would allow LLM to produce expected result","placeholder":"e.g. Get the current weather in the requested city","default":"","typeOptions":{"rows":3}},{"displayName":"Method","name":"method","type":"options","options":[{"name":"DELETE","value":"DELETE"},{"name":"GET","value":"GET"},{"name":"PATCH","value":"PATCH"},{"name":"POST","value":"POST"},{"name":"PUT","value":"PUT"}],"default":"GET"},{"displayName":"Tip: You can use a {placeholder} for any part of the request to be filled by the model. Provide more context about them in the placeholders section","name":"placeholderNotice","type":"notice","default":""},{"displayName":"URL","name":"url","type":"string","default":"","required":true,"placeholder":"e.g. http://www.example.com/{path}"},{"displayName":"Authentication","name":"authentication","description":"Select the type of authentication to use if needed, authentication would be done by n8n and your credentials will not be shared with the LLM","noDataExpression":true,"type":"options","options":[{"name":"None","value":"none"},{"name":"Predefined Credential Type","value":"predefinedCredentialType","description":"We've already implemented auth for many services so that you don't have to set it up manually"},{"name":"Generic Credential Type","value":"genericCredentialType","description":"Fully customizable. Choose between basic, header, OAuth2, etc."}],"default":"none"},{"displayName":"Credential Type","name":"nodeCredentialType","type":"credentialsSelect","noDataExpression":true,"required":true,"default":"","credentialTypes":["extends:oAuth2Api","extends:oAuth1Api","has:authenticate"],"displayOptions":{"show":{"authentication":["predefinedCredentialType"]}}},{"displayName":"Make sure you have specified the scope(s) for the Service Account in the credential","name":"googleApiWarning","type":"notice","default":"","displayOptions":{"show":{"nodeCredentialType":["googleApi"]}}},{"displayName":"Generic Auth Type","name":"genericAuthType","type":"credentialsSelect","required":true,"default":"","credentialTypes":["has:genericAuth"],"displayOptions":{"show":{"authentication":["genericCredentialType"]}}},{"displayName":"Send Query Parameters","name":"sendQuery","type":"boolean","default":false,"noDataExpression":true,"description":"Whether the request has query params or not"},{"displayName":"Specify Query Parameters","name":"specifyQuery","type":"options","options":[{"name":"Using Fields Below","value":"keypair"},{"name":"Using JSON Below","value":"json"},{"name":"Let Model Specify Entire Body","value":"model"}],"default":"keypair","displayOptions":{"show":{"sendQuery":[true]}}},{"displayName":"Query Parameters","name":"parametersQuery","type":"fixedCollection","typeOptions":{"multipleValues":true},"placeholder":"Add Parameter","default":{"values":[{"name":""}]},"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Name","name":"name","type":"string","default":""},{"displayName":"Value Provided","name":"valueProvider","type":"options","options":[{"name":"By Model (and is required)","value":"modelRequired"},{"name":"By Model (but is optional)","value":"modelOptional"},{"name":"Using Field Below","value":"fieldValue"}],"default":"modelRequired"},{"displayName":"Value","name":"value","type":"string","default":"","hint":"Use a {placeholder} for any data to be filled in by the model","displayOptions":{"show":{"valueProvider":["fieldValue"]}}}]}],"displayOptions":{"show":{"sendQuery":[true],"specifyQuery":["keypair"]}}},{"displayName":"JSON","name":"jsonQuery","type":"string","typeOptions":{"rows":5},"hint":"Use a {placeholder} for any data to be filled in by the model","default":"","displayOptions":{"show":{"sendQuery":[true],"specifyQuery":["json"]}}},{"displayName":"Send Headers","name":"sendHeaders","type":"boolean","default":false,"noDataExpression":true,"description":"Whether the request has headers or not"},{"displayName":"Specify Headers","name":"specifyHeaders","type":"options","options":[{"name":"Using Fields Below","value":"keypair"},{"name":"Using JSON Below","value":"json"},{"name":"Let Model Specify Entire Body","value":"model"}],"default":"keypair","displayOptions":{"show":{"sendHeaders":[true]}}},{"displayName":"Header Parameters","name":"parametersHeaders","type":"fixedCollection","typeOptions":{"multipleValues":true},"placeholder":"Add Parameter","default":{"values":[{"name":""}]},"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Name","name":"name","type":"string","default":""},{"displayName":"Value Provided","name":"valueProvider","type":"options","options":[{"name":"By Model (and is required)","value":"modelRequired"},{"name":"By Model (but is optional)","value":"modelOptional"},{"name":"Using Field Below","value":"fieldValue"}],"default":"modelRequired"},{"displayName":"Value","name":"value","type":"string","default":"","hint":"Use a {placeholder} for any data to be filled in by the model","displayOptions":{"show":{"valueProvider":["fieldValue"]}}}]}],"displayOptions":{"show":{"sendHeaders":[true],"specifyHeaders":["keypair"]}}},{"displayName":"JSON","name":"jsonHeaders","type":"string","typeOptions":{"rows":5},"hint":"Use a {placeholder} for any data to be filled in by the model","default":"","displayOptions":{"show":{"sendHeaders":[true],"specifyHeaders":["json"]}}},{"displayName":"Send Body","name":"sendBody","type":"boolean","default":false,"noDataExpression":true,"description":"Whether the request has body or not"},{"displayName":"Specify Body","name":"specifyBody","type":"options","options":[{"name":"Using Fields Below","value":"keypair"},{"name":"Using JSON Below","value":"json"},{"name":"Let Model Specify Entire Body","value":"model"}],"default":"keypair","displayOptions":{"show":{"sendBody":[true]}}},{"displayName":"Body Parameters","name":"parametersBody","type":"fixedCollection","typeOptions":{"multipleValues":true},"placeholder":"Add Parameter","default":{"values":[{"name":""}]},"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Name","name":"name","type":"string","default":""},{"displayName":"Value Provided","name":"valueProvider","type":"options","options":[{"name":"By Model (and is required)","value":"modelRequired"},{"name":"By Model (but is optional)","value":"modelOptional"},{"name":"Using Field Below","value":"fieldValue"}],"default":"modelRequired"},{"displayName":"Value","name":"value","type":"string","default":"","hint":"Use a {placeholder} for any data to be filled in by the model","displayOptions":{"show":{"valueProvider":["fieldValue"]}}}]}],"displayOptions":{"show":{"sendBody":[true],"specifyBody":["keypair"]}}},{"displayName":"JSON","name":"jsonBody","type":"string","typeOptions":{"rows":5},"hint":"Use a {placeholder} for any data to be filled in by the model","default":"","displayOptions":{"show":{"sendBody":[true],"specifyBody":["json"]}}},{"displayName":"Placeholder Definitions","name":"placeholderDefinitions","type":"fixedCollection","typeOptions":{"multipleValues":true},"placeholder":"Add Definition","default":[],"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Placeholder Name","name":"name","type":"string","default":""},{"displayName":"Description","name":"description","type":"string","default":""},{"displayName":"Type","name":"type","type":"options","options":[{"name":"Not Specified (Default)","value":"not specified"},{"name":"String","value":"string"},{"name":"Number","value":"number"},{"name":"Boolean","value":"boolean"},{"name":"JSON","value":"json"}],"default":"not specified"}]}]},{"displayName":"Optimize Response","name":"optimizeResponse","type":"boolean","default":false,"noDataExpression":true,"description":"Whether the optimize the tool response to reduce amount of data passed to the LLM that could lead to better result and reduce cost"},{"displayName":"Expected Response Type","name":"responseType","type":"options","displayOptions":{"show":{"optimizeResponse":[true]}},"options":[{"name":"JSON","value":"json"},{"name":"HTML","value":"html"},{"name":"Text","value":"text"}],"default":"json"},{"displayName":"Field Containing Data","name":"dataField","type":"string","default":"","placeholder":"e.g. records","description":"Specify the name of the field in the response containing the data","hint":"leave blank to use whole response","requiresDataPath":"single","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["json"]}}},{"displayName":"Include Fields","name":"fieldsToInclude","type":"options","description":"What fields response object should include","default":"all","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["json"]}},"options":[{"name":"All","value":"all","description":"Include all fields"},{"name":"Selected","value":"selected","description":"Include only fields specified below"},{"name":"Except","value":"except","description":"Exclude fields specified below"}]},{"displayName":"Fields","name":"fields","type":"string","default":"","placeholder":"e.g. field1,field2","description":"Comma-separated list of the field names. Supports dot notation. You can drag the selected fields from the input panel.","requiresDataPath":"multiple","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["json"]},"hide":{"fieldsToInclude":["all"]}}},{"displayName":"Selector (CSS)","name":"cssSelector","type":"string","description":"Select specific element(e.g. body) or multiple elements(e.g. div) of chosen type in the response HTML.","placeholder":"e.g. body","default":"body","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["html"]}}},{"displayName":"Return Only Content","name":"onlyContent","type":"boolean","default":false,"description":"Whether to return only content of html elements, stripping html tags and attributes","hint":"Uses less tokens and may be easier for model to understand","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["html"]}}},{"displayName":"Elements To Omit","name":"elementsToOmit","type":"string","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["html"],"onlyContent":[true]}},"default":"","placeholder":"e.g. img, .className, #ItemId","description":"Comma-separated list of selectors that would be excluded when extracting content"},{"displayName":"Truncate Response","name":"truncateResponse","type":"boolean","default":false,"hint":"Helps save tokens","displayOptions":{"show":{"optimizeResponse":[true],"responseType":["text","html"]}}},{"displayName":"Max Response Characters","name":"maxLength","type":"number","default":1000,"typeOptions":{"minValue":1},"displayOptions":{"show":{"optimizeResponse":[true],"responseType":["text","html"],"truncateResponse":[true]}}}],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/tools/ToolHttpRequest/httprequest.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/tools/ToolHttpRequest/httprequest.dark.svg"}},
66
66
  {"displayName":"SearXNG","name":"toolSearXng","group":["transform"],"version":1,"description":"Search in SearXNG","defaults":{"name":"SearXNG"},"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Other Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolsearxng"}]}},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"credentials":[{"name":"searXngApi","required":true}],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"Options","name":"options","type":"collection","placeholder":"Add Option","default":{},"options":[{"displayName":"Number of Results","name":"numResults","type":"number","default":10},{"displayName":"Search Page Number","name":"pageNumber","type":"number","default":1},{"displayName":"Language","name":"language","type":"string","default":"en","description":"Defines the language to use. It's a two-letter language code. (e.g., `en` for English, `es` for Spanish, or `fr` for French). Head to <a href=\"https://docs.searxng.org/user/search-syntax.html#select-language\">SearXNG search syntax page</a> for more info."},{"displayName":"Safe Search","name":"safesearch","type":"options","options":[{"name":"None","value":0},{"name":"Moderate","value":1},{"name":"Strict","value":2}],"default":0,"description":"Filter search results of engines which support safe search"}]}],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/tools/ToolSearXng/searXng.svg"},
67
67
  {"displayName":"SerpApi (Google Search)","name":"toolSerpApi","group":["transform"],"version":1,"description":"Search in Google using SerpAPI","defaults":{"name":"SerpAPI"},"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Other Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolserpapi/"}]}},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"credentials":[{"name":"serpApi","required":true}],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"Options","name":"options","type":"collection","placeholder":"Add Option","default":{},"options":[{"displayName":"Country","name":"gl","type":"string","default":"us","description":"Defines the country to use for search. Head to <a href=\"https://serpapi.com/google-countries\">Google countries page</a> for a full list of supported countries."},{"displayName":"Device","name":"device","type":"options","options":[{"name":"Desktop","value":"desktop"},{"name":"Mobile","value":"mobile"},{"name":"Tablet","value":"tablet"}],"default":"desktop","description":"Device to use to get the results"},{"displayName":"Explicit Array","name":"no_cache","type":"boolean","default":false,"description":"Whether to force SerpApi to fetch the Google results even if a cached version is already present. Cache expires after 1h. Cached searches are free, and are not counted towards your searches per month."},{"displayName":"Google Domain","name":"google_domain","type":"string","default":"google.com","description":"Defines the domain to use for search. Head to <a href=\"https://serpapi.com/google-domains\">Google domains page</a> for a full list of supported domains."},{"displayName":"Language","name":"hl","type":"string","default":"en","description":"Defines the language to use. It's a two-letter language code. (e.g., `en` for English, `es` for Spanish, or `fr` for French). Head to <a href=\"https://serpapi.com/google-languages\">Google languages page</a> for a full list of supported languages."}]}],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/tools/ToolSerpApi/serpApi.svg"},
68
68
  {"displayName":"Think Tool","name":"toolThink","icon":"fa:brain","iconColor":"black","group":["transform"],"version":1,"description":"Invite the AI agent to do some thinking","defaults":{"name":"Think"},"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Other Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolthink/"}]}},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"Think Tool Description","name":"description","type":"string","default":"Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.","placeholder":"[Describe your thinking tool here, explaining how it will help the AI think]","description":"The thinking tool's description","typeOptions":{"rows":3},"required":true}]},
69
- {"displayName":"Vector Store Question Answer Tool","name":"toolVectorStore","icon":"fa:database","iconColor":"black","group":["transform"],"version":[1],"description":"Answer questions with a vector store","defaults":{"name":"Answer questions with a vector store"},"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Other Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolvectorstore/"}]}},"inputs":[{"displayName":"Vector Store","maxConnections":1,"type":"ai_vectorStore","required":true},{"displayName":"Model","maxConnections":1,"type":"ai_languageModel","required":true}],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"Data Name","name":"name","type":"string","default":"","placeholder":"e.g. users_info","validateType":"string-alphanumeric","description":"Name of the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question."},{"displayName":"Description of Data","name":"description","type":"string","default":"","placeholder":"[Describe your data here, e.g. a user's name, email, etc.]","description":"Describe the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.","typeOptions":{"rows":3}},{"displayName":"Limit","name":"topK","type":"number","default":4,"description":"The maximum number of results to return"}]},
69
+ {"displayName":"Vector Store Question Answer Tool","name":"toolVectorStore","icon":"fa:database","iconColor":"black","group":["transform"],"version":[1,1.1],"description":"Answer questions with a vector store","defaults":{"name":"Answer questions with a vector store"},"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Other Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolvectorstore/"}]}},"inputs":[{"displayName":"Vector Store","maxConnections":1,"type":"ai_vectorStore","required":true},{"displayName":"Model","maxConnections":1,"type":"ai_languageModel","required":true}],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"Data Name","name":"name","type":"string","default":"","placeholder":"e.g. users_info","validateType":"string-alphanumeric","description":"Name of the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.","displayOptions":{"show":{"@version":[1]}}},{"displayName":"Description of Data","name":"description","type":"string","default":"","placeholder":"[Describe your data here, e.g. a user's name, email, etc.]","description":"Describe the data in vector store. This will be used to fill this tool description: Useful for when you need to answer questions about [name]. Whenever you need information about [data description], you should ALWAYS use this. Input should be a fully formed question.","typeOptions":{"rows":3}},{"displayName":"Limit","name":"topK","type":"number","default":4,"description":"The maximum number of results to return"}]},
70
70
  {"displayName":"Wikipedia","name":"toolWikipedia","group":["transform"],"version":1,"description":"Search in Wikipedia","defaults":{"name":"Wikipedia"},"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Other Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolwikipedia/"}]}},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}}],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/tools/ToolWikipedia/wikipedia.svg"},
71
71
  {"displayName":"Wolfram|Alpha","name":"toolWolframAlpha","group":["transform"],"version":1,"description":"Connects to WolframAlpha's computational intelligence engine.","defaults":{"name":"Wolfram Alpha"},"credentials":[{"name":"wolframAlphaApi","required":true}],"codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Other Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolwolframalpha/"}]}},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}}],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/tools/ToolWolframAlpha/wolfram-alpha.svg"},
72
- {"displayName":"Call n8n Workflow Tool","name":"toolWorkflow","icon":"fa:network-wired","iconColor":"black","group":["transform"],"description":"Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.","codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Recommended Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolworkflow/"}]}},"defaultVersion":2.1,"defaults":{"name":"Call n8n Workflow Tool"},"version":[2,2.1],"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"See an example of a workflow to suggest meeting slots using AI <a href=\"/templates/1953\" target=\"_blank\">here</a>.","name":"noticeTemplateExample","type":"notice","default":""},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"e.g. My_Color_Tool","validateType":"string-alphanumeric","description":"The name of the function to be called, could contain letters, numbers, and underscores only"},{"displayName":"Description","name":"description","type":"string","default":"","placeholder":"Call this tool to get a random color. The input should be a string with comma separated names of colors to exclude.","typeOptions":{"rows":3}},{"displayName":"This tool will call the workflow you define below, and look in the last node for the response. The workflow needs to start with an Execute Workflow trigger","name":"executeNotice","type":"notice","default":""},{"displayName":"Source","name":"source","type":"options","options":[{"name":"Database","value":"database","description":"Load the workflow from the database by ID"},{"name":"Define Below","value":"parameter","description":"Pass the JSON code of a workflow"}],"default":"database","description":"Where to get the workflow to execute from"},{"displayName":"Workflow","name":"workflowId","type":"workflowSelector","displayOptions":{"show":{"source":["database"]}},"default":"","required":true},{"displayName":"Workflow Inputs","name":"workflowInputs","type":"resourceMapper","noDataExpression":true,"default":{"mappingMode":"defineBelow","value":null},"required":true,"typeOptions":{"loadOptionsDependsOn":["workflowId.value"],"resourceMapper":{"localResourceMapperMethod":"loadSubWorkflowInputs","valuesLabel":"Workflow Inputs","mode":"map","fieldWords":{"singular":"workflow input","plural":"workflow inputs"},"addAllFields":true,"multiKeyMatch":false,"supportAutoMap":false}},"displayOptions":{"show":{"source":["database"]},"hide":{"workflowId":[""]}}},{"displayName":"Workflow JSON","name":"workflowJson","type":"json","typeOptions":{"rows":10},"displayOptions":{"show":{"source":["parameter"]}},"default":"\n\n\n\n\n\n\n\n\n","required":true,"description":"The workflow JSON code to execute"}]},
73
- {"displayName":"Call n8n Workflow Tool","name":"toolWorkflow","icon":"fa:network-wired","iconColor":"black","group":["transform"],"description":"Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.","codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Recommended Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolworkflow/"}]}},"defaultVersion":2.1,"version":[1,1.1,1.2,1.3],"defaults":{"name":"Call n8n Workflow Tool"},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"See an example of a workflow to suggest meeting slots using AI <a href=\"/templates/1953\" target=\"_blank\">here</a>.","name":"noticeTemplateExample","type":"notice","default":""},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"My_Color_Tool","displayOptions":{"show":{"@version":[1]}}},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"e.g. My_Color_Tool","validateType":"string-alphanumeric","description":"The name of the function to be called, could contain letters, numbers, and underscores only","displayOptions":{"show":{"@version":[{"_cnd":{"gte":1.1}}]}}},{"displayName":"Description","name":"description","type":"string","default":"","placeholder":"Call this tool to get a random color. The input should be a string with comma separted names of colors to exclude.","typeOptions":{"rows":3}},{"displayName":"This tool will call the workflow you define below, and look in the last node for the response. The workflow needs to start with an Execute Workflow trigger","name":"executeNotice","type":"notice","default":""},{"displayName":"Source","name":"source","type":"options","options":[{"name":"Database","value":"database","description":"Load the workflow from the database by ID"},{"name":"Define Below","value":"parameter","description":"Pass the JSON code of a workflow"}],"default":"database","description":"Where to get the workflow to execute from"},{"displayName":"Workflow ID","name":"workflowId","type":"string","displayOptions":{"show":{"source":["database"],"@version":[{"_cnd":{"lte":1.1}}]}},"default":"","required":true,"description":"The workflow to execute","hint":"Can be found in the URL of the workflow"},{"displayName":"Workflow","name":"workflowId","type":"workflowSelector","displayOptions":{"show":{"source":["database"],"@version":[{"_cnd":{"gte":1.2}}]}},"default":"","required":true},{"displayName":"Workflow JSON","name":"workflowJson","type":"json","typeOptions":{"rows":10},"displayOptions":{"show":{"source":["parameter"]}},"default":"\n\n\n\n\n\n\n\n\n","required":true,"description":"The workflow JSON code to execute"},{"displayName":"Field to Return","name":"responsePropertyName","type":"string","default":"response","required":true,"hint":"The field in the last-executed node of the workflow that contains the response","description":"Where to find the data that this tool should return. n8n will look in the output of the last-executed node of the workflow for a field with this name, and return its value.","displayOptions":{"show":{"@version":[{"_cnd":{"lt":1.3}}]}}},{"displayName":"Extra Workflow Inputs","name":"fields","placeholder":"Add Value","type":"fixedCollection","description":"These will be output by the 'execute workflow' trigger of the workflow being called","typeOptions":{"multipleValues":true,"sortable":true},"default":{},"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"e.g. fieldName","description":"Name of the field to set the value of. Supports dot-notation. Example: data.person[0].name.","requiresDataPath":"single"},{"displayName":"Type","name":"type","type":"options","description":"The field value type","options":[{"name":"String","value":"stringValue"},{"name":"Number","value":"numberValue"},{"name":"Boolean","value":"booleanValue"},{"name":"Array","value":"arrayValue"},{"name":"Object","value":"objectValue"}],"default":"stringValue"},{"displayName":"Value","name":"stringValue","type":"string","default":"","displayOptions":{"show":{"type":["stringValue"]}},"validateType":"string","ignoreValidationDuringExecution":true},{"displayName":"Value","name":"numberValue","type":"string","default":"","displayOptions":{"show":{"type":["numberValue"]}},"validateType":"number","ignoreValidationDuringExecution":true},{"displayName":"Value","name":"booleanValue","type":"options","default":"true","options":[{"name":"True","value":"true"},{"name":"False","value":"false"}],"displayOptions":{"show":{"type":["booleanValue"]}},"validateType":"boolean","ignoreValidationDuringExecution":true},{"displayName":"Value","name":"arrayValue","type":"string","default":"","placeholder":"e.g. [ arrayItem1, arrayItem2, arrayItem3 ]","displayOptions":{"show":{"type":["arrayValue"]}},"validateType":"array","ignoreValidationDuringExecution":true},{"displayName":"Value","name":"objectValue","type":"json","default":"={}","typeOptions":{"rows":2},"displayOptions":{"show":{"type":["objectValue"]}},"validateType":"object","ignoreValidationDuringExecution":true}]}]},{"displayName":"Specify Input Schema","name":"specifyInputSchema","type":"boolean","description":"Whether to specify the schema for the function. This would require the LLM to provide the input in the correct format and would validate it against the schema.","noDataExpression":true,"default":false},{"displayName":"Schema Type","name":"schemaType","type":"options","noDataExpression":true,"options":[{"name":"Generate From JSON Example","value":"fromJson","description":"Generate a schema from an example JSON object"},{"name":"Define Below","value":"manual","description":"Define the JSON schema manually"}],"default":"fromJson","description":"How to specify the schema for the function","displayOptions":{"show":{"specifyInputSchema":[true]}}},{"displayName":"JSON Example","name":"jsonSchemaExample","type":"json","default":"{\n\t\"some_input\": \"some_value\"\n}","noDataExpression":true,"typeOptions":{"rows":10},"displayOptions":{"show":{"schemaType":["fromJson"]}},"description":"Example JSON object to use to generate the schema"},{"displayName":"Input Schema","name":"inputSchema","type":"json","default":"{\n\"type\": \"object\",\n\"properties\": {\n\t\"some_input\": {\n\t\t\"type\": \"string\",\n\t\t\"description\": \"Some input to the function\"\n\t\t}\n\t}\n}","noDataExpression":true,"typeOptions":{"rows":10},"displayOptions":{"show":{"schemaType":["manual"]}},"description":"Schema to use for the function"}]},
72
+ {"displayName":"Call n8n Workflow Tool","name":"toolWorkflow","icon":"fa:network-wired","iconColor":"black","group":["transform"],"description":"Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.","codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Recommended Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolworkflow/"}]}},"defaultVersion":2.2,"defaults":{"name":"Call n8n Workflow Tool"},"version":[2,2.1,2.2],"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"See an example of a workflow to suggest meeting slots using AI <a href=\"/templates/1953\" target=\"_blank\">here</a>.","name":"noticeTemplateExample","type":"notice","default":""},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"e.g. My_Color_Tool","validateType":"string-alphanumeric","description":"The name of the function to be called, could contain letters, numbers, and underscores only","displayOptions":{"show":{"@version":[{"_cnd":{"lte":2.1}}]}}},{"displayName":"Description","name":"description","type":"string","default":"","placeholder":"Call this tool to get a random color. The input should be a string with comma separated names of colors to exclude.","typeOptions":{"rows":3}},{"displayName":"This tool will call the workflow you define below, and look in the last node for the response. The workflow needs to start with an Execute Workflow trigger","name":"executeNotice","type":"notice","default":""},{"displayName":"Source","name":"source","type":"options","options":[{"name":"Database","value":"database","description":"Load the workflow from the database by ID"},{"name":"Define Below","value":"parameter","description":"Pass the JSON code of a workflow"}],"default":"database","description":"Where to get the workflow to execute from"},{"displayName":"Workflow","name":"workflowId","type":"workflowSelector","displayOptions":{"show":{"source":["database"]}},"default":"","required":true},{"displayName":"Workflow Inputs","name":"workflowInputs","type":"resourceMapper","noDataExpression":true,"default":{"mappingMode":"defineBelow","value":null},"required":true,"typeOptions":{"loadOptionsDependsOn":["workflowId.value"],"resourceMapper":{"localResourceMapperMethod":"loadSubWorkflowInputs","valuesLabel":"Workflow Inputs","mode":"map","fieldWords":{"singular":"workflow input","plural":"workflow inputs"},"addAllFields":true,"multiKeyMatch":false,"supportAutoMap":false}},"displayOptions":{"show":{"source":["database"]},"hide":{"workflowId":[""]}}},{"displayName":"Workflow JSON","name":"workflowJson","type":"json","typeOptions":{"rows":10},"displayOptions":{"show":{"source":["parameter"]}},"default":"\n\n\n\n\n\n\n\n\n","required":true,"description":"The workflow JSON code to execute"}]},
73
+ {"displayName":"Call n8n Workflow Tool","name":"toolWorkflow","icon":"fa:network-wired","iconColor":"black","group":["transform"],"description":"Uses another n8n workflow as a tool. Allows packaging any n8n node(s) as a tool.","codex":{"categories":["AI"],"subcategories":{"AI":["Tools"],"Tools":["Recommended Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolworkflow/"}]}},"defaultVersion":2.2,"version":[1,1.1,1.2,1.3],"defaults":{"name":"Call n8n Workflow Tool"},"inputs":[],"outputs":["ai_tool"],"outputNames":["Tool"],"properties":[{"displayName":"This node must be connected to an AI agent. <a data-action='openSelectiveNodeCreator' data-action-parameter-creatorview='AI'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"}},{"displayName":"See an example of a workflow to suggest meeting slots using AI <a href=\"/templates/1953\" target=\"_blank\">here</a>.","name":"noticeTemplateExample","type":"notice","default":""},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"My_Color_Tool","displayOptions":{"show":{"@version":[1]}}},{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"e.g. My_Color_Tool","validateType":"string-alphanumeric","description":"The name of the function to be called, could contain letters, numbers, and underscores only","displayOptions":{"show":{"@version":[{"_cnd":{"gte":1.1}}]}}},{"displayName":"Description","name":"description","type":"string","default":"","placeholder":"Call this tool to get a random color. The input should be a string with comma separted names of colors to exclude.","typeOptions":{"rows":3}},{"displayName":"This tool will call the workflow you define below, and look in the last node for the response. The workflow needs to start with an Execute Workflow trigger","name":"executeNotice","type":"notice","default":""},{"displayName":"Source","name":"source","type":"options","options":[{"name":"Database","value":"database","description":"Load the workflow from the database by ID"},{"name":"Define Below","value":"parameter","description":"Pass the JSON code of a workflow"}],"default":"database","description":"Where to get the workflow to execute from"},{"displayName":"Workflow ID","name":"workflowId","type":"string","displayOptions":{"show":{"source":["database"],"@version":[{"_cnd":{"lte":1.1}}]}},"default":"","required":true,"description":"The workflow to execute","hint":"Can be found in the URL of the workflow"},{"displayName":"Workflow","name":"workflowId","type":"workflowSelector","displayOptions":{"show":{"source":["database"],"@version":[{"_cnd":{"gte":1.2}}]}},"default":"","required":true},{"displayName":"Workflow JSON","name":"workflowJson","type":"json","typeOptions":{"rows":10},"displayOptions":{"show":{"source":["parameter"]}},"default":"\n\n\n\n\n\n\n\n\n","required":true,"description":"The workflow JSON code to execute"},{"displayName":"Field to Return","name":"responsePropertyName","type":"string","default":"response","required":true,"hint":"The field in the last-executed node of the workflow that contains the response","description":"Where to find the data that this tool should return. n8n will look in the output of the last-executed node of the workflow for a field with this name, and return its value.","displayOptions":{"show":{"@version":[{"_cnd":{"lt":1.3}}]}}},{"displayName":"Extra Workflow Inputs","name":"fields","placeholder":"Add Value","type":"fixedCollection","description":"These will be output by the 'execute workflow' trigger of the workflow being called","typeOptions":{"multipleValues":true,"sortable":true},"default":{},"options":[{"name":"values","displayName":"Values","values":[{"displayName":"Name","name":"name","type":"string","default":"","placeholder":"e.g. fieldName","description":"Name of the field to set the value of. Supports dot-notation. Example: data.person[0].name.","requiresDataPath":"single"},{"displayName":"Type","name":"type","type":"options","description":"The field value type","options":[{"name":"String","value":"stringValue"},{"name":"Number","value":"numberValue"},{"name":"Boolean","value":"booleanValue"},{"name":"Array","value":"arrayValue"},{"name":"Object","value":"objectValue"}],"default":"stringValue"},{"displayName":"Value","name":"stringValue","type":"string","default":"","displayOptions":{"show":{"type":["stringValue"]}},"validateType":"string","ignoreValidationDuringExecution":true},{"displayName":"Value","name":"numberValue","type":"string","default":"","displayOptions":{"show":{"type":["numberValue"]}},"validateType":"number","ignoreValidationDuringExecution":true},{"displayName":"Value","name":"booleanValue","type":"options","default":"true","options":[{"name":"True","value":"true"},{"name":"False","value":"false"}],"displayOptions":{"show":{"type":["booleanValue"]}},"validateType":"boolean","ignoreValidationDuringExecution":true},{"displayName":"Value","name":"arrayValue","type":"string","default":"","placeholder":"e.g. [ arrayItem1, arrayItem2, arrayItem3 ]","displayOptions":{"show":{"type":["arrayValue"]}},"validateType":"array","ignoreValidationDuringExecution":true},{"displayName":"Value","name":"objectValue","type":"json","default":"={}","typeOptions":{"rows":2},"displayOptions":{"show":{"type":["objectValue"]}},"validateType":"object","ignoreValidationDuringExecution":true}]}]},{"displayName":"Specify Input Schema","name":"specifyInputSchema","type":"boolean","description":"Whether to specify the schema for the function. This would require the LLM to provide the input in the correct format and would validate it against the schema.","noDataExpression":true,"default":false},{"displayName":"Schema Type","name":"schemaType","type":"options","noDataExpression":true,"options":[{"name":"Generate From JSON Example","value":"fromJson","description":"Generate a schema from an example JSON object"},{"name":"Define Below","value":"manual","description":"Define the JSON schema manually"}],"default":"fromJson","description":"How to specify the schema for the function","displayOptions":{"show":{"specifyInputSchema":[true]}}},{"displayName":"JSON Example","name":"jsonSchemaExample","type":"json","default":"{\n\t\"some_input\": \"some_value\"\n}","noDataExpression":true,"typeOptions":{"rows":10},"displayOptions":{"show":{"schemaType":["fromJson"]}},"description":"Example JSON object to use to generate the schema"},{"displayName":"Input Schema","name":"inputSchema","type":"json","default":"{\n\"type\": \"object\",\n\"properties\": {\n\t\"some_input\": {\n\t\t\"type\": \"string\",\n\t\t\"description\": \"Some input to the function\"\n\t\t}\n\t}\n}","noDataExpression":true,"typeOptions":{"rows":10},"displayOptions":{"show":{"schemaType":["manual"]}},"description":"Schema to use for the function"}]},
74
74
  {"displayName":"Manual Chat Trigger","name":"manualChatTrigger","icon":"fa:comments","group":["trigger"],"version":[1,1.1],"description":"Runs the flow on new manual chat message","eventTriggerDescription":"","maxNodes":1,"hidden":true,"defaults":{"name":"When chat message received","color":"#909298"},"codex":{"categories":["Core Nodes"],"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.chattrigger/"}]},"subcategories":{"Core Nodes":["Other Trigger Nodes"]}},"inputs":[],"outputs":["main"],"properties":[{"displayName":"This node is where a manual chat workflow execution starts. To make one, go back to the canvas and click ‘Chat’","name":"notice","type":"notice","default":""},{"displayName":"Chat and execute workflow","name":"openChat","type":"button","typeOptions":{"buttonConfig":{"action":"openChat"}},"default":""}]},
75
75
  {"displayName":"Chat Trigger","name":"chatTrigger","icon":"fa:comments","iconColor":"black","group":["trigger"],"version":[1,1.1],"description":"Runs the workflow when an n8n generated webchat is submitted","defaults":{"name":"When chat message received"},"codex":{"categories":["Core Nodes"],"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.chattrigger/"}]}},"maxNodes":1,"inputs":"={{ (() => {\n\t\t\tif (!['hostedChat', 'webhook'].includes($parameter.mode)) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tif ($parameter.options?.loadPreviousSession !== 'memory') {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Memory',\n\t\t\t\t\tmaxConnections: 1,\n\t\t\t\t\ttype: 'ai_memory',\n\t\t\t\t\trequired: true,\n\t\t\t\t}\n\t\t\t];\n\t\t })() }}","outputs":["main"],"credentials":[{"name":"httpBasicAuth","required":true,"displayOptions":{"show":{"authentication":["basicAuth"]}}}],"webhooks":[{"name":"setup","httpMethod":"GET","responseMode":"onReceived","path":"chat","ndvHideUrl":true},{"name":"default","httpMethod":"POST","responseMode":"={{$parameter.options?.[\"responseMode\"] || \"lastNode\" }}","path":"chat","ndvHideMethod":true,"ndvHideUrl":"={{ !$parameter.public }}"}],"eventTriggerDescription":"Waiting for you to submit the chat","activationMessage":"You can now make calls to your production chat URL.","triggerPanel":false,"properties":[{"displayName":"Make Chat Publicly Available","name":"public","type":"boolean","default":false,"description":"Whether the chat should be publicly available or only accessible through the manual chat interface"},{"displayName":"Mode","name":"mode","type":"options","options":[{"name":"Hosted Chat","value":"hostedChat","description":"Chat on a page served by n8n"},{"name":"Embedded Chat","value":"webhook","description":"Chat through a widget embedded in another page, or by calling a webhook"}],"default":"hostedChat","displayOptions":{"show":{"public":[true]}}},{"displayName":"Chat will be live at the URL above once you activate this workflow. Live executions will show up in the ‘executions’ tab","name":"hostedChatNotice","type":"notice","displayOptions":{"show":{"mode":["hostedChat"],"public":[true]}},"default":""},{"displayName":"Follow the instructions <a href=\"https://www.npmjs.com/package/@n8n/chat\" target=\"_blank\">here</a> to embed chat in a webpage (or just call the webhook URL at the top of this section). Chat will be live once you activate this workflow","name":"embeddedChatNotice","type":"notice","displayOptions":{"show":{"mode":["webhook"],"public":[true]}},"default":""},{"displayName":"Authentication","name":"authentication","type":"options","displayOptions":{"show":{"public":[true]}},"options":[{"name":"Basic Auth","value":"basicAuth","description":"Simple username and password (the same one for all users)"},{"name":"n8n User Auth","value":"n8nUserAuth","description":"Require user to be logged in with their n8n account"},{"name":"None","value":"none"}],"default":"none","description":"The way to authenticate"},{"displayName":"Initial Message(s)","name":"initialMessages","type":"string","displayOptions":{"show":{"mode":["hostedChat"],"public":[true]}},"typeOptions":{"rows":3},"default":"Hi there! 👋\nMy name is Nathan. How can I assist you today?","description":"Default messages shown at the start of the chat, one per line"},{"displayName":"Options","name":"options","type":"collection","displayOptions":{"show":{"public":[false],"@version":[{"_cnd":{"gte":1.1}}]}},"placeholder":"Add Field","default":{},"options":[{"displayName":"Allow File Uploads","name":"allowFileUploads","type":"boolean","default":false,"description":"Whether to allow file uploads in the chat"},{"displayName":"Allowed File Mime Types","name":"allowedFilesMimeTypes","type":"string","default":"*","placeholder":"e.g. image/*, text/*, application/pdf","description":"Allowed file types for upload. Comma-separated list of <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\" target=\"_blank\">MIME types</a>."}]},{"displayName":"Options","name":"options","type":"collection","displayOptions":{"show":{"mode":["hostedChat","webhook"],"public":[true]}},"placeholder":"Add Field","default":{},"options":[{"displayName":"Allowed Origins (CORS)","name":"allowedOrigins","type":"string","default":"*","description":"Comma-separated list of URLs allowed for cross-origin non-preflight requests. Use * (default) to allow all origins.","displayOptions":{"show":{"/mode":["hostedChat","webhook"]}}},{"displayName":"Allow File Uploads","name":"allowFileUploads","type":"boolean","default":false,"description":"Whether to allow file uploads in the chat","displayOptions":{"show":{"/mode":["hostedChat"]}}},{"displayName":"Allowed File Mime Types","name":"allowedFilesMimeTypes","type":"string","default":"*","placeholder":"e.g. image/*, text/*, application/pdf","description":"Allowed file types for upload. Comma-separated list of <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\" target=\"_blank\">MIME types</a>.","displayOptions":{"show":{"/mode":["hostedChat"]}}},{"displayName":"Input Placeholder","name":"inputPlaceholder","type":"string","displayOptions":{"show":{"/mode":["hostedChat"]}},"default":"Type your question..","placeholder":"e.g. Type your message here","description":"Shown as placeholder text in the chat input field"},{"displayName":"Load Previous Session","name":"loadPreviousSession","type":"options","options":[{"name":"Off","value":"notSupported","description":"Loading messages of previous session is turned off"},{"name":"From Memory","value":"memory","description":"Load session messages from memory"},{"name":"Manually","value":"manually","description":"Manually return messages of session"}],"default":"notSupported","description":"If loading messages of a previous session should be enabled"},{"displayName":"Response Mode","name":"responseMode","type":"options","options":[{"name":"When Last Node Finishes","value":"lastNode","description":"Returns data of the last-executed node"},{"name":"Using 'Respond to Webhook' Node","value":"responseNode","description":"Response defined in that node"}],"default":"lastNode","description":"When and how to respond to the webhook"},{"displayName":"Require Button Click to Start Chat","name":"showWelcomeScreen","type":"boolean","displayOptions":{"show":{"/mode":["hostedChat"]}},"default":false,"description":"Whether to show the welcome screen at the start of the chat"},{"displayName":"Start Conversation Button Text","name":"getStarted","type":"string","displayOptions":{"show":{"showWelcomeScreen":[true],"/mode":["hostedChat"]}},"default":"New Conversation","placeholder":"e.g. New Conversation","description":"Shown as part of the welcome screen, in the middle of the chat window"},{"displayName":"Subtitle","name":"subtitle","type":"string","displayOptions":{"show":{"/mode":["hostedChat"]}},"default":"Start a chat. We're here to help you 24/7.","placeholder":"e.g. We're here for you","description":"Shown at the top of the chat, under the title"},{"displayName":"Title","name":"title","type":"string","displayOptions":{"show":{"/mode":["hostedChat"]}},"default":"Hi there! 👋","placeholder":"e.g. Welcome","description":"Shown at the top of the chat"},{"displayName":"Custom Chat Styling","name":"customCss","type":"string","typeOptions":{"rows":10,"editor":"cssEditor"},"displayOptions":{"show":{"/mode":["hostedChat"]}},"default":":root {\n /* Colors */\n --chat--color-primary: #e74266;\n --chat--color-primary-shade-50: #db4061;\n --chat--color-primary-shade-100: #cf3c5c;\n --chat--color-secondary: #20b69e;\n --chat--color-secondary-shade-50: #1ca08a;\n --chat--color-white: #ffffff;\n --chat--color-light: #f2f4f8;\n --chat--color-light-shade-50: #e6e9f1;\n --chat--color-light-shade-100: #c2c5cc;\n --chat--color-medium: #d2d4d9;\n --chat--color-dark: #101330;\n --chat--color-disabled: #777980;\n --chat--color-typing: #404040;\n\n /* Base Layout */\n --chat--spacing: 1rem;\n --chat--border-radius: 0.25rem;\n --chat--transition-duration: 0.15s;\n --chat--font-family: (\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Oxygen-Sans,\n Ubuntu,\n Cantarell,\n 'Helvetica Neue',\n sans-serif\n );\n\n /* Window Dimensions */\n --chat--window--width: 400px;\n --chat--window--height: 600px;\n --chat--window--bottom: var(--chat--spacing);\n --chat--window--right: var(--chat--spacing);\n --chat--window--z-index: 9999;\n --chat--window--border: 1px solid var(--chat--color-light-shade-50);\n --chat--window--border-radius: var(--chat--border-radius);\n --chat--window--margin-bottom: var(--chat--spacing);\n\n /* Header Styles */\n --chat--header-height: auto;\n --chat--header--padding: var(--chat--spacing);\n --chat--header--background: var(--chat--color-dark);\n --chat--header--color: var(--chat--color-light);\n --chat--header--border-top: none;\n --chat--header--border-bottom: none;\n --chat--header--border-left: none;\n --chat--header--border-right: none;\n --chat--heading--font-size: 2em;\n --chat--subtitle--font-size: inherit;\n --chat--subtitle--line-height: 1.8;\n\n /* Message Styles */\n --chat--message--font-size: 1rem;\n --chat--message--padding: var(--chat--spacing);\n --chat--message--border-radius: var(--chat--border-radius);\n --chat--message-line-height: 1.5;\n --chat--message--margin-bottom: calc(var(--chat--spacing) * 1);\n --chat--message--bot--background: var(--chat--color-white);\n --chat--message--bot--color: var(--chat--color-dark);\n --chat--message--bot--border: none;\n --chat--message--user--background: var(--chat--color-secondary);\n --chat--message--user--color: var(--chat--color-white);\n --chat--message--user--border: none;\n --chat--message--pre--background: rgba(0, 0, 0, 0.05);\n --chat--messages-list--padding: var(--chat--spacing);\n\n /* Toggle Button */\n --chat--toggle--size: 64px;\n --chat--toggle--width: var(--chat--toggle--size);\n --chat--toggle--height: var(--chat--toggle--size);\n --chat--toggle--border-radius: 50%;\n --chat--toggle--background: var(--chat--color-primary);\n --chat--toggle--hover--background: var(--chat--color-primary-shade-50);\n --chat--toggle--active--background: var(--chat--color-primary-shade-100);\n --chat--toggle--color: var(--chat--color-white);\n\n /* Input Area */\n --chat--textarea--height: 50px;\n --chat--textarea--max-height: 30rem;\n --chat--input--font-size: inherit;\n --chat--input--border: 0;\n --chat--input--border-radius: 0;\n --chat--input--padding: 0.8rem;\n --chat--input--background: var(--chat--color-white);\n --chat--input--text-color: initial;\n --chat--input--line-height: 1.5;\n --chat--input--placeholder--font-size: var(--chat--input--font-size);\n --chat--input--border-active: 0;\n --chat--input--left--panel--width: 2rem;\n\n /* Button Styles */\n --chat--button--color: var(--chat--color-light);\n --chat--button--background: var(--chat--color-primary);\n --chat--button--padding: calc(var(--chat--spacing) * 1 / 2) var(--chat--spacing);\n --chat--button--border-radius: var(--chat--border-radius);\n --chat--button--hover--color: var(--chat--color-light);\n --chat--button--hover--background: var(--chat--color-primary-shade-50);\n --chat--close--button--color-hover: var(--chat--color-primary);\n\n /* Send and File Buttons */\n --chat--input--send--button--background: var(--chat--color-white);\n --chat--input--send--button--color: var(--chat--color-light);\n --chat--input--send--button--background-hover: var(--chat--color-primary-shade-50);\n --chat--input--send--button--color-hover: var(--chat--color-secondary-shade-50);\n --chat--input--file--button--background: var(--chat--color-white);\n --chat--input--file--button--color: var(--chat--color-secondary);\n --chat--input--file--button--background-hover: var(--chat--input--file--button--background);\n --chat--input--file--button--color-hover: var(--chat--color-secondary-shade-50);\n --chat--files-spacing: 0.25rem;\n\n /* Body and Footer */\n --chat--body--background: var(--chat--color-light);\n --chat--footer--background: var(--chat--color-light);\n --chat--footer--color: var(--chat--color-dark);\n}\n\n\n/* You can override any class styles, too. Right-click inspect in Chat UI to find class to override. */\n.chat-message {\n\tmax-width: 50%;\n}","description":"Override default styling of the public chat interface with CSS"}]}]},
76
76
  {"displayName":"Simple Vector Store","name":"vectorStoreInMemory","description":"Work with your data in a Simple Vector Store. Don't use this for production usage.","icon":"fa:database","iconColor":"black","group":["transform"],"version":[1,1.1],"defaults":{"name":"Simple Vector Store"},"codex":{"categories":["AI"],"subcategories":{"AI":["Vector Stores","Tools","Root Nodes"],"Tools":["Other Tools"]},"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreinmemory/"}]}},"inputs":"={{\n\t\t\t((parameters) => {\n\t\t\t\tconst mode = parameters?.mode;\n\t\t\t\tconst inputs = [{ displayName: \"Embedding\", type: \"ai_embedding\", required: true, maxConnections: 1}]\n\n\t\t\t\tif (mode === 'retrieve-as-tool') {\n\t\t\t\t\treturn inputs;\n\t\t\t\t}\n\n\t\t\t\tif (['insert', 'load', 'update'].includes(mode)) {\n\t\t\t\t\tinputs.push({ displayName: \"\", type: \"main\"})\n\t\t\t\t}\n\n\t\t\t\tif (['insert'].includes(mode)) {\n\t\t\t\t\tinputs.push({ displayName: \"Document\", type: \"ai_document\", required: true, maxConnections: 1})\n\t\t\t\t}\n\t\t\t\treturn inputs\n\t\t\t})($parameter)\n\t\t}}","outputs":"={{\n\t\t\t((parameters) => {\n\t\t\t\tconst mode = parameters?.mode ?? 'retrieve';\n\n\t\t\t\tif (mode === 'retrieve-as-tool') {\n\t\t\t\t\treturn [{ displayName: \"Tool\", type: \"ai_tool\"}]\n\t\t\t\t}\n\n\t\t\t\tif (mode === 'retrieve') {\n\t\t\t\t\treturn [{ displayName: \"Vector Store\", type: \"ai_vectorStore\"}]\n\t\t\t\t}\n\t\t\t\treturn [{ displayName: \"\", type: \"main\"}]\n\t\t\t})($parameter)\n\t\t}}","properties":[{"displayName":"Operation Mode","name":"mode","type":"options","noDataExpression":true,"default":"retrieve","options":[{"name":"Get Many","value":"load","description":"Get many ranked documents from vector store for query","action":"Get ranked documents from vector store"},{"name":"Insert Documents","value":"insert","description":"Insert documents into vector store","action":"Add documents to vector store"},{"name":"Retrieve Documents (As Vector Store for Chain/Tool)","value":"retrieve","description":"Retrieve documents from vector store to be used as vector store with AI nodes","action":"Retrieve documents for Chain/Tool as Vector Store","outputConnectionType":"ai_vectorStore"},{"name":"Retrieve Documents (As Tool for AI Agent)","value":"retrieve-as-tool","description":"Retrieve documents from vector store to be used as tool with AI nodes","action":"Retrieve documents for AI Agent as Tool","outputConnectionType":"ai_tool"}]},{"displayName":"This node must be connected to a vector store retriever. <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='ai_retriever'>Insert one</a>","name":"notice","type":"notice","default":"","typeOptions":{"containerClass":"ndv-connection-hint-notice"},"displayOptions":{"show":{"mode":["retrieve"]}}},{"displayName":"Name","name":"toolName","type":"string","default":"","required":true,"description":"Name of the vector store","placeholder":"e.g. company_knowledge_base","validateType":"string-alphanumeric","displayOptions":{"show":{"mode":["retrieve-as-tool"]}}},{"displayName":"Description","name":"toolDescription","type":"string","default":"","required":true,"typeOptions":{"rows":2},"description":"Explain to the LLM what this tool does, a good, specific description would allow LLMs to produce expected results much more often","placeholder":"e.g. Work with your data in a Simple Vector Store. Don't use this for production usage.","displayOptions":{"show":{"mode":["retrieve-as-tool"]}}},{"displayName":"Memory Key","name":"memoryKey","type":"string","default":"vector_store_key","description":"The key to use to store the vector memory in the workflow data. The key will be prefixed with the workflow ID to avoid collisions."},{"displayName":"Embedding Batch Size","name":"embeddingBatchSize","type":"number","default":200,"description":"Number of documents to embed in a single batch","displayOptions":{"show":{"mode":["insert"],"@version":[{"_cnd":{"gte":1.1}}]}}},{"displayName":"<strong>For experimental use only</strong>: Data is stored in memory and will be lost if n8n restarts. Data may also be cleared if available memory gets low. <a href=\"https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreinmemory/\">More info</a>","name":"notice","type":"notice","default":"","displayOptions":{"show":{"mode":["insert"]}}},{"displayName":"Clear Store","name":"clearStore","type":"boolean","default":false,"description":"Whether to clear the store before inserting new data","displayOptions":{"show":{"mode":["insert"]}}},{"displayName":"Prompt","name":"prompt","type":"string","default":"","required":true,"description":"Search prompt to retrieve matching documents from the vector store using similarity-based ranking","displayOptions":{"show":{"mode":["load"]}}},{"displayName":"Limit","name":"topK","type":"number","default":4,"description":"Number of top results to fetch from vector store","displayOptions":{"show":{"mode":["load","retrieve-as-tool"]}}},{"displayName":"Include Metadata","name":"includeDocumentMetadata","type":"boolean","default":true,"description":"Whether or not to include document metadata","displayOptions":{"show":{"mode":["load","retrieve-as-tool"]}}},{"displayName":"ID","name":"id","type":"string","default":"","required":true,"description":"ID of an embedding entry","displayOptions":{"show":{"mode":["update"]}}}]},
@@ -28,6 +28,7 @@ __export(helpers_exports, {
28
28
  isChatInstance: () => isChatInstance,
29
29
  isToolsInstance: () => isToolsInstance,
30
30
  logAiEvent: () => logAiEvent,
31
+ nodeNameToToolName: () => nodeNameToToolName,
31
32
  serializeChatHistory: () => serializeChatHistory,
32
33
  unwrapNestedOutput: () => unwrapNestedOutput
33
34
  });
@@ -172,6 +173,9 @@ function unwrapNestedOutput(output) {
172
173
  }
173
174
  return output;
174
175
  }
176
+ function nodeNameToToolName(node) {
177
+ return node.name.replace(/ /g, "_");
178
+ }
175
179
  // Annotate the CommonJS export names for ESM import in node:
176
180
  0 && (module.exports = {
177
181
  escapeSingleCurlyBrackets,
@@ -184,6 +188,7 @@ function unwrapNestedOutput(output) {
184
188
  isChatInstance,
185
189
  isToolsInstance,
186
190
  logAiEvent,
191
+ nodeNameToToolName,
187
192
  serializeChatHistory,
188
193
  unwrapNestedOutput
189
194
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../utils/helpers.ts"],"sourcesContent":["import type { BaseChatMessageHistory } from '@langchain/core/chat_history';\nimport type { BaseChatModel } from '@langchain/core/language_models/chat_models';\nimport type { BaseLLM } from '@langchain/core/language_models/llms';\nimport type { BaseMessage } from '@langchain/core/messages';\nimport type { Tool } from '@langchain/core/tools';\nimport { Toolkit } from 'langchain/agents';\nimport type { BaseChatMemory } from 'langchain/memory';\nimport { NodeConnectionTypes, NodeOperationError, jsonStringify } from 'n8n-workflow';\nimport type {\n\tAiEvent,\n\tIDataObject,\n\tIExecuteFunctions,\n\tISupplyDataFunctions,\n\tIWebhookFunctions,\n} from 'n8n-workflow';\n\nimport { N8nTool } from './N8nTool';\n\nfunction hasMethods<T>(obj: unknown, ...methodNames: Array<string | symbol>): obj is T {\n\treturn methodNames.every(\n\t\t(methodName) =>\n\t\t\ttypeof obj === 'object' &&\n\t\t\tobj !== null &&\n\t\t\tmethodName in obj &&\n\t\t\ttypeof (obj as Record<string | symbol, unknown>)[methodName] === 'function',\n\t);\n}\n\nexport function getMetadataFiltersValues(\n\tctx: IExecuteFunctions | ISupplyDataFunctions,\n\titemIndex: number,\n): Record<string, never> | undefined {\n\tconst options = ctx.getNodeParameter('options', itemIndex, {});\n\n\tif (options.metadata) {\n\t\tconst { metadataValues: metadata } = options.metadata as {\n\t\t\tmetadataValues: Array<{\n\t\t\t\tname: string;\n\t\t\t\tvalue: string;\n\t\t\t}>;\n\t\t};\n\t\tif (metadata.length > 0) {\n\t\t\treturn metadata.reduce((acc, { name, value }) => ({ ...acc, [name]: value }), {});\n\t\t}\n\t}\n\n\tif (options.searchFilterJson) {\n\t\treturn ctx.getNodeParameter('options.searchFilterJson', itemIndex, '', {\n\t\t\tensureType: 'object',\n\t\t}) as Record<string, never>;\n\t}\n\n\treturn undefined;\n}\n\nexport function isBaseChatMemory(obj: unknown) {\n\treturn hasMethods<BaseChatMemory>(obj, 'loadMemoryVariables', 'saveContext');\n}\n\nexport function isBaseChatMessageHistory(obj: unknown) {\n\treturn hasMethods<BaseChatMessageHistory>(obj, 'getMessages', 'addMessage');\n}\n\nexport function isChatInstance(model: unknown): model is BaseChatModel {\n\tconst namespace = (model as BaseLLM)?.lc_namespace ?? [];\n\n\treturn namespace.includes('chat_models');\n}\n\nexport function isToolsInstance(model: unknown): model is Tool {\n\tconst namespace = (model as Tool)?.lc_namespace ?? [];\n\n\treturn namespace.includes('tools');\n}\n\nexport function getPromptInputByType(options: {\n\tctx: IExecuteFunctions;\n\ti: number;\n\tpromptTypeKey: string;\n\tinputKey: string;\n}) {\n\tconst { ctx, i, promptTypeKey, inputKey } = options;\n\tconst prompt = ctx.getNodeParameter(promptTypeKey, i) as string;\n\n\tlet input;\n\tif (prompt === 'auto') {\n\t\tinput = ctx.evaluateExpression('{{ $json[\"chatInput\"] }}', i) as string;\n\t} else {\n\t\tinput = ctx.getNodeParameter(inputKey, i) as string;\n\t}\n\n\tif (input === undefined) {\n\t\tthrow new NodeOperationError(ctx.getNode(), 'No prompt specified', {\n\t\t\tdescription:\n\t\t\t\t\"Expected to find the prompt in an input field called 'chatInput' (this is what the chat trigger node outputs). To use something else, change the 'Prompt' parameter\",\n\t\t});\n\t}\n\n\treturn input;\n}\n\nexport function getSessionId(\n\tctx: ISupplyDataFunctions | IWebhookFunctions,\n\titemIndex: number,\n\tselectorKey = 'sessionIdType',\n\tautoSelect = 'fromInput',\n\tcustomKey = 'sessionKey',\n) {\n\tlet sessionId = '';\n\tconst selectorType = ctx.getNodeParameter(selectorKey, itemIndex) as string;\n\n\tif (selectorType === autoSelect) {\n\t\t// If memory node is used in webhook like node(like chat trigger node), it doesn't have access to evaluateExpression\n\t\t// so we try to extract sessionId from the bodyData\n\t\tif ('getBodyData' in ctx) {\n\t\t\tconst bodyData = ctx.getBodyData() ?? {};\n\t\t\tsessionId = bodyData.sessionId as string;\n\t\t} else {\n\t\t\tsessionId = ctx.evaluateExpression('{{ $json.sessionId }}', itemIndex) as string;\n\t\t}\n\n\t\tif (sessionId === '' || sessionId === undefined) {\n\t\t\tthrow new NodeOperationError(ctx.getNode(), 'No session ID found', {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Expected to find the session ID in an input field called 'sessionId' (this is what the chat trigger node outputs). To use something else, change the 'Session ID' parameter\",\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t}\n\t} else {\n\t\tsessionId = ctx.getNodeParameter(customKey, itemIndex, '') as string;\n\t\tif (sessionId === '' || sessionId === undefined) {\n\t\t\tthrow new NodeOperationError(ctx.getNode(), 'Key parameter is empty', {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Provide a key to use as session ID in the 'Key' parameter or use the 'Connected Chat Trigger Node' option to use the session ID from your Chat Trigger\",\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn sessionId;\n}\n\nexport function logAiEvent(\n\texecuteFunctions: IExecuteFunctions | ISupplyDataFunctions,\n\tevent: AiEvent,\n\tdata?: IDataObject,\n) {\n\ttry {\n\t\texecuteFunctions.logAiEvent(event, data ? jsonStringify(data) : undefined);\n\t} catch (error) {\n\t\texecuteFunctions.logger.debug(`Error logging AI event: ${event}`);\n\t}\n}\n\nexport function serializeChatHistory(chatHistory: BaseMessage[]): string {\n\treturn chatHistory\n\t\t.map((chatMessage) => {\n\t\t\tif (chatMessage._getType() === 'human') {\n\t\t\t\treturn `Human: ${chatMessage.content}`;\n\t\t\t} else if (chatMessage._getType() === 'ai') {\n\t\t\t\treturn `Assistant: ${chatMessage.content}`;\n\t\t\t} else {\n\t\t\t\treturn `${chatMessage.content}`;\n\t\t\t}\n\t\t})\n\t\t.join('\\n');\n}\n\nexport function escapeSingleCurlyBrackets(text?: string): string | undefined {\n\tif (text === undefined) return undefined;\n\n\tlet result = text;\n\n\tresult = result\n\t\t// First handle triple brackets to avoid interference with double brackets\n\t\t.replace(/(?<!{){{{(?!{)/g, '{{{{')\n\t\t.replace(/(?<!})}}}(?!})/g, '}}}}')\n\t\t// Then handle single brackets, but only if they're not part of double brackets\n\t\t// Convert single { to {{ if it's not already part of {{ or {{{\n\t\t.replace(/(?<!{){(?!{)/g, '{{')\n\t\t// Convert single } to }} if it's not already part of }} or }}}\n\t\t.replace(/(?<!})}(?!})/g, '}}');\n\n\treturn result;\n}\n\nexport const getConnectedTools = async (\n\tctx: IExecuteFunctions | IWebhookFunctions,\n\tenforceUniqueNames: boolean,\n\tconvertStructuredTool: boolean = true,\n\tescapeCurlyBrackets: boolean = false,\n) => {\n\tconst connectedTools = (\n\t\t((await ctx.getInputConnectionData(NodeConnectionTypes.AiTool, 0)) as Array<Toolkit | Tool>) ??\n\t\t[]\n\t).flatMap((toolOrToolkit) => {\n\t\tif (toolOrToolkit instanceof Toolkit) {\n\t\t\treturn toolOrToolkit.getTools() as Tool[];\n\t\t}\n\n\t\treturn toolOrToolkit;\n\t});\n\n\tif (!enforceUniqueNames) return connectedTools;\n\n\tconst seenNames = new Set<string>();\n\n\tconst finalTools: Tool[] = [];\n\n\tfor (const tool of connectedTools) {\n\t\tconst { name } = tool;\n\t\tif (seenNames.has(name)) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tctx.getNode(),\n\t\t\t\t`You have multiple tools with the same name: '${name}', please rename them to avoid conflicts`,\n\t\t\t);\n\t\t}\n\t\tseenNames.add(name);\n\n\t\tif (escapeCurlyBrackets) {\n\t\t\ttool.description = escapeSingleCurlyBrackets(tool.description) ?? tool.description;\n\t\t}\n\n\t\tif (convertStructuredTool && tool instanceof N8nTool) {\n\t\t\tfinalTools.push(tool.asDynamicTool());\n\t\t} else {\n\t\t\tfinalTools.push(tool);\n\t\t}\n\t}\n\n\treturn finalTools;\n};\n\n/**\n * Sometimes model output is wrapped in an additional object property.\n * This function unwraps the output if it is in the format { output: { output: { ... } } }\n */\nexport function unwrapNestedOutput(output: Record<string, unknown>): Record<string, unknown> {\n\tif (\n\t\t'output' in output &&\n\t\tObject.keys(output).length === 1 &&\n\t\ttypeof output.output === 'object' &&\n\t\toutput.output !== null &&\n\t\t'output' in output.output &&\n\t\tObject.keys(output.output).length === 1\n\t) {\n\t\treturn output.output as Record<string, unknown>;\n\t}\n\n\treturn output;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,oBAAwB;AAExB,0BAAuE;AASvE,qBAAwB;AAExB,SAAS,WAAc,QAAiB,aAA+C;AACtF,SAAO,YAAY;AAAA,IAClB,CAAC,eACA,OAAO,QAAQ,YACf,QAAQ,QACR,cAAc,OACd,OAAQ,IAAyC,UAAU,MAAM;AAAA,EACnE;AACD;AAEO,SAAS,yBACf,KACA,WACoC;AACpC,QAAM,UAAU,IAAI,iBAAiB,WAAW,WAAW,CAAC,CAAC;AAE7D,MAAI,QAAQ,UAAU;AACrB,UAAM,EAAE,gBAAgB,SAAS,IAAI,QAAQ;AAM7C,QAAI,SAAS,SAAS,GAAG;AACxB,aAAO,SAAS,OAAO,CAAC,KAAK,EAAE,MAAM,MAAM,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC,CA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,CAAC,GACA,QAAQ,CAAC,kBAAkB;AAC5B,QAAI,yBAAyB,uBAAS;AACrC,aAAO,cAAc,SAAS;AAAA,IAC/B;AAEA,WAAO;AAAA,EACR,CAAC;AAED,MAAI,CAAC,mBAAoB,QAAO;AAEhC,QAAM,YAAY,oBAAI,IAAY;AAElC,QAAM,aAAqB,CAAC;AAE5B,aAAW,QAAQ,gBAAgB;AAClC,UAAM,EAAE,KAAK,IAAI;AACjB,QAAI,UAAU,IAAI,IAAI,GAAG;AACxB,YAAM,IAAI;AAAA,QACT,IAAI,QAAQ;AAAA,QACZ,gDAAgD,IAAI;AAAA,MACrD;AAAA,IACD;AACA,cAAU,IAAI,IAAI;AAElB,QAAI,qBAAqB;AACxB,WAAK,cAAc,0BAA0B,KAAK,WAAW,KAAK,KAAK;AAAA,IACxE;AAEA,QAAI,yBAAyB,gBAAgB,wBAAS;AACrD,iBAAW,KAAK,KAAK,cAAc,CAAC;AAAA,IACrC,OAAO;AACN,iBAAW,KAAK,IAAI;AAAA,IACrB;AAAA,EACD;AAEA,SAAO;AACR;AAMO,SAAS,mBAAmB,QAA0D;AAC5F,MACC,YAAY,UACZ,OAAO,KAAK,MAAM,EAAE,WAAW,KAC/B,OAAO,OAAO,WAAW,YACzB,OAAO,WAAW,QAClB,YAAY,OAAO,UACnB,OAAO,KAAK,OAAO,MAAM,EAAE,WAAW,GACrC;AACD,WAAO,OAAO;AAAA,EACf;AAEA,SAAO;AACR;","names":[]}
1
+ {"version":3,"sources":["../../utils/helpers.ts"],"sourcesContent":["import type { BaseChatMessageHistory } from '@langchain/core/chat_history';\nimport type { BaseChatModel } from '@langchain/core/language_models/chat_models';\nimport type { BaseLLM } from '@langchain/core/language_models/llms';\nimport type { BaseMessage } from '@langchain/core/messages';\nimport type { Tool } from '@langchain/core/tools';\nimport { Toolkit } from 'langchain/agents';\nimport type { BaseChatMemory } from 'langchain/memory';\nimport { NodeConnectionTypes, NodeOperationError, jsonStringify } from 'n8n-workflow';\nimport type {\n\tAiEvent,\n\tINode,\n\tIDataObject,\n\tIExecuteFunctions,\n\tISupplyDataFunctions,\n\tIWebhookFunctions,\n} from 'n8n-workflow';\n\nimport { N8nTool } from './N8nTool';\n\nfunction hasMethods<T>(obj: unknown, ...methodNames: Array<string | symbol>): obj is T {\n\treturn methodNames.every(\n\t\t(methodName) =>\n\t\t\ttypeof obj === 'object' &&\n\t\t\tobj !== null &&\n\t\t\tmethodName in obj &&\n\t\t\ttypeof (obj as Record<string | symbol, unknown>)[methodName] === 'function',\n\t);\n}\n\nexport function getMetadataFiltersValues(\n\tctx: IExecuteFunctions | ISupplyDataFunctions,\n\titemIndex: number,\n): Record<string, never> | undefined {\n\tconst options = ctx.getNodeParameter('options', itemIndex, {});\n\n\tif (options.metadata) {\n\t\tconst { metadataValues: metadata } = options.metadata as {\n\t\t\tmetadataValues: Array<{\n\t\t\t\tname: string;\n\t\t\t\tvalue: string;\n\t\t\t}>;\n\t\t};\n\t\tif (metadata.length > 0) {\n\t\t\treturn metadata.reduce((acc, { name, value }) => ({ ...acc, [name]: value }), {});\n\t\t}\n\t}\n\n\tif (options.searchFilterJson) {\n\t\treturn ctx.getNodeParameter('options.searchFilterJson', itemIndex, '', {\n\t\t\tensureType: 'object',\n\t\t}) as Record<string, never>;\n\t}\n\n\treturn undefined;\n}\n\nexport function isBaseChatMemory(obj: unknown) {\n\treturn hasMethods<BaseChatMemory>(obj, 'loadMemoryVariables', 'saveContext');\n}\n\nexport function isBaseChatMessageHistory(obj: unknown) {\n\treturn hasMethods<BaseChatMessageHistory>(obj, 'getMessages', 'addMessage');\n}\n\nexport function isChatInstance(model: unknown): model is BaseChatModel {\n\tconst namespace = (model as BaseLLM)?.lc_namespace ?? [];\n\n\treturn namespace.includes('chat_models');\n}\n\nexport function isToolsInstance(model: unknown): model is Tool {\n\tconst namespace = (model as Tool)?.lc_namespace ?? [];\n\n\treturn namespace.includes('tools');\n}\n\nexport function getPromptInputByType(options: {\n\tctx: IExecuteFunctions;\n\ti: number;\n\tpromptTypeKey: string;\n\tinputKey: string;\n}) {\n\tconst { ctx, i, promptTypeKey, inputKey } = options;\n\tconst prompt = ctx.getNodeParameter(promptTypeKey, i) as string;\n\n\tlet input;\n\tif (prompt === 'auto') {\n\t\tinput = ctx.evaluateExpression('{{ $json[\"chatInput\"] }}', i) as string;\n\t} else {\n\t\tinput = ctx.getNodeParameter(inputKey, i) as string;\n\t}\n\n\tif (input === undefined) {\n\t\tthrow new NodeOperationError(ctx.getNode(), 'No prompt specified', {\n\t\t\tdescription:\n\t\t\t\t\"Expected to find the prompt in an input field called 'chatInput' (this is what the chat trigger node outputs). To use something else, change the 'Prompt' parameter\",\n\t\t});\n\t}\n\n\treturn input;\n}\n\nexport function getSessionId(\n\tctx: ISupplyDataFunctions | IWebhookFunctions,\n\titemIndex: number,\n\tselectorKey = 'sessionIdType',\n\tautoSelect = 'fromInput',\n\tcustomKey = 'sessionKey',\n) {\n\tlet sessionId = '';\n\tconst selectorType = ctx.getNodeParameter(selectorKey, itemIndex) as string;\n\n\tif (selectorType === autoSelect) {\n\t\t// If memory node is used in webhook like node(like chat trigger node), it doesn't have access to evaluateExpression\n\t\t// so we try to extract sessionId from the bodyData\n\t\tif ('getBodyData' in ctx) {\n\t\t\tconst bodyData = ctx.getBodyData() ?? {};\n\t\t\tsessionId = bodyData.sessionId as string;\n\t\t} else {\n\t\t\tsessionId = ctx.evaluateExpression('{{ $json.sessionId }}', itemIndex) as string;\n\t\t}\n\n\t\tif (sessionId === '' || sessionId === undefined) {\n\t\t\tthrow new NodeOperationError(ctx.getNode(), 'No session ID found', {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Expected to find the session ID in an input field called 'sessionId' (this is what the chat trigger node outputs). To use something else, change the 'Session ID' parameter\",\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t}\n\t} else {\n\t\tsessionId = ctx.getNodeParameter(customKey, itemIndex, '') as string;\n\t\tif (sessionId === '' || sessionId === undefined) {\n\t\t\tthrow new NodeOperationError(ctx.getNode(), 'Key parameter is empty', {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Provide a key to use as session ID in the 'Key' parameter or use the 'Connected Chat Trigger Node' option to use the session ID from your Chat Trigger\",\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn sessionId;\n}\n\nexport function logAiEvent(\n\texecuteFunctions: IExecuteFunctions | ISupplyDataFunctions,\n\tevent: AiEvent,\n\tdata?: IDataObject,\n) {\n\ttry {\n\t\texecuteFunctions.logAiEvent(event, data ? jsonStringify(data) : undefined);\n\t} catch (error) {\n\t\texecuteFunctions.logger.debug(`Error logging AI event: ${event}`);\n\t}\n}\n\nexport function serializeChatHistory(chatHistory: BaseMessage[]): string {\n\treturn chatHistory\n\t\t.map((chatMessage) => {\n\t\t\tif (chatMessage._getType() === 'human') {\n\t\t\t\treturn `Human: ${chatMessage.content}`;\n\t\t\t} else if (chatMessage._getType() === 'ai') {\n\t\t\t\treturn `Assistant: ${chatMessage.content}`;\n\t\t\t} else {\n\t\t\t\treturn `${chatMessage.content}`;\n\t\t\t}\n\t\t})\n\t\t.join('\\n');\n}\n\nexport function escapeSingleCurlyBrackets(text?: string): string | undefined {\n\tif (text === undefined) return undefined;\n\n\tlet result = text;\n\n\tresult = result\n\t\t// First handle triple brackets to avoid interference with double brackets\n\t\t.replace(/(?<!{){{{(?!{)/g, '{{{{')\n\t\t.replace(/(?<!})}}}(?!})/g, '}}}}')\n\t\t// Then handle single brackets, but only if they're not part of double brackets\n\t\t// Convert single { to {{ if it's not already part of {{ or {{{\n\t\t.replace(/(?<!{){(?!{)/g, '{{')\n\t\t// Convert single } to }} if it's not already part of }} or }}}\n\t\t.replace(/(?<!})}(?!})/g, '}}');\n\n\treturn result;\n}\n\nexport const getConnectedTools = async (\n\tctx: IExecuteFunctions | IWebhookFunctions,\n\tenforceUniqueNames: boolean,\n\tconvertStructuredTool: boolean = true,\n\tescapeCurlyBrackets: boolean = false,\n) => {\n\tconst connectedTools = (\n\t\t((await ctx.getInputConnectionData(NodeConnectionTypes.AiTool, 0)) as Array<Toolkit | Tool>) ??\n\t\t[]\n\t).flatMap((toolOrToolkit) => {\n\t\tif (toolOrToolkit instanceof Toolkit) {\n\t\t\treturn toolOrToolkit.getTools() as Tool[];\n\t\t}\n\n\t\treturn toolOrToolkit;\n\t});\n\n\tif (!enforceUniqueNames) return connectedTools;\n\n\tconst seenNames = new Set<string>();\n\n\tconst finalTools: Tool[] = [];\n\n\tfor (const tool of connectedTools) {\n\t\tconst { name } = tool;\n\t\tif (seenNames.has(name)) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tctx.getNode(),\n\t\t\t\t`You have multiple tools with the same name: '${name}', please rename them to avoid conflicts`,\n\t\t\t);\n\t\t}\n\t\tseenNames.add(name);\n\n\t\tif (escapeCurlyBrackets) {\n\t\t\ttool.description = escapeSingleCurlyBrackets(tool.description) ?? tool.description;\n\t\t}\n\n\t\tif (convertStructuredTool && tool instanceof N8nTool) {\n\t\t\tfinalTools.push(tool.asDynamicTool());\n\t\t} else {\n\t\t\tfinalTools.push(tool);\n\t\t}\n\t}\n\n\treturn finalTools;\n};\n\n/**\n * Sometimes model output is wrapped in an additional object property.\n * This function unwraps the output if it is in the format { output: { output: { ... } } }\n */\nexport function unwrapNestedOutput(output: Record<string, unknown>): Record<string, unknown> {\n\tif (\n\t\t'output' in output &&\n\t\tObject.keys(output).length === 1 &&\n\t\ttypeof output.output === 'object' &&\n\t\toutput.output !== null &&\n\t\t'output' in output.output &&\n\t\tObject.keys(output.output).length === 1\n\t) {\n\t\treturn output.output as Record<string, unknown>;\n\t}\n\n\treturn output;\n}\n\nexport function nodeNameToToolName(node: INode): string {\n\treturn node.name.replace(/ /g, '_');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,oBAAwB;AAExB,0BAA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C/B,OAAO,OAAO,WAAW,YACzB,OAAO,WAAW,QAClB,YAAY,OAAO,UACnB,OAAO,KAAK,OAAO,MAAM,EAAE,WAAW,GACrC;AACD,WAAO,OAAO;AAAA,EACf;AAEA,SAAO;AACR;AAEO,SAAS,mBAAmB,MAAqB;AACvD,SAAO,KAAK,KAAK,QAAQ,MAAM,GAAG;AACnC;","names":[]}
@@ -308,7 +308,8 @@ function logWrapper(originalInstance, executeFunctions) {
308
308
  });
309
309
  (0, import_helpers.logAiEvent)(executeFunctions, "ai-tool-called", { ...inputData, response });
310
310
  executeFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);
311
- return response;
311
+ if (typeof response === "string") return response;
312
+ return JSON.stringify(response);
312
313
  };
313
314
  }
314
315
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../utils/logWrapper.ts"],"sourcesContent":["import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';\nimport type { BaseCallbackConfig, Callbacks } from '@langchain/core/callbacks/manager';\nimport type { BaseChatMessageHistory } from '@langchain/core/chat_history';\nimport type { Document } from '@langchain/core/documents';\nimport { Embeddings } from '@langchain/core/embeddings';\nimport type { InputValues, MemoryVariables, OutputValues } from '@langchain/core/memory';\nimport type { BaseMessage } from '@langchain/core/messages';\nimport { BaseRetriever } from '@langchain/core/retrievers';\nimport type { StructuredTool, Tool } from '@langchain/core/tools';\nimport { VectorStore } from '@langchain/core/vectorstores';\nimport { TextSplitter } from '@langchain/textsplitters';\nimport type { BaseDocumentLoader } from 'langchain/dist/document_loaders/base';\nimport type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tISupplyDataFunctions,\n\tITaskMetadata,\n\tNodeConnectionType,\n} from 'n8n-workflow';\nimport { NodeOperationError, NodeConnectionTypes, parseErrorMetadata } from 'n8n-workflow';\n\nimport { logAiEvent, isToolsInstance, isBaseChatMemory, isBaseChatMessageHistory } from './helpers';\nimport { N8nBinaryLoader } from './N8nBinaryLoader';\nimport { N8nJsonLoader } from './N8nJsonLoader';\n\nexport async function callMethodAsync<T>(\n\tthis: T,\n\tparameters: {\n\t\texecuteFunctions: IExecuteFunctions | ISupplyDataFunctions;\n\t\tconnectionType: NodeConnectionType;\n\t\tcurrentNodeRunIndex: number;\n\t\tmethod: (...args: any[]) => Promise<unknown>;\n\t\targuments: unknown[];\n\t},\n): Promise<unknown> {\n\ttry {\n\t\treturn await parameters.method.call(this, ...parameters.arguments);\n\t} catch (e) {\n\t\tconst connectedNode = parameters.executeFunctions.getNode();\n\n\t\tconst error = new NodeOperationError(connectedNode, e, {\n\t\t\tfunctionality: 'configuration-node',\n\t\t});\n\n\t\tconst metadata = parseErrorMetadata(error);\n\t\tparameters.executeFunctions.addOutputData(\n\t\t\tparameters.connectionType,\n\t\t\tparameters.currentNodeRunIndex,\n\t\t\terror,\n\t\t\tmetadata,\n\t\t);\n\n\t\tif (error.message) {\n\t\t\tif (!error.description) {\n\t\t\t\terror.description = error.message;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\tthrow new NodeOperationError(\n\t\t\tconnectedNode,\n\t\t\t`Error on node \"${connectedNode.name}\" which is connected via input \"${parameters.connectionType}\"`,\n\t\t\t{ functionality: 'configuration-node' },\n\t\t);\n\t}\n}\n\nexport function callMethodSync<T>(\n\tthis: T,\n\tparameters: {\n\t\texecuteFunctions: IExecuteFunctions;\n\t\tconnectionType: NodeConnectionType;\n\t\tcurrentNodeRunIndex: number;\n\t\tmethod: (...args: any[]) => T;\n\t\targuments: unknown[];\n\t},\n): unknown {\n\ttry {\n\t\treturn parameters.method.call(this, ...parameters.arguments);\n\t} catch (e) {\n\t\tconst connectedNode = parameters.executeFunctions.getNode();\n\t\tconst error = new NodeOperationError(connectedNode, e);\n\t\tparameters.executeFunctions.addOutputData(\n\t\t\tparameters.connectionType,\n\t\t\tparameters.currentNodeRunIndex,\n\t\t\terror,\n\t\t);\n\n\t\tthrow new NodeOperationError(\n\t\t\tconnectedNode,\n\t\t\t`Error on node \"${connectedNode.name}\" which is connected via input \"${parameters.connectionType}\"`,\n\t\t\t{ functionality: 'configuration-node' },\n\t\t);\n\t}\n}\n\nexport function logWrapper<\n\tT extends\n\t\t| Tool\n\t\t| StructuredTool\n\t\t| BaseChatMemory\n\t\t| BaseChatMessageHistory\n\t\t| BaseRetriever\n\t\t| Embeddings\n\t\t| Document[]\n\t\t| Document\n\t\t| BaseDocumentLoader\n\t\t| TextSplitter\n\t\t| VectorStore\n\t\t| N8nBinaryLoader\n\t\t| N8nJsonLoader,\n>(originalInstance: T, executeFunctions: IExecuteFunctions | ISupplyDataFunctions): T {\n\treturn new Proxy(originalInstance, {\n\t\tget: (target, prop) => {\n\t\t\tlet connectionType: NodeConnectionType | undefined;\n\t\t\t// ========== BaseChatMemory ==========\n\t\t\tif (isBaseChatMemory(originalInstance)) {\n\t\t\t\tif (prop === 'loadMemoryVariables' && 'loadMemoryVariables' in target) {\n\t\t\t\t\treturn async (values: InputValues): Promise<MemoryVariables> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiMemory;\n\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { action: 'loadMemoryVariables', values } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [values],\n\t\t\t\t\t\t})) as MemoryVariables;\n\n\t\t\t\t\t\tconst chatHistory = (response?.chat_history as BaseMessage[]) ?? response;\n\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [\n\t\t\t\t\t\t\t[{ json: { action: 'loadMemoryVariables', chatHistory } }],\n\t\t\t\t\t\t]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t} else if (prop === 'saveContext' && 'saveContext' in target) {\n\t\t\t\t\treturn async (input: InputValues, output: OutputValues): Promise<MemoryVariables> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiMemory;\n\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { action: 'saveContext', input, output } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [input, output],\n\t\t\t\t\t\t})) as MemoryVariables;\n\n\t\t\t\t\t\tconst chatHistory = await target.chatHistory.getMessages();\n\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [\n\t\t\t\t\t\t\t[{ json: { action: 'saveContext', chatHistory } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== BaseChatMessageHistory ==========\n\t\t\tif (isBaseChatMessageHistory(originalInstance)) {\n\t\t\t\tif (prop === 'getMessages' && 'getMessages' in target) {\n\t\t\t\t\treturn async (): Promise<BaseMessage[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiMemory;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { action: 'getMessages' } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [],\n\t\t\t\t\t\t})) as BaseMessage[];\n\n\t\t\t\t\t\tconst payload = { action: 'getMessages', response };\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: payload }]]);\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-messages-retrieved-from-memory', { response });\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t} else if (prop === 'addMessage' && 'addMessage' in target) {\n\t\t\t\t\treturn async (message: BaseMessage): Promise<void> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiMemory;\n\t\t\t\t\t\tconst payload = { action: 'addMessage', message };\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [[{ json: payload }]]);\n\n\t\t\t\t\t\tawait callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [message],\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-message-added-to-memory', { message });\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: payload }]]);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== BaseRetriever ==========\n\t\t\tif (originalInstance instanceof BaseRetriever) {\n\t\t\t\tif (prop === 'getRelevantDocuments' && 'getRelevantDocuments' in target) {\n\t\t\t\t\treturn async (\n\t\t\t\t\t\tquery: string,\n\t\t\t\t\t\tconfig?: Callbacks | BaseCallbackConfig,\n\t\t\t\t\t): Promise<Document[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiRetriever;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { query, config } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [query, config],\n\t\t\t\t\t\t})) as Array<Document<Record<string, any>>>;\n\n\t\t\t\t\t\tconst executionId: string | undefined = response[0]?.metadata?.executionId as string;\n\t\t\t\t\t\tconst workflowId: string | undefined = response[0]?.metadata?.workflowId as string;\n\n\t\t\t\t\t\tconst metadata: ITaskMetadata = {};\n\t\t\t\t\t\tif (executionId && workflowId) {\n\t\t\t\t\t\t\tmetadata.subExecution = {\n\t\t\t\t\t\t\t\texecutionId,\n\t\t\t\t\t\t\t\tworkflowId,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-documents-retrieved', { query });\n\t\t\t\t\t\texecuteFunctions.addOutputData(\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t[[{ json: { response } }]],\n\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== Embeddings ==========\n\t\t\tif (originalInstance instanceof Embeddings) {\n\t\t\t\t// Docs -> Embeddings\n\t\t\t\tif (prop === 'embedDocuments' && 'embedDocuments' in target) {\n\t\t\t\t\treturn async (documents: string[]): Promise<number[][]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiEmbedding;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { documents } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [documents],\n\t\t\t\t\t\t})) as number[][];\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-document-embedded');\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t// Query -> Embeddings\n\t\t\t\tif (prop === 'embedQuery' && 'embedQuery' in target) {\n\t\t\t\t\treturn async (query: string): Promise<number[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiEmbedding;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { query } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [query],\n\t\t\t\t\t\t})) as number[];\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-query-embedded');\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== N8n Loaders Process All ==========\n\t\t\tif (\n\t\t\t\toriginalInstance instanceof N8nJsonLoader ||\n\t\t\t\toriginalInstance instanceof N8nBinaryLoader\n\t\t\t) {\n\t\t\t\t// Process All\n\t\t\t\tif (prop === 'processAll' && 'processAll' in target) {\n\t\t\t\t\treturn async (items: INodeExecutionData[]): Promise<number[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiDocument;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [items]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [items],\n\t\t\t\t\t\t})) as number[];\n\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Process Each\n\t\t\t\tif (prop === 'processItem' && 'processItem' in target) {\n\t\t\t\t\treturn async (item: INodeExecutionData, itemIndex: number): Promise<number[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiDocument;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [[item]]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [item, itemIndex],\n\t\t\t\t\t\t})) as number[];\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-document-processed');\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [\n\t\t\t\t\t\t\t[{ json: { response }, pairedItem: { item: itemIndex } }],\n\t\t\t\t\t\t]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== TextSplitter ==========\n\t\t\tif (originalInstance instanceof TextSplitter) {\n\t\t\t\tif (prop === 'splitText' && 'splitText' in target) {\n\t\t\t\t\treturn async (text: string): Promise<string[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiTextSplitter;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { textSplitter: text } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [text],\n\t\t\t\t\t\t})) as string[];\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-text-split');\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== Tool ==========\n\t\t\tif (isToolsInstance(originalInstance)) {\n\t\t\t\tif (prop === '_call' && '_call' in target) {\n\t\t\t\t\treturn async (query: string): Promise<string> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiTool;\n\t\t\t\t\t\tconst inputData: IDataObject = { query };\n\n\t\t\t\t\t\tif (target.metadata?.isFromToolkit) {\n\t\t\t\t\t\t\tinputData.tool = {\n\t\t\t\t\t\t\t\tname: target.name,\n\t\t\t\t\t\t\t\tdescription: target.description,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: inputData }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [query],\n\t\t\t\t\t\t})) as string;\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-tool-called', { ...inputData, response });\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== VectorStore ==========\n\t\t\tif (originalInstance instanceof VectorStore) {\n\t\t\t\tif (prop === 'similaritySearch' && 'similaritySearch' in target) {\n\t\t\t\t\treturn async (\n\t\t\t\t\t\tquery: string,\n\t\t\t\t\t\tk?: number,\n\t\t\t\t\t\tfilter?: BiquadFilterType | undefined,\n\t\t\t\t\t\t_callbacks?: Callbacks | undefined,\n\t\t\t\t\t): Promise<Document[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiVectorStore;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { query, k, filter } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [query, k, filter, _callbacks],\n\t\t\t\t\t\t})) as Array<Document<Record<string, any>>>;\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-vector-store-searched', { query });\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn (target as any)[prop];\n\t\t},\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,wBAA2B;AAG3B,wBAA8B;AAE9B,0BAA4B;AAC5B,2BAA6B;AAU7B,0BAA4E;AAE5E,qBAAwF;AACxF,6BAAgC;AAChC,2BAA8B;AAE9B,eAAsB,gBAErB,YAOmB;AACnB,MAAI;AACH,WAAO,MAAM,WAAW,OAAO,KAAK,MAAM,GAAG,WAAW,SAAS;AAAA,EAClE,SAAS,GAAG;AACX,UAAM,gBAAgB,WAAW,iBAAiB,QAAQ;AAE1D,UAAM,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AAa,gBAAgB;AAAA,cAC/D,CAAC,EAAE,MAAM,UAAU,CAAC;AAAA,YACrB,CAAC;AAED,kBAAM,WAAY,MAAM,gBAAgB,KAAK,QAAQ;AAAA,cACpD;AAAA,cACA;AAAA,cACA,qBAAqB;AAAA,cACrB,QAAQ,OAAO,IAAI;AAAA,cACnB,WAAW,CAAC,KAAK;AAAA,YAClB,CAAC;AAED,2CAAW,kBAAkB,kBAAkB,EAAE,GAAG,WAAW,SAAS,CAAC;AACzE,6BAAiB,cAAc,gBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AAChF,mBAAO;AAAA,UACR;AAAA,QACD;AAAA,MACD;AAGA,UAAI,4BAA4B,iCAAa;AAC5C,YAAI,SAAS,sBAAsB,sBAAsB,QAAQ;AAChE,iBAAO,OACN,OACA,GACA,QACA,eACyB;AACzB,6BAAiB,wCAAoB;AACrC,kBAAM,EAAE,MAAM,IAAI,iBAAiB,aAAa,gBAAgB;AAAA,cAC/D,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;AAAA,YAChC,CAAC;AAED,kBAAM,WAAY,MAAM,gBAAgB,KAAK,QAAQ;AAAA,cACpD;AAAA,cACA;AAAA,cACA,qBAAqB;AAAA,cACrB,QAAQ,OAAO,IAAI;AAAA,cACnB,WAAW,CAAC,OAAO,GAAG,QAAQ,UAAU;AAAA,YACzC,CAAC;AAED,2CAAW,kBAAkB,4BAA4B,EAAE,MAAM,CAAC;AAClE,6BAAiB,cAAc,gBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AAEhF,mBAAO;AAAA,UACR;AAAA,QACD;AAAA,MACD;AAGA,aAAQ,OAAe,IAAI;AAAA,IAC5B;AAAA,EACD,CAAC;AACF;","names":[]}
1
+ {"version":3,"sources":["../../utils/logWrapper.ts"],"sourcesContent":["import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';\nimport type { BaseCallbackConfig, Callbacks } from '@langchain/core/callbacks/manager';\nimport type { BaseChatMessageHistory } from '@langchain/core/chat_history';\nimport type { Document } from '@langchain/core/documents';\nimport { Embeddings } from '@langchain/core/embeddings';\nimport type { InputValues, MemoryVariables, OutputValues } from '@langchain/core/memory';\nimport type { BaseMessage } from '@langchain/core/messages';\nimport { BaseRetriever } from '@langchain/core/retrievers';\nimport type { StructuredTool, Tool } from '@langchain/core/tools';\nimport { VectorStore } from '@langchain/core/vectorstores';\nimport { TextSplitter } from '@langchain/textsplitters';\nimport type { BaseDocumentLoader } from 'langchain/dist/document_loaders/base';\nimport type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tISupplyDataFunctions,\n\tITaskMetadata,\n\tNodeConnectionType,\n} from 'n8n-workflow';\nimport { NodeOperationError, NodeConnectionTypes, parseErrorMetadata } from 'n8n-workflow';\n\nimport { logAiEvent, isToolsInstance, isBaseChatMemory, isBaseChatMessageHistory } from './helpers';\nimport { N8nBinaryLoader } from './N8nBinaryLoader';\nimport { N8nJsonLoader } from './N8nJsonLoader';\n\nexport async function callMethodAsync<T>(\n\tthis: T,\n\tparameters: {\n\t\texecuteFunctions: IExecuteFunctions | ISupplyDataFunctions;\n\t\tconnectionType: NodeConnectionType;\n\t\tcurrentNodeRunIndex: number;\n\t\tmethod: (...args: any[]) => Promise<unknown>;\n\t\targuments: unknown[];\n\t},\n): Promise<unknown> {\n\ttry {\n\t\treturn await parameters.method.call(this, ...parameters.arguments);\n\t} catch (e) {\n\t\tconst connectedNode = parameters.executeFunctions.getNode();\n\n\t\tconst error = new NodeOperationError(connectedNode, e, {\n\t\t\tfunctionality: 'configuration-node',\n\t\t});\n\n\t\tconst metadata = parseErrorMetadata(error);\n\t\tparameters.executeFunctions.addOutputData(\n\t\t\tparameters.connectionType,\n\t\t\tparameters.currentNodeRunIndex,\n\t\t\terror,\n\t\t\tmetadata,\n\t\t);\n\n\t\tif (error.message) {\n\t\t\tif (!error.description) {\n\t\t\t\terror.description = error.message;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\tthrow new NodeOperationError(\n\t\t\tconnectedNode,\n\t\t\t`Error on node \"${connectedNode.name}\" which is connected via input \"${parameters.connectionType}\"`,\n\t\t\t{ functionality: 'configuration-node' },\n\t\t);\n\t}\n}\n\nexport function callMethodSync<T>(\n\tthis: T,\n\tparameters: {\n\t\texecuteFunctions: IExecuteFunctions;\n\t\tconnectionType: NodeConnectionType;\n\t\tcurrentNodeRunIndex: number;\n\t\tmethod: (...args: any[]) => T;\n\t\targuments: unknown[];\n\t},\n): unknown {\n\ttry {\n\t\treturn parameters.method.call(this, ...parameters.arguments);\n\t} catch (e) {\n\t\tconst connectedNode = parameters.executeFunctions.getNode();\n\t\tconst error = new NodeOperationError(connectedNode, e);\n\t\tparameters.executeFunctions.addOutputData(\n\t\t\tparameters.connectionType,\n\t\t\tparameters.currentNodeRunIndex,\n\t\t\terror,\n\t\t);\n\n\t\tthrow new NodeOperationError(\n\t\t\tconnectedNode,\n\t\t\t`Error on node \"${connectedNode.name}\" which is connected via input \"${parameters.connectionType}\"`,\n\t\t\t{ functionality: 'configuration-node' },\n\t\t);\n\t}\n}\n\nexport function logWrapper<\n\tT extends\n\t\t| Tool\n\t\t| StructuredTool\n\t\t| BaseChatMemory\n\t\t| BaseChatMessageHistory\n\t\t| BaseRetriever\n\t\t| Embeddings\n\t\t| Document[]\n\t\t| Document\n\t\t| BaseDocumentLoader\n\t\t| TextSplitter\n\t\t| VectorStore\n\t\t| N8nBinaryLoader\n\t\t| N8nJsonLoader,\n>(originalInstance: T, executeFunctions: IExecuteFunctions | ISupplyDataFunctions): T {\n\treturn new Proxy(originalInstance, {\n\t\tget: (target, prop) => {\n\t\t\tlet connectionType: NodeConnectionType | undefined;\n\t\t\t// ========== BaseChatMemory ==========\n\t\t\tif (isBaseChatMemory(originalInstance)) {\n\t\t\t\tif (prop === 'loadMemoryVariables' && 'loadMemoryVariables' in target) {\n\t\t\t\t\treturn async (values: InputValues): Promise<MemoryVariables> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiMemory;\n\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { action: 'loadMemoryVariables', values } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [values],\n\t\t\t\t\t\t})) as MemoryVariables;\n\n\t\t\t\t\t\tconst chatHistory = (response?.chat_history as BaseMessage[]) ?? response;\n\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [\n\t\t\t\t\t\t\t[{ json: { action: 'loadMemoryVariables', chatHistory } }],\n\t\t\t\t\t\t]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t} else if (prop === 'saveContext' && 'saveContext' in target) {\n\t\t\t\t\treturn async (input: InputValues, output: OutputValues): Promise<MemoryVariables> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiMemory;\n\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { action: 'saveContext', input, output } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [input, output],\n\t\t\t\t\t\t})) as MemoryVariables;\n\n\t\t\t\t\t\tconst chatHistory = await target.chatHistory.getMessages();\n\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [\n\t\t\t\t\t\t\t[{ json: { action: 'saveContext', chatHistory } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== BaseChatMessageHistory ==========\n\t\t\tif (isBaseChatMessageHistory(originalInstance)) {\n\t\t\t\tif (prop === 'getMessages' && 'getMessages' in target) {\n\t\t\t\t\treturn async (): Promise<BaseMessage[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiMemory;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { action: 'getMessages' } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [],\n\t\t\t\t\t\t})) as BaseMessage[];\n\n\t\t\t\t\t\tconst payload = { action: 'getMessages', response };\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: payload }]]);\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-messages-retrieved-from-memory', { response });\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t} else if (prop === 'addMessage' && 'addMessage' in target) {\n\t\t\t\t\treturn async (message: BaseMessage): Promise<void> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiMemory;\n\t\t\t\t\t\tconst payload = { action: 'addMessage', message };\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [[{ json: payload }]]);\n\n\t\t\t\t\t\tawait callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [message],\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-message-added-to-memory', { message });\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: payload }]]);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== BaseRetriever ==========\n\t\t\tif (originalInstance instanceof BaseRetriever) {\n\t\t\t\tif (prop === 'getRelevantDocuments' && 'getRelevantDocuments' in target) {\n\t\t\t\t\treturn async (\n\t\t\t\t\t\tquery: string,\n\t\t\t\t\t\tconfig?: Callbacks | BaseCallbackConfig,\n\t\t\t\t\t): Promise<Document[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiRetriever;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { query, config } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [query, config],\n\t\t\t\t\t\t})) as Array<Document<Record<string, any>>>;\n\n\t\t\t\t\t\tconst executionId: string | undefined = response[0]?.metadata?.executionId as string;\n\t\t\t\t\t\tconst workflowId: string | undefined = response[0]?.metadata?.workflowId as string;\n\n\t\t\t\t\t\tconst metadata: ITaskMetadata = {};\n\t\t\t\t\t\tif (executionId && workflowId) {\n\t\t\t\t\t\t\tmetadata.subExecution = {\n\t\t\t\t\t\t\t\texecutionId,\n\t\t\t\t\t\t\t\tworkflowId,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-documents-retrieved', { query });\n\t\t\t\t\t\texecuteFunctions.addOutputData(\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t[[{ json: { response } }]],\n\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== Embeddings ==========\n\t\t\tif (originalInstance instanceof Embeddings) {\n\t\t\t\t// Docs -> Embeddings\n\t\t\t\tif (prop === 'embedDocuments' && 'embedDocuments' in target) {\n\t\t\t\t\treturn async (documents: string[]): Promise<number[][]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiEmbedding;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { documents } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [documents],\n\t\t\t\t\t\t})) as number[][];\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-document-embedded');\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t// Query -> Embeddings\n\t\t\t\tif (prop === 'embedQuery' && 'embedQuery' in target) {\n\t\t\t\t\treturn async (query: string): Promise<number[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiEmbedding;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { query } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [query],\n\t\t\t\t\t\t})) as number[];\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-query-embedded');\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== N8n Loaders Process All ==========\n\t\t\tif (\n\t\t\t\toriginalInstance instanceof N8nJsonLoader ||\n\t\t\t\toriginalInstance instanceof N8nBinaryLoader\n\t\t\t) {\n\t\t\t\t// Process All\n\t\t\t\tif (prop === 'processAll' && 'processAll' in target) {\n\t\t\t\t\treturn async (items: INodeExecutionData[]): Promise<number[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiDocument;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [items]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [items],\n\t\t\t\t\t\t})) as number[];\n\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Process Each\n\t\t\t\tif (prop === 'processItem' && 'processItem' in target) {\n\t\t\t\t\treturn async (item: INodeExecutionData, itemIndex: number): Promise<number[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiDocument;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [[item]]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [item, itemIndex],\n\t\t\t\t\t\t})) as number[];\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-document-processed');\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [\n\t\t\t\t\t\t\t[{ json: { response }, pairedItem: { item: itemIndex } }],\n\t\t\t\t\t\t]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== TextSplitter ==========\n\t\t\tif (originalInstance instanceof TextSplitter) {\n\t\t\t\tif (prop === 'splitText' && 'splitText' in target) {\n\t\t\t\t\treturn async (text: string): Promise<string[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiTextSplitter;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { textSplitter: text } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [text],\n\t\t\t\t\t\t})) as string[];\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-text-split');\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== Tool ==========\n\t\t\tif (isToolsInstance(originalInstance)) {\n\t\t\t\tif (prop === '_call' && '_call' in target) {\n\t\t\t\t\treturn async (query: string): Promise<string> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiTool;\n\t\t\t\t\t\tconst inputData: IDataObject = { query };\n\n\t\t\t\t\t\tif (target.metadata?.isFromToolkit) {\n\t\t\t\t\t\t\tinputData.tool = {\n\t\t\t\t\t\t\t\tname: target.name,\n\t\t\t\t\t\t\t\tdescription: target.description,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: inputData }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [query],\n\t\t\t\t\t\t})) as string;\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-tool-called', { ...inputData, response });\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\n\t\t\t\t\t\tif (typeof response === 'string') return response;\n\t\t\t\t\t\treturn JSON.stringify(response);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ========== VectorStore ==========\n\t\t\tif (originalInstance instanceof VectorStore) {\n\t\t\t\tif (prop === 'similaritySearch' && 'similaritySearch' in target) {\n\t\t\t\t\treturn async (\n\t\t\t\t\t\tquery: string,\n\t\t\t\t\t\tk?: number,\n\t\t\t\t\t\tfilter?: BiquadFilterType | undefined,\n\t\t\t\t\t\t_callbacks?: Callbacks | undefined,\n\t\t\t\t\t): Promise<Document[]> => {\n\t\t\t\t\t\tconnectionType = NodeConnectionTypes.AiVectorStore;\n\t\t\t\t\t\tconst { index } = executeFunctions.addInputData(connectionType, [\n\t\t\t\t\t\t\t[{ json: { query, k, filter } }],\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tconst response = (await callMethodAsync.call(target, {\n\t\t\t\t\t\t\texecuteFunctions,\n\t\t\t\t\t\t\tconnectionType,\n\t\t\t\t\t\t\tcurrentNodeRunIndex: index,\n\t\t\t\t\t\t\tmethod: target[prop],\n\t\t\t\t\t\t\targuments: [query, k, filter, _callbacks],\n\t\t\t\t\t\t})) as Array<Document<Record<string, any>>>;\n\n\t\t\t\t\t\tlogAiEvent(executeFunctions, 'ai-vector-store-searched', { query });\n\t\t\t\t\t\texecuteFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);\n\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn (target as any)[prop];\n\t\t},\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,wBAA2B;AAG3B,wBAA8B;AAE9B,0BAA4B;AAC5B,2BAA6B;AAU7B,0BAA4E;AAE5E,qBAAwF;AACxF,6BAAgC;AAChC,2BAA8B;AAE9B,eAAsB,gBAErB,YAOmB;AACnB,MAAI;AACH,WAAO,MAAM,WAAW,OAAO,KAAK,MAAM,GAAG,WAAW,SAAS;AAAA,EAClE,SAAS,GAAG;AACX,UAAM,gBAAgB,WAAW,iBAAiB,QAAQ;AAE1D,UAAM,QAAQ,IAAI,uCAAmB,eAAe,GAAG;AAAA,MACtD,eAAe;AAAA,IAChB,CAAC;AAED,UAAM,eAAW,wCAAmB,KAAK;AACzC,eAAW,iBAAiB;AAAA,MAC3B,WAAW;AAAA,MACX,WAAW;AAAA,MACX;AAAA,MACA;AAAA,IACD;AAEA,QAAI,MAAM,SAAS;AAClB,UAAI,CAAC,MAAM,aAAa;AACvB,cAAM,cAAc,MAAM;AAAA,MAC3B;AACA,YAAM;AAAA,IACP;AAEA,UAAM,IAAI;AAAA,MACT;AAAA,MACA,kBAAkB,cAAc,IAAI,mCAAmC,WAAW,cAAc;AAAA,MAChG,EAAE,eAAe,qBAAqB;AAAA,IACvC;AAAA,EACD;AACD;AAEO,SAAS,eAEf,YAOU;AACV,MAAI;AACH,WAAO,WAAW,OAAO,KAAK,MAAM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,4BAA4B,iCAAa;AAC5C,YAAI,SAAS,sBAAsB,sBAAsB,QAAQ;AAChE,iBAAO,OACN,OACA,GACA,QACA,eACyB;AACzB,6BAAiB,wCAAoB;AACrC,kBAAM,EAAE,MAAM,IAAI,iBAAiB,aAAa,gBAAgB;AAAA,cAC/D,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;AAAA,YAChC,CAAC;AAED,kBAAM,WAAY,MAAM,gBAAgB,KAAK,QAAQ;AAAA,cACpD;AAAA,cACA;AAAA,cACA,qBAAqB;AAAA,cACrB,QAAQ,OAAO,IAAI;AAAA,cACnB,WAAW,CAAC,OAAO,GAAG,QAAQ,UAAU;AAAA,YACzC,CAAC;AAED,2CAAW,kBAAkB,4BAA4B,EAAE,MAAM,CAAC;AAClE,6BAAiB,cAAc,gBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AAEhF,mBAAO;AAAA,UACR;AAAA,QACD;AAAA,MACD;AAGA,aAAQ,OAAe,IAAI;AAAA,IAC5B;AAAA,EACD,CAAC;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/n8n-nodes-langchain",
3
- "version": "1.89.0",
3
+ "version": "1.90.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -133,7 +133,7 @@
133
133
  "@types/sanitize-html": "^2.11.0",
134
134
  "@types/temp": "^0.9.1",
135
135
  "tsup": "^8.4.0",
136
- "n8n-core": "1.88.0"
136
+ "n8n-core": "1.89.0"
137
137
  },
138
138
  "dependencies": {
139
139
  "@aws-sdk/client-sso-oidc": "3.666.0",
@@ -193,9 +193,9 @@
193
193
  "zod": "3.24.1",
194
194
  "zod-to-json-schema": "3.23.3",
195
195
  "@n8n/json-schema-to-zod": "1.3.0",
196
- "n8n-workflow": "1.87.0",
197
- "n8n-nodes-base": "1.88.0",
198
- "@n8n/typescript-config": "1.2.0"
196
+ "@n8n/typescript-config": "1.2.0",
197
+ "n8n-nodes-base": "1.89.0",
198
+ "n8n-workflow": "1.88.0"
199
199
  },
200
200
  "license": "SEE LICENSE IN LICENSE.md",
201
201
  "homepage": "https://n8n.io",