@@ -71,10 +71,14 @@ def evaluate(self, entry: ValidFormatEntry) -> SingleEvaluationResult:
71
71
)
72
72
except ValidationError as e :
73
73
return ValidFormatResult (
74
- passed = False , details = f"JSON Schema validation failed: { e } "
74
+ score = 0 ,
75
+ passed = False ,
76
+ details = f"JSON Schema validation failed: { e } " ,
75
77
)
76
78
except json .JSONDecodeError as e :
77
- return ValidFormatResult (passed = False , details = f"Invalid JSON: { e } " )
79
+ return ValidFormatResult (
80
+ score = 0 , passed = False , details = f"Invalid JSON: { e } "
81
+ )
78
82
elif self .settings .format == "markdown" :
79
83
try :
80
84
html_result = markdown .markdown (entry .output )
@@ -93,12 +97,16 @@ def evaluate(self, entry: ValidFormatEntry) -> SingleEvaluationResult:
93
97
details = "No markdown elements found. Text should contain markdown formatting like headers (#), bold (**), lists, etc." ,
94
98
)
95
99
except Exception as e :
96
- return ValidFormatResult (passed = False , details = f"Invalid Markdown: { e } " )
100
+ return ValidFormatResult (
101
+ score = 0 , passed = False , details = f"Invalid Markdown: { e } "
102
+ )
97
103
elif self .settings .format == "python" :
98
104
try :
99
105
ast .parse (entry .output )
100
106
except Exception as e :
101
- return ValidFormatResult (passed = False , details = f"Invalid Python: { e } " )
107
+ return ValidFormatResult (
108
+ score = 0 , passed = False , details = f"Invalid Python: { e } "
109
+ )
102
110
elif self .settings .format == "sql" :
103
111
try :
104
112
try :
@@ -110,6 +118,8 @@ def evaluate(self, entry: ValidFormatEntry) -> SingleEvaluationResult:
110
118
except Exception :
111
119
sqlglot .parse (entry .output )
112
120
except Exception as e :
113
- return ValidFormatResult (passed = False , details = f"Invalid SQL: { e } " )
121
+ return ValidFormatResult (
122
+ score = 0 , passed = False , details = f"Invalid SQL: { e } "
123
+ )
114
124
115
- return ValidFormatResult (passed = True )
125
+ return ValidFormatResult (score = 1 , passed = True )
0 commit comments