From b7d035115394e147bd3789ee371157494259cbc7 Mon Sep 17 00:00:00 2001 From: Prof <64834222+oslijunw@users.noreply.github.com> Date: Wed, 15 Jan 2025 19:41:58 +0800 Subject: [PATCH] raise error for type check --- src/ragas/testset/synthesizers/multi_hop/base.py | 2 +- src/ragas/testset/synthesizers/single_hop/base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ragas/testset/synthesizers/multi_hop/base.py b/src/ragas/testset/synthesizers/multi_hop/base.py index ecccb6c33..48b72ba7c 100644 --- a/src/ragas/testset/synthesizers/multi_hop/base.py +++ b/src/ragas/testset/synthesizers/multi_hop/base.py @@ -161,7 +161,7 @@ async def _generate_sample( self, scenario: Scenario, callbacks: Callbacks ) -> SingleTurnSample: if not isinstance(scenario, MultiHopScenario): - logger.warning('scenario type should be MultiHopScenario') + raise TypeError('scenario type should be MultiHopScenario') reference_context = self.make_contexts(scenario) prompt_input = QueryConditions( persona=scenario.persona, diff --git a/src/ragas/testset/synthesizers/single_hop/base.py b/src/ragas/testset/synthesizers/single_hop/base.py index 6ab0c4412..3a60a6dbc 100644 --- a/src/ragas/testset/synthesizers/single_hop/base.py +++ b/src/ragas/testset/synthesizers/single_hop/base.py @@ -122,7 +122,7 @@ async def _generate_sample( self, scenario: Scenario, callbacks: Callbacks ) -> SingleTurnSample: if not isinstance(scenario, SingleHopScenario): - logger.warning('scenario type should be SingleHopScenario') + raise TypeError('scenario type should be SingleHopScenario') reference_context = scenario.nodes[0].properties.get("page_content", "") prompt_input = QueryCondition( persona=scenario.persona,