Practical overview
When it fits
Use it when embedding or reranking is the model-inference component you need inside a Rust retrieval, search, or RAG system, rather than a hosted end-user search product.
Who it is for
- Rust developers adding local embedding generation to retrieval or semantic-search pipelines.
- Teams building Rust applications that need to rerank candidate search results.
- Developers who want synchronous model use without a Tokio dependency.
Documented uses
- Generate dense or sparse vectors from text for a retrieval workflow.
- Generate image embeddings for image-related search workflows.
- Rerank a set of candidate results.
- Choose among documented embedding and reranking models for a Rust application.
Requirements & limits
The repository specifies the Apache-2.0 license.
- The standard documented inference path uses ONNX through ort and Hugging Face tokenizers.
- The README lists distinct model families for text, sparse text, images, and reranking.
- Qwen3 models require the qwen3 feature and candle backend; Nomic Embed Text v2 MoE requires the nomic-v2-moe feature and candle backend.
- The documented OpenSearch neural sparse model offers inference-free query embeddings using a tokenizer and precomputed IDF table.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Add Fastembed Rs to a Rust project
Declare the library as a project dependency before using its documented Rust model APIs.
Before you start
- A Rust project using Cargo.
Steps
In the project directory, run the command below.
cargo add fastembedAlternatively, add
fastembed = "7"under[dependencies]in Cargo.toml.
Expected outcome
Fastembed Rs is declared as a dependency for the Rust project.
Guide limitations
- The documented dependency declaration does not by itself initialize a model or generate embeddings.
Generate text embeddings in Rust
Initialize a documented text embedding model and embed a batch of text inputs.
Before you start
- Fastembed Rs declared as a Cargo dependency.
Steps
Import TextEmbedding, TextInitOptions, and EmbeddingModel from fastembed.
Initialize a model with
TextEmbedding::try_new(Default::default())?, or select a model with TextInitOptions.Pass a vector of text inputs to
model.embed(documents, None)?.
Expected outcome
The documented API returns one embedding for each input; the example reports four embeddings with a dimension of 384 for its selected default setup.
Guide limitations
- The README recommends query and passage prefixes for relevant inputs, while noting they can be omitted.
- The example's reported dimension applies to that example and should not be assumed for other models.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 9 October 2026
- Original website title
- anush008/fastembed-rs · Official homepage title · retained in its source language

