From 26848c6dca19d821802f45241ddbeda841d97217 Mon Sep 17 00:00:00 2001 From: corey hu Date: Thu, 27 Jun 2024 16:40:32 -0700 Subject: [PATCH] virtual record should use supplied perf, cost (#1266) * virtual record should use supplied perf, cost * fmt --- trulens_eval/trulens_eval/tru_virtual.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/trulens_eval/trulens_eval/tru_virtual.py b/trulens_eval/trulens_eval/tru_virtual.py index 17bcd5417..d41e3ce41 100644 --- a/trulens_eval/trulens_eval/tru_virtual.py +++ b/trulens_eval/trulens_eval/tru_virtual.py @@ -407,12 +407,10 @@ def __init__( if (end_time - start_time).total_seconds() == 0.0: end_time += datetime.timedelta(microseconds=1) - if "cost" not in kwargs: - kwargs['cost'] = mod_base_schema.Cost() - if "perf" not in kwargs: - kwargs['perf'] = mod_base_schema.Perf( - start_time=start_time, end_time=end_time - ) + kwargs['cost'] = cost or mod_base_schema.Cost() + kwargs['perf'] = perf or mod_base_schema.Perf( + start_time=start_time, end_time=end_time + ) if "main_input" not in kwargs: kwargs['main_input'] = "No main_input provided."