Skip to content

Commit

Permalink
Merge pull request #36 from prabhkaran/fix/rank-extraction-in-listwis…
Browse files Browse the repository at this point in the history
…e-ranking

Fix: rank extraction by stripping square brackets in listwise ranking
  • Loading branch information
PrithivirajDamodaran authored Oct 8, 2024
2 parents b068ee5 + 2810a2d commit a7481ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion flashrank/Ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def rerank(self, request: RerankRequest) -> List[Dict[str, Any]]:
raw_ranks = self.llm_model.create_chat_completion(messages)
results = []
for rank in raw_ranks["choices"][0]["message"]["content"].split(" > "):
results.append(result_map[int(rank[1])])
results.append(result_map[int(rank.strip("[]"))])
return results

# self.session will be instantiated for ONNX based pairwise CE models
Expand Down

0 comments on commit a7481ad

Please sign in to comment.