bm42

Crates.iobm42
lib.rsbm42
version0.0.0-alpha-rc.7
sourcesrc
created_at2024-07-06 15:27:08.660029
updated_at2024-07-08 06:46:50.916552
descriptionRust implementation of Qdrant's BM42
homepagehttps://crates.io/crates/bm42
repositoryhttps://github.com/Anush008/bm42-rs
max_upload_size
id1294146
size37,034
Anush (Anush008)

documentation

README

BM42-rs 🦀

Rust implementation of Qdrant BM42

Crates.io Apache Licensed Licensed

🔍 Not looking for Rust?

📥 Installation

Run the following command in your project directory:

cargo add bm42

Or add the following line to your Cargo.toml:

[dependencies]
bm42 = "0"

📖 Usage

Generating Sparse Embeddings

use bm42::{BM42Options, BM42};

// With default InitOptions
let bm42 = BM42::try_new(Default::default()).unwrap();

// With custom BM42Options
let bm42_options = BM42Options {
    alpha: 0.5,
    show_download_progress: true,
    ..Default::default()
};

let texts = vec![
    "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).unwrap();

// Generate embeddings for querying
let query_embeddings = bm42.query_embed(texts).unwrap();

📄 LICENSE

Apache 2.0 © 2024

Commit count: 3

cargo fmt