Squashed 'vendor/ruvector/' content from commit b64c2172
git-subtree-dir: vendor/ruvector git-subtree-split: b64c21726f2bb37286d9ee36a7869fef60cc6900
This commit is contained in:
84
crates/ruvector-attention-node/src/lib.rs
Normal file
84
crates/ruvector-attention-node/src/lib.rs
Normal file
@@ -0,0 +1,84 @@
|
||||
//! ruvector-attention-node
|
||||
//!
|
||||
//! Node.js bindings for ruvector-attention via NAPI-RS
|
||||
//!
|
||||
//! This crate provides comprehensive Node.js bindings for:
|
||||
//! - Attention mechanisms (dot-product, multi-head, hyperbolic, flash, linear, local-global, MoE)
|
||||
//! - Training utilities (loss functions, optimizers, schedulers)
|
||||
//! - Async/batch processing
|
||||
//! - Graph attention mechanisms
|
||||
//! - Benchmarking utilities
|
||||
|
||||
#![deny(clippy::all)]
|
||||
|
||||
use napi_derive::napi;
|
||||
|
||||
pub mod async_ops;
|
||||
pub mod attention;
|
||||
pub mod graph;
|
||||
pub mod training;
|
||||
|
||||
// Re-export main attention types
|
||||
pub use attention::{
|
||||
AttentionConfig, DotProductAttention, FlashAttention, HyperbolicAttention, LinearAttention,
|
||||
LocalGlobalAttention, MoEAttention, MoEConfig, MultiHeadAttention,
|
||||
};
|
||||
|
||||
// Re-export training types
|
||||
pub use training::{
|
||||
AdamOptimizer, AdamWOptimizer, CurriculumScheduler, CurriculumStageConfig, DecayType,
|
||||
HardNegativeMiner, InBatchMiner, InfoNCELoss, LearningRateScheduler, LocalContrastiveLoss,
|
||||
LossWithGradients, MiningStrategy, SGDOptimizer, SpectralRegularization, TemperatureAnnealing,
|
||||
};
|
||||
|
||||
// Re-export async/batch types
|
||||
pub use async_ops::{
|
||||
AttentionType, BatchConfig, BatchResult, BenchmarkResult, ParallelConfig, StreamProcessor,
|
||||
};
|
||||
|
||||
// Re-export graph attention types
|
||||
pub use graph::{
|
||||
DualSpaceAttention, DualSpaceConfig, EdgeFeaturedAttention, EdgeFeaturedConfig,
|
||||
GraphRoPEAttention, RoPEConfig,
|
||||
};
|
||||
|
||||
/// Get library version
|
||||
#[napi]
|
||||
pub fn version() -> String {
|
||||
env!("CARGO_PKG_VERSION").to_string()
|
||||
}
|
||||
|
||||
/// Get library info
|
||||
#[napi]
|
||||
pub fn info() -> LibraryInfo {
|
||||
LibraryInfo {
|
||||
name: "ruvector-attention-node".to_string(),
|
||||
version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
description: "Node.js bindings for ruvector-attention".to_string(),
|
||||
features: vec![
|
||||
"scaled-dot-product".to_string(),
|
||||
"multi-head".to_string(),
|
||||
"hyperbolic".to_string(),
|
||||
"flash".to_string(),
|
||||
"linear".to_string(),
|
||||
"local-global".to_string(),
|
||||
"moe".to_string(),
|
||||
"edge-featured".to_string(),
|
||||
"graph-rope".to_string(),
|
||||
"dual-space".to_string(),
|
||||
"training".to_string(),
|
||||
"async".to_string(),
|
||||
"batch".to_string(),
|
||||
"benchmark".to_string(),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
/// Library information
|
||||
#[napi(object)]
|
||||
pub struct LibraryInfo {
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub description: String,
|
||||
pub features: Vec<String>,
|
||||
}
|
||||
Reference in New Issue
Block a user