@omendb/omendb 0.0.2-alpha.1 → 0.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 CHANGED
@@ -20,12 +20,12 @@ const db = open("./vectors", { dimensions: 384 });
20
20
  db.set([
21
21
  {
22
22
  id: "doc1",
23
- embedding: new Float32Array(384).fill(0.1),
23
+ vector: new Float32Array(384).fill(0.1),
24
24
  metadata: { title: "Hello" },
25
25
  },
26
26
  {
27
27
  id: "doc2",
28
- embedding: new Float32Array(384).fill(0.2),
28
+ vector: new Float32Array(384).fill(0.2),
29
29
  metadata: { title: "World" },
30
30
  },
31
31
  ]);
package/index.d.ts CHANGED
@@ -1,104 +1,130 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
3
  export declare class VectorDatabase {
4
- /**
5
- * Insert or update vectors.
6
- *
7
- * Accepts an array of items with id, embedding, and optional metadata.
8
- */
9
- set(items: Array<VectorItem>): Array<number>;
10
- /**
11
- * Search for k nearest neighbors.
12
- *
13
- * @param query - Query vector (number[] or Float32Array)
14
- * @param k - Number of results to return
15
- * @param ef - Optional search width override
16
- * @returns Array of {id, distance, metadata}
17
- */
18
- search(
19
- query: Array<number> | Float32Array,
20
- k: number,
21
- ef?: number | undefined | null,
22
- ): Array<SearchResult>;
23
- /**
24
- * Batch search with parallel execution (async).
25
- *
26
- * Runs searches in parallel using rayon, returns Promise.
27
- */
28
- searchBatch(
29
- queries: Array<Array<number> | Float32Array>,
30
- k: number,
31
- ef?: number | undefined | null,
32
- ): Promise<Array<Array<SearchResult>>>;
33
- /** Get a vector by ID. */
34
- get(id: string): GetResult | null;
35
- /**
36
- * Delete vectors by ID.
37
- *
38
- * @returns Number of vectors deleted
39
- */
40
- delete(ids: Array<string>): number;
41
- /** Update a vector's embedding and/or metadata. */
42
- update(
43
- id: string,
44
- embedding: Array<number> | Float32Array,
45
- metadata?: Record<string, unknown> | undefined,
46
- ): void;
47
- /** Save database to disk. */
48
- save(): void;
49
- /** Get number of vectors in database. */
50
- get count(): number;
51
- /** Get current ef_search value. */
52
- get efSearch(): number | null;
53
- /** Set ef_search value. */
54
- set efSearch(efSearch: number);
55
- /** Get or create a named collection. */
56
- collection(name: string): VectorDatabase;
57
- /** List all collections. */
58
- collections(): Array<string>;
59
- /** Delete a collection. */
60
- deleteCollection(name: string): void;
61
- /** Merge another database into this one. */
62
- mergeFrom(other: VectorDatabase): number;
4
+ /**
5
+ * Insert or update vectors.
6
+ *
7
+ * Accepts an array of items with id, vector, and optional metadata.
8
+ */
9
+ set(items: Array<VectorItem>): Array<number>
10
+ /**
11
+ * Search for k nearest neighbors.
12
+ *
13
+ * @param query - Query vector (number[] or Float32Array)
14
+ * @param k - Number of results to return
15
+ * @param ef - Optional search width override
16
+ * @param filter - Optional metadata filter (e.g., {category: "foo"} or {price: {$gt: 10}})
17
+ * @returns Array of {id, distance, metadata}
18
+ */
19
+ search(query: Array<number> | Float32Array, k: number, ef?: number | undefined | null, filter?: Record<string, unknown> | undefined): Array<SearchResult>
20
+ /**
21
+ * Batch search with parallel execution (async).
22
+ *
23
+ * Runs searches in parallel using rayon, returns Promise.
24
+ */
25
+ searchBatch(queries: Array<Array<number> | Float32Array>, k: number, ef?: number | undefined | null): Promise<Array<Array<SearchResult>>>
26
+ /** Get a vector by ID. */
27
+ get(id: string): GetResult | null
28
+ /**
29
+ * Delete vectors by ID.
30
+ *
31
+ * @returns Number of vectors deleted
32
+ */
33
+ delete(ids: Array<string>): number
34
+ /** Update a vector's data and/or metadata. */
35
+ update(id: string, vector: Array<number> | Float32Array, metadata?: Record<string, unknown> | undefined): void
36
+ /** Save database to disk. */
37
+ save(): void
38
+ /** Get number of vectors in database. */
39
+ get count(): number
40
+ /** Get current ef_search value. */
41
+ get efSearch(): number | null
42
+ /** Set ef_search value. */
43
+ set efSearch(efSearch: number)
44
+ /** Get or create a named collection. */
45
+ collection(name: string): VectorDatabase
46
+ /** List all collections. */
47
+ collections(): Array<string>
48
+ /** Delete a collection. */
49
+ deleteCollection(name: string): void
50
+ /** Merge another database into this one. */
51
+ mergeFrom(other: VectorDatabase): number
63
52
  }
64
53
 
65
54
  export interface GetResult {
66
- id: string;
67
- embedding: Array<number>;
68
- metadata: Record<string, unknown>;
55
+ id: string
56
+ vector: Array<number>
57
+ metadata: Record<string, unknown>
69
58
  }
70
59
 
71
60
  /**
72
61
  * Open or create a vector database.
73
62
  *
74
63
  * @param path - Database directory path (use ":memory:" for in-memory)
75
- * @param options - Optional configuration
64
+ * @param options - Optional configuration (see OpenOptions for defaults)
76
65
  * @returns VectorDatabase instance
66
+ *
67
+ * @example
68
+ * ```javascript
69
+ * // Simple usage with defaults
70
+ * const db = omendb.open("./mydb");
71
+ *
72
+ * // With custom HNSW parameters
73
+ * const db = omendb.open("./mydb", {
74
+ * dimensions: 384,
75
+ * m: 32,
76
+ * efConstruction: 200,
77
+ * efSearch: 150
78
+ * });
79
+ *
80
+ * // With RaBitQ quantization (8x memory reduction)
81
+ * const db = omendb.open("./mydb", {
82
+ * dimensions: 128,
83
+ * quantization: 4 // 4-bit quantization
84
+ * });
85
+ * ```
77
86
  */
78
- export declare function open(
79
- path: string,
80
- options?: OpenOptions | undefined | null,
81
- ): VectorDatabase;
87
+ export declare function open(path: string, options?: OpenOptions | undefined | null): VectorDatabase
82
88
 
89
+ /**
90
+ * Configuration options for opening a vector database.
91
+ *
92
+ * All fields are optional with sensible defaults:
93
+ * - dimensions: 128 (auto-detected on first insert if not specified)
94
+ * - m: 16 (HNSW neighbors per node, higher = better recall, more memory)
95
+ * - efConstruction: 100 (build quality, higher = better graph, slower build)
96
+ * - efSearch: 100 (search quality, higher = better recall, slower search)
97
+ * - quantization: null (RaBitQ bit width: 2, 4, or 8 for compression)
98
+ */
83
99
  export interface OpenOptions {
84
- dimensions?: number;
85
- m?: number;
86
- efConstruction?: number;
100
+ /** Vector dimensions (default: 128, auto-detected on first insert) */
101
+ dimensions?: number
102
+ /** HNSW M parameter: neighbors per node (default: 16, range: 4-64) */
103
+ m?: number
104
+ /** HNSW ef_construction: build quality (default: 100, must be >= m) */
105
+ efConstruction?: number
106
+ /** HNSW ef_search: search quality/speed tradeoff (default: 100) */
107
+ efSearch?: number
108
+ /**
109
+ * RaBitQ quantization bits: 2, 4, or 8 (default: null = no quantization)
110
+ * Enables 4-16x memory compression with ~1-2% recall loss
111
+ */
112
+ quantization?: number
87
113
  }
88
114
 
89
115
  export interface SearchResult {
90
- id: string;
91
- distance: number;
92
- /** Metadata as JSON (using serde-json feature) */
93
- metadata: Record<string, unknown>;
116
+ id: string
117
+ distance: number
118
+ /** Metadata as JSON (using serde-json feature) */
119
+ metadata: Record<string, unknown>
94
120
  }
95
121
 
96
122
  export interface VectorItem {
97
- id: string;
98
- /** Embedding as array of numbers */
99
- embedding: Array<number>;
100
- /** Optional metadata */
101
- metadata?: Record<string, unknown> | undefined;
102
- /** Optional document text (stored in metadata.document) */
103
- document?: string;
123
+ id: string
124
+ /** Vector data as array of numbers */
125
+ vector: Array<number>
126
+ /** Optional metadata */
127
+ metadata?: Record<string, unknown> | undefined
128
+ /** Optional document text (stored in metadata.document) */
129
+ document?: string
104
130
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@omendb/omendb",
3
- "version": "0.0.2-alpha.1",
3
+ "version": "0.0.2",
4
4
  "description": "Fast embedded vector database with HNSW indexing",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/nijaru/omendb"
9
+ "url": "https://github.com/omendb/omendb"
10
10
  },
11
11
  "keywords": [
12
12
  "vector",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "napi": {
28
28
  "binaryName": "omendb",
29
- "packageName": "omendb",
29
+ "packageName": "@omendb/omendb",
30
30
  "targets": [
31
31
  "x86_64-apple-darwin",
32
32
  "aarch64-apple-darwin",
@@ -49,9 +49,9 @@
49
49
  "omendb.node"
50
50
  ],
51
51
  "optionalDependencies": {
52
- "omendb-darwin-x64": "0.0.2-alpha.1",
53
- "omendb-darwin-arm64": "0.0.2-alpha.1",
54
- "omendb-linux-x64-gnu": "0.0.2-alpha.1",
55
- "omendb-linux-arm64-gnu": "0.0.2-alpha.1"
52
+ "@omendb/omendb-darwin-x64": "0.0.2",
53
+ "@omendb/omendb-darwin-arm64": "0.0.2",
54
+ "@omendb/omendb-linux-x64-gnu": "0.0.2",
55
+ "@omendb/omendb-linux-arm64-gnu": "0.0.2"
56
56
  }
57
57
  }
package/omendb.node DELETED
Binary file