Skip to content

Commit b47878f

Browse files
authored
fix numpy invert error in metrics (#1835)
#1796 TypeError(ufunc 'invert' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'') will trigger when evaluating by `FactualCorrectness`
1 parent 6afb505 commit b47878f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/ragas/metrics/_factual_correctness.py

+1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ async def _single_turn_ascore(
260260
tp = sum(reference_response)
261261
fp = sum(~reference_response)
262262
if self.mode != "precision":
263+
response_reference = np.array(response_reference, dtype=bool)
263264
fn = sum(~response_reference)
264265
else:
265266
fn = 0

0 commit comments

Comments
 (0)