7个版本

0.0.0-alpha-rc.72024年7月8日
0.0.0-alpha-rc.62024年7月7日
0.0.0-alpha-rc.52024年7月6日

#257 in 科学

Download history 346/week @ 2024-07-04 17/week @ 2024-07-11

363 每月下载量

Apache-2.0

24KB
482 代码行

BM42-rs 🦀

Rust实现的Qdrant BM42

Crates.io Apache Licensed Licensed

🔍 不需要Rust?

📥 安装

在您的项目目录中运行以下命令

cargo add bm42

或者将以下行添加到您的Cargo.toml文件中

[dependencies]
bm42 = "0"

📖 使用方法

生成稀疏嵌入

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();

📄 许可证

Apache 2.0 © 2024

依赖关系

~22–35MB
~590K SLoC