From 2f38c3965ab399feb3dfca2d013e5cbdaa67813c Mon Sep 17 00:00:00 2001 From: sjadler2004 Date: Mon, 30 Sep 2024 14:11:40 -0700 Subject: [PATCH] add exception handling --- evals/cli/oaieval.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/evals/cli/oaieval.py b/evals/cli/oaieval.py index a8927dda4c..da2a5f4740 100644 --- a/evals/cli/oaieval.py +++ b/evals/cli/oaieval.py @@ -224,7 +224,10 @@ def to_number(x: str) -> Union[int, float, str]: **extra_eval_params, ) result = eval.run(recorder) - add_token_usage_to_result(result, recorder) + try: + add_token_usage_to_result(result, recorder) + except Exception as e: + logger.error(f"Failed to add token usage to result: {e}") recorder.record_final_report(result) if not (args.dry_run or args.local_run):