76 lines
2.8 KiB
Markdown
76 lines
2.8 KiB
Markdown
# product-data
|
||
|
||
`product-data` 是产品/标签定义到标准数据记录的可迁移 skill 包。
|
||
|
||
设计原则:
|
||
|
||
- `SKILL.md` 描述流程、review 门禁和 Agent 使用方式。
|
||
- `knowledge/` 保存数据格式、生成协议和可维护知识。
|
||
- `scripts/` 保存可独立执行的脚本能力。
|
||
- `tools.yaml` 描述脚本如何被平台注册成工具;没有注册能力的 Agent 也可以直接调用脚本。
|
||
|
||
## 可迁移工具约定
|
||
|
||
脚本能力是本体,平台注册是适配层。
|
||
|
||
每个脚本都支持两种输入:
|
||
|
||
```bash
|
||
python skills/product-data/scripts/<tool>.py --input input.json
|
||
```
|
||
|
||
或:
|
||
|
||
```bash
|
||
cat input.json | python skills/product-data/scripts/<tool>.py
|
||
```
|
||
|
||
脚本统一输出 JSON:
|
||
|
||
```json
|
||
{"ok":true}
|
||
```
|
||
|
||
失败时输出:
|
||
|
||
```json
|
||
{"ok":false,"error":"..."}
|
||
```
|
||
|
||
## 当前脚本
|
||
|
||
| 脚本 | 用途 |
|
||
| --- | --- |
|
||
| `scripts/normalize_dataset_draft.py` | 把 dataset draft text v1 转成 canonical records |
|
||
| `scripts/validate_dataset_records.py` | 校验 canonical records |
|
||
| `scripts/export_dataset_records.py` | 导出紧凑 JSONL/JSON,并默认生成同目录 `records.csv` 表格 |
|
||
| `scripts/export_dataset_table.py` | 已有 canonical records 时,只补生成同事流转表格 |
|
||
| `scripts/export_training_jsonl.py` | 把 canonical records 转成训练 JSONL,`output` 自动组合 `complex` 和标签 |
|
||
| `scripts/export_planning_eval_csv.py` | 把 canonical records 转成含 chat-template `newPrompt` 的评测 CSV,`complex` 列来自元数据并输出为 `TRUE/FALSE` |
|
||
|
||
## 平台内使用方式
|
||
|
||
在 ZK Data Agent 里,前链路输入文本化和 review 状态机仍使用平台注册的 `data_agent_*` 工具;格式转换、校验和导出使用 `python_exec` 的 `script_path` 模式直接执行本目录 `scripts/` 下的 portable scripts。不要在 `python_exec.code` 里通过 subprocess 二次调用这些脚本。
|
||
|
||
通过 `python_exec` 运行时,脚本会根据 `PYTHON_EXEC_SCRATCHPAD` 自动把逻辑路径 `output/...` 路由到当前会话 output 目录。独立运行时,仍按当前目录下的 `output/` 输出。
|
||
|
||
大批量生成时,不要先写 `draft_part*.txt`。推荐每批最多 8 条,通过 stdin 调用 `normalize_dataset_draft.py`,并设置:
|
||
|
||
```json
|
||
{
|
||
"records_output_path": "scratchpad/normalized_records.jsonl",
|
||
"append": true,
|
||
"return_records": false
|
||
}
|
||
```
|
||
|
||
最后从 `scratchpad/normalized_records.jsonl` 统一校验和导出。
|
||
|
||
用户确认计划后,生成任务应在同一轮内尽量跑完整个批次链路;不要因为超过 24 条就主动停顿等待继续。每批工具调用前用固定格式输出进度,方便 Web 摘要行展示:
|
||
|
||
```text
|
||
进度:批 i/n,已生成 x/y,主题
|
||
```
|
||
|
||
如果确实因为超时、取消或工具错误中断,用户回复继续后先统计 `scratchpad/normalized_records.jsonl` 已有行数,再从下一批 append。
|