From f0d9919d93ae35934b17fe34069b5f6512efab3a Mon Sep 17 00:00:00 2001 From: you-n-g Date: Sun, 13 Apr 2025 10:21:24 +0800 Subject: [PATCH] fix: import path of T (#787) * feat: add DocDev for auto-generating workspace documentation * fix: update markdown instructions in tpl.yaml * feat: add enable_doc_dev flag and conditionally call DocDev * refactor: update T import and prompt keys for DocDev * fix: update include path for MarkdownOut template * fix: update file search, README injection, and brief prompt text * docs: update prompt to only introduce models * lint --- rdagent/components/coder/data_science/share/doc.py | 10 +++++----- .../components/coder/data_science/share/prompts.yaml | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/rdagent/components/coder/data_science/share/doc.py b/rdagent/components/coder/data_science/share/doc.py index f9be3ee9..6d7a6df4 100644 --- a/rdagent/components/coder/data_science/share/doc.py +++ b/rdagent/components/coder/data_science/share/doc.py @@ -6,7 +6,7 @@ from rdagent.core.developer import Developer from rdagent.core.experiment import Experiment, FBWorkspace from rdagent.oai.llm_utils import APIBackend from rdagent.utils.agent.ret import MarkdownAgentOut -from rdagent.utils.agent.workflow import T +from rdagent.utils.agent.tpl import T class DocDev(Developer[Experiment]): @@ -20,12 +20,12 @@ class DocDev(Developer[Experiment]): """ ws: FBWorkspace = exp.experiment_workspace - file_li = [str(file.relative_to(ws.workspace_path)) for file in ws.workspace_path.iterdir() if file.is_file()] + file_li = [str(file.relative_to(ws.workspace_path)) for file in ws.workspace_path.rglob("*") if file.is_file()] key_file_list = ["main.py", "scores.csv"] - system_prompt = T(".prompts:dump_model_eval.system").r() - user_prompt = T(".prompts:dump_model_eval.user").r( + system_prompt = T(".prompts:docdev.system").r() + user_prompt = T(".prompts:docdev.user").r( file_li=file_li, key_files={f: (ws.workspace_path / f).read_text() for f in key_file_list}, ) @@ -34,4 +34,4 @@ class DocDev(Developer[Experiment]): user_prompt=user_prompt, system_prompt=system_prompt ) markdown = MarkdownAgentOut.extract_output(resp) - ws.inject_files({"README.md": markdown}) + ws.inject_files(**{"README.md": markdown}) diff --git a/rdagent/components/coder/data_science/share/prompts.yaml b/rdagent/components/coder/data_science/share/prompts.yaml index ea2fe47c..6d5038cf 100644 --- a/rdagent/components/coder/data_science/share/prompts.yaml +++ b/rdagent/components/coder/data_science/share/prompts.yaml @@ -67,9 +67,11 @@ docdev: - Important training parameters - Model details - Performance of each model - - Ensemble - {% include "rdagent.utils.agent.tpl:MarkdownOut" %} + Be brief. Mention the file path when you introduce files. + Don't introduce anything other than models. + + {% include "utils.agent.tpl:MarkdownOut" %} user: |- --------------- The file list in the workspace ---------------