bm42
v0.0.6
Published
TS/JS implementation of Qdrant BM42
Downloads
5
Readme
🔍 Not looking for JS?
- Python 🐍: BM42 with FastEmbed
- Rust 🦀: BM42-rs
📥 Installation
Run the following command in your project directory:
npm install bm42
Platform Support
This library uses Rust bindings of https://github.com/Anush008/bm42-rs. Works for the following architectures.
- darwin-arm64
- darwin-x64
- linux-x64-gnu
- win32-x64-msvc
📖 Usage
Generating Sparse Embeddings
import { BM42 } from "bm42";
// With default options
let bm42 = new BM42();
// With custom options
let bm42 = new BM42({
alpha: 0.5,
showDownloadProgress: true,
// others
});
let texts = [
"It's a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.",
"We're not in Infinity; we're in the suburbs.",
"I was a thousand times more evil than thou!",
"History is merely a list of surprises... It can only prepare us to be surprised yet again.",
];
// Generate embeddings for indexing
let doc_embeddings = bm42.embed(texts);
// Generate embeddings for querying
let query_embeddings = bm42.queryEmbed(texts);
📄 LICENSE
Apache 2.0 © 2024