endee 1.0.1-beta.1 → 1.0.2
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 +90 -10
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ Endee is a TypeScript client for a vector database designed for maximum speed an
|
|
|
8
8
|
- **Fast ANN Searches**: Efficient similarity searches on vector data
|
|
9
9
|
- **Multiple Distance Metrics**: Support for cosine, L2, and inner product distance metrics
|
|
10
10
|
- **Metadata Support**: Attach and search with metadata and filters
|
|
11
|
+
- **Client-Side Encryption**: Optional AES-256 encryption for your metadata
|
|
11
12
|
- **High Performance**: Optimized for speed and efficiency
|
|
12
13
|
- **Modern ES Modules**: Native ES module support with proper tree-shaking
|
|
13
14
|
|
|
@@ -17,13 +18,21 @@ Endee is a TypeScript client for a vector database designed for maximum speed an
|
|
|
17
18
|
npm install endee
|
|
18
19
|
```
|
|
19
20
|
|
|
21
|
+
## Getting Your Auth Token
|
|
22
|
+
|
|
23
|
+
1. Go to the [Endee Dashboard](https://dapp.endee.io)
|
|
24
|
+
2. Sign up or log in to your account
|
|
25
|
+
3. Navigate to **API Keys** section
|
|
26
|
+
4. Click **Generate New Token**
|
|
27
|
+
5. Copy the generated auth token and store it securely
|
|
28
|
+
|
|
20
29
|
## Quick Start
|
|
21
30
|
|
|
22
31
|
```typescript
|
|
23
32
|
import { Endee } from "endee";
|
|
24
33
|
|
|
25
|
-
// Initialize client with your
|
|
26
|
-
const endee = new Endee("
|
|
34
|
+
// Initialize client with your Auth token
|
|
35
|
+
const endee = new Endee("<auth-token>");
|
|
27
36
|
|
|
28
37
|
// Create a new index
|
|
29
38
|
await endee.createIndex({
|
|
@@ -47,8 +56,7 @@ await index.upsert([
|
|
|
47
56
|
// Query similar vectors
|
|
48
57
|
const results = await index.query({
|
|
49
58
|
vector: [0.2, 0.3, 0.4 /* ... */], // Query vector
|
|
50
|
-
topK: 10
|
|
51
|
-
filter: { category: { eq: "reference" } }, // Optional filter
|
|
59
|
+
topK: 10
|
|
52
60
|
});
|
|
53
61
|
|
|
54
62
|
// Process results
|
|
@@ -66,7 +74,7 @@ for (const item of results) {
|
|
|
66
74
|
import { Endee } from "endee";
|
|
67
75
|
|
|
68
76
|
// Production with specific region
|
|
69
|
-
const endee = new Endee("
|
|
77
|
+
const endee = new Endee("<auth-token>");
|
|
70
78
|
|
|
71
79
|
// Local development (defaults to http://127.0.0.1:8080/api/v1)
|
|
72
80
|
const endee = new Endee();
|
|
@@ -82,10 +90,10 @@ const indexes = await endee.listIndexes();
|
|
|
82
90
|
await endee.createIndex({
|
|
83
91
|
name: "my_custom_index",
|
|
84
92
|
dimension: 384,
|
|
85
|
-
spaceType: "l2", // space type
|
|
93
|
+
spaceType: "l2", // space type (cosine, l2, ip)
|
|
86
94
|
M: 32, // M: Graph connectivity parameter
|
|
87
|
-
efCon:
|
|
88
|
-
|
|
95
|
+
efCon: 256, // efCon: Construction-time parameter
|
|
96
|
+
precision: "medium" // precision: "medium" | "high" | "ultra-high" | "fp16"
|
|
89
97
|
});
|
|
90
98
|
|
|
91
99
|
// Delete an index
|
|
@@ -117,14 +125,14 @@ await index.upsert([
|
|
|
117
125
|
const results = await index.query({
|
|
118
126
|
vector: [/* ... */], // Query vector
|
|
119
127
|
topK: 5, // Number of results to return
|
|
120
|
-
filter: { tags: "important" }, // Filter
|
|
128
|
+
filter: [{ tags: { "$eq": "important" } }], // Filter array with operators
|
|
121
129
|
ef: 128, // Runtime parameter for search quality
|
|
122
130
|
includeVectors: true, // Include vector data in results
|
|
123
131
|
});
|
|
124
132
|
|
|
125
133
|
// Delete vectors
|
|
126
134
|
await index.deleteVector("vec1");
|
|
127
|
-
await index.deleteWithFilter({ visibility: "public" });
|
|
135
|
+
await index.deleteWithFilter({ visibility: { "$eq": "public" } });
|
|
128
136
|
|
|
129
137
|
// Get a specific vector
|
|
130
138
|
const vector = await index.getVector("vec1");
|
|
@@ -134,6 +142,78 @@ const description = await index.describe();
|
|
|
134
142
|
console.log(description);
|
|
135
143
|
```
|
|
136
144
|
|
|
145
|
+
## Filtering
|
|
146
|
+
|
|
147
|
+
Endee supports structured filtering using operators like `$eq`, `$in`, and `$range`. For detailed documentation on filtering, see the [official documentation](https://docs.endee.io/sdks/typescript/usage#filtered-querying).
|
|
148
|
+
|
|
149
|
+
## Encryption
|
|
150
|
+
|
|
151
|
+
Endee supports optional client-side encryption for your metadata using AES-256-CBC. When encryption is enabled, your metadata is encrypted before being sent to the server and decrypted when retrieved. The encryption key never leaves your environment.
|
|
152
|
+
|
|
153
|
+
### Generating an Encryption Key
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { Endee } from "endee";
|
|
157
|
+
|
|
158
|
+
const endee = new Endee("<your-auth-token>");
|
|
159
|
+
|
|
160
|
+
// Generate a secure 256-bit encryption key
|
|
161
|
+
const key = endee.generateKey();
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
> **Important**: Store your encryption key securely. If you lose the key, you will not be able to decrypt your data. The key is a 64-character hexadecimal string (256 bits).
|
|
166
|
+
|
|
167
|
+
### Creating an Encrypted Index
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
// Create an index with encryption enabled
|
|
171
|
+
await endee.createIndex({
|
|
172
|
+
name: "encrypted_index",
|
|
173
|
+
dimension: 128,
|
|
174
|
+
spaceType: "cosine",
|
|
175
|
+
key: key // Pass your encryption key
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Working with Encrypted Data
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
// Get index reference with encryption key
|
|
183
|
+
const index = await endee.getIndex("encrypted_index", key);
|
|
184
|
+
|
|
185
|
+
// Insert vectors - metadata will be automatically encrypted
|
|
186
|
+
await index.upsert([
|
|
187
|
+
{
|
|
188
|
+
id: "secret_doc",
|
|
189
|
+
vector: [0.1, 0.2, 0.3 /* ... */], // Your vector data,
|
|
190
|
+
meta: {
|
|
191
|
+
content: "This is sensitive information",
|
|
192
|
+
userId: "user123"
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
]);
|
|
196
|
+
|
|
197
|
+
// Query vectors - metadata will be automatically decrypted
|
|
198
|
+
const results = await index.query({
|
|
199
|
+
vector: [0.2, 0.4, 0.3 /* ... */], // Your query data,
|
|
200
|
+
topK: 10,
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// Results contain decrypted metadata
|
|
204
|
+
for (const item of results) {
|
|
205
|
+
console.log(item.meta); // { content: "This is sensitive information", userId: "user123" }
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Key Points
|
|
210
|
+
|
|
211
|
+
- **Encryption is optional**: Only enable it if you need to protect sensitive metadata
|
|
212
|
+
- **Key management is your responsibility**: Store keys securely (e.g., environment variables, secret managers)
|
|
213
|
+
- **Vectors are not encrypted**: Only metadata is encrypted; vector data remains searchable
|
|
214
|
+
- **Key verification**: The system verifies the key checksum when accessing an encrypted index
|
|
215
|
+
- **No key recovery**: Lost keys cannot be recovered; encrypted data becomes inaccessible
|
|
216
|
+
|
|
137
217
|
## TypeScript Types
|
|
138
218
|
|
|
139
219
|
The package includes comprehensive TypeScript types:
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface CreateIndexOptions {
|
|
|
8
8
|
spaceType?: SpaceType;
|
|
9
9
|
M?: number;
|
|
10
10
|
key?: string;
|
|
11
|
-
precision?: "medium" | "high" | "
|
|
11
|
+
precision?: "medium" | "high" | "ultra-high" | "fp16";
|
|
12
12
|
efCon?: number;
|
|
13
13
|
version?: number;
|
|
14
14
|
}
|
|
@@ -20,7 +20,7 @@ export interface VectorItem {
|
|
|
20
20
|
}
|
|
21
21
|
export interface QueryOptions {
|
|
22
22
|
vector: number[];
|
|
23
|
-
topK
|
|
23
|
+
topK: number;
|
|
24
24
|
filter?: Array<Record<string, unknown>> | null;
|
|
25
25
|
ef?: number;
|
|
26
26
|
includeVectors?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAC,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAC,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MA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