mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-26 16:04:02 +00:00
feat: Integrate @ruvector/attention as optional re-export from @ruvector/core
- Add @ruvector/attention as optional dependency
- Re-export attention module when installed
- Add VectorDB alias for compatibility
- Bump version to 0.1.16
Usage:
const { VectorDB, attention } = require('@ruvector/core');
const dpa = new attention.DotProductAttention(64);
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9008fb18eb
commit
6bc7671854
3 changed files with 36 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@ruvector/core",
|
||||
"version": "0.1.15",
|
||||
"version": "0.1.16",
|
||||
"description": "High-performance Rust vector database for Node.js with HNSW indexing and SIMD optimizations",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
|
|
@ -28,6 +28,9 @@
|
|||
"@types/node": "^20.19.25",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@ruvector/attention": "^0.1.0"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"platforms",
|
||||
|
|
|
|||
|
|
@ -89,11 +89,29 @@ function loadNativeBinding() {
|
|||
// Load the native module
|
||||
const nativeBinding = loadNativeBinding();
|
||||
|
||||
// Try to load optional attention module
|
||||
let attention = null;
|
||||
try {
|
||||
attention = require('@ruvector/attention');
|
||||
} catch {
|
||||
// Attention module not installed - this is optional
|
||||
}
|
||||
|
||||
// Export everything from the native binding
|
||||
module.exports = nativeBinding;
|
||||
|
||||
// Add VectorDB alias (native exports as VectorDb)
|
||||
if (nativeBinding.VectorDb && !nativeBinding.VectorDB) {
|
||||
module.exports.VectorDB = nativeBinding.VectorDb;
|
||||
}
|
||||
|
||||
// Also export as default
|
||||
module.exports.default = nativeBinding;
|
||||
|
||||
// Re-export DistanceMetric
|
||||
module.exports.DistanceMetric = DistanceMetric;
|
||||
|
||||
// Export attention if available
|
||||
if (attention) {
|
||||
module.exports.attention = attention;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,6 +371,17 @@ export const hello = nativeBinding.hello;
|
|||
export const getMetrics = nativeBinding.getMetrics;
|
||||
export const getHealth = nativeBinding.getHealth;
|
||||
|
||||
// Try to load optional attention module
|
||||
let attention: any = null;
|
||||
try {
|
||||
attention = require('@ruvector/attention');
|
||||
} catch {
|
||||
// Attention module not installed - this is optional
|
||||
}
|
||||
|
||||
// Export attention if available
|
||||
export { attention };
|
||||
|
||||
// Default export
|
||||
export default {
|
||||
VectorDB,
|
||||
|
|
@ -379,5 +390,7 @@ export default {
|
|||
hello,
|
||||
getMetrics,
|
||||
getHealth,
|
||||
DistanceMetric
|
||||
DistanceMetric,
|
||||
// Include attention if available
|
||||
...(attention ? { attention } : {})
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue