modelfunction-cli 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +118 -2
- package/fixtures/models.json +39 -0
- package/fixtures/suite.json +150 -0
- package/fixtures/tools/resume_score.json +37 -0
- package/lib/ablate.js +120 -0
- package/lib/adapter-import.js +24 -0
- package/lib/adapters/mock.js +143 -0
- package/lib/adapters/openai.js +95 -0
- package/lib/cases.js +188 -0
- package/lib/compare.js +220 -0
- package/lib/eval-exec.js +140 -0
- package/lib/exec.js +265 -0
- package/lib/fingerprint.js +52 -0
- package/lib/fsutil.js +7 -0
- package/lib/lint.js +110 -0
- package/lib/mcp-probe.js +152 -0
- package/lib/mcp-server.js +222 -0
- package/lib/report.js +119 -0
- package/lib/runtime/harness.mjs +145 -0
- package/lib/runtime/harness.py +373 -0
- package/lib/sandbox-check.js +166 -0
- package/lib/scan.js +510 -0
- package/lib/score.js +137 -0
- package/lib/suite.js +117 -0
- package/mf.js +638 -0
- package/package.json +38 -4
- package/skills/mf-cases/SKILL.md +59 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mf-cases
|
|
3
|
+
description: 为 ModelFunction 评测套件撰写 function-calling 用例。当用户要求“给这些工具写评测用例 / 补测试用例 / 检查覆盖率 / 测模型会不会选对函数”时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 目标
|
|
7
|
+
|
|
8
|
+
为已有的工具定义写**可直接运行**的评测用例,覆盖工具选择与参数填充的常见失败模式。
|
|
9
|
+
|
|
10
|
+
# 输入
|
|
11
|
+
|
|
12
|
+
0. 还没有套件时:先调 `scan_tools`(`probe=true` 可连 MCP server)并传 `writeSuite: "mf.suite.json"`,得到工具清单草稿,再补用例。
|
|
13
|
+
1. 工具定义:`mf.scan.json` 或 `mf.suite.json`(只看名字、description、parameters)
|
|
14
|
+
2. 覆盖率现状:`mf coverage --suite <file> --json`
|
|
15
|
+
3. 可选:用户提供的真实日志、投诉记录、产品文档
|
|
16
|
+
|
|
17
|
+
# 规则
|
|
18
|
+
|
|
19
|
+
1. **只从 schema 取材**:工具名、参数名必须与定义一致,不得发明。
|
|
20
|
+
2. **数量**:每个工具至少 3 条;负例(`expectedTool: null`)占全部用例 ≥20%。
|
|
21
|
+
3. **必须覆盖的失败模式**:
|
|
22
|
+
- 近义工具混淆(两个工具描述相近,用户话里只有一处细节能区分)
|
|
23
|
+
- 用户没提供必要参数(推荐用负例表达“应追问”,而不是编造参数)
|
|
24
|
+
- 中英混输、口语化表达
|
|
25
|
+
- 多意图(用户一句话里两个诉求,必须确定主意图)
|
|
26
|
+
4. **input 要像真实用户**:不要出现工具名,不要写“请调用 xxx”。
|
|
27
|
+
5. **期望参数**用以下形式之一:
|
|
28
|
+
- 普通值(数字、枚举、短字符串,比较时去空格)
|
|
29
|
+
- `{ "$contains": "子串" }`(长文本字段)
|
|
30
|
+
- `{ "$oneOf": [..] }`(可接受多个等价取值)
|
|
31
|
+
- `{ "$exists": true|false }`(只关心有没有)
|
|
32
|
+
6. **不要用被测模型生成用例**,也不要让被测模型参与出题。
|
|
33
|
+
|
|
34
|
+
# 输出格式
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
[
|
|
38
|
+
{
|
|
39
|
+
"id": "agent_001",
|
|
40
|
+
"input": "用户原话",
|
|
41
|
+
"expectedTool": "工具名或 null",
|
|
42
|
+
"expectedArgs": { "参数名": "值或匹配器" },
|
|
43
|
+
"note": "为什么这条用例重要(可选)",
|
|
44
|
+
"source": "agent",
|
|
45
|
+
"reviewed": false,
|
|
46
|
+
"tags": ["confusion", "negative"]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
# 写入与自检
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
mf case add --suite <file> --input cases.json # 默认 source=agent、reviewed=false
|
|
55
|
+
mf coverage --suite <file> # 看是否达标
|
|
56
|
+
mf eval --models mock --show-cases # 先离线跑一遍,确认用例本身可执行
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
写入后提醒用户:**未复核用例不计入正式分数**,需要在 `mf eval` 前把 `reviewed` 改为 `true`,或用 `--reviewed` 添加。
|