force use_chat_cache False when facing error in evaluators (#432)

This commit is contained in:
Xu Yang
2024-10-15 12:21:33 +08:00
committed by GitHub
parent a9421cb93f
commit 5988683cd9
2 changed files with 5 additions and 3 deletions
@@ -190,7 +190,8 @@ class FactorOutputFormatEvaluator(FactorEvaluator):
while attempts < max_attempts:
try:
resp = APIBackend().build_messages_and_create_chat_completion(
api = APIBackend() if attempts == 0 else APIBackend(use_chat_cache=False)
resp = api.build_messages_and_create_chat_completion(
user_prompt=gen_df_info_str, system_prompt=system_prompt, json_mode=True
)
resp_dict = json.loads(resp)
@@ -535,8 +536,9 @@ class FactorFinalDecisionEvaluator(Evaluator):
while attempts < max_attempts:
try:
api = APIBackend() if attempts == 0 else APIBackend(use_chat_cache=False)
final_evaluation_dict = json.loads(
APIBackend().build_messages_and_create_chat_completion(
api.build_messages_and_create_chat_completion(
user_prompt=user_prompt,
system_prompt=system_prompt,
json_mode=True,
@@ -55,7 +55,7 @@ class FactorTestCaseLoaderFromJsonFile:
factor_formulation=factor_data["formulation"],
variables=factor_data["variables"],
)
gt = FactorFBWorkspace(task, raise_exception=True)
gt = FactorFBWorkspace(task, raise_exception=False)
code = {"factor.py": factor_data["gt_code"]}
gt.inject_code(**code)
test_cases.test_case_l.append(TestCase(task, gt))