|
11 | 11 | from pydantic import BaseModel, ConfigDict, Field |
12 | 12 | from ragas.evaluation import EvaluationDataset, EvaluationResult, RunConfig, evaluate |
13 | 13 | from ragas.metrics import Metric |
14 | | -from ragas.metrics._domain_specific_rubrics import ( # the rubrics we must instantiate are located inside of a file marked as private |
15 | | - DEFAULT_WITH_REFERENCE_RUBRICS, |
16 | | - RubricsScore, |
17 | | -) |
| 14 | +from ragas.metrics._domain_specific_rubrics import RubricsScore |
18 | 15 |
|
19 | 16 | # Local |
20 | 17 | from .evaluator import Evaluator |
21 | 18 | from .logger_config import setup_logger |
22 | 19 |
|
23 | 20 | logger = setup_logger(__name__) |
24 | 21 |
|
| 22 | +# DEFAULT_WITH_REFERENCE_RUBRICS from ragas v0.2.11. |
| 23 | +# This rubric is hardcoded in case ragas makes any changes to their DEFAULT_WITH_REFERENCE_RUBRICS in the future |
| 24 | +SCORING_RUBRICS = { |
| 25 | + "score1_description": "The response is entirely incorrect, irrelevant, or does not align with the reference in any meaningful way.", |
| 26 | + "score2_description": "The response partially matches the reference but contains major errors, significant omissions, or irrelevant information.", |
| 27 | + "score3_description": "The response aligns with the reference overall but lacks sufficient detail, clarity, or contains minor inaccuracies.", |
| 28 | + "score4_description": "The response is mostly accurate, aligns closely with the reference, and contains only minor issues or omissions.", |
| 29 | + "score5_description": "The response is fully accurate, completely aligns with the reference, and is clear, thorough, and detailed.", |
| 30 | +} |
| 31 | + |
25 | 32 |
|
26 | 33 | class Sample(TypedDict): |
27 | 34 | """ |
@@ -256,9 +263,8 @@ def _generate_answers_from_model( |
256 | 263 |
|
257 | 264 | @staticmethod |
258 | 265 | def _get_metrics() -> List[Metric]: |
259 | | - # default set of metrics |
260 | 266 | return [ |
261 | 267 | RubricsScore( |
262 | | - rubrics=DEFAULT_WITH_REFERENCE_RUBRICS, |
| 268 | + rubrics=SCORING_RUBRICS, |
263 | 269 | ) |
264 | 270 | ] |
0 commit comments