🍕 Features
- Supports synchronous usage. No dependency on Tokio.
- Uses @pykeio/ort for performant ONNX inference.
- Uses @huggingface/tokenizers for fast encodings.
- Supports batch embeddings generation with parallelism using @rayon-rs/rayon.
🔍 Not looking for Rust?
- Python 🐍: fastembed
- Go 🐳: fastembed-go
- JavaScript 🌐: fastembed-js
🤖 Models
Text Embedding
- BAAI/bge-small-en-v1.5 - Default
- sentence-transformers/all-MiniLM-L6-v2
- mixedbread-ai/mxbai-embed-large-v1
- Qdrant/clip-ViT-B-32-text - pairs with the
clip-ViT-B-32-vision
image model for image-to-text search
- BAAI/bge-large-en-v1.5
- BAAI/bge-small-zh-v1.5
- BAAI/bge-base-en-v1.5
- sentence-transformers/all-MiniLM-L12-v2
- sentence-transformers/paraphrase-MiniLM-L12-v2
- sentence-transformers/paraphrase-multilingual-mpnet-base-v2
- nomic-ai/nomic-embed-text-v1
- nomic-ai/nomic-embed-text-v1.5 - pairs with the
nomic-embed-vision-v1.5
image model for image-to-text search - intfloat/multilingual-e5-small
- intfloat/multilingual-e5-base
- intfloat/multilingual-e5-large
- Alibaba-NLP/gte-base-en-v1.5
- Alibaba-NLP/gte-large-en-v1.5
Sparse Text Embedding
- prithivida/Splade_PP_en_v1 - Default
Image Embedding
- Qdrant/clip-ViT-B-32-vision - Default
- Qdrant/resnet50-onnx
- Qdrant/Unicom-ViT-B-16
- Qdrant/Unicom-ViT-B-32
- nomic-ai/nomic-embed-vision-v1.5
Reranking
- BAAI/bge-reranker-base - Default
- BAAI/bge-reranker-v2-m3
- jinaai/jina-reranker-v1-turbo-en
- jinaai/jina-reranker-v2-base-multiligual
🚀 Installation
Run the following command in your project directory:
Or add the following line to your Cargo.toml:
[]
= "4"
📖 Usage
Text Embeddings
use ;
// With default InitOptions
let model = try_new?;
// With custom InitOptions
let model = try_new?;
let documents = vec!;
// Generate embeddings with the default batch size, 256
let embeddings = model.embed?;
println!; // -> Embeddings length: 4
println!; // -> Embedding dimension: 384
Image Embeddings
use ;
// With default InitOptions
let model = try_new?;
// With custom InitOptions
let model = try_new?;
let images = vec!;
// Generate embeddings with the default batch size, 256
let embeddings = model.embed?;
println!; // -> Embeddings length: 2
println!; // -> Embedding dimension: 512
Candidates Reranking
use ;
let model = try_new?;
let documents = vec!;
// Rerank with the default batch size, 256 and return document contents
let results = model.rerank?;
println!;
Alternatively, local model files can be used for inference via the try_new_from_user_defined(...)
methods of respective structs.
✊ Support
To support the library, please consider donating to our primary upstream dependency, ort
- The Rust wrapper for the ONNX runtime.
📄 LICENSE
Apache 2.0 © 2024