Skip to content

@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/core

Key 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

ExportTypeDescription
VectorDBclassVector database with HNSW indexing
GraphDBclassLabeled property graph database
VectorEntryinterfaceEntry with vector, optional id and metadata
SearchQueryinterfaceQuery with vector, k, efSearch, filter
SearchResultinterfaceResult with id, score, optional vector/metadata
DbOptionsinterfaceConfig: dimensions, distance metric, HNSW params
HnswConfiginterfaceHNSW tuning: m, efConstruction, efSearch
QuantizationConfiginterfaceQuantization type and parameters
getImplementationTypefunctionReturns 'native' or 'stub'

Released under the MIT License.