Squashed 'vendor/ruvector/' content from commit b64c2172
git-subtree-dir: vendor/ruvector git-subtree-split: b64c21726f2bb37286d9ee36a7869fef60cc6900
This commit is contained in:
62
npm/core/native/linux-x64/index.cjs
Normal file
62
npm/core/native/linux-x64/index.cjs
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Native binding wrapper for linux-x64
|
||||
*/
|
||||
|
||||
const nativeBinding = require('./ruvector.node');
|
||||
|
||||
// The native module exports VectorDb (lowercase 'b') but we want VectorDB
|
||||
// Also need to add the withDimensions static method since it's not exported properly
|
||||
|
||||
class VectorDB {
|
||||
constructor(options) {
|
||||
// Create internal instance
|
||||
this._db = new nativeBinding.VectorDb(options);
|
||||
}
|
||||
|
||||
static withDimensions(dimensions) {
|
||||
// Factory method - create with default options
|
||||
return new VectorDB({
|
||||
dimensions: dimensions,
|
||||
distanceMetric: 'Cosine',
|
||||
storagePath: './ruvector.db'
|
||||
});
|
||||
}
|
||||
|
||||
async insert(entry) {
|
||||
return this._db.insert(entry);
|
||||
}
|
||||
|
||||
async insertBatch(entries) {
|
||||
return this._db.insertBatch(entries);
|
||||
}
|
||||
|
||||
async search(query) {
|
||||
return this._db.search(query);
|
||||
}
|
||||
|
||||
async delete(id) {
|
||||
return this._db.delete(id);
|
||||
}
|
||||
|
||||
async get(id) {
|
||||
return this._db.get(id);
|
||||
}
|
||||
|
||||
async len() {
|
||||
return this._db.len();
|
||||
}
|
||||
|
||||
async isEmpty() {
|
||||
return this._db.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
VectorDB,
|
||||
CollectionManager: nativeBinding.CollectionManager,
|
||||
version: nativeBinding.version,
|
||||
hello: nativeBinding.hello,
|
||||
getMetrics: nativeBinding.getMetrics,
|
||||
getHealth: nativeBinding.getHealth,
|
||||
DistanceMetric: nativeBinding.JsDistanceMetric
|
||||
};
|
||||
BIN
npm/core/native/linux-x64/ruvector.node
Executable file
BIN
npm/core/native/linux-x64/ruvector.node
Executable file
Binary file not shown.
Reference in New Issue
Block a user