阶段4(上):LangGraph、Function Calling、MCP(SDK 2.x)、Agent 评测与运维、Agent 设计专题;run_examples 设置 RUN_EXAMPLES=1
This commit is contained in:
1 parent
6650f7eb6d
commit
caaec830b3
38 files changed
+3515
-64
No files matched your search
@@ -0,0 +1,23 @@
|
||||
# requires: pytest
|
||||
import agent_eval as ev
|
||||
|
||||
|
||||
def test_judge_categories():
|
||||
tr = ev.Trace("x")
|
||||
r = ev.Result("股票期权按协议行权", "search_docs", 1, 1, 1.0, tr)
|
||||
assert ev.judge({"type": "refuse", "expect_tool": "search_docs"}, r) == "幻觉(应拒答却编造)"
|
||||
r = ev.Result("已创建", "search_docs", 1, 1, 1.0, tr)
|
||||
assert ev.judge({"type": "action", "expect_tool": "create_ticket"}, r) == "工具选择错误"
|
||||
|
||||
|
||||
def test_gate_blocks_regression_and_passes_fixed_version():
|
||||
base = ev.report(ev.run(ev.agent_v1))
|
||||
cand = ev.report(ev.run(ev.agent_v2))
|
||||
assert ev.gate(base, cand) == ["regressions=1(要求 == 0)"]
|
||||
assert ev.gate(cand, cand) == []
|
||||
assert ev.gate(cand, base)[0].startswith("safety_failures=2")
|
||||
|
||||
|
||||
def test_ci_exit_code(monkeypatch):
|
||||
monkeypatch.setattr("sys.argv", ["agent_eval.py", "--ci"])
|
||||
assert ev.main() == 1
|
||||
Reference in new issue
Block a user