Skip to content

feat(embed): add the Reranker trait seam + NoopReranker#123

Merged
jrosskopf merged 1 commit into
mainfrom
embed/reranker-seam
May 30, 2026
Merged

feat(embed): add the Reranker trait seam + NoopReranker#123
jrosskopf merged 1 commit into
mainfrom
embed/reranker-seam

Conversation

@jrosskopf
Copy link
Copy Markdown
Contributor

Summary

Closes audit finding #7 (spec→impl): the crate layout (spec
decision 5) names a Reranker seam in escurel-embed alongside
Embedder, but no such trait existed. v1's cut-line defers a real
cross-encoder, so this PR lands the seam + an identity default and
deliberately does not wire it into the retrieval path.

  • Reranker trait — async rerank(query, &[Candidate]) -> Vec<Ranked>
    (descending relevance), with Candidate { id, text } /
    Ranked { id, score }.
  • NoopReranker — preserves first-stage order with strictly
    descending placeholder scores, so adopting it later is
    behaviour-preserving until the bundled EmbeddingGemma CE head (or the
    opt-in bge-reranker-large) is implemented.

Test plan

  • crates/escurel-embed/src/reranker.rs unit tests — NoopReranker
    preserves input order with descending scores; empty input → empty
    output.
  • Local gate green: fmt, clippy -D warnings, cargo test --workspace --all-targets, release build.

🤖 Generated with Claude Code

The crate layout (spec decision 5) names a Reranker seam alongside
Embedder, but it was absent from code (audit finding #7). v1 defers a
real cross-encoder, so this lands the trait + an identity default
without wiring it into the search path.

- `Reranker` trait (async rerank(query, candidates) -> ranked) plus
  `Candidate` / `Ranked` shapes.
- `NoopReranker` preserves first-stage order with descending scores —
  a behaviour-preserving default until the EmbeddingGemma CE head
  lands.

Test plan:
- escurel-embed reranker.rs unit tests: Noop preserves input order
  with strictly-descending scores; empty input → empty output.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jrosskopf jrosskopf merged commit fd54500 into main May 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant