1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! Embedding backends for trusty-analyzer.
//!
//! Why: clustering quality depends heavily on embedding quality. BOW hashing
//! is cheap and always available; neural embeddings (fastembed) produce
//! semantically richer vectors at the cost of a one-time model load.
//!
//! What: `Embedder` trait with two implementations — `BowEmbedder` (wraps
//! `crate::core::bow_embedding`) and `NeuralEmbedder` (fastembed
//! `all-MiniLM-L6-v2`). `EmbedderKind` selects which to use.
//!
//! Test: both embedders produce normalized vectors of the correct dimension.
pub use BowEmbedder;
pub use NeuralEmbedder;
/// Which embedding backend to use.
/// Common interface for all embedding backends.
///
/// Why: callers (clustering, similarity search) should be backend-agnostic so
/// that we can swap BOW for neural without touching call sites.
/// What: embed a batch of texts into a `Vec<Vec<f32>>` of consistent
/// dimension; expose `kind()` for response metadata and `dim()` for sanity
/// checks.
/// Test: see per-implementation tests in `bow.rs` and `neural.rs`.