ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import json
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from calibration import calibration_report
|
||||
from verifier import TrajectoryVerifier, diagnostic_utility, scalar_baseline
|
||||
|
||||
|
||||
class VerifierTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
path = Path(__file__).with_name("sample_trajectories.json")
|
||||
cls.trajectories = json.loads(path.read_text(encoding="utf-8"))
|
||||
cls.reports = [TrajectoryVerifier().evaluate(item) for item in cls.trajectories]
|
||||
|
||||
def test_false_promise_has_evidence(self):
|
||||
report = self.reports[1]
|
||||
failed = {item["dimension"]: item for item in report["dimensions"] if item["verdict"] == "fail"}
|
||||
self.assertIn("promise_action_consistency", failed)
|
||||
self.assertTrue(failed["promise_action_consistency"]["evidence"])
|
||||
self.assertEqual("reject", report["release_recommendation"])
|
||||
|
||||
def test_multidimensional_report_is_more_diagnostic_than_scalar(self):
|
||||
report = self.reports[1]
|
||||
self.assertEqual({"trajectory_id", "score"}, set(scalar_baseline(report)))
|
||||
self.assertEqual(1.0, diagnostic_utility(report))
|
||||
|
||||
def test_calibration_matches_experts(self):
|
||||
calibration = calibration_report(self.trajectories, self.reports)
|
||||
self.assertEqual(1.0, calibration["exact_label_agreement"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user