@n8n/n8n-nodes-langchain 1.94.0 → 1.95.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\n/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport type { Embeddings } from '@langchain/core/embeddings';\nimport type { VectorStore } from '@langchain/core/vectorstores';\nimport { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\nimport type {\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeTypeDescription,\n\tSupplyData,\n\tISupplyDataFunctions,\n\tINodeType,\n} from 'n8n-workflow';\n\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\n// Import custom types\nimport {\n\thandleLoadOperation,\n\thandleInsertOperation,\n\thandleUpdateOperation,\n\thandleRetrieveOperation,\n\thandleRetrieveAsToolOperation,\n} from './operations';\nimport type { NodeOperationMode, VectorStoreNodeConstructorArgs } from './types';\n// Import utility functions\nimport { transformDescriptionForOperationMode, getOperationModeOptions } from './utils';\n\n// Import operation handlers\n\n/**\n * Creates a vector store node with the given configuration\n * This factory function produces a complete node class that implements all vector store operations\n */\nexport const createVectorStoreNode = <T extends VectorStore = VectorStore>(\n\targs: VectorStoreNodeConstructorArgs<T>,\n) =>\n\tclass VectorStoreNodeType implements INodeType {\n\t\tdescription: INodeTypeDescription = {\n\t\t\tdisplayName: args.meta.displayName,\n\t\t\tname: args.meta.name,\n\t\t\tdescription: args.meta.description,\n\t\t\ticon: args.meta.icon,\n\t\t\ticonColor: args.meta.iconColor,\n\t\t\tgroup: ['transform'],\n\t\t\tversion: [1, 1.1],\n\t\t\tdefaults: {\n\t\t\t\tname: args.meta.displayName,\n\t\t\t},\n\t\t\tcodex: {\n\t\t\t\tcategories: ['AI'],\n\t\t\t\tsubcategories: {\n\t\t\t\t\tAI: ['Vector Stores', 'Tools', 'Root Nodes'],\n\t\t\t\t\tTools: ['Other 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: args.meta.docsUrl,\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\tcredentials: args.meta.credentials,\n\t\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\t\tinputs: `={{\n\t\t\t((parameters) => {\n\t\t\t\tconst mode = parameters?.mode;\n\t\t\t\tconst inputs = [{ displayName: \"Embedding\", type: \"${NodeConnectionTypes.AiEmbedding}\", 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: \"${NodeConnectionTypes.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: \"${NodeConnectionTypes.AiDocument}\", required: true, maxConnections: 1})\n\t\t\t\t}\n\t\t\t\treturn inputs\n\t\t\t})($parameter)\n\t\t}}`,\n\t\t\toutputs: `={{\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: \"${NodeConnectionTypes.AiTool}\"}]\n\t\t\t\t}\n\n\t\t\t\tif (mode === 'retrieve') {\n\t\t\t\t\treturn [{ displayName: \"Vector Store\", type: \"${NodeConnectionTypes.AiVectorStore}\"}]\n\t\t\t\t}\n\t\t\t\treturn [{ displayName: \"\", type: \"${NodeConnectionTypes.Main}\"}]\n\t\t\t})($parameter)\n\t\t}}`,\n\t\t\tproperties: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Operation Mode',\n\t\t\t\t\tname: 'mode',\n\t\t\t\t\ttype: 'options',\n\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\tdefault: 'retrieve',\n\t\t\t\t\toptions: getOperationModeOptions(args),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...getConnectionHintNoticeField([NodeConnectionTypes.AiRetriever]),\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['retrieve'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\tname: 'toolName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: 'Name of the vector store',\n\t\t\t\t\tplaceholder: 'e.g. company_knowledge_base',\n\t\t\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['retrieve-as-tool'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Description',\n\t\t\t\t\tname: 'toolDescription',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttypeOptions: { rows: 2 },\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Explain to the LLM what this tool does, a good, specific description would allow LLMs to produce expected results much more often',\n\t\t\t\t\tplaceholder: `e.g. ${args.meta.description}`,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['retrieve-as-tool'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t...args.sharedFields,\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Embedding Batch Size',\n\t\t\t\t\tname: 'embeddingBatchSize',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tdefault: 200,\n\t\t\t\t\tdescription: 'Number of documents to embed in a single batch',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['insert'],\n\t\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.1 } }],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t...transformDescriptionForOperationMode(args.insertFields ?? [], 'insert'),\n\t\t\t\t// Prompt and topK are always used for the load operation\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Prompt',\n\t\t\t\t\tname: 'prompt',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Search prompt to retrieve matching documents from the vector store using similarity-based ranking',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['load'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Limit',\n\t\t\t\t\tname: 'topK',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tdefault: 4,\n\t\t\t\t\tdescription: 'Number of top results to fetch from vector store',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['load', 'retrieve-as-tool'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Include Metadata',\n\t\t\t\t\tname: 'includeDocumentMetadata',\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: true,\n\t\t\t\t\tdescription: 'Whether or not to include document metadata',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['load', 'retrieve-as-tool'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// ID is always used for update operation\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'ID',\n\t\t\t\t\tname: 'id',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: 'ID of an embedding entry',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['update'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t...transformDescriptionForOperationMode(args.loadFields ?? [], [\n\t\t\t\t\t'load',\n\t\t\t\t\t'retrieve-as-tool',\n\t\t\t\t]),\n\t\t\t\t...transformDescriptionForOperationMode(args.retrieveFields ?? [], 'retrieve'),\n\t\t\t\t...transformDescriptionForOperationMode(args.updateFields ?? [], 'update'),\n\t\t\t],\n\t\t};\n\n\t\tmethods = args.methods;\n\n\t\t/**\n\t\t * Method to execute the node in regular workflow mode\n\t\t * Supports 'load', 'insert', and 'update' operation modes\n\t\t */\n\t\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\t\tconst mode = this.getNodeParameter('mode', 0) as NodeOperationMode;\n\n\t\t\t// Get the embeddings model connected to this node\n\t\t\tconst embeddings = (await this.getInputConnectionData(\n\t\t\t\tNodeConnectionTypes.AiEmbedding,\n\t\t\t\t0,\n\t\t\t)) as Embeddings;\n\n\t\t\t// Handle each operation mode with dedicated modules\n\t\t\tif (mode === 'load') {\n\t\t\t\tconst items = this.getInputData(0);\n\t\t\t\tconst resultData = [];\n\n\t\t\t\tfor (let itemIndex = 0; itemIndex < items.length; itemIndex++) {\n\t\t\t\t\tconst docs = await handleLoadOperation(this, args, embeddings, itemIndex);\n\t\t\t\t\tresultData.push(...docs);\n\t\t\t\t}\n\n\t\t\t\treturn [resultData];\n\t\t\t}\n\n\t\t\tif (mode === 'insert') {\n\t\t\t\tconst resultData = await handleInsertOperation(this, args, embeddings);\n\t\t\t\treturn [resultData];\n\t\t\t}\n\n\t\t\tif (mode === 'update') {\n\t\t\t\tconst resultData = await handleUpdateOperation(this, args, embeddings);\n\t\t\t\treturn [resultData];\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'Only the \"load\", \"update\" and \"insert\" operation modes are supported with execute',\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Method to supply data to AI nodes\n\t\t * Supports 'retrieve' and 'retrieve-as-tool' operation modes\n\t\t */\n\t\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\t\tconst mode = this.getNodeParameter('mode', 0) as NodeOperationMode;\n\n\t\t\t// Get the embeddings model connected to this node\n\t\t\tconst embeddings = (await this.getInputConnectionData(\n\t\t\t\tNodeConnectionTypes.AiEmbedding,\n\t\t\t\t0,\n\t\t\t)) as Embeddings;\n\n\t\t\t// Handle each supply data operation mode with dedicated modules\n\t\t\tif (mode === 'retrieve') {\n\t\t\t\treturn await handleRetrieveOperation(this, args, embeddings, itemIndex);\n\t\t\t}\n\n\t\t\tif (mode === 'retrieve-as-tool') {\n\t\t\t\treturn await handleRetrieveAsToolOperation(this, args, embeddings, itemIndex);\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'Only the \"retrieve\" and \"retrieve-as-tool\" operation mode is supported to supply data',\n\t\t\t);\n\t\t}\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,0BAAwD;AAUxD,0BAA6C;AAG7C,wBAMO;AAGP,mBAA8E;AAQvE,MAAM,wBAAwB,CACpC,SAEA,MAAM,oBAAyC;AAAA,EAA/C;AACC,uBAAoC;AAAA,MACnC,aAAa,KAAK,KAAK;AAAA,MACvB,MAAM,KAAK,KAAK;AAAA,MAChB,aAAa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AACrE,aAAO,CAAC,UAAU;AAAA,IACnB;AAEA,QAAI,SAAS,UAAU;AACtB,YAAM,aAAa,UAAM,yCAAsB,MAAM,MAAM,UAAU;AACrE,aAAO,CAAC,UAAU;AAAA,IACnB;AAEA,UAAM,IAAI;AAAA,MACT,KAAK,QAAQ;AAAA,MACb;AAAA,IACD;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,WAAuC,WAAwC;AACpF,UAAM,OAAO,KAAK,iBAAiB,QAAQ,CAAC;AAG5C,UAAM,aAAc,MAAM,KAAK;AAAA,MAC9B,wCAAoB;AAAA,MACpB;AAAA,IACD;AAGA,QAAI,SAAS,YAAY;AACxB,aAAO,UAAM,2CAAwB,MAAM,MAAM,YAAY,SAAS;AAAA,IACvE;AAEA,QAAI,SAAS,oBAAoB;AAChC,aAAO,UAAM,iDAA8B,MAAM,MAAM,YAAY,SAAS;AAAA,IAC7E;AAEA,UAAM,IAAI;AAAA,MACT,KAAK,QAAQ;AAAA,MACb;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../../nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\n/* eslint-disable n8n-nodes-base/node-dirname-against-convention */\nimport type { Embeddings } from '@langchain/core/embeddings';\nimport type { VectorStore } from '@langchain/core/vectorstores';\nimport { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\nimport type {\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeTypeDescription,\n\tSupplyData,\n\tISupplyDataFunctions,\n\tINodeType,\n} from 'n8n-workflow';\n\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\n// Import custom types\nimport {\n\thandleLoadOperation,\n\thandleInsertOperation,\n\thandleUpdateOperation,\n\thandleRetrieveOperation,\n\thandleRetrieveAsToolOperation,\n} from './operations';\nimport type { NodeOperationMode, VectorStoreNodeConstructorArgs } from './types';\n// Import utility functions\nimport { transformDescriptionForOperationMode, getOperationModeOptions } from './utils';\n\n// Import operation handlers\n\n/**\n * Creates a vector store node with the given configuration\n * This factory function produces a complete node class that implements all vector store operations\n */\nexport const createVectorStoreNode = <T extends VectorStore = VectorStore>(\n\targs: VectorStoreNodeConstructorArgs<T>,\n) =>\n\tclass VectorStoreNodeType implements INodeType {\n\t\tdescription: INodeTypeDescription = {\n\t\t\tdisplayName: args.meta.displayName,\n\t\t\tname: args.meta.name,\n\t\t\tdescription: args.meta.description,\n\t\t\ticon: args.meta.icon,\n\t\t\ticonColor: args.meta.iconColor,\n\t\t\tgroup: ['transform'],\n\t\t\t// 1.2 has changes to VectorStoreInMemory node.\n\t\t\tversion: [1, 1.1, 1.2],\n\t\t\tdefaults: {\n\t\t\t\tname: args.meta.displayName,\n\t\t\t},\n\t\t\tcodex: {\n\t\t\t\tcategories: ['AI'],\n\t\t\t\tsubcategories: {\n\t\t\t\t\tAI: ['Vector Stores', 'Tools', 'Root Nodes'],\n\t\t\t\t\tTools: ['Other 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: args.meta.docsUrl,\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\tcredentials: args.meta.credentials,\n\t\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node\n\t\t\tinputs: `={{\n\t\t\t((parameters) => {\n\t\t\t\tconst mode = parameters?.mode;\n\t\t\t\tconst inputs = [{ displayName: \"Embedding\", type: \"${NodeConnectionTypes.AiEmbedding}\", 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: \"${NodeConnectionTypes.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: \"${NodeConnectionTypes.AiDocument}\", required: true, maxConnections: 1})\n\t\t\t\t}\n\t\t\t\treturn inputs\n\t\t\t})($parameter)\n\t\t}}`,\n\t\t\toutputs: `={{\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: \"${NodeConnectionTypes.AiTool}\"}]\n\t\t\t\t}\n\n\t\t\t\tif (mode === 'retrieve') {\n\t\t\t\t\treturn [{ displayName: \"Vector Store\", type: \"${NodeConnectionTypes.AiVectorStore}\"}]\n\t\t\t\t}\n\t\t\t\treturn [{ displayName: \"\", type: \"${NodeConnectionTypes.Main}\"}]\n\t\t\t})($parameter)\n\t\t}}`,\n\t\t\tproperties: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Operation Mode',\n\t\t\t\t\tname: 'mode',\n\t\t\t\t\ttype: 'options',\n\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\tdefault: 'retrieve',\n\t\t\t\t\toptions: getOperationModeOptions(args),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...getConnectionHintNoticeField([NodeConnectionTypes.AiRetriever]),\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['retrieve'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\tname: 'toolName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: 'Name of the vector store',\n\t\t\t\t\tplaceholder: 'e.g. company_knowledge_base',\n\t\t\t\t\tvalidateType: 'string-alphanumeric',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['retrieve-as-tool'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Description',\n\t\t\t\t\tname: 'toolDescription',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttypeOptions: { rows: 2 },\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Explain to the LLM what this tool does, a good, specific description would allow LLMs to produce expected results much more often',\n\t\t\t\t\tplaceholder: `e.g. ${args.meta.description}`,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['retrieve-as-tool'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t...args.sharedFields,\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Embedding Batch Size',\n\t\t\t\t\tname: 'embeddingBatchSize',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tdefault: 200,\n\t\t\t\t\tdescription: 'Number of documents to embed in a single batch',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['insert'],\n\t\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.1 } }],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t...transformDescriptionForOperationMode(args.insertFields ?? [], 'insert'),\n\t\t\t\t// Prompt and topK are always used for the load operation\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Prompt',\n\t\t\t\t\tname: 'prompt',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Search prompt to retrieve matching documents from the vector store using similarity-based ranking',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['load'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Limit',\n\t\t\t\t\tname: 'topK',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tdefault: 4,\n\t\t\t\t\tdescription: 'Number of top results to fetch from vector store',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['load', 'retrieve-as-tool'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Include Metadata',\n\t\t\t\t\tname: 'includeDocumentMetadata',\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: true,\n\t\t\t\t\tdescription: 'Whether or not to include document metadata',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['load', 'retrieve-as-tool'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// ID is always used for update operation\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'ID',\n\t\t\t\t\tname: 'id',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: 'ID of an embedding entry',\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\tmode: ['update'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t...transformDescriptionForOperationMode(args.loadFields ?? [], [\n\t\t\t\t\t'load',\n\t\t\t\t\t'retrieve-as-tool',\n\t\t\t\t]),\n\t\t\t\t...transformDescriptionForOperationMode(args.retrieveFields ?? [], 'retrieve'),\n\t\t\t\t...transformDescriptionForOperationMode(args.updateFields ?? [], 'update'),\n\t\t\t],\n\t\t};\n\n\t\tmethods = args.methods;\n\n\t\t/**\n\t\t * Method to execute the node in regular workflow mode\n\t\t * Supports 'load', 'insert', and 'update' operation modes\n\t\t */\n\t\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\t\tconst mode = this.getNodeParameter('mode', 0) as NodeOperationMode;\n\n\t\t\t// Get the embeddings model connected to this node\n\t\t\tconst embeddings = (await this.getInputConnectionData(\n\t\t\t\tNodeConnectionTypes.AiEmbedding,\n\t\t\t\t0,\n\t\t\t)) as Embeddings;\n\n\t\t\t// Handle each operation mode with dedicated modules\n\t\t\tif (mode === 'load') {\n\t\t\t\tconst items = this.getInputData(0);\n\t\t\t\tconst resultData = [];\n\n\t\t\t\tfor (let itemIndex = 0; itemIndex < items.length; itemIndex++) {\n\t\t\t\t\tconst docs = await handleLoadOperation(this, args, embeddings, itemIndex);\n\t\t\t\t\tresultData.push(...docs);\n\t\t\t\t}\n\n\t\t\t\treturn [resultData];\n\t\t\t}\n\n\t\t\tif (mode === 'insert') {\n\t\t\t\tconst resultData = await handleInsertOperation(this, args, embeddings);\n\t\t\t\treturn [resultData];\n\t\t\t}\n\n\t\t\tif (mode === 'update') {\n\t\t\t\tconst resultData = await handleUpdateOperation(this, args, embeddings);\n\t\t\t\treturn [resultData];\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'Only the \"load\", \"update\" and \"insert\" operation modes are supported with execute',\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Method to supply data to AI nodes\n\t\t * Supports 'retrieve' and 'retrieve-as-tool' operation modes\n\t\t */\n\t\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\t\tconst mode = this.getNodeParameter('mode', 0) as NodeOperationMode;\n\n\t\t\t// Get the embeddings model connected to this node\n\t\t\tconst embeddings = (await this.getInputConnectionData(\n\t\t\t\tNodeConnectionTypes.AiEmbedding,\n\t\t\t\t0,\n\t\t\t)) as Embeddings;\n\n\t\t\t// Handle each supply data operation mode with dedicated modules\n\t\t\tif (mode === 'retrieve') {\n\t\t\t\treturn await handleRetrieveOperation(this, args, embeddings, itemIndex);\n\t\t\t}\n\n\t\t\tif (mode === 'retrieve-as-tool') {\n\t\t\t\treturn await handleRetrieveAsToolOperation(this, args, embeddings, itemIndex);\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'Only the \"retrieve\" and \"retrieve-as-tool\" operation mode is supported to supply data',\n\t\t\t);\n\t\t}\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,0BAAwD;AAUxD,0BAA6C;AAG7C,wBAMO;AAGP,mBAA8E;AAQvE,MAAM,wBAAwB,CACpC,SAEA,MAAM,oBAAyC;AAAA,EAA/C;AACC,uBAAoC;AAAA,MACnC,aAAa,KAAK,KAAK;AAAA,MACvB,MAAM,KAAK,KAAK;AAAA,MAChB,aAAa,KAAK,KAAK;AAAA,MACvB,MAAM,KAAK,KAAK;AAAA,MAChB,WAAW,KAAK,KAAK;AAAA,MACrB,OAAO,CAAC,WAAW;AAAA;AAAA,MAEnB,SAAS,CAAC,GAAG,KAAK,GAAG;AAAA,MACrB,UAAU;AAAA,QACT,MAAM,KAAK,KAAK;AAAA,MACjB;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,iBAAiB,SAAS,YAAY;AAAA,UAC3C,OAAO,CAAC,aAAa;AAAA,QACtB;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK,KAAK,KAAK;AAAA,YAChB;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MACA,aAAa,KAAK,KAAK;AAAA;AAAA,MAEvB,QAAQ;AAAA;AAAA;AAAA,yDAG8C,wCAAoB,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6CAO3C,wCAAoB,IAAI;AAAA;AAAA;AA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EACD;AACD;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../nodes/vector_store/shared/createVectorStoreNode/types.ts"],"sourcesContent":["import type { Document } from '@langchain/core/documents';\nimport type { Embeddings } from '@langchain/core/embeddings';\nimport type { VectorStore } from '@langchain/core/vectorstores';\nimport type {\n\tIExecuteFunctions,\n\tINodeCredentialDescription,\n\tINodeProperties,\n\tILoadOptionsFunctions,\n\tINodeListSearchResult,\n\tIcon,\n\tISupplyDataFunctions,\n\tThemeIconColor,\n} from 'n8n-workflow';\n\nexport type NodeOperationMode = 'insert' | 'load' | 'retrieve' | 'update' | 'retrieve-as-tool';\n\nexport interface NodeMeta {\n\tdisplayName: string;\n\tname: string;\n\tdescription: string;\n\tdocsUrl: string;\n\ticon: Icon;\n\ticonColor?: ThemeIconColor;\n\tcredentials?: INodeCredentialDescription[];\n\toperationModes?: NodeOperationMode[];\n}\n\nexport interface VectorStoreNodeConstructorArgs<T extends VectorStore = VectorStore> {\n\tmeta: NodeMeta;\n\tmethods?: {\n\t\tlistSearch?: {\n\t\t\t[key: string]: (\n\t\t\t\tthis: ILoadOptionsFunctions,\n\t\t\t\tfilter?: string,\n\t\t\t\tpaginationToken?: string,\n\t\t\t) => Promise<INodeListSearchResult>;\n\t\t};\n\t};\n\n\tsharedFields: INodeProperties[];\n\tinsertFields?: INodeProperties[];\n\tloadFields?: INodeProperties[];\n\tretrieveFields?: INodeProperties[];\n\tupdateFields?: INodeProperties[];\n\n\t/**\n\t * Function to populate the vector store with documents\n\t * Used during the 'insert' operation mode\n\t */\n\tpopulateVectorStore: (\n\t\tcontext: IExecuteFunctions | ISupplyDataFunctions,\n\t\tembeddings: Embeddings,\n\t\tdocuments: Array<Document<Record<string, unknown>>>,\n\t\titemIndex: number,\n\t) => Promise<void>;\n\n\t/**\n\t * Function to get the vector store client\n\t * This function is called for all operation modes\n\t */\n\tgetVectorStoreClient: (\n\t\tcontext: IExecuteFunctions | ISupplyDataFunctions,\n\t\tfilter: Record<string, never> | undefined,\n\t\tembeddings: Embeddings,\n\t\titemIndex: number,\n\t) => Promise<T>;\n\n\t/**\n\t * Optional function to release resources associated with the vector store client\n\t * Called after the vector store operations are complete\n\t */\n\treleaseVectorStoreClient?: (vectorStore: T) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../../../nodes/vector_store/shared/createVectorStoreNode/types.ts"],"sourcesContent":["import type { Document } from '@langchain/core/documents';\nimport type { Embeddings } from '@langchain/core/embeddings';\nimport type { VectorStore } from '@langchain/core/vectorstores';\nimport type {\n\tIExecuteFunctions,\n\tINodeCredentialDescription,\n\tINodeProperties,\n\tILoadOptionsFunctions,\n\tINodeListSearchResult,\n\tIcon,\n\tISupplyDataFunctions,\n\tThemeIconColor,\n\tIDataObject,\n\tNodeParameterValueType,\n} from 'n8n-workflow';\n\nexport type NodeOperationMode = 'insert' | 'load' | 'retrieve' | 'update' | 'retrieve-as-tool';\n\nexport interface NodeMeta {\n\tdisplayName: string;\n\tname: string;\n\tdescription: string;\n\tdocsUrl: string;\n\ticon: Icon;\n\ticonColor?: ThemeIconColor;\n\tcredentials?: INodeCredentialDescription[];\n\toperationModes?: NodeOperationMode[];\n}\n\nexport interface VectorStoreNodeConstructorArgs<T extends VectorStore = VectorStore> {\n\tmeta: NodeMeta;\n\tmethods?: {\n\t\tlistSearch?: {\n\t\t\t[key: string]: (\n\t\t\t\tthis: ILoadOptionsFunctions,\n\t\t\t\tfilter?: string,\n\t\t\t\tpaginationToken?: string,\n\t\t\t) => Promise<INodeListSearchResult>;\n\t\t};\n\t\tactionHandler?: {\n\t\t\t[functionName: string]: (\n\t\t\t\tthis: ILoadOptionsFunctions,\n\t\t\t\tpayload: IDataObject | string | undefined,\n\t\t\t) => Promise<NodeParameterValueType>;\n\t\t};\n\t};\n\n\tsharedFields: INodeProperties[];\n\tinsertFields?: INodeProperties[];\n\tloadFields?: INodeProperties[];\n\tretrieveFields?: INodeProperties[];\n\tupdateFields?: INodeProperties[];\n\n\t/**\n\t * Function to populate the vector store with documents\n\t * Used during the 'insert' operation mode\n\t */\n\tpopulateVectorStore: (\n\t\tcontext: IExecuteFunctions | ISupplyDataFunctions,\n\t\tembeddings: Embeddings,\n\t\tdocuments: Array<Document<Record<string, unknown>>>,\n\t\titemIndex: number,\n\t) => Promise<void>;\n\n\t/**\n\t * Function to get the vector store client\n\t * This function is called for all operation modes\n\t */\n\tgetVectorStoreClient: (\n\t\tcontext: IExecuteFunctions | ISupplyDataFunctions,\n\t\tfilter: Record<string, never> | undefined,\n\t\tembeddings: Embeddings,\n\t\titemIndex: number,\n\t) => Promise<T>;\n\n\t/**\n\t * Optional function to release resources associated with the vector store client\n\t * Called after the vector store operations are complete\n\t */\n\treleaseVectorStoreClient?: (vectorStore: T) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}