diff --git a/sentence_transformers/evaluation/TripletEvaluator.py b/sentence_transformers/evaluation/TripletEvaluator.py index 786180e19..ff17e89e9 100644 --- a/sentence_transformers/evaluation/TripletEvaluator.py +++ b/sentence_transformers/evaluation/TripletEvaluator.py @@ -71,6 +71,7 @@ def __init__( write_csv: bool = True, truncate_dim: int | None = None, similarity_fn_names: list[Literal["cosine", "dot", "euclidean", "manhattan"]] | None = None, + main_distance_function: str | SimilarityFunction | None = "deprecated", ): """ Initializes a TripletEvaluator object. @@ -107,6 +108,13 @@ def __init__( assert len(self.anchors) == len(self.positives) assert len(self.anchors) == len(self.negatives) + if main_distance_function != "deprecated" and main_similarity_function is None: + main_similarity_function = main_distance_function + logger.warning( + "The 'main_distance_function' parameter is deprecated. Please use 'main_similarity_function' instead. " + "'main_distance_function' will be removed in a future release." + ) + self.main_similarity_function = ( SimilarityFunction(main_similarity_function) if main_similarity_function else None )