From 2f38c3965ab399feb3dfca2d013e5cbdaa67813c Mon Sep 17 00:00:00 2001 From: sjadler2004 Date: Mon, 30 Sep 2024 14:11:40 -0700 Subject: [PATCH 1/2] 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): From 55aa69d249c9a8f7e4bcc15c9c791545cac475d5 Mon Sep 17 00:00:00 2001 From: sjadler2004 Date: Mon, 30 Sep 2024 14:12:15 -0700 Subject: [PATCH 2/2] update exception message --- evals/cli/oaieval.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evals/cli/oaieval.py b/evals/cli/oaieval.py index da2a5f4740..e48a09ac19 100644 --- a/evals/cli/oaieval.py +++ b/evals/cli/oaieval.py @@ -227,7 +227,7 @@ def to_number(x: str) -> Union[int, float, str]: try: add_token_usage_to_result(result, recorder) except Exception as e: - logger.error(f"Failed to add token usage to result: {e}") + logger.error(f"Failed to add token usage to result: {e}. Eval results will be reported and are not affected.") recorder.record_final_report(result) if not (args.dry_run or args.local_run):