Skip to content

feat(embeddings): add resilient voyage reranking support - #59

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
Johnson-f:feat/voyage-reranking
Oct 4, 2026
Merged

senamakel merged 1 commit into
tinyhumansai:mainfrom
Johnson-f:feat/voyage-reranking

Conversation

@Johnson-f

Copy link
Copy Markdown
Contributor

Summary

Add standalone Voyage reranking to tinyinference-embeddings. Callers can rerank document texts from any search system and map validated results back to the original candidates without changing stored vectors, metadata, or similarity scores.

Also make the existing voice cleanup timeout test deterministic: it now exercises unfinished inference directly instead of waiting on socket activity while Tokio time is paused.

Related issue

None.

API or behavior changes

  • Export Reranker, request/result/usage types, cancellation, VoyageReranker, and VoyageRerankConfig.
  • Default to rerank-3, a 30-second total deadline, bounded request/response bodies, and up to three retries for explicit 429/500/502/503/504 responses. Transport interruptions are not replayed.
  • Validate result counts, original document positions, duplicate indices, and finite scores. Keep missing usage unknown and require explicit opt-in to input truncation.
  • Keep fallback decisions and original document storage with the caller.
  • Add Error::Rerank(RerankError): downstream exhaustive matches on the existing error enum need a new arm.
  • No new production dependencies; existing embedding and public voice-cleanup behavior remain unchanged.

Validation

All passed locally against the committed contents:

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo build --all-targets --all-features
  • cargo test --all-features
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features

Live verification used the public Rust adapter with retries disabled: one rerank-3 request correctly selected the top two of three documents, preserved original positions, and reported 75 input tokens in 839 ms. The temporary runner was removed; credentials were not saved.

Tests

Added 25 reranking tests covering request shape, result validation, usage, original-document mapping, both candidate sources, cancellation, deadlines, retry boundaries, byte limits, and credential-safe diagnostics. The embedding package passes 100 unit tests and seven documentation tests.

The updated voice timeout test checks that work is still pending before its deadline, returns the original text afterward, and drops the unfinished operation. The complete workspace suite now finishes without skipping that test.

Failure-path tests use synthetic provider responses and controlled time; live verification covers one successful request, not provider outages or billing guarantees.

Documentation

Updated README.md and the rerank module rustdoc with configuration, source-text ownership, result mapping, caller fallback, retry/billing limits, and the new error arm.

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 495eaabf-0a1d-414d-a855-e2d75249a6f6
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@tinysweeper

tinysweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 6 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Incomplete
Priority: none
Reviewed head: ca84c28c0489
Updated: 1791069631 (Unix time)

Review snapshot

Change surface Files Review signal Count
Production 7 Active findings 0
Tests 3 Noted findings 0
Documentation 1 Resolved findings 5
Configuration 1 Pending checks/questions 24

Completeness: Incomplete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

The review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

  • Unreviewed: tinysweeper/tests

Findings

No active actionable findings.

Resolved this pass

  • pass static slices to Bytes::from_static
  • wire marker helpers into the Ollama lifecycle
  • return the crate-wide typed result
  • keep token offsets on valid UTF-8 boundaries
  • fall back when the preferred catalog identifier is unusable

Could not review: README.md, crates/tinyinference-embeddings/Cargo.toml, crates/tinyinference-embeddings/src/error.rs, crates/tinyinference-embeddings/src/lib.rs, crates/tinyinference-embeddings/src/rerank/mod.rs, crates/tinyinference-embeddings/src/rerank/mod_tests.rs, crates/tinyinference-embeddings/src/rerank/types.rs, crates/tinyinference-embeddings/src/rerank/voyage.rs, crates/tinyinference-embeddings/src/rerank/voyage_tests.rs, crates/tinyinference-embeddings/src/types.rs, crates/tinyinference-voice/src/postprocess.rs, crates/tinyinference-voice/src/postprocess_tests.rs, tinysweeper/tests

Before merge

  • Complete the critique review for README.md, crates/tinyinference-embeddings/Cargo.toml, crates/tinyinference-embeddings/src/error.rs, crates/tinyinference-embeddings/src/lib.rs, crates/tinyinference-embeddings/src/types.rs, crates/tinyinference-embeddings/src/rerank/mod.rs, crates/tinyinference-embeddings/src/rerank/mod_tests.rs, crates/tinyinference-embeddings/src/rerank/types.rs, crates/tinyinference-embeddings/src/rerank/voyage.rs, crates/tinyinference-embeddings/src/rerank/voyage_tests.rs, crates/tinyinference-voice/src/postprocess.rs, crates/tinyinference-voice/src/postprocess_tests.rs.
  • Complete the security review for crates/tinyinference-embeddings/src/rerank/voyage.rs, crates/tinyinference-embeddings/src/rerank/voyage_tests.rs, crates/tinyinference-embeddings/Cargo.toml, crates/tinyinference-embeddings/src/error.rs, crates/tinyinference-embeddings/src/lib.rs, crates/tinyinference-embeddings/src/types.rs, crates/tinyinference-embeddings/src/rerank/mod.rs, crates/tinyinference-embeddings/src/rerank/mod_tests.rs, crates/tinyinference-embeddings/src/rerank/types.rs, crates/tinyinference-voice/src/postprocess.rs, crates/tinyinference-voice/src/postprocess_tests.rs.
  • Complete the tests review for tinysweeper/tests.

How this fits together

flowchart LR
  n0["cleanup_transcription<br/>changed"]:::changed
  n1["llm_error_response_falls_back_to_raw_text<br/>changed"]:::changed
  n2["runtime_and_service"]:::impacted
  n3["spawn_mock"]:::impacted
  n4["chat_response"]:::impacted
  n5["degraded_service_still_runs_cleanup"]:::impacted
  n6["empty_llm_response_falls_back_to_raw_text"]:::impacted
  n1 -->|calls| n0
  n1 -->|tests| n0
  n1 -->|calls| n2
  n1 -->|tests| n2
  n1 -->|calls| n3
  n1 -->|tests| n3
  n5 -->|calls| n0
  n5 -->|tests| n0
  n5 -->|calls| n2
  n5 -->|tests| n2
  n5 -->|calls| n3
  n5 -->|tests| n3
  n5 -->|calls| n4
  n5 -->|tests| n4
  n6 -->|calls| n0
  n6 -->|tests| n0
  n6 -->|calls| n2
  n6 -->|tests| n2
  n6 -->|calls| n3
  n6 -->|tests| n3
  n6 -->|calls| n4
  n6 -->|tests| n4
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: README.md, crates/tinyinference-embeddings/Cargo.toml, crates/tinyinference-embeddings/src/error.rs, crates/tinyinference-embeddings/src/lib.rs, crates/tinyinference-embeddings/src/types.rs, crates/tinyinference-embeddings/src/rerank/mod.rs, crates/tinyinference-embeddings/src/rerank/mod_tests.rs, crates/tinyinference-embeddings/src/rerank/types.rs, crates/tinyinference-embeddings/src/rerank/voyage.rs, crates/tinyinference-embeddings/src/rerank/voyage_tests.rs, crates/tinyinference-voice/src/postprocess.rs, crates/tinyinference-voice/src/postprocess_tests.rs
  • Lane summary: Reviewed 0 files; 0 findings. 12 files could not be reviewed: README.md, crates/tinyinference-embeddings/Cargo.toml, crates/tinyinference-embeddings/src/error.rs, crates/tinyinference-embeddings/src/lib.rs, crates/tinyinference-embeddings/src/types.rs, crates/tinyinference-embeddings/src/rerank/mod.rs, crates/tinyinference-embeddings/src/rerank/mod_tests.rs, crates/tinyinference-embeddings/src/rerank/types.rs, crates/tinyinference-embeddings/src/rerank/voyage.rs, crates/tinyinference-embeddings/src/rerank/voyage_tests.rs, crates/tinyinference-voice/src/postprocess.rs, crates/tinyinference-voice/src/postprocess_tests.rs.

security

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: crates/tinyinference-embeddings/src/rerank/voyage.rs, crates/tinyinference-embeddings/src/rerank/voyage_tests.rs, crates/tinyinference-embeddings/Cargo.toml, crates/tinyinference-embeddings/src/error.rs, crates/tinyinference-embeddings/src/lib.rs, crates/tinyinference-embeddings/src/types.rs, crates/tinyinference-embeddings/src/rerank/mod.rs, crates/tinyinference-embeddings/src/rerank/mod_tests.rs, crates/tinyinference-embeddings/src/rerank/types.rs, crates/tinyinference-voice/src/postprocess.rs, crates/tinyinference-voice/src/postprocess_tests.rs
  • Lane summary: Reviewed 0 files; 0 findings. 11 files could not be reviewed: crates/tinyinference-embeddings/src/rerank/voyage.rs, crates/tinyinference-embeddings/src/rerank/voyage_tests.rs, crates/tinyinference-embeddings/Cargo.toml, crates/tinyinference-embeddings/src/error.rs, crates/tinyinference-embeddings/src/lib.rs, crates/tinyinference-embeddings/src/types.rs, crates/tinyinference-embeddings/src/rerank/mod.rs, crates/tinyinference-embeddings/src/rerank/mod_tests.rs, crates/tinyinference-embeddings/src/rerank/types.rs, crates/tinyinference-voice/src/postprocess.rs, crates/tinyinference-voice/src/postprocess_tests.rs. 1 file was not security-reviewed: README.md (prose or tabular data).

tests

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: tinysweeper/tests
  • Lane summary: No reviewer could be consulted.

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: This pull request adds Voyage reranking to the embeddings crate with a new public `Reranker` trait, request/response types, configurable retry and timeout behaviour, and full validation of provider results. The existing voice cleanup timeout test is also refactored to use an unfinished inference future directly. The code is cleanly structured, follows the repository's patterns, and no new issues were found. _Code retrieval was unavailable (model: ladder embeddings returned 402 Payment Required: {"error":"Insufficient USD or Diem balance to complete request. Visit https://venice\.ai/settings/api to add credits."}), so this review saw the diff alone._ _3 memory call(s) failed (model: cortex: v1/answer: timed out after 20s), so this review saw part of what the engine holds._

e2e

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: No end-to-end harness in this repository: no e2e test files and no e2e workflow.
Evidence and run details
  • Models: deepseek/deepseek-v4-flash
  • Spend: $0.001672
  • Tokens: 51922 input · 3905 output · 0 cached · 0 embedding
Head State Pass summary
ca84c28c0489 incomplete 0 active finding(s), 5 resolved finding(s) (at 1791069631)

tinysweeper 0.1.0

@Johnson-f

Copy link
Copy Markdown
Contributor Author

@senamakel pls review.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: README.md, crates/tinyinference-embeddings/Cargo.toml, crates/tinyinference-embeddings/src/error.rs, crates/tinyinference-embeddings/src/lib.rs, crates/tinyinference-embeddings/src/rerank/mod.rs, crates/tinyinference-embeddings/src/rerank/mod_tests.rs, crates/tinyinference-embeddings/src/rerank/types.rs, crates/tinyinference-embeddings/src/rerank/voyage.rs and 5 more.

             $0.0017 · 51,922 in / 3,905 out · 0 cached (0%) · deepseek/deepseek-v4-flash
description: $0.0008 · 26,992 in / 162 out   · 0 cached (0%) · deepseek/deepseek-v4-flash

@senamakel

Copy link
Copy Markdown
Member

looks great

@senamakel
senamakel merged commit e7a2599 into tinyhumansai:main Oct 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants