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
@@ -14,6 +14,7 @@ from rdagent.components.coder.CoSTEER.knowledge_management import (
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
@@ -75,5 +76,6 @@ class DataLoaderCoSTEEREvaluator(CoSTEEREvaluator):
workflow_stdout=workflow_stdout,
)
resp = APIBackend().build_messages_and_create_chat_completion(user_prompt, system_prompt, json_mode=True)
return DataLoaderEvalFeedback(**json.loads(resp))
return build_cls_from_json_with_retry(
DataLoaderEvalFeedback, system_prompt=system_prompt, user_prompt=user_prompt
)