Allow to disable reranking by having an empty provider
This commit is contained in:
parent
5103e6c2d7
commit
ffe867f7bb
2 changed files with 10 additions and 6 deletions
|
|
@ -109,6 +109,14 @@ Reranking improves search quality by re-ordering the initial search results usin
|
|||
|
||||
Reranking is **automatically enabled** by default using Ollama, or if you install the appropriate reranking provider package.
|
||||
|
||||
### Disabling Reranking
|
||||
|
||||
To disable reranking completely for faster searches:
|
||||
|
||||
```bash
|
||||
RERANK_PROVIDER=""
|
||||
```
|
||||
|
||||
### Ollama (Default)
|
||||
|
||||
Ollama reranking uses LLMs with structured output to rank documents by relevance:
|
||||
|
|
|
|||
|
|
@ -1,22 +1,18 @@
|
|||
from haiku.rag.config import Config
|
||||
from haiku.rag.reranking.base import RerankerBase
|
||||
|
||||
try:
|
||||
from haiku.rag.reranking.cohere import CohereReranker
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
_reranker: RerankerBase | None = None
|
||||
|
||||
|
||||
def get_reranker() -> RerankerBase | None:
|
||||
"""
|
||||
Factory function to get the appropriate reranker based on the configuration.
|
||||
Returns None if the required package is not available.
|
||||
Returns None if if reranking is disabled.
|
||||
"""
|
||||
global _reranker
|
||||
if _reranker is not None:
|
||||
return _reranker
|
||||
|
||||
if Config.RERANK_PROVIDER == "mxbai":
|
||||
try:
|
||||
from haiku.rag.reranking.mxbai import MxBAIReranker
|
||||
|
|
|
|||
Loading…
Reference in a new issue