@@ -34,16 +34,16 @@ def validate_threshold(cls, v):
34
34
@field_validator ('score_type' )
35
35
def convert_to_enum_value (cls , v ):
36
36
"""
37
- Validates that the `score_type` is a valid `JudgmentMetric ` enum value.
38
- Converts string values to `JudgmentMetric ` enum values.
37
+ Validates that the `score_type` is a valid `APIScorer ` enum value.
38
+ Converts string values to `APIScorer ` enum values.
39
39
"""
40
40
debug (f"Attempting to convert score_type value: { v } " )
41
41
if isinstance (v , APIScorer ):
42
- info (f"Using existing JudgmentMetric : { v . value } " )
43
- return v . value
42
+ info (f"Using existing APIScorer : { v } " )
43
+ return v
44
44
elif isinstance (v , str ):
45
- debug (f"Converting string value to JudgmentMetric enum: { v } " )
46
- return APIScorer [v .upper ()]. value
45
+ debug (f"Converting string value to APIScorer enum: { v } " )
46
+ return APIScorer [v .upper ()]
47
47
error (f"Invalid score_type value: { v } " )
48
48
raise ValueError (f"Invalid value for score_type: { v } " )
49
49
@@ -58,7 +58,7 @@ def to_dict(self) -> dict:
58
58
dict: A dictionary containing the scorer's configuration
59
59
"""
60
60
return {
61
- "score_type" : self .score_type ,
61
+ "score_type" : self .score_type . value , # Convert enum to string for serialization
62
62
"threshold" : self .threshold
63
63
}
64
64
0 commit comments