avoigt1121 commited on
Commit
53fbe3b
·
1 Parent(s): 7cf6449

Add dataset selection heuristics to system prompt

Browse files

Pass survival_columns through to the per-dataset prompt context and add a
"## Dataset Selection Heuristics" section covering survival/prognostic,
tumor-vs-normal matched-pair, subtype (Bailey/Moffitt/Puleo), and
no-preference/robust-cohort questions. Efficiency Rule #1 now directs the
agent to apply these heuristics, state its chosen dataset_id and rationale,
and proceed when the user doesn't name a dataset.

Files changed (2) hide show
  1. prompts.yaml +19 -1
  2. src/agent.py +2 -0
prompts.yaml CHANGED
@@ -128,6 +128,22 @@ The ONLY datasets registered in this system are listed below with everything\
128
  \ endfor %}\n{% endif %}\n{% endfor %}\n\
129
  \nCRITICAL: Do not claim access to any dataset not listed above. Do not infer additional\
130
  \ datasets from training knowledge.\n
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  ## Handling Dataset Limitations and Refusals\n\nIf the user's requested analysis matches a\
132
  \ REFUSE rule or Known limitation for the dataset they specified (e.g. \"compare Bailey\
133
  \ subtypes in gse28735_pdac\" when gse28735_pdac has no Bailey labels, or \"tumor vs normal\
@@ -142,7 +158,9 @@ The ONLY datasets registered in this system are listed below with everything\
142
  \ on every request.\n\n1. **Skip `dataset_list_available` when the dataset is already identified.** If the user's message\
143
  \ names a specific dataset (e.g. \"Moffitt\", \"GSE71729\", \"gse71729_moffitt\") or any GSE accession number, do not call\
144
  \ `dataset_list_available`. The dataset is already known — proceed directly to `dataset_describe` or the analysis tool sequence.\
145
- \ Only call `dataset_list_available` when the user asks what datasets exist or when no specific dataset is mentioned.\n\n\
 
 
146
  2. **Never call `decoupler_check_limma_available` during analysis.** This tool is for diagnostics only. During any analysis\
147
  \ workflow, call `decoupler_differential_expression` directly with `method=\"limma\"`. If limma is unavailable, the tool\
148
  \ handles the fallback internally and reports which method was used.\n\n3. **Never call `dataset_validate_manifest_against_data`\
 
128
  \ endfor %}\n{% endif %}\n{% endfor %}\n\
129
  \nCRITICAL: Do not claim access to any dataset not listed above. Do not infer additional\
130
  \ datasets from training knowledge.\n
131
+ ## Dataset Selection Heuristics\n\nWhen the user's request does not name a specific dataset,\
132
+ \ apply these heuristics to choose one. State your chosen dataset_id and a one-sentence\
133
+ \ rationale tied to the heuristic before proceeding with any tool calls.\n\n- **Survival or\
134
+ \ prognostic questions:** prefer datasets with non-empty survival_columns — tcga_paad\
135
+ \ (curated subset), puleo_2018, paca_au_rnaseq, gse28735_pdac, gse50827_nones, gse57495,\
136
+ \ cptac_pda.\n- **Tumor vs. normal or matched-pair questions:** prefer paired tissue designs\
137
+ \ — gse16515_mayo, gse28735_pdac, gse15471_badea (note: gse15471_badea's \"normal\"\
138
+ \ samples are adjacent non-tumor tissue, per its limitations).\n- **Subtype questions:**\
139
+ \ Bailey 4-subtype (squamous, pancreatic progenitor, immunogenic, ADEX) — only\
140
+ \ paca_au_rnaseq or paca_au_array have membership.ordered, use one of these. Classical/basal\
141
+ \ (Moffitt) — gse71729_moffitt. 5-subtype (Puleo) — puleo_2018.\n- **No-preference,\
142
+ \ robust, or large-cohort questions:** prefer larger curated cohorts — tcga_paad,\
143
+ \ puleo_2018, paca_ca_rnaseq, paca_au_rnaseq. Pick one dataset and proceed; only run multiple\
144
+ \ cohorts if the user explicitly asks for cross-cohort validation.\n- **Always:** when you\
145
+ \ select a dataset using these heuristics (i.e. the user did not name one), state the chosen\
146
+ \ dataset_id and your rationale before making any tool calls.\n
147
  ## Handling Dataset Limitations and Refusals\n\nIf the user's requested analysis matches a\
148
  \ REFUSE rule or Known limitation for the dataset they specified (e.g. \"compare Bailey\
149
  \ subtypes in gse28735_pdac\" when gse28735_pdac has no Bailey labels, or \"tumor vs normal\
 
158
  \ on every request.\n\n1. **Skip `dataset_list_available` when the dataset is already identified.** If the user's message\
159
  \ names a specific dataset (e.g. \"Moffitt\", \"GSE71729\", \"gse71729_moffitt\") or any GSE accession number, do not call\
160
  \ `dataset_list_available`. The dataset is already known — proceed directly to `dataset_describe` or the analysis tool sequence.\
161
+ \ Only call `dataset_list_available` when the user asks what datasets exist or when no specific dataset is mentioned.\
162
+ \ In the latter case, apply ## Dataset Selection Heuristics to choose a dataset, state your choice and rationale, then\
163
+ \ proceed.\n\n\
164
  2. **Never call `decoupler_check_limma_available` during analysis.** This tool is for diagnostics only. During any analysis\
165
  \ workflow, call `decoupler_differential_expression` directly with `method=\"limma\"`. If limma is unavailable, the tool\
166
  \ handles the fallback internally and reports which method was used.\n\n3. **Never call `dataset_validate_manifest_against_data`\
src/agent.py CHANGED
@@ -66,6 +66,7 @@ def get_system_prompt(
66
  "requires_collapse": _feat.get("requires_collapse", False),
67
  "group_columns": _raw.get("group_columns", []),
68
  "default_contrasts": _raw.get("default_contrasts", []),
 
69
  "refusal_rules": _raw.get("refusal_rules", []),
70
  "limitations": _raw.get("limitations", []),
71
  "reporting_rules": _raw.get("reporting_rules", []),
@@ -148,6 +149,7 @@ class CodeAgent:
148
  "requires_collapse": _feat.get("requires_collapse", False),
149
  "group_columns": _raw.get("group_columns", []),
150
  "default_contrasts": _raw.get("default_contrasts", []),
 
151
  "refusal_rules": _raw.get("refusal_rules", []),
152
  "limitations": _raw.get("limitations", []),
153
  "reporting_rules": _raw.get("reporting_rules", []),
 
66
  "requires_collapse": _feat.get("requires_collapse", False),
67
  "group_columns": _raw.get("group_columns", []),
68
  "default_contrasts": _raw.get("default_contrasts", []),
69
+ "survival_columns": _raw.get("survival_columns") or {},
70
  "refusal_rules": _raw.get("refusal_rules", []),
71
  "limitations": _raw.get("limitations", []),
72
  "reporting_rules": _raw.get("reporting_rules", []),
 
149
  "requires_collapse": _feat.get("requires_collapse", False),
150
  "group_columns": _raw.get("group_columns", []),
151
  "default_contrasts": _raw.get("default_contrasts", []),
152
+ "survival_columns": _raw.get("survival_columns") or {},
153
  "refusal_rules": _raw.get("refusal_rules", []),
154
  "limitations": _raw.get("limitations", []),
155
  "reporting_rules": _raw.get("reporting_rules", []),