Skip to content

Commit e4a88d6

Browse files
removed MetricWithLLM from SemanticSimilarity (#1678)
- `SemanticSimilarity` is not an LLM metric, so it doesn't have to extend `MetricWithLLM`
1 parent e126418 commit e4a88d6

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/ragas/metrics/_answer_correctness.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ def __post_init__(self):
195195
def init(self, run_config: RunConfig):
196196
super().init(run_config)
197197
if self.answer_similarity is None and self.weights[1] != 0:
198-
self.answer_similarity = AnswerSimilarity(
199-
llm=self.llm, embeddings=self.embeddings
200-
)
198+
self.answer_similarity = AnswerSimilarity(embeddings=self.embeddings)
201199

202200
def _compute_statement_presence(
203201
self, prediction: ClassificationWithReason

src/ragas/metrics/_answer_similarity.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from ragas.metrics.base import (
1212
MetricType,
1313
MetricWithEmbeddings,
14-
MetricWithLLM,
1514
SingleTurnMetric,
1615
)
1716

@@ -23,7 +22,7 @@
2322

2423

2524
@dataclass
26-
class SemanticSimilarity(MetricWithLLM, MetricWithEmbeddings, SingleTurnMetric):
25+
class SemanticSimilarity(MetricWithEmbeddings, SingleTurnMetric):
2726
"""
2827
Scores the semantic similarity of ground truth with generated answer.
2928
cross encoder score is used to quantify semantic similarity.

0 commit comments

Comments
 (0)