feat: out spec change for o1-preview (#666)

* add not_json batcheditout

* ensemble out_spec change

* feature out_spec change

* model out_spec change

* workflow out_spec change

* runner debugger out_spec change

* filter_progress_bar return format fix

* data_loader and spec out_spec change

* show finish_reason in llm log

* json_mode fix

* remove hardcode

* fix CI

* fix grammer

* complete PythonBatchEditOut logic

---------

Co-authored-by: yuanteli <1957922024@qq.com>
This commit is contained in:
XianBW
2025-03-18 17:43:44 +08:00
committed by GitHub
parent d32d8754d9
commit e21b334741
15 changed files with 160 additions and 126 deletions
@@ -32,6 +32,7 @@ from rdagent.core.exception import CoderError
from rdagent.core.experiment import FBWorkspace
from rdagent.core.scenario import Scenario
from rdagent.oai.llm_utils import APIBackend
from rdagent.utils.agent.ret import PythonAgentOut
from rdagent.utils.agent.tpl import T
@@ -76,6 +77,7 @@ class EnsembleMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy):
queried_former_failed_knowledge[0] if queried_former_failed_knowledge else None
),
all_code=workspace.all_codes,
out_spec=PythonAgentOut.get_spec(),
)
user_prompt = T(".prompts:ensemble_coder.user").r(
ensemble_spec=workspace.file_dict["spec/ensemble.md"],
@@ -84,14 +86,12 @@ class EnsembleMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy):
)
for _ in range(5):
ensemble_code = json.loads(
ensemble_code = PythonAgentOut.extract_output(
APIBackend().build_messages_and_create_chat_completion(
user_prompt=user_prompt,
system_prompt=system_prompt,
json_mode=True,
json_target_type=Dict[str, str],
)
)["code"]
)
if ensemble_code != workspace.file_dict.get("ensemble.py"):
break
else:
@@ -41,10 +41,14 @@ ensemble_coder:
2. You should avoid using logging module to output information in your generated code, and instead use the print() function.
## Output Format
{% if out_spec %}
{{ out_spec }}
{% else %}
Please response the code in the following json format. Here is an example structure for the JSON output:
{
"code": "The Python code as a string."
}
{% endif %}
user: |-
--------- Ensemble Specification ---------