|
20 | 20 | from ragas.metrics.validators import AllowedValuesType |
21 | 21 | from ragas.prompt import FewShotPydanticPrompt, PromptMixin |
22 | 22 | from ragas.run_config import RunConfig |
23 | | -from ragas.utils import camel_to_snake, deprecated, get_metric_language |
| 23 | +from ragas.utils import camel_to_snake, get_metric_language |
24 | 24 |
|
25 | 25 | if t.TYPE_CHECKING: |
26 | 26 | from langchain_core.callbacks import Callbacks |
@@ -153,79 +153,6 @@ def init(self, run_config: RunConfig) -> None: |
153 | 153 | """ |
154 | 154 | ... |
155 | 155 |
|
156 | | - @deprecated("0.2", removal="0.3", alternative="single_turn_ascore") |
157 | | - def score(self, row: t.Dict, callbacks: Callbacks = None) -> float: |
158 | | - """ |
159 | | - Calculates the score for a single row of data. |
160 | | -
|
161 | | - Note |
162 | | - ---- |
163 | | - This method is deprecated and will be removed in 0.3. Please use `single_turn_ascore` or `multi_turn_ascore` instead. |
164 | | - """ |
165 | | - callbacks = callbacks or [] |
166 | | - rm, group_cm = new_group( |
167 | | - self.name, |
168 | | - inputs=row, |
169 | | - callbacks=callbacks, |
170 | | - metadata={"type": ChainType.METRIC}, |
171 | | - ) |
172 | | - |
173 | | - async def _async_wrapper(): |
174 | | - try: |
175 | | - result = await self._ascore(row=row, callbacks=group_cm) |
176 | | - except Exception as e: |
177 | | - if not group_cm.ended: |
178 | | - rm.on_chain_error(e) |
179 | | - raise e |
180 | | - else: |
181 | | - if not group_cm.ended: |
182 | | - rm.on_chain_end({"output": result}) |
183 | | - return result |
184 | | - |
185 | | - # Apply nest_asyncio logic to ensure compatibility in notebook/Jupyter environments. |
186 | | - apply_nest_asyncio() |
187 | | - return run(_async_wrapper) |
188 | | - |
189 | | - @deprecated("0.2", removal="0.3", alternative="single_turn_ascore") |
190 | | - async def ascore( |
191 | | - self, |
192 | | - row: t.Dict, |
193 | | - callbacks: Callbacks = None, |
194 | | - timeout: t.Optional[float] = None, |
195 | | - ) -> float: |
196 | | - """ |
197 | | - Asynchronously calculates the score for a single row of data. |
198 | | -
|
199 | | - Note |
200 | | - ---- |
201 | | - This method is deprecated and will be removed in 0.3. Please use `single_turn_ascore` instead. |
202 | | - """ |
203 | | - callbacks = callbacks or [] |
204 | | - rm, group_cm = new_group( |
205 | | - self.name, |
206 | | - inputs=row, |
207 | | - callbacks=callbacks, |
208 | | - metadata={"type": ChainType.METRIC}, |
209 | | - ) |
210 | | - try: |
211 | | - score = await asyncio.wait_for( |
212 | | - self._ascore(row=row, callbacks=group_cm), |
213 | | - timeout=timeout, |
214 | | - ) |
215 | | - except Exception as e: |
216 | | - if not group_cm.ended: |
217 | | - rm.on_chain_error(e) |
218 | | - raise e |
219 | | - else: |
220 | | - if not group_cm.ended: |
221 | | - rm.on_chain_end({"output": score}) |
222 | | - return score |
223 | | - |
224 | | - async def _ascore(self, row: t.Dict, callbacks: Callbacks) -> float: |
225 | | - raise NotImplementedError( |
226 | | - f"Metric '{self.name}' has no implementation for _ascore. score() is deprecated and will be removed in 0.3. Please use single_turn_ascore or multi_turn_ascore instead." |
227 | | - ) |
228 | | - |
229 | 156 |
|
230 | 157 | @dataclass |
231 | 158 | class MetricWithLLM(Metric, PromptMixin): |
|
0 commit comments