diff --git a/deepeval/metrics/ragas.py b/deepeval/metrics/ragas.py index b0a5d9c72..72e99fe51 100644 --- a/deepeval/metrics/ragas.py +++ b/deepeval/metrics/ragas.py @@ -82,7 +82,10 @@ def measure(self, test_case: LLMTestCase): dataset = Dataset.from_dict(data) with capture_metric_type( - self.__name__, _track=self._track, async_mode=False + self.__name__, + _track=self._track, + async_mode=False, + in_component=False, ): # Evaluate the dataset using Ragas scores = evaluate( @@ -162,7 +165,10 @@ def measure(self, test_case: LLMTestCase): } dataset = Dataset.from_dict(data) with capture_metric_type( - self.__name__, _track=self._track, async_mode=False + self.__name__, + _track=self._track, + async_mode=False, + in_component=False, ): scores = evaluate(dataset, [context_recall], llm=chat_model) context_recall_score = scores["context_recall"][0] @@ -233,7 +239,10 @@ def measure(self, test_case: LLMTestCase): dataset = Dataset.from_dict(data) with capture_metric_type( - self.__name__, _track=self._track, async_mode=False + self.__name__, + _track=self._track, + async_mode=False, + in_component=False, ): scores = evaluate( dataset, @@ -383,7 +392,10 @@ def measure(self, test_case: LLMTestCase): dataset = Dataset.from_dict(data) with capture_metric_type( - self.__name__, _track=self._track, async_mode=False + self.__name__, + _track=self._track, + async_mode=False, + in_component=False, ): scores = evaluate( dataset, @@ -457,7 +469,10 @@ def measure(self, test_case: LLMTestCase): } dataset = Dataset.from_dict(data) with capture_metric_type( - self.__name__, _track=self._track, async_mode=False + self.__name__, + _track=self._track, + async_mode=False, + in_component=False, ): scores = evaluate(dataset, metrics=[faithfulness], llm=chat_model) faithfulness_score = scores["faithfulness"][0] @@ -526,7 +541,9 @@ def measure(self, test_case: LLMTestCase): RAGASFaithfulnessMetric(model=self.model, _track=False), ] - with capture_metric_type(self.__name__, async_mode=False): + with capture_metric_type( + self.__name__, async_mode=False, in_component=False + ): for metric in metrics: score = metric.measure(test_case) score_breakdown[metric.__name__] = score