@wiscale/velesdb-sdk 0.5.2 → 0.6.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 +19 -1
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -90,7 +90,25 @@ Create a new collection.
|
|
|
90
90
|
| Option | Type | Default | Description |
|
|
91
91
|
|--------|------|---------|-------------|
|
|
92
92
|
| `dimension` | `number` | Required | Vector dimension |
|
|
93
|
-
| `metric` | `'cosine' \| 'euclidean' \| 'dot'` | `'cosine'` | Distance metric |
|
|
93
|
+
| `metric` | `'cosine' \| 'euclidean' \| 'dot' \| 'hamming' \| 'jaccard'` | `'cosine'` | Distance metric |
|
|
94
|
+
| `storageMode` | `'full' \| 'sq8' \| 'binary'` | `'full'` | Memory optimization mode |
|
|
95
|
+
|
|
96
|
+
#### Storage Modes
|
|
97
|
+
|
|
98
|
+
| Mode | Memory (768D) | Compression | Use Case |
|
|
99
|
+
|------|---------------|-------------|----------|
|
|
100
|
+
| `full` | 3 KB/vector | 1x | Default, max precision |
|
|
101
|
+
| `sq8` | 776 B/vector | **4x** | Scale, RAM-constrained |
|
|
102
|
+
| `binary` | 96 B/vector | **32x** | Edge, IoT |
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// Memory-optimized collection
|
|
106
|
+
await db.createCollection('embeddings', {
|
|
107
|
+
dimension: 768,
|
|
108
|
+
metric: 'cosine',
|
|
109
|
+
storageMode: 'sq8' // 4x memory reduction
|
|
110
|
+
});
|
|
111
|
+
```
|
|
94
112
|
|
|
95
113
|
### `db.insert(collection, document)`
|
|
96
114
|
|
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
/** Supported distance metrics for vector similarity */
|
|
6
|
-
type DistanceMetric = 'cosine' | 'euclidean' | 'dot';
|
|
6
|
+
type DistanceMetric = 'cosine' | 'euclidean' | 'dot' | 'hamming' | 'jaccard';
|
|
7
|
+
/** Storage mode for vector quantization */
|
|
8
|
+
type StorageMode = 'full' | 'sq8' | 'binary';
|
|
7
9
|
/** Backend type for VelesDB connection */
|
|
8
10
|
type BackendType = 'wasm' | 'rest';
|
|
9
11
|
/** Configuration options for VelesDB client */
|
|
@@ -23,6 +25,12 @@ interface CollectionConfig {
|
|
|
23
25
|
dimension: number;
|
|
24
26
|
/** Distance metric (default: 'cosine') */
|
|
25
27
|
metric?: DistanceMetric;
|
|
28
|
+
/** Storage mode for vector quantization (default: 'full')
|
|
29
|
+
* - 'full': Full f32 precision (3 KB/vector for 768D)
|
|
30
|
+
* - 'sq8': 8-bit scalar quantization, 4x memory reduction (~1% recall loss)
|
|
31
|
+
* - 'binary': 1-bit binary quantization, 32x memory reduction (edge/IoT)
|
|
32
|
+
*/
|
|
33
|
+
storageMode?: StorageMode;
|
|
26
34
|
/** Optional collection description */
|
|
27
35
|
description?: string;
|
|
28
36
|
}
|
|
@@ -34,6 +42,8 @@ interface Collection {
|
|
|
34
42
|
dimension: number;
|
|
35
43
|
/** Distance metric */
|
|
36
44
|
metric: DistanceMetric;
|
|
45
|
+
/** Storage mode */
|
|
46
|
+
storageMode?: StorageMode;
|
|
37
47
|
/** Number of vectors */
|
|
38
48
|
count: number;
|
|
39
49
|
/** Creation timestamp */
|
|
@@ -296,4 +306,4 @@ declare class RestBackend implements IVelesDBBackend {
|
|
|
296
306
|
close(): Promise<void>;
|
|
297
307
|
}
|
|
298
308
|
|
|
299
|
-
export { type BackendType, type Collection, type CollectionConfig, ConnectionError, type DistanceMetric, type IVelesDBBackend, NotFoundError, RestBackend, type SearchOptions, type SearchResult, ValidationError, type VectorDocument, VelesDB, type VelesDBConfig, VelesDBError, WasmBackend };
|
|
309
|
+
export { type BackendType, type Collection, type CollectionConfig, ConnectionError, type DistanceMetric, type IVelesDBBackend, NotFoundError, RestBackend, type SearchOptions, type SearchResult, type StorageMode, ValidationError, type VectorDocument, VelesDB, type VelesDBConfig, VelesDBError, WasmBackend };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
/** Supported distance metrics for vector similarity */
|
|
6
|
-
type DistanceMetric = 'cosine' | 'euclidean' | 'dot';
|
|
6
|
+
type DistanceMetric = 'cosine' | 'euclidean' | 'dot' | 'hamming' | 'jaccard';
|
|
7
|
+
/** Storage mode for vector quantization */
|
|
8
|
+
type StorageMode = 'full' | 'sq8' | 'binary';
|
|
7
9
|
/** Backend type for VelesDB connection */
|
|
8
10
|
type BackendType = 'wasm' | 'rest';
|
|
9
11
|
/** Configuration options for VelesDB client */
|
|
@@ -23,6 +25,12 @@ interface CollectionConfig {
|
|
|
23
25
|
dimension: number;
|
|
24
26
|
/** Distance metric (default: 'cosine') */
|
|
25
27
|
metric?: DistanceMetric;
|
|
28
|
+
/** Storage mode for vector quantization (default: 'full')
|
|
29
|
+
* - 'full': Full f32 precision (3 KB/vector for 768D)
|
|
30
|
+
* - 'sq8': 8-bit scalar quantization, 4x memory reduction (~1% recall loss)
|
|
31
|
+
* - 'binary': 1-bit binary quantization, 32x memory reduction (edge/IoT)
|
|
32
|
+
*/
|
|
33
|
+
storageMode?: StorageMode;
|
|
26
34
|
/** Optional collection description */
|
|
27
35
|
description?: string;
|
|
28
36
|
}
|
|
@@ -34,6 +42,8 @@ interface Collection {
|
|
|
34
42
|
dimension: number;
|
|
35
43
|
/** Distance metric */
|
|
36
44
|
metric: DistanceMetric;
|
|
45
|
+
/** Storage mode */
|
|
46
|
+
storageMode?: StorageMode;
|
|
37
47
|
/** Number of vectors */
|
|
38
48
|
count: number;
|
|
39
49
|
/** Creation timestamp */
|
|
@@ -296,4 +306,4 @@ declare class RestBackend implements IVelesDBBackend {
|
|
|
296
306
|
close(): Promise<void>;
|
|
297
307
|
}
|
|
298
308
|
|
|
299
|
-
export { type BackendType, type Collection, type CollectionConfig, ConnectionError, type DistanceMetric, type IVelesDBBackend, NotFoundError, RestBackend, type SearchOptions, type SearchResult, ValidationError, type VectorDocument, VelesDB, type VelesDBConfig, VelesDBError, WasmBackend };
|
|
309
|
+
export { type BackendType, type Collection, type CollectionConfig, ConnectionError, type DistanceMetric, type IVelesDBBackend, NotFoundError, RestBackend, type SearchOptions, type SearchResult, type StorageMode, ValidationError, type VectorDocument, VelesDB, type VelesDBConfig, VelesDBError, WasmBackend };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiscale/velesdb-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Official TypeScript SDK for VelesDB - Vector Search in Microseconds",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vitest": "^4.0.16"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@wiscale/velesdb-wasm": "^0.
|
|
66
|
+
"@wiscale/velesdb-wasm": "^0.6.0"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=18.0.0"
|