Skip to content

Commit

Permalink
removed MetricWithLLM from SemanticSimilarity (explodinggradients#1678)
Browse files Browse the repository at this point in the history
- `SemanticSimilarity` is not an LLM metric, so it doesn't have to
extend `MetricWithLLM`
  • Loading branch information
Luka958Pixion authored and shahules786 committed Nov 14, 2024
1 parent bdfa339 commit 162370f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/ragas/metrics/_answer_correctness.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ def __post_init__(self):
def init(self, run_config: RunConfig):
super().init(run_config)
if self.answer_similarity is None and self.weights[1] != 0:
self.answer_similarity = AnswerSimilarity(
llm=self.llm, embeddings=self.embeddings
)
self.answer_similarity = AnswerSimilarity(embeddings=self.embeddings)

def _compute_statement_presence(
self, prediction: ClassificationWithReason
Expand Down
3 changes: 1 addition & 2 deletions src/ragas/metrics/_answer_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from ragas.metrics.base import (
MetricType,
MetricWithEmbeddings,
MetricWithLLM,
SingleTurnMetric,
)

Expand All @@ -23,7 +22,7 @@


@dataclass
class SemanticSimilarity(MetricWithLLM, MetricWithEmbeddings, SingleTurnMetric):
class SemanticSimilarity(MetricWithEmbeddings, SingleTurnMetric):
"""
Scores the semantic similarity of ground truth with generated answer.
cross encoder score is used to quantify semantic similarity.
Expand Down

0 comments on commit 162370f

Please sign in to comment.