Deepeval Patches
Instance-scoped monkey-patches for confirmed upstream DeepEval bugs, pinned deepeval<4.0.0.
Corrects the exact bugs in TopicAdherenceMetric.a_measure and
TurnContextualRecallMetric.a_measure documented next to the metrics that use them
(gllm_evals/metrics/safety/deepeval_topic_adherence.py,
gllm_evals/metrics/retrieval/deepeval_contextual_recall.py). Patches are bound onto the
one DeepEval instance each metric builds per row -- never onto the shared class -- so any
other code importing deepeval directly keeps the original, unpatched behavior.
apply_topic_adherence_patch(metric)
Bind the corrected a_measure onto this one TopicAdherenceMetric instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
TopicAdherenceMetric
|
The instance to patch, built fresh for one row. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TopicAdherenceMetric |
TopicAdherenceMetric
|
The same instance, patched in place, for convenient chaining. |
apply_turn_contextual_recall_patch(metric)
Bind the corrected a_measure onto this one TurnContextualRecallMetric instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
TurnContextualRecallMetric
|
The instance to patch, built fresh for one row. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TurnContextualRecallMetric |
TurnContextualRecallMetric
|
The same instance, patched in place, for convenient chaining. |
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. |
topic_adherence_patch_available()
cached
Whether the installed TopicAdherenceMetric.a_measure still matches this patch's target.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if instances can safely be patched via |
turn_contextual_recall_patch_available()
cached
Whether the installed TurnContextualRecallMetric.a_measure still matches this patch's target.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if instances can safely be patched via |
turn_faithfulness_reason_patch_available()
cached
Whether the installed TurnFaithfulnessMetric still has the sync-reason bug and this patch's hook.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if instances can safely be patched via |