embedding-utils

Vector math, similarity search, ANN indexing, clustering, async pipelines, evaluation metrics, and multi-provider embedding generation -- zero dependencies, full TypeScript, one import.

A TypeScript library covering vector math, similarity search, ANN indexing, clustering, async pipelines, evaluation metrics, and multi-provider embedding generation behind a single import, with zero production dependencies. It targets semantic search, RAG pipelines, recommendation engines, duplicate detection, and document clustering without pulling in heavy ML frameworks or vector databases. The API includes HNSW approximate nearest-neighbor search, hybrid search with reciprocal rank fusion and score normalization, HDBSCAN clustering, aggregation, quantization, and random-projection dimensionality reduction. It also provides markdown-aware chunking, storage, model management, and higher-level APIs, plus documented local inference setup and multiple embedding providers.

Installation

Requires Node.js 18+. Supports both ESM and CommonJS.

npm install embedding-utils

For local ONNX inference (no API key needed), also install the optional peer dependency:

npm install @huggingface/transformers