name: data-generator description: 訓練資料生成技能。根據傳入的工具名和使用者指令列表,生成多輪對話格式的 JSONL 訓練資料。觸發場景:(1) 傳入工具名和使用者指令列表,生成完整訓練資料;(2) 批次生成指定工具的標註資料;(3) 給定指令列表,輸出 JSONL 對話樣本。
將使用者指令列表轉換為標準 JSONL 訓練資料。
兩個必填引數:
| 引數 | 型別 | 說明 |
|---|---|---|
tool_name |
string | 工具名,如 dev_control、scene_generator、weather |
user_instructions |
string[] | 使用者指令列表,如 ["5分鐘後開啟空調", "3分鐘後關燈"] |
{"conversations":[
{"from":"human","value":"<當前使用者指令>開啟客廳空調</當前使用者指令>\n<本地裝置>格力冷靜王(空調)</本地裝置>\n<當前時間>2026-03-15 14:22:47</當前時間>\n<使用者場景列表>[{\"scene_id\":1001,\"scene_name\":\"回家模式\",\"room_name\":\"全屋\"},{\"scene_id\":1002,\"scene_name\":\"睡眠模式\",\"room_name\":\"主臥\"}]</使用者場景列表>\n<使用者裝置列表>{\"客廳\":[\"格力冷靜王(空調)\",\"洗碗機A1(洗碗機)\"],\"主臥\":[\"美的舒省風(空調)\"]}</使用者裝置列表>"},
{"from":"assistant","value":"<tool_call>{\"tool_name\":\"dev_control\",\"query\":\"開啟客廳空調\"}</tool_call>"},
{"from":"observation","value":"<tool_response>客廳空調已開啟</tool_response>"},
{"from":"assistant","value":"好的,客廳空調已經開啟啦~"}
],"system":"","history":[]}
<當前使用者指令>使用者原始指令</當前使用者指令>
<本地裝置>裝置名(型別)</本地裝置>
<當前時間>YYYY-MM-DD HH:mm:ss</當前時間>
<使用者場景列表>[{"scene_id":xxx,"scene_name":"場景名","room_name":"房間名"},...]</使用者場景列表>
<使用者裝置列表>{"房間":["裝置名(型別)",...]}</使用者裝置列表><tool_response>...</tool_response> 或 <tool_call>{...}</tool_call>(dev_info/weather 等工具)1. 接收 tool_name + user_instructions[]
↓
2. 載入提示詞:通用要求 + 工具特定要求(references/tools/{tool}.txt)
↓
3. 將 user_instructions 注入提示詞
↓
4. 生成 JSONL(每條獨立)
↓
5. 輸出 .jsonl 檔案
拼接規則:
[通用要求]
# ═══════════════════════════════════════════════════════════════════
# 【工具特定要求】
# 本次只調用:{TOOL_NAME}
# ────────────────────────────────────────────────────────────────
[references/tools/{TOOL_NAME}.txt 內容]
拼接指令碼:scripts/build_prompt.py
| 工具 | 要求檔案 |
|---|---|
dev_control |
references/tools/dev_control.txt |
scene_generator |
references/tools/scene_generator.txt |
alarm_remind |
references/tools/alarm_remind.txt |
weather |
references/tools/weather.txt |
scene_control |
references/tools/scene_control.txt |
dev_info |
references/tools/dev_info.txt |
exit_dialog |
references/tools/exit_dialog.txt |
GreeQA |
references/tools/GreeQA.txt |
scene_guide |
references/tools/scene_guide.txt |
chat |
references/tools/chat.txt |
輸入:
tool_name: "dev_info"
user_instructions: ["家裡空調數量", "有幾個空調"]
輸出欄位說明:
| 欄位 | 說明 |
|---|---|
conversations[0].value |
含 <當前使用者指令> + 完整上下文 |
conversations[1].value |
<tool_call>{"tool_name":"dev_info"}</tool_call> |
conversations[2].value |
dev_info 返回結果(裝置列表) |
conversations[3].value |
文字終接回復 |
system |
空字串 "" |
history |
空陣列 [] |
當傳入 tool_name 為修復後的正確工具時,生成的資料應體現:
- 工具呼叫格式正確(符合工具要求檔案)
- query 欄位格式正確(如延時類指令含 timing 欄位)
- 文字回覆符合預期(含延時時間描述)
具體格式參考:references/tools/scene_generator.txt。
更多技能請訪問小蔥技能站7w4.net。
這個 Skill 用於自動生成智慧家居對話的訓練資料,質量中等偏上。優點是支援的工具型別多、格式規範明確、使用文件詳細。缺點是部分複雜規則的實現可能與預期不符,生成的資料樣式較為固定,不夠靈活多樣。如果需要批次生成標註資料,可以用它作為基礎,但建議配合人工稽核確保資料質量。