Skip to main content

Crate embroider

Crate embroider 

Source
Expand description

Embroider — Jina v5 text embeddings through ONNX Runtime.

Rust core with opt-in PyO3 bindings (the bobine pattern). The crate layering: providers/probe/policy/acquire/error/diag are the shared ONNX plumbing (session building, provider fallback, CUDA probing, HF acquisition); jina is the frozen text-embedding contract.

Provenance: a clean move out of OKFgraph’s rust/okf-embed (itself an exact port of EmbeddingEngine._encode, pinned by that repo’s parity harness at ≤1e-5). Session/threading choices follow EmbedAnything’s ort_jina.rs; device fallback semantics mirror bobine: CUDA is opportunistic, never fatal.

§Module layout

  • error — anyhow-based error plumbing (oe stringification)
  • providers — provider-name matrix + clone-and-fallback application
  • probe — corrected CUDA availability check (OnceLock-cached)
  • policyDeviceReq + explicit SessionPolicy (text vs defaults)
  • acquire — validated HF hub acquisition (blocking, cached)
  • diagOrtReport observation for logs and diagnostics
  • jinaJinaV5 + TokenizerHandle (the frozen contract)

Re-exports§

pub use acquire::fetch_tokenizer_file;
pub use acquire::parse_owner_name;
pub use diag::report;
pub use diag::OrtReport;
pub use jina::JinaV5;
pub use jina::TokenizerHandle;
pub use jina::MAX_LENGTH;
pub use jina::MODEL_MAX_TOKENS;
pub use jina::NATIVE_DIM;
pub use policy::DeviceReq;
pub use policy::SessionPolicy;
pub use probe::cuda_available;
pub use providers::apply_providers;
pub use providers::map_provider;
pub use providers::ProviderMapping;

Modules§

acquire
HuggingFace acquisition (blocking, cached).
diag
Runtime observation shared by consumers’ logs and diagnostics.
error
Error plumbing.
jina
The Jina v5 text-embedding contract.
policy
Device requests and session tuning policy.
probe
CUDA availability probing against the loaded ONNX Runtime library.
providers
ONNX Runtime execution-provider plumbing.