Expand description
§mnem-rerank-providers
Cross-encoder reranker adapters for mnem. Ships Cohere, Voyage, and Jina out of the box; all three behind opt-in (on-by-default) cargo features.
§Scope
Per , mnem-core defines a
Reranker trait
and wires it into the retrieve
pipeline as an optional post-fusion pass over the top-K. This crate
provides the production adapters. The adapters all read (query, candidate) pairs jointly, which is what makes them useful for
compositional paraphrase that defeats dense + sparse bi-encoder
fusion (“father’s sister” == “aunt”).
§Invariants
- No tokio / no async. All adapters are sync, built on top of
ureq(rustls-backed). Matchesmnem-embed-providers. - No API keys in config / on disk. The config stores the name
of the env var holding the key (
api_key_env). The key itself is read from the environment at adapter-construction time and is never persisted by this crate. mnem-coreis not pulled onto an HTTP client.mnem-corestill has zero network / HTTP / tokio in its dep tree, preserving the WASM-embeddability promises.
§Usage
let cfg = ProviderConfig::Cohere(CohereConfig {
model: "rerank-v3.5".into(),
..Default::default()
});
let rr: Arc<dyn Reranker> = open(&cfg)?;
let scores = rr.rerank("who is my father's sister", &["Eve is my aunt", "Bob is my cousin"])?;
assert_eq!(scores.len(), 2);Re-exports§
pub use config::CohereConfig;pub use config::JinaConfig;pub use config::ProviderConfig;pub use config::VoyageConfig;pub use config::open;