Skip to content

Deepeval Patches

Instance-scoped monkey-patches for confirmed upstream DeepEval bugs.

Replaces TurnFaithfulnessMetric's conversational reason with one built from DeepEval's own claim verdicts. As of deepeval 4.2.9, its async path still generates each window's reason through the synchronous generate (which DeepEvalLLMWrapper cannot serve), so the metric runs with include_reason=False and DeepEval itself returns no reason; see gllm_evals/metrics/generation/deepeval_turn_faithfulness.py. The patch is bound onto the one DeepEval instance the metric builds per row -- never onto the shared class -- so any other code importing deepeval directly keeps the original, unpatched behavior.

apply_turn_faithfulness_reason_patch(metric)

Bind the claim-based reason builder onto this one TurnFaithfulnessMetric instance.

Parameters:

Name Type Description Default
metric TurnFaithfulnessMetric

The instance to patch, built fresh for one row.

required

Returns:

Name Type Description
TurnFaithfulnessMetric TurnFaithfulnessMetric

The same instance, patched when the installed source still matches.

turn_faithfulness_reason_patch_available() cached

Whether the installed TurnFaithfulnessMetric still makes the sync per-window reason call and has our hook.

Returns:

Name Type Description
bool bool

True if instances can safely be patched via apply_turn_faithfulness_reason_patch.