n8n-nodes-minimemory 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,204 @@
1
+ # n8n-nodes-minimemory
2
+
3
+ An n8n community node for embedded vector database operations - **100% serverless**.
4
+
5
+ Perform vector similarity search directly within n8n without any external server. Perfect for:
6
+ - RAG (Retrieval Augmented Generation)
7
+ - Semantic search
8
+ - Recommendations
9
+ - Deduplication
10
+
11
+ ## Features
12
+
13
+ - **No server required** - Everything runs locally within n8n
14
+ - **Similarity search** - Find the k most similar vectors
15
+ - **Multiple metrics** - Cosine, Euclidean, Dot Product
16
+ - **Metadata support** - Associate additional information with each vector
17
+ - **Persistence** - Save/load from JSON files
18
+ - **Bulk insert** - Insert multiple vectors from previous nodes
19
+
20
+ ## Installation
21
+
22
+ ### From n8n UI (Recommended)
23
+
24
+ 1. Go to **Settings** > **Community Nodes**
25
+ 2. Search for `n8n-nodes-minimemory`
26
+ 3. Click **Install**
27
+
28
+ ### From npm
29
+
30
+ ```bash
31
+ cd ~/.n8n/nodes
32
+ npm install n8n-nodes-minimemory
33
+ ```
34
+
35
+ Then restart n8n.
36
+
37
+ ## Operations
38
+
39
+ ### Create Database
40
+ Create a new vector database in memory.
41
+
42
+ | Parameter | Description | Example |
43
+ |-----------|-------------|---------|
44
+ | Database Name | Unique name for the DB | `my_vectors` |
45
+ | Dimensions | Number of dimensions | `384` (MiniLM), `1536` (OpenAI) |
46
+ | Distance Metric | Similarity metric | `cosine`, `euclidean`, `dot` |
47
+ | Index Type | Index type | `flat` (exact), `hnsw` (fast) |
48
+
49
+ ### Insert Vector
50
+ Insert a single vector with ID and optional metadata.
51
+
52
+ | Parameter | Description |
53
+ |-----------|-------------|
54
+ | Vector ID | Unique identifier |
55
+ | Vector | Array of numbers `[0.1, 0.2, ...]` |
56
+ | Metadata | JSON object `{"title": "Doc 1"}` |
57
+
58
+ ### Insert Many
59
+ Bulk insert vectors from input items.
60
+
61
+ | Parameter | Description | Default |
62
+ |-----------|-------------|---------|
63
+ | ID Field | Field containing the ID | `id` |
64
+ | Vector Field | Field containing the vector | `embedding` |
65
+ | Metadata Fields | Fields for metadata (empty = all) | |
66
+
67
+ **Example input:**
68
+ ```json
69
+ [
70
+ {"id": "doc1", "embedding": [0.1, 0.2, ...], "title": "Document 1"},
71
+ {"id": "doc2", "embedding": [0.3, 0.4, ...], "title": "Document 2"}
72
+ ]
73
+ ```
74
+
75
+ ### Search
76
+ Search for the k nearest neighbors.
77
+
78
+ | Parameter | Description | Default |
79
+ |-----------|-------------|---------|
80
+ | Query Vector | Query vector | |
81
+ | Number of Results (K) | Number of results | `10` |
82
+ | Include Vectors | Include vectors in result | `false` |
83
+ | Minimum Similarity | Filter by minimum similarity | `0` |
84
+
85
+ **Output:**
86
+ ```json
87
+ {
88
+ "success": true,
89
+ "results": [
90
+ {"id": "doc1", "distance": 0.1, "similarity": 0.9, "metadata": {...}},
91
+ {"id": "doc2", "distance": 0.2, "similarity": 0.8, "metadata": {...}}
92
+ ]
93
+ }
94
+ ```
95
+
96
+ ### Get
97
+ Get a vector by its ID.
98
+
99
+ ### Delete Vector
100
+ Delete a vector by its ID.
101
+
102
+ ### Save to File
103
+ Save the database to a JSON file.
104
+
105
+ ### Load from File
106
+ Load a database from a JSON file.
107
+
108
+ ### Get Info
109
+ Get database information and statistics.
110
+
111
+ ### List Databases
112
+ List all databases in memory.
113
+
114
+ ### Clear Database
115
+ Remove all vectors from the database.
116
+
117
+ ### Delete Database
118
+ Remove a database from memory.
119
+
120
+ ## Example Workflow
121
+
122
+ ### Basic RAG with OpenAI
123
+
124
+ ```
125
+ [Trigger]
126
+ |
127
+ [OpenAI Embeddings] -> [Minimemory: Insert Many]
128
+ |
129
+ [Query Input]
130
+ |
131
+ [OpenAI Embeddings] -> [Minimemory: Search] -> [OpenAI Chat]
132
+ |
133
+ [Response]
134
+ ```
135
+
136
+ ### Step by step:
137
+
138
+ 1. **Create DB** (run once):
139
+ - Operation: `Create Database`
140
+ - Database Name: `docs`
141
+ - Dimensions: `1536` (OpenAI)
142
+ - Distance: `cosine`
143
+
144
+ 2. **Index documents**:
145
+ - Connect node that generates embeddings
146
+ - Operation: `Insert Many`
147
+ - ID Field: `id`
148
+ - Vector Field: `embedding`
149
+
150
+ 3. **Search**:
151
+ - Connect query with embedding
152
+ - Operation: `Search`
153
+ - Query Vector: `{{ $json.embedding }}`
154
+ - K: `5`
155
+
156
+ ## Persistence
157
+
158
+ Databases live in memory while n8n is running. To persist:
159
+
160
+ ```
161
+ [Startup Trigger] -> [Minimemory: Load from File]
162
+ |
163
+ (DB available for use)
164
+ |
165
+ [Before shutdown] -> [Minimemory: Save to File]
166
+ ```
167
+
168
+ ## Embedding Compatibility
169
+
170
+ | Model | Dimensions | Notes |
171
+ |-------|------------|-------|
172
+ | all-MiniLM-L6-v2 | 384 | Fast, good for short text |
173
+ | all-mpnet-base-v2 | 768 | Better quality |
174
+ | text-embedding-ada-002 | 1536 | OpenAI legacy |
175
+ | text-embedding-3-small | 1536 | OpenAI new |
176
+ | text-embedding-3-large | 3072 | OpenAI high quality |
177
+ | embed-english-v3.0 | 1024 | Cohere |
178
+
179
+ ## Performance
180
+
181
+ - **Flat Index**: O(n) - Exact, ideal for < 10,000 vectors
182
+ - **HNSW Index**: O(log n) - Approximate, for large datasets
183
+
184
+ ## Troubleshooting
185
+
186
+ ### "Database not found"
187
+ Make sure to run `Create Database` or `Load from File` first.
188
+
189
+ ### "Dimension mismatch"
190
+ The inserted/searched vector has a different number of dimensions than the DB.
191
+
192
+ ### Node doesn't appear
193
+ 1. Verify `npm run build` completed without errors
194
+ 2. Check the link with `npm ls -g --link`
195
+ 3. Restart n8n
196
+
197
+ ## Support
198
+
199
+ For issues and feature requests, please visit:
200
+ https://github.com/yourusername/n8n-nodes-minimemory/issues
201
+
202
+ ## License
203
+
204
+ MIT
@@ -0,0 +1,8 @@
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class MinimemoryConfig implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ }
8
+ //# sourceMappingURL=MinimemoryConfig.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MinimemoryConfig.credentials.d.ts","sourceRoot":"","sources":["../../credentials/MinimemoryConfig.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,gBAAiB,YAAW,eAAe;IACvD,IAAI,SAAsB;IAC1B,WAAW,SAA8B;IACzC,gBAAgB,SAA8C;IAE9D,UAAU,EAAE,eAAe,EAAE,CA2B3B;CACF"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MinimemoryConfig = void 0;
4
+ class MinimemoryConfig {
5
+ constructor() {
6
+ this.name = 'minimemoryConfig';
7
+ this.displayName = 'Minimemory Configuration';
8
+ this.documentationUrl = 'https://github.com/minimemory/minimemory';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Default Data Directory',
12
+ name: 'dataDirectory',
13
+ type: 'string',
14
+ default: './data/minimemory',
15
+ description: 'Default directory for storing .mmdb database files',
16
+ },
17
+ {
18
+ displayName: 'Default Dimensions',
19
+ name: 'defaultDimensions',
20
+ type: 'number',
21
+ default: 384,
22
+ description: 'Default number of dimensions for new databases (384 for all-MiniLM-L6-v2, 1536 for OpenAI)',
23
+ },
24
+ {
25
+ displayName: 'Default Distance Metric',
26
+ name: 'defaultDistance',
27
+ type: 'options',
28
+ options: [
29
+ { name: 'Cosine', value: 'cosine' },
30
+ { name: 'Euclidean', value: 'euclidean' },
31
+ { name: 'Dot Product', value: 'dot' },
32
+ ],
33
+ default: 'cosine',
34
+ description: 'Default distance metric for new databases',
35
+ },
36
+ ];
37
+ }
38
+ }
39
+ exports.MinimemoryConfig = MinimemoryConfig;
40
+ //# sourceMappingURL=MinimemoryConfig.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MinimemoryConfig.credentials.js","sourceRoot":"","sources":["../../credentials/MinimemoryConfig.credentials.ts"],"names":[],"mappings":";;;AAKA,MAAa,gBAAgB;IAA7B;QACC,SAAI,GAAG,kBAAkB,CAAC;QAC1B,gBAAW,GAAG,0BAA0B,CAAC;QACzC,qBAAgB,GAAG,0CAA0C,CAAC;QAE9D,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,wBAAwB;gBACrC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,mBAAmB;gBAC5B,WAAW,EAAE,oDAAoD;aACjE;YACD;gBACC,WAAW,EAAE,oBAAoB;gBACjC,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,GAAG;gBACZ,WAAW,EAAE,4FAA4F;aACzG;YACD;gBACC,WAAW,EAAE,yBAAyB;gBACtC,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACnC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBACzC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE;iBACrC;gBACD,OAAO,EAAE,QAAQ;gBACjB,WAAW,EAAE,2CAA2C;aACxD;SACD,CAAC;IACH,CAAC;CAAA;AAjCD,4CAiCC"}
@@ -0,0 +1,3 @@
1
+ export { Minimemory } from './nodes/Minimemory/Minimemory.node';
2
+ export { MinimemoryConfig } from './credentials/MinimemoryConfig.credentials';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MinimemoryConfig = exports.Minimemory = void 0;
4
+ var Minimemory_node_1 = require("./nodes/Minimemory/Minimemory.node");
5
+ Object.defineProperty(exports, "Minimemory", { enumerable: true, get: function () { return Minimemory_node_1.Minimemory; } });
6
+ var MinimemoryConfig_credentials_1 = require("./credentials/MinimemoryConfig.credentials");
7
+ Object.defineProperty(exports, "MinimemoryConfig", { enumerable: true, get: function () { return MinimemoryConfig_credentials_1.MinimemoryConfig; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,sEAAgE;AAAvD,6GAAA,UAAU,OAAA;AACnB,2FAA8E;AAArE,gIAAA,gBAAgB,OAAA"}
@@ -0,0 +1,6 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class Minimemory implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
6
+ //# sourceMappingURL=Minimemory.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Minimemory.node.d.ts","sourceRoot":"","sources":["../../../nodes/Minimemory/Minimemory.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EAGpB,MAAM,cAAc,CAAC;AAYtB,qBAAa,UAAW,YAAW,SAAS;IAC3C,WAAW,EAAE,oBAAoB,CA6U/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAsRvE"}