@smartpointstech/core
High-performance vector database with HNSW indexing - built in Rust for AI/ML similarity search and semantic search applications
Overview
This package provides native Node.js bindings to the spt-core Rust crate. It includes a vector database with HNSW (Hierarchical Navigable Small World) indexing for approximate nearest-neighbor search, plus a graph database for labeled node/edge operations. A stub fallback is available when native bindings are not installed.
Installation
bash
npm install @smartpointstech/coreKey Features
- HNSW Vector Search -- fast approximate nearest-neighbor queries with configurable ef parameters
- Multiple Distance Metrics -- Cosine, Euclidean, DotProduct, Manhattan
- Quantization Support -- scalar, product, and binary quantization for memory efficiency
- Graph Database -- labeled nodes and typed edges with property storage
- Batch Operations -- bulk insert for high-throughput ingestion
Dependencies
No internal npm dependencies. Uses platform-specific native binaries via optional dependencies (e.g., spt-core-darwin-arm64). Built with @napi-rs/cli.
Quick Start
typescript
import { VectorDB } from '@smartpointstech/core';
const db = VectorDB.withDimensions(384);
await db.insert({ vector: embedding, metadata: JSON.stringify({ text: 'hello' }) });
const results = await db.search({ vector: queryVec, k: 10 });API Reference
Exports
| Export | Type | Description |
|---|---|---|
VectorDB | class | Vector database with HNSW indexing |
GraphDB | class | Labeled property graph database |
VectorEntry | interface | Entry with vector, optional id and metadata |
SearchQuery | interface | Query with vector, k, efSearch, filter |
SearchResult | interface | Result with id, score, optional vector/metadata |
DbOptions | interface | Config: dimensions, distance metric, HNSW params |
HnswConfig | interface | HNSW tuning: m, efConstruction, efSearch |
QuantizationConfig | interface | Quantization type and parameters |
getImplementationType | function | Returns 'native' or 'stub' |