feat: new proposal (structured outputs) prompts (#887)

* some initial modifications

* first prompt

* refine prompts

* isolate to v3 exp gen

* Revert prompts

* Add hypothesis

* task gen prompt

* minor updates

* minor updates

* update proposal

* Move the pydantic schema upfront to avoid loading error

* Update first prompts

* New prompt

* Update prompt

* Update data folder

* .

* Revert changes

* support v3 in pipeline and feedback

* sort imports

* black format

* Update rdagent/scenarios/data_science/dev/prompts.yaml

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

---------

Co-authored-by: Xu Yang <peteryang@vip.qq.com>
Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
This commit is contained in:
Yuge Zhang
2025-05-22 15:08:33 +08:00
committed by GitHub
parent 37e9912ac0
commit 9ea44be5f8
7 changed files with 1031 additions and 18 deletions
@@ -98,12 +98,21 @@ class PipelineMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy):
spec=T("scenarios.data_science.share:component_spec.Pipeline").r(),
enable_model_dump=DS_RD_SETTING.enable_model_dump,
)
user_prompt = T(".prompts:pipeline_coder.user").r(
competition_info=competition_info,
folder_spec=data_folder_info,
latest_code=workspace.file_dict.get("main.py"),
latest_code_feedback=prev_task_feedback,
)
if DS_RD_SETTING.proposal_version == "v3":
# FIXME: A temporary patch for BUILD
user_prompt = T(".prompts:pipeline_coder.user_v3").r(
competition_info=competition_info,
folder_spec=data_folder_info,
latest_code=workspace.file_dict.get("main.py"),
latest_code_feedback=prev_task_feedback,
)
else:
user_prompt = T(".prompts:pipeline_coder.user").r(
competition_info=competition_info,
folder_spec=data_folder_info,
latest_code=workspace.file_dict.get("main.py"),
latest_code_feedback=prev_task_feedback,
)
for _ in range(5):
pipeline_code = PythonAgentOut.extract_output(
@@ -97,6 +97,27 @@ pipeline_coder:
You should strictly follow the code specifications provided by the specification to implement the function.
user_v3: |-
--------- Competition Information ---------
{{ competition_info }}
--------- Data Folder Description (All path are relative to the data folder) ---------
{{ folder_spec }}
{% if latest_code %}
--------- Former code ---------
{{ latest_code }}
{% if latest_code_feedback is not none %}
--------- Feedback to former code ---------
{{ latest_code_feedback }}
The former code contains errors. You should correct the code based on the provided information, ensuring you do not repeat the same mistakes.
Keep the part that already seem correct intact. Avoid modifying them to refrain from introducing new errors.
{% else %}
The former code is correct. You should try to improve the code based on the provided task while not changing the irrelevant parts.
{% endif %}
{% endif %}
You should strictly follow the code specifications provided by the specification to implement the function.
pipeline_eval:
system: |-