fix: replace API call with build_cls_from_json_with_retry function (#548)

* refactor: Replace API call with build_cls_from_json_with_retry function

* fix lint error

* fix lint errors

* lint

* trigger
This commit is contained in:
you-n-g
2025-01-27 20:19:11 +08:00
committed by GitHub
parent 1bd192e061
commit 8bc381855e
8 changed files with 77 additions and 14 deletions
@@ -17,6 +17,7 @@ from rdagent.core.exception import CoderError
from rdagent.core.experiment import FBWorkspace, Task
from rdagent.oai.llm_utils import APIBackend
from rdagent.utils.agent.tpl import T
from rdagent.utils.agent.workflow import build_cls_from_json_with_retry
from rdagent.utils.env import DockerEnv, DSDockerConf
DIRNAME = Path(__file__).absolute().resolve().parent
@@ -91,5 +92,4 @@ class ModelGeneralCaseSpecEvaluator(CoSTEEREvaluator):
code=implementation.file_dict[f"{target_task.name}.py"],
workflow_stdout=workflow_stdout,
)
resp = APIBackend().build_messages_and_create_chat_completion(user_prompt, system_prompt, json_mode=True)
return ModelSingleFeedback(**json.loads(resp))
return build_cls_from_json_with_retry(ModelSingleFeedback, system_prompt=system_prompt, user_prompt=user_prompt)