mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 12:32:30 +08:00
Refactor:Improve VoyageRerank not texts handling (#9539)
### What problem does this PR solve? Improve VoyageRerank not texts handling ### Type of change - [x] Refactoring
This commit is contained in:
@ -482,9 +482,10 @@ class VoyageRerank(Base):
|
||||
self.model_name = model_name
|
||||
|
||||
def similarity(self, query: str, texts: list):
|
||||
rank = np.zeros(len(texts), dtype=float)
|
||||
if not texts:
|
||||
return rank, 0
|
||||
return np.array([]), 0
|
||||
rank = np.zeros(len(texts), dtype=float)
|
||||
|
||||
res = self.client.rerank(query=query, documents=texts, model=self.model_name, top_k=len(texts))
|
||||
try:
|
||||
for r in res.results:
|
||||
|
||||
Reference in New Issue
Block a user