diff --git a/dspy/teleprompt/bootstrap_trace.py b/dspy/teleprompt/bootstrap_trace.py index 2f0cc60cd1..8645d56998 100644 --- a/dspy/teleprompt/bootstrap_trace.py +++ b/dspy/teleprompt/bootstrap_trace.py @@ -51,10 +51,10 @@ def bootstrap_trace_data( ) def wrapped_metric(example, prediction, trace=None): - prediction, _ = prediction + prediction, captured_trace = prediction if isinstance(prediction, FailedPrediction): return prediction.format_reward or format_failure_score - return metric(example, prediction, trace) if metric else True + return metric(example, prediction, captured_trace) if metric else True # Use `object.__getattribute__` to bypass the custom hook `Module.__getattribute__` so that we avoid # the warning that `forward` is not accessed through `__call__`. @@ -87,7 +87,7 @@ def patched_forward(program_to_use: Module, **kwargs): failed_pred = FailedPrediction( completion_text=completion_str, format_reward=format_failure_score - + (failure_score - format_failure_score) * (present / expected), + + (failure_score - format_failure_score) * (len(present) / len(expected)), ) else: failed_pred = FailedPrediction(completion_text=completion_str, format_reward=format_failure_score)