eval.rerankers¶
chunktuner.eval.rerankers
¶
Reranker backends — dummy for tests, local cross-encoder, and LiteLLM for hosted APIs.
DummyReranker
¶
Deterministic lexical-overlap reranker for tests (no network, no dependencies).
Score = fraction of distinct query words present in the document, plus a tiny bonus for total query-word occurrences so documents with equal coverage still separate.
Source code in src/chunktuner/eval/rerankers.py
CrossEncoderReranker
¶
Local sentence-transformers cross-encoder (downloads the model on first use).
Source code in src/chunktuner/eval/rerankers.py
LiteLLMReranker
¶
LiteLLM-backed reranking (calls provider rerank APIs, e.g. cohere/rerank-v3.5).
Source code in src/chunktuner/eval/rerankers.py
validate_reranker_spec
¶
Check a reranker spec string without importing any backend; returns it stripped.
Valid specs: dummy, local, local:<model id>, or a LiteLLM rerank model string.
Source code in src/chunktuner/eval/rerankers.py
reranker_from_spec
¶
Build a reranker from a spec string (see validate_reranker_spec); None/"" -> None.
Source code in src/chunktuner/eval/rerankers.py
reranker_spec
¶
Spec string that reranker_from_spec turns back into an equivalent reranker.