Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dspy/teleprompt/bootstrap_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__`.
Expand Down Expand Up @@ -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)
Expand Down