From 694afd81331227d2be7f780f72023d00c0c9864e Mon Sep 17 00:00:00 2001 From: you-n-g Date: Mon, 15 Sep 2025 23:27:24 +0800 Subject: [PATCH] fix: add json format response fallback to prompt templates (#1246) * fix: add json format response fallback to prompt templates * more json prompt --- rdagent/scenarios/data_science/dev/prompts.yaml | 4 ++-- .../proposal/exp_gen/draft/prompts_draft.yaml | 2 ++ .../data_science/proposal/exp_gen/prompts_v2.yaml | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/rdagent/scenarios/data_science/dev/prompts.yaml b/rdagent/scenarios/data_science/dev/prompts.yaml index 0678bd41..7fdb5b5a 100644 --- a/rdagent/scenarios/data_science/dev/prompts.yaml +++ b/rdagent/scenarios/data_science/dev/prompts.yaml @@ -78,7 +78,7 @@ exp_feedback: - Set `"Acceptable": "no"` if ANY of the above conditions fail - This acceptability assessment serves as a final quality gate to ensure only truly valuable experiments are accepted - Provide detailed and constructive feedback structured as follows without anything else: + Provide detailed and constructive feedback structured as follows in JSON format without anything else: { "Submission Format Check": "yes or no", "First Valid Submission": "yes or no", @@ -212,7 +212,7 @@ exp_feedback_draft: - You should provide your feedback based on the current code and SOTA code. Especially focus on the feature engineering part. - For example, if the code truncate the line with N words, you can suggest to print the mean, median or quantile of the length of the line for better understanding of the data in the next rounds of experiments. - Provide detailed and constructive feedback structured as follows without anything else: + Provide detailed and constructive feedback structured as follows in JSON format without anything else: { "Submission Format Check": "yes or no", "First Valid Submission": "yes or no", diff --git a/rdagent/scenarios/data_science/proposal/exp_gen/draft/prompts_draft.yaml b/rdagent/scenarios/data_science/proposal/exp_gen/draft/prompts_draft.yaml index 84d15040..82206db5 100644 --- a/rdagent/scenarios/data_science/proposal/exp_gen/draft/prompts_draft.yaml +++ b/rdagent/scenarios/data_science/proposal/exp_gen/draft/prompts_draft.yaml @@ -228,6 +228,8 @@ task_gen: "task_design": ---The dict corresponding to task output format---, {% if workflow_check %}"workflow_update": ---A string corresponding to workflow description--- {% endif %} } + {% else %} + Please response in json format. {% endif %} user: |- diff --git a/rdagent/scenarios/data_science/proposal/exp_gen/prompts_v2.yaml b/rdagent/scenarios/data_science/proposal/exp_gen/prompts_v2.yaml index 6a0347e4..fd14762a 100644 --- a/rdagent/scenarios/data_science/proposal/exp_gen/prompts_v2.yaml +++ b/rdagent/scenarios/data_science/proposal/exp_gen/prompts_v2.yaml @@ -42,6 +42,8 @@ scenario_problem: {% if problem_output_format is not none %} ### Output Format {{ problem_output_format }} + {% else %} + Please response in json format. {% endif %} user: |- @@ -116,6 +118,8 @@ feedback_problem: {% if problem_output_format is not none %} ### Output Format {{ problem_output_format }} + {% else %} + Please response in json format. {% endif %} user: |- @@ -267,6 +271,8 @@ hypothesis_gen: {% if hypothesis_output_format is not none %} ## Final Output Format in JSON Schema: {{ hypothesis_output_format }} + {% else %} + Please response in json format. {% endif %} user: |- @@ -328,6 +334,8 @@ hypothesis_critique: {% if critique_output_format is not none %} ## Output Format {{ critique_output_format }} + {% else %} + Please response in json format. {% endif %} user: |- @@ -420,6 +428,8 @@ hypothesis_rewrite: {% if rewrite_output_format is not none %} ## Output Format {{ rewrite_output_format }} + {% else %} + Please response in json format. {% endif %} user: |- @@ -609,6 +619,8 @@ hypothesis_select: {% if hypothesis_output_format is not none %} ## Final Output Format in JSON Schema: {{ hypothesis_output_format }} + {% else %} + Please response in json format. {% endif %} @@ -777,6 +789,8 @@ task_gen: "workflow_update": "A string which is a precise and comprehensive description of the Workflow Update, or 'No update needed' if no changes are required." } {% endif %} + {% else %} + Please response in json format. {% endif %} user: |-