fix: answerdotai rerankers argument passing (#2117)

This fixes an issue for people wishing to use different kinds of
rerankers in lancedb via AnswerDotAI rerankers. Currently, the arguments
are passed sequentially, but they don't match the[Reranker class
implementation](d604a8c47d/rerankers/reranker.py (L179)):
the second argument is expected to be an optional "lang" for default
models, while model_type should be passed explicitly.

The one line changes in this PR fixes it and enables the use of other
methods (eg LLMs-as-rerankers)
This commit is contained in:
Benjamin Clavié
2025-03-24 16:01:59 +09:00
committed by GitHub
parent 846a5cea33
commit a68311a893

View File

@@ -42,7 +42,9 @@ class AnswerdotaiRerankers(Reranker):
rerankers = attempt_import_or_raise(
"rerankers"
) # import here for faster ops later
self.reranker = rerankers.Reranker(model_name, model_type, **kwargs)
self.reranker = rerankers.Reranker(
model_name=model_name, model_type=model_type, **kwargs
)
def _rerank(self, result_set: pa.Table, query: str):
docs = result_set[self.column].to_pylist()