feat: make spec optional (#719)

* feat: Add spec_enabled configuration for data science settings

* make spec alternative

* change spec logic in exp_gen

* remove some general texts

* align

---------

Co-authored-by: Young <afe.young@gmail.com>
Co-authored-by: yuanteli <1957922024@qq.com>
This commit is contained in:
XianBW
2025-03-27 17:17:41 +08:00
committed by GitHub
parent 031d264957
commit 7fc9e18a71
20 changed files with 334 additions and 92 deletions
@@ -1,6 +1,7 @@
import json
from typing import Dict
from rdagent.app.data_science.conf import DS_RD_SETTING
from rdagent.components.coder.CoSTEER import CoSTEER
from rdagent.components.coder.CoSTEER.evaluators import (
CoSTEERMultiEvaluator,
@@ -69,7 +70,11 @@ class WorkflowMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy):
model_codes=workspace.get_codes(r"^model_(?!test)\w+\.py$"),
ensemble_code=workspace.file_dict["ensemble.py"],
latest_code=workspace.file_dict.get("main.py"),
workflow_spec=workspace.file_dict["spec/workflow.md"],
code_spec=(
workspace.file_dict["spec/workflow.md"]
if DS_RD_SETTING.spec_enabled
else T("scenarios.data_science.share:component_spec.Workflow").r()
),
latest_code_feedback=prev_task_feedback,
)
@@ -115,7 +115,11 @@ class WorkflowGeneralCaseSpecEvaluator(CoSTEEREvaluator):
system_prompt = T(".prompts:workflow_eval.system").r(
scenario=self.scen.get_scenario_all_desc(),
task_desc=target_task.get_task_information(),
spec=implementation.file_dict["spec/workflow.md"],
spec=(
implementation.file_dict["spec/workflow.md"]
if DS_RD_SETTING.spec_enabled
else T("scenarios.data_science.share:component_spec.Workflow").r()
),
)
user_prompt = T(".prompts:workflow_eval.user").r(
stdout=stdout.strip(),
@@ -52,8 +52,8 @@ workflow_coder:
{% endif %}
user: |-
--------- Workflow Specification ---------
{{ workflow_spec }}
--------- Code Specification ---------
{{ code_spec }}
--------- load data code ---------
file: load_data.py
@@ -96,9 +96,10 @@ workflow_eval:
The user provides workflow information and its components.
The details on how to structure the workflow are given in the specification file:
```python
```markdown
{{ spec }}
```
This workflow integrates multiple stages, including:
- Data loading
- Feature engineering