Skip to content

Commit

Permalink
Improve error logging with stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
severi committed Sep 6, 2024
1 parent 316e0b4 commit afd675e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dspy/evaluate/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
import threading
import types
import traceback

import pandas as pd
import tqdm
Expand Down Expand Up @@ -179,9 +180,9 @@ def wrapped_program(example_idx, example):
current_error_count = self.error_count
if current_error_count >= self.max_errors:
raise e

dspy.logger.error(f"Error for example in dev set: \t\t {e}")

dspy.logger.error(f"Error for example in dev set: \t\t {e}\n\twith inputs:\n\t\t{example.inputs()}\n\nStack trace:\n\t{traceback.format_exc()}")
return example_idx, example, {}, 0.0
finally:
if creating_new_thread:
Expand Down

0 comments on commit afd675e

Please sign in to comment.