mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-04 02:37:44 +00:00
feat: add DocDev for auto-generating workspace documentation (#781)
* 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
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""
|
||||
Developers concentrating on writing documents for a workspace
|
||||
"""
|
||||
|
||||
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
|
||||
|
||||
|
||||
class DocDev(Developer[Experiment]):
|
||||
"""
|
||||
The developer is responsible for writing documents for a workspace.
|
||||
"""
|
||||
|
||||
def develop(self, exp: Experiment) -> None:
|
||||
"""
|
||||
Write documents for the workspace.
|
||||
"""
|
||||
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()]
|
||||
|
||||
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(
|
||||
file_li=file_li,
|
||||
key_files={f: (ws.workspace_path / f).read_text() for f in key_file_list},
|
||||
)
|
||||
|
||||
resp = APIBackend().build_messages_and_create_chat_completion(
|
||||
user_prompt=user_prompt, system_prompt=system_prompt
|
||||
)
|
||||
markdown = MarkdownAgentOut.extract_output(resp)
|
||||
ws.inject_files({"README.md": markdown})
|
||||
@@ -52,3 +52,36 @@ dump_model_eval:
|
||||
# Inference:
|
||||
{{scores_content_after}}
|
||||
|
||||
|
||||
docdev:
|
||||
system: |-
|
||||
You are a skilled developer and a Kaggle grandmaster. Your task is to create documentation for a data science solution.
|
||||
|
||||
You will be given:
|
||||
- a list of files in the folder.
|
||||
- content from some important files.
|
||||
|
||||
Please explain the trained models in the "models/" folder. The training and inference processes are detailed in the `main.py` file. The models' evaluation results are in `scores.csv`. Please respond with a markdown file that includes the following information:
|
||||
- Explain the purpose of each model. If some models are part of a group (like those from cross-validation), describe them together.
|
||||
- Provide key details for each model group:
|
||||
- Important training parameters
|
||||
- Model details
|
||||
- Performance of each model
|
||||
- Ensemble
|
||||
|
||||
{% include "rdagent.utils.agent.tpl:MarkdownOut" %}
|
||||
|
||||
user: |-
|
||||
--------------- The file list in the workspace ---------------
|
||||
{% for f in file_li %}
|
||||
- {{ f }}
|
||||
{% endfor %}
|
||||
|
||||
--------------- File content of each file ---------------
|
||||
{% for fname, content in key_files.items() %}
|
||||
File Path: {{fname}}
|
||||
```
|
||||
{{content}}
|
||||
```
|
||||
{% endfor %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user