@n8n/n8n-nodes-langchain 0.2.0 → 0.2.1

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.
@@ -179,6 +179,10 @@
179
179
  "className": "ManualChatTrigger",
180
180
  "sourcePath": "dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.js"
181
181
  },
182
+ "vectorStoreInMemory": {
183
+ "className": "VectorStoreInMemory",
184
+ "sourcePath": "dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.js"
185
+ },
182
186
  "vectorStoreInMemoryInsert": {
183
187
  "className": "VectorStoreInMemoryInsert",
184
188
  "sourcePath": "dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js"
@@ -0,0 +1,5 @@
1
+ import { type IExecuteFunctions, type INodeType, type INodeTypeDescription, type SupplyData } from 'n8n-workflow';
2
+ export declare class VectorStoreInMemory implements INodeType {
3
+ description: INodeTypeDescription;
4
+ supplyData(this: IExecuteFunctions): Promise<SupplyData>;
5
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VectorStoreInMemory = void 0;
4
+ const memory_1 = require("langchain/vectorstores/memory");
5
+ const logWrapper_1 = require("../../../utils/logWrapper");
6
+ class VectorStoreInMemory {
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'In Memory Vector Store',
10
+ name: 'vectorStoreInMemory',
11
+ icon: 'fa:database',
12
+ group: ['transform'],
13
+ version: 1,
14
+ description: 'Stores vectors in memory',
15
+ defaults: {
16
+ name: 'In Memory Vector Store',
17
+ },
18
+ codex: {
19
+ categories: ['AI'],
20
+ subcategories: {
21
+ AI: ['Vector Stores'],
22
+ },
23
+ resources: {
24
+ primaryDocumentation: [
25
+ {
26
+ url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.vectorstoreinmemory/',
27
+ },
28
+ ],
29
+ },
30
+ },
31
+ inputs: [
32
+ {
33
+ displayName: 'Document',
34
+ type: "ai_document",
35
+ required: false,
36
+ },
37
+ {
38
+ displayName: 'Embedding',
39
+ maxConnections: 1,
40
+ type: "ai_embedding",
41
+ required: false,
42
+ },
43
+ ],
44
+ outputs: ["ai_vectorRetriever"],
45
+ outputNames: ['Vector Retriever'],
46
+ properties: [
47
+ {
48
+ displayName: 'Specify the document to load in the document loader sub-node',
49
+ name: 'notice',
50
+ type: 'notice',
51
+ default: '',
52
+ },
53
+ ],
54
+ };
55
+ }
56
+ async supplyData() {
57
+ const documents = (await this.getInputConnectionData("ai_document", 0));
58
+ const embeddings = (await this.getInputConnectionData("ai_embedding", 0));
59
+ const documentsStore = await memory_1.MemoryVectorStore.fromDocuments(documents, embeddings);
60
+ return {
61
+ response: (0, logWrapper_1.logWrapper)(documentsStore, this),
62
+ };
63
+ }
64
+ }
65
+ exports.VectorStoreInMemory = VectorStoreInMemory;
66
+ //# sourceMappingURL=VectorStoreInMemory.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VectorStoreInMemory.node.js","sourceRoot":"","sources":["../../../../nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.ts"],"names":[],"mappings":";;;AASA,0DAAkE;AAElE,0DAAuD;AAEvD,MAAa,mBAAmB;IAAhC;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE;gBACT,IAAI,EAAE,wBAAwB;aAC9B;YACD,KAAK,EAAE;gBACN,UAAU,EAAE,CAAC,IAAI,CAAC;gBAClB,aAAa,EAAE;oBACd,EAAE,EAAE,CAAC,eAAe,CAAC;iBACrB;gBACD,SAAS,EAAE;oBACV,oBAAoB,EAAE;wBACrB;4BACC,GAAG,EAAE,2G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