mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-02 01:47:43 +00:00
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:
@@ -21,6 +21,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
|
||||
|
||||
|
||||
@@ -60,6 +61,7 @@ class WorkflowMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy):
|
||||
competition_info=self.scen.get_scenario_all_desc(),
|
||||
queried_similar_successful_knowledge=queried_similar_successful_knowledge,
|
||||
queried_former_failed_knowledge=queried_former_failed_knowledge[0],
|
||||
out_spec=PythonAgentOut.get_spec(),
|
||||
)
|
||||
user_prompt = T(".prompts:workflow_coder.user").r(
|
||||
load_data_code=workspace.file_dict["load_data.py"],
|
||||
@@ -72,14 +74,12 @@ class WorkflowMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy):
|
||||
)
|
||||
|
||||
for _ in range(5):
|
||||
workflow_code = json.loads(
|
||||
workflow_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 workflow_code != workspace.file_dict.get("main.py"):
|
||||
break
|
||||
else:
|
||||
|
||||
@@ -42,10 +42,14 @@ workflow_coder:
|
||||
5. 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: |-
|
||||
--------- Workflow Specification ---------
|
||||
|
||||
Reference in New Issue
Block a user