Skip to main content

compute_with_embedder

Function compute_with_embedder 

Source
pub fn compute_with_embedder(
    pairs: &[(&Record, &Record)],
    embedder: &dyn Embedder,
    seed: Option<u64>,
) -> AxisStat
Expand description

Compute the semantic-similarity axis using a caller-supplied dense Embedder.

The embedder is invoked once per side: baseline texts are embedded together, then candidate texts. Pair-wise cosine similarity is computed in Rust on the returned vectors, then folded into the usual median + paired-CI shape.

Mismatched dimensions or a zero-length result are treated as a no-op axis (AxisStat::empty) so a misconfigured embedder can’t poison the rest of the report.