The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
[Community]: HuggingFaceCrossEncoder `score` accounting for <not-relevant score,relevant score> pairs. (#22578)
Mohammad Mohtashimd1b7a934aa85
diff --git a/libs/community/langchain_community/cross_encoders/huggingface.py b/libs/community/langchain_community/cross_encoders/huggingface.pyindex 6cfbceff7a..0a1229bb03 100644--- a/libs/community/langchain_community/cross_encoders/huggingface.py+++ b/libs/community/langchain_community/cross_encoders/huggingface.py@@ -60,4 +60,8 @@ class HuggingFaceCrossEncoder(BaseModel, BaseCrossEncoder):List of scores, one for each pair."""scores = self.client.predict(text_pairs)+ # Somes models e.g bert-multilingual-passage-reranking-msmarco+ # gives two score not_relevant and relevant as compare with the query.+ if len(scores.shape) > 1: # we are going to get the relevant scores+ scores = map(lambda x: x[1], scores)return scores