Add workplace verifiers for ClawBenchPro
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- checksums.sha256 +0 -0
- manifest.json +4 -4
- persona_aligned_mix_200/checksums.sha256 +61 -60
- persona_aligned_mix_200/manifest.json +2 -2
- persona_aligned_mix_200/provenance/verifier_repair_manifest.jsonl +3 -0
- persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0027/verify_workplace.py +99 -140
- persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0028/verify_workplace.py +215 -83
- persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0031/verify_workplace.py +80 -88
- persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0038/verify_workplace.py +147 -77
- persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0039/verify_workplace.py +150 -0
- persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0044/verify_workplace.py +27 -106
- persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0050/verify_workplace.py +26 -97
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0003/verify_workplace.py +87 -109
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0005/verify_workplace.py +74 -162
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0008/verify_workplace.py +51 -54
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0010/verify_workplace.py +69 -81
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0018/verify_workplace.py +98 -75
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0025/verify_workplace.py +82 -155
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0026/verify_workplace.py +127 -100
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0029/verify_workplace.py +134 -23
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0031/verify_workplace.py +90 -32
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0039/verify_workplace.py +95 -74
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0041/verify_workplace.py +99 -0
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0042/verify_workplace.py +134 -0
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0044/verify_workplace.py +30 -87
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0045/verify_workplace.py +123 -94
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0049/verify_workplace.py +52 -132
- persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0050/verify_workplace.py +29 -66
- persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0027/verify_workplace.py +99 -140
- persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0028/verify_workplace.py +215 -83
- persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0031/verify_workplace.py +80 -88
- persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0038/verify_workplace.py +147 -77
- persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0039/verify_workplace.py +150 -0
- persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0044/verify_workplace.py +27 -106
- persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0050/verify_workplace.py +26 -97
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0001/verify_workplace.py +50 -144
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0002/verify_workplace.py +66 -62
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0003/verify_workplace.py +95 -49
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0005/verify_workplace.py +85 -49
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0011/verify_workplace.py +55 -128
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0014/verify_workplace.py +81 -56
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0015/verify_workplace.py +63 -87
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0016/verify_workplace.py +117 -77
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0018/verify_workplace.py +100 -61
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0021/verify_workplace.py +162 -72
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0022/verify_workplace.py +72 -101
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0024/verify_workplace.py +72 -119
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0026/verify_workplace.py +120 -95
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0029/verify_workplace.py +135 -42
- persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0033/verify_workplace.py +117 -106
checksums.sha256
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
manifest.json
CHANGED
|
@@ -16,8 +16,8 @@
|
|
| 16 |
"multi_turn_aligned": 200,
|
| 17 |
"skills_aligned": 200
|
| 18 |
},
|
| 19 |
-
"files":
|
| 20 |
-
"bytes":
|
| 21 |
"checksums": "round_01_aligned_mix_800/checksums.sha256",
|
| 22 |
"verifiers": "round_01_aligned_mix_800/verifiers"
|
| 23 |
},
|
|
@@ -32,8 +32,8 @@
|
|
| 32 |
"multi_turn": 50,
|
| 33 |
"skills": 50
|
| 34 |
},
|
| 35 |
-
"files":
|
| 36 |
-
"bytes":
|
| 37 |
"checksums": "persona_aligned_mix_200/checksums.sha256",
|
| 38 |
"verifiers": "persona_aligned_mix_200/verifiers"
|
| 39 |
}
|
|
|
|
| 16 |
"multi_turn_aligned": 200,
|
| 17 |
"skills_aligned": 200
|
| 18 |
},
|
| 19 |
+
"files": 6359,
|
| 20 |
+
"bytes": 23850515,
|
| 21 |
"checksums": "round_01_aligned_mix_800/checksums.sha256",
|
| 22 |
"verifiers": "round_01_aligned_mix_800/verifiers"
|
| 23 |
},
|
|
|
|
| 32 |
"multi_turn": 50,
|
| 33 |
"skills": 50
|
| 34 |
},
|
| 35 |
+
"files": 1397,
|
| 36 |
+
"bytes": 6118979,
|
| 37 |
"checksums": "persona_aligned_mix_200/checksums.sha256",
|
| 38 |
"verifiers": "persona_aligned_mix_200/verifiers"
|
| 39 |
}
|
persona_aligned_mix_200/checksums.sha256
CHANGED
|
@@ -10,7 +10,7 @@ ddc9ea1b1b06f971daa332d2864fa4a1643dc377693181f75897d2c56056e9af eval_manifests
|
|
| 10 |
937eaca759b3664669c8aeb3a0705f12d2fa66a1cb40674e425dbb97048064f4 eval_manifests/skills.jsonl
|
| 11 |
2d0a464c28dc1aa380cf5740a7ba9aa76bcc33649e46ea32d8ce12ba6b601027 eval_manifests/skills.task_ids
|
| 12 |
273c0a3d6342edf14abd7ea4f10f9c9179e7982455e8d99be39c0739689d50fa import_manifest.jsonl
|
| 13 |
-
|
| 14 |
12ae83d267551b1e73808354b802a7d0efcc1a3b76453e7b84c9964c4e294503 provenance/eval_manifests/base.jsonl
|
| 15 |
72aeea0c6321b55982263dbd1cbc23ff114768b3cc21b3cfeab7ff70b7e00284 provenance/eval_manifests/base.task_ids
|
| 16 |
cdfe914540244feb618a00470b455aba9622d94761352a174dda05826f79d040 provenance/eval_manifests/hard.jsonl
|
|
@@ -28,6 +28,7 @@ f886fe8dcee33c3f7ed31e47edea105b4ac16383a7eca79fe2a1b3f584deaa15 provenance/imp
|
|
| 28 |
cf3ca3b84a84ca57b8914d4fc3d08e15d04838687ae503baef3206c00888d9ac provenance/selection_summary.json
|
| 29 |
48fdd4735d4a5bae570f6436e1cfcfe10ba5d236c6522da69ec2960b115670a2 provenance/task_manifest.csv
|
| 30 |
46c5f60e5218f57b7dd190fee99eb81ca932e52f3f09b11fbf1b76861fa2ef9a provenance/validation_report.json
|
|
|
|
| 31 |
7b9957d6b41f006baa0fb5661a7b84520eaeaf2ca0baba12968c99e6e7039033 selection_manifest.jsonl
|
| 32 |
6b74f75513fad3b4fd1cdebd1e2edc931602987fb6305045f614087f917354c3 skills/data-persona-aligned-skills-50-0001-legacy-raft-parser-skill/SKILL.md
|
| 33 |
96ea388e187a635832d43c3306cb4c9988d57aed2cf144a92244875fb8c98567 skills/data-persona-aligned-skills-50-0001-legacy-raft-parser-skill/legacy_raft_parser_skill.py
|
|
@@ -395,11 +396,11 @@ f5239e4cce892bd9423347e512e9f6bf27a56b4269507834c9efae8c06881b03 tasks/data_per
|
|
| 395 |
419c473e36b05d09253cc080d90514eb79e1730c08b20d5c25a28926f4e0e976 tasks/data_persona_aligned_base_50_0026.yaml
|
| 396 |
309fe08d3f1f04be1366ea65740e959b651f91fe55d4bd13da4c41db1d679414 tasks/data_persona_aligned_base_50_0027/_env_builder_impl.py
|
| 397 |
701e904057b4ff9c724910458106eee93f4f7fc03fe7469aeee72abdecaccdfd tasks/data_persona_aligned_base_50_0027/env_builder.py
|
| 398 |
-
|
| 399 |
adf7bda9cf224903ae10b3946e8b5ceddd73f5e6d8647f3b12f0fb1d1b5efd94 tasks/data_persona_aligned_base_50_0027.yaml
|
| 400 |
99e50d5dac2bf083625b694a59f8a0f6788fef363189e9f628af378e2db19e49 tasks/data_persona_aligned_base_50_0028/_env_builder_impl.py
|
| 401 |
30376ea0cf4aee7c2dec63117aa45844e1fa81511e864a4f65b0dee849272660 tasks/data_persona_aligned_base_50_0028/env_builder.py
|
| 402 |
-
|
| 403 |
f836f191afc149f21bd1a50c7babd2eaee3c191ecd24415184456dd0209a6115 tasks/data_persona_aligned_base_50_0028.yaml
|
| 404 |
c1b63bdd52c37439a150793741e470c9ef81c1963175ce5c3b76698704154e21 tasks/data_persona_aligned_base_50_0029/_env_builder_impl.py
|
| 405 |
1cae3b31de8df3ead7017cb31c7cf86f9c80ff05175fa490d7c7488f1966dabd tasks/data_persona_aligned_base_50_0029/env_builder.py
|
|
@@ -411,7 +412,7 @@ fad418cecfe44395fcfd641f293f42a7d07d069862702238595527dd91c98c00 tasks/data_per
|
|
| 411 |
94493ce13f1f732cdb9b1ce467de39300de2c4ce52ada5c5213e2c7dd5079003 tasks/data_persona_aligned_base_50_0030.yaml
|
| 412 |
2d38a884e90526b3985d2dfbefc313f7a92b9e490164dbf94fdbd7117202947d tasks/data_persona_aligned_base_50_0031/_env_builder_impl.py
|
| 413 |
962233981532626c1d8ad5a71a3502d076a57e494890127cdfb84172efb11fca tasks/data_persona_aligned_base_50_0031/env_builder.py
|
| 414 |
-
|
| 415 |
a0c6f4af4e68ff04f39239543bd0e9b952818074c5c6827a8be58e2cd7b2edb3 tasks/data_persona_aligned_base_50_0031.yaml
|
| 416 |
a50b6379bd53a7c06a8de7cd843d681def34cbf074a926d8a400ea5450f5aeb2 tasks/data_persona_aligned_base_50_0032/_env_builder_impl.py
|
| 417 |
0d0659c5bd27644758e79b1644369f3af8f4caf6ac7b454f1e308cd87ed98a61 tasks/data_persona_aligned_base_50_0032/env_builder.py
|
|
@@ -439,11 +440,11 @@ a9068ff071983d3dd611b2d5a2acc8617176707412c32a9815caa022b35fb4cc tasks/data_per
|
|
| 439 |
e163a7719e34c46c247540197dc4ccb9b4ad22dd6e18dbf676817ef018e06e00 tasks/data_persona_aligned_base_50_0037.yaml
|
| 440 |
0a345ac8c0b22a643e0382c660b34d0bb34f9e9c768eafd84a374a8403ca7763 tasks/data_persona_aligned_base_50_0038/_env_builder_impl.py
|
| 441 |
d307444652d33c8e30fc3d2cbfa33a7be79c5f4c5205d5aad21b6a5d660f62ac tasks/data_persona_aligned_base_50_0038/env_builder.py
|
| 442 |
-
|
| 443 |
38aae608a4c8247283e4021b8cd3d6185fa1b34f30574b23c7268ffb461a20a9 tasks/data_persona_aligned_base_50_0038.yaml
|
| 444 |
f19c5b30bd5c3a9b832b2d28d05b73994e7563a8581265b337a7ca1bf54d36b5 tasks/data_persona_aligned_base_50_0039/_env_builder_impl.py
|
| 445 |
f9116c57a7886975283b29c060c9989352a11d923624c433b5fb34cae2ef26bf tasks/data_persona_aligned_base_50_0039/env_builder.py
|
| 446 |
-
|
| 447 |
e4bb5d21f034ecfea41ce097f7f583ee9e21516288efc529f3122f1833fa7d98 tasks/data_persona_aligned_base_50_0039.yaml
|
| 448 |
5046ee44b9f95c4bf1f48829c6fe39e9cb840fc55f2f424782c844e3c8bddbe7 tasks/data_persona_aligned_base_50_0040/_env_builder_impl.py
|
| 449 |
fef2ef8050e166f29c89bd79ed479d597710754b3c31d00b7e11e4477c8dd9bb tasks/data_persona_aligned_base_50_0040/env_builder.py
|
|
@@ -463,7 +464,7 @@ a5ed75d43e1e30d662992b0193ee7eaf0489fdcf2dd1441b6fa507de13a91750 tasks/data_per
|
|
| 463 |
bd8ff94edccc5a0673c4420fadd0b5b2ed0f97dffe2bc84678220bf7ed914a1e tasks/data_persona_aligned_base_50_0043.yaml
|
| 464 |
250b4807517b0b3bb86ac7d661dab733e27adb4928ca59e3d8e784613014d967 tasks/data_persona_aligned_base_50_0044/_env_builder_impl.py
|
| 465 |
974c8fdcd0dc2873aeb9362c3ef9aec854580103db90148adb7e1002a0c4fa45 tasks/data_persona_aligned_base_50_0044/env_builder.py
|
| 466 |
-
|
| 467 |
91ec50ad850b6f8c5b9dcd6d9d6b697dbd4de208694545a4e4e4c1986d12107c tasks/data_persona_aligned_base_50_0044.yaml
|
| 468 |
22503e360c49920cec2452ecb6ee9781275a8f7757bfb74f98d52b4621b2a8b1 tasks/data_persona_aligned_base_50_0045/_env_builder_impl.py
|
| 469 |
ca3933e0a647e00517baf586b4608e42df835592e854e6ff03710c594f19e0f5 tasks/data_persona_aligned_base_50_0045/env_builder.py
|
|
@@ -487,7 +488,7 @@ c53229f72d98969364a510c422ad052f8831c8520aefbcc2610db2243695934f tasks/data_per
|
|
| 487 |
33e33f82ff35a6ad6cb1092e5e36b3f5939a8efe3f084955c9086b7508fcb579 tasks/data_persona_aligned_base_50_0049.yaml
|
| 488 |
621b6ad772a34c7de0253650134ff3ffa2965558360f7d3064aecec375da447e tasks/data_persona_aligned_base_50_0050/_env_builder_impl.py
|
| 489 |
db6022647edb92f6923877f378d15eb624578baef866632d74b05166a7cd908b tasks/data_persona_aligned_base_50_0050/env_builder.py
|
| 490 |
-
|
| 491 |
39985f7f65d42723fad48a0f4f9485351aeb9d3fdba74d11987c403a5a2a5c30 tasks/data_persona_aligned_base_50_0050.yaml
|
| 492 |
9892213853ca4c0261fd68c4cb4e247eaa0b21430d22b5209ea1cb29b1f4edfc tasks/data_persona_aligned_hard_50_0001/_env_builder_impl.py
|
| 493 |
3e61d1d76042916afa0bd62010e86d59370e0d27c26971e7e9f3905d86b78886 tasks/data_persona_aligned_hard_50_0001/env_builder.py
|
|
@@ -499,7 +500,7 @@ e8dc8cd5f2a5f0dcacb08f6b59c79625e767d1ad33b2c98debbcdcdf481f6bd8 tasks/data_per
|
|
| 499 |
b14d812ae12f36674a7df36748145b7beaa7806f8e15ab0bedfe6a982e8ac1cc tasks/data_persona_aligned_hard_50_0002.yaml
|
| 500 |
3663abd9569ead92bf55f91bc1afa38f9b3cb9983f1878204bf36b10bb755a1e tasks/data_persona_aligned_hard_50_0003/_env_builder_impl.py
|
| 501 |
0565d7f925923ff2026cf8f268ca40a8e3cb64f63d0465121b5d9ba1d8743c8a tasks/data_persona_aligned_hard_50_0003/env_builder.py
|
| 502 |
-
|
| 503 |
88ff6a2515b4135b23b5f0d99c444f0e7bc6752d16d17ed1c1679b6c55a40906 tasks/data_persona_aligned_hard_50_0003.yaml
|
| 504 |
f4d62cc9d321d62f6a3dd231a882bfc6731bb6cc8ee67be55dbc97c0307ec002 tasks/data_persona_aligned_hard_50_0004/_env_builder_impl.py
|
| 505 |
c3b2349fa5381acac97516862d5853aa61853adbe3dd0f288c5b78fa3005fcb4 tasks/data_persona_aligned_hard_50_0004/env_builder.py
|
|
@@ -507,7 +508,7 @@ c3b2349fa5381acac97516862d5853aa61853adbe3dd0f288c5b78fa3005fcb4 tasks/data_per
|
|
| 507 |
8bfdaca55308c27902185f964ebea07c47516010a236af3b7bbea5c65b394133 tasks/data_persona_aligned_hard_50_0004.yaml
|
| 508 |
9377b5cddccdc96cffc589184fadc5dc44828a84a89d023a44ec86bc4478745f tasks/data_persona_aligned_hard_50_0005/_env_builder_impl.py
|
| 509 |
ec61a256c79a4cf56633c6cd1e401203c96ef27ba8686fc8ecae56a2a3225a45 tasks/data_persona_aligned_hard_50_0005/env_builder.py
|
| 510 |
-
|
| 511 |
ef459e1e02cb3ed81b88ec63e8e574199b4d0aead843d3627f9d634effa39157 tasks/data_persona_aligned_hard_50_0005.yaml
|
| 512 |
1b8d9ed1662013c6063095a9dee57f4eb45e90e52aaccc23665e686d7d6ee285 tasks/data_persona_aligned_hard_50_0006/_env_builder_impl.py
|
| 513 |
4de8a87722a1a52230c66a4f518b0f2dc71e9dcab64c0d4ce2a5928f3bf408ba tasks/data_persona_aligned_hard_50_0006/env_builder.py
|
|
@@ -519,7 +520,7 @@ f4d5839a43ee22c0ccea148e52ffc2a668b121b954b8778cabab7b2647033caf tasks/data_per
|
|
| 519 |
93ed4d1565625e3807ab2bd958b08f13eefdff0177fd2a3976191dac1559c5ff tasks/data_persona_aligned_hard_50_0007.yaml
|
| 520 |
26e506a445f77a0753ad8925746c99bdc9504359ba99d6496a7cd39c1303f7e2 tasks/data_persona_aligned_hard_50_0008/_env_builder_impl.py
|
| 521 |
342c106b617b8540cacc25ce925991e51f53b3cf7f8466705867de9aa8813c48 tasks/data_persona_aligned_hard_50_0008/env_builder.py
|
| 522 |
-
|
| 523 |
9272346004462fd9b33b9ce938153b90b4c3ba63a20a4b3f4a238e0ae89b8b9b tasks/data_persona_aligned_hard_50_0008.yaml
|
| 524 |
81d367d74e1ab93dc2c40117acf662ee1df3e59d97836a40e7694d919ae85258 tasks/data_persona_aligned_hard_50_0009/_env_builder_impl.py
|
| 525 |
4c89bb7b35cbcede49935ea0a78d6ee5adf3225738523fbfe3d0161328ba05d1 tasks/data_persona_aligned_hard_50_0009/env_builder.py
|
|
@@ -527,7 +528,7 @@ cd7dd3eca81159f53f018bf176e0711db8cfd37ddaa1e5741b7e6c7d7bf718b3 tasks/data_per
|
|
| 527 |
0e7bc5aa1ee8327bd92ac848ac58551cef3542910c1f8816761cf79dc307d456 tasks/data_persona_aligned_hard_50_0009.yaml
|
| 528 |
aaa724cf61cbf07ae648089a1c790880da4969085fa5b6fc1b49b42134a23b66 tasks/data_persona_aligned_hard_50_0010/_env_builder_impl.py
|
| 529 |
a0b86d0d17662a9c17cbd783917140943b55b5b4264df71528558781dfd36ce6 tasks/data_persona_aligned_hard_50_0010/env_builder.py
|
| 530 |
-
|
| 531 |
c1a09ff9086f6ae5a6150e807b971374dde5d1f90b998701c0b189fb4732b446 tasks/data_persona_aligned_hard_50_0010.yaml
|
| 532 |
06d42d54408f75e93d1b8be591f6bf259037caae86064f98f335992f619d6c3c tasks/data_persona_aligned_hard_50_0011/_env_builder_impl.py
|
| 533 |
316d452fdba8ec3f9f774b94f8a2ea6d898d280b133dff09efa1c6cc55e61cda tasks/data_persona_aligned_hard_50_0011/env_builder.py
|
|
@@ -559,7 +560,7 @@ ddbca9bd917f791418d49f0086bc60885e990284ea22c94e73bce7fd8118cb04 tasks/data_per
|
|
| 559 |
d04f43e4c15c4c935c9586b61e948637ce13668e1fc131f3ec326193df779e40 tasks/data_persona_aligned_hard_50_0017.yaml
|
| 560 |
17fcd2a10401eb20c0778932a134f08aa739d51566965e4d35ba01be72a0f734 tasks/data_persona_aligned_hard_50_0018/_env_builder_impl.py
|
| 561 |
98944163bb3ed53c6d7850cd088c09f15b9a634c1b03e4b0ccabb73fc7fe07c9 tasks/data_persona_aligned_hard_50_0018/env_builder.py
|
| 562 |
-
|
| 563 |
5a374e07aa2bbc2ecd36b7f8706e293b1552920462256a87b4cfbc717d6e12b6 tasks/data_persona_aligned_hard_50_0018.yaml
|
| 564 |
91f2a954bcc89ee384a12b36a45675d6d1af572f8c88d1ca0a534914592bff70 tasks/data_persona_aligned_hard_50_0019/_env_builder_impl.py
|
| 565 |
765b8babb18dc5d8b9c7abc5cf3c8b527c8b3dc0718bc58486e177d68a812f70 tasks/data_persona_aligned_hard_50_0019/env_builder.py
|
|
@@ -587,11 +588,11 @@ aa92ca12d84e09a0364123092ba0ca97dd166c00aaf90d019d1a80696e7362b7 tasks/data_per
|
|
| 587 |
6abe823a388bb7d9b4178bfe63c1364714a326172c110b39feaab026ca64665d tasks/data_persona_aligned_hard_50_0024.yaml
|
| 588 |
10e5ab67e724c6eff45567a16296e426583b4a01191c5c9657c4f053ffc9672e tasks/data_persona_aligned_hard_50_0025/_env_builder_impl.py
|
| 589 |
9623bfa7c6debc23c10fd65680189bc336c74820b51edf66d13a3256a345c3f4 tasks/data_persona_aligned_hard_50_0025/env_builder.py
|
| 590 |
-
|
| 591 |
aa6e710116826c1faec4c6db3ade51b804c0ed28f3d1786c25c6c9055ba297cd tasks/data_persona_aligned_hard_50_0025.yaml
|
| 592 |
94dce0fdb078c2c0978b2d755a1ed677f12ad86f1b01eceb4a99bb2f77cbf766 tasks/data_persona_aligned_hard_50_0026/_env_builder_impl.py
|
| 593 |
b5a5760af5aa6213db8ae77365d5a324260fbeb05ac38f6183bed96d2497e3a4 tasks/data_persona_aligned_hard_50_0026/env_builder.py
|
| 594 |
-
|
| 595 |
94d37e64629a0afc19595978c77be604fd0f69e8d021eecebd606f8697e37e44 tasks/data_persona_aligned_hard_50_0026.yaml
|
| 596 |
6d71034b3da4d856404318ae3e8c6964039c746d31568bd001120f9f2ee323d8 tasks/data_persona_aligned_hard_50_0027/_env_builder_impl.py
|
| 597 |
e916a151a5dfc1216d3126e1fdc9d3e49d4ff21dfd0d8e1a69c481b99e652844 tasks/data_persona_aligned_hard_50_0027/env_builder.py
|
|
@@ -603,7 +604,7 @@ d22ec93e6890578d6cad793b3f75be07274ecaa2dca93d0d00ef7b075960a0c0 tasks/data_per
|
|
| 603 |
e9482f5c8e5e45ac6ce070706b4b16229f5411a3c59c9d266d20dcd4dd40a7bc tasks/data_persona_aligned_hard_50_0028.yaml
|
| 604 |
641130cbb094d46c4f6a6453bf48c4da4223b1c6b2f11378cea254a3d1550cd2 tasks/data_persona_aligned_hard_50_0029/_env_builder_impl.py
|
| 605 |
bedb04030f528ca6141a3a8d98870e6298ece7296c1e9427c6ef24f155292030 tasks/data_persona_aligned_hard_50_0029/env_builder.py
|
| 606 |
-
|
| 607 |
cb3cf4435c2d8f1b84430fba628f17a187d07500152b6869ef58ba690486596e tasks/data_persona_aligned_hard_50_0029.yaml
|
| 608 |
57ec090bb1439b10bebbe4ba8effc0dd0251169a5c7afe6da44097428359edbc tasks/data_persona_aligned_hard_50_0030/_env_builder_impl.py
|
| 609 |
4c060230b3d775a246e7917095863cff5352ecf49aa0861d6ad5e4b6468337e5 tasks/data_persona_aligned_hard_50_0030/env_builder.py
|
|
@@ -611,7 +612,7 @@ b64b6b1d5dfdf584acff4d6519b03cc10dda92a282fabcc853b7715780f64fe3 tasks/data_per
|
|
| 611 |
653f70b05c6670ce5a312a40ddf98974ffdbeb079b10a62d5755dc7da3b4b47e tasks/data_persona_aligned_hard_50_0030.yaml
|
| 612 |
8a7abefe1106481b16b296adad117e7c789d97297a674e8b734d8079718d5adc tasks/data_persona_aligned_hard_50_0031/_env_builder_impl.py
|
| 613 |
1208d3209535d6a643c81fe45d9b2b2399e2c32b762ab32319642b12ee9d5040 tasks/data_persona_aligned_hard_50_0031/env_builder.py
|
| 614 |
-
|
| 615 |
1b61c0f4805f412a3286e128d8307900ac900e769e4e146df828df3f9be32932 tasks/data_persona_aligned_hard_50_0031.yaml
|
| 616 |
72c58b2d69f62db6115a3b44e28dc24b6a8478a8c2a50d78e413fbe588b2338d tasks/data_persona_aligned_hard_50_0032/_env_builder_impl.py
|
| 617 |
462064396cd8a259d88b6dbdc0be51924d3119170343c1871e159d51b9bab1e2 tasks/data_persona_aligned_hard_50_0032/env_builder.py
|
|
@@ -643,7 +644,7 @@ f1d2c832a21b95ed93ded2126e4fed9c1ad7adf8f80597b91ab2297f959c047f tasks/data_per
|
|
| 643 |
d6f4dac47bcfa65828f04f5b912efe77dda129fc70f4772512092faf7b764db9 tasks/data_persona_aligned_hard_50_0038.yaml
|
| 644 |
cee58c8a384c84e40e1dafdc1dd9bf1b8a8cb45bb405b164856e84d10b164b59 tasks/data_persona_aligned_hard_50_0039/_env_builder_impl.py
|
| 645 |
736d65347297195a85d31a4601ad05f4f2b5798bdc24708655c97b8055c34ab1 tasks/data_persona_aligned_hard_50_0039/env_builder.py
|
| 646 |
-
|
| 647 |
03a305940543100215db9305eea51043bab58f331ff3c821170f90ceabed5f70 tasks/data_persona_aligned_hard_50_0039.yaml
|
| 648 |
cccb54a1d4689bc2d39a5d82f25367675db0b86f9081f6e754b69ce8e6793885 tasks/data_persona_aligned_hard_50_0040/_env_builder_impl.py
|
| 649 |
4aeaecc382f24f28cbb616749ecc37a92c699f6bf79e38a2a46c518a1f20d972 tasks/data_persona_aligned_hard_50_0040/env_builder.py
|
|
@@ -651,11 +652,11 @@ cccb54a1d4689bc2d39a5d82f25367675db0b86f9081f6e754b69ce8e6793885 tasks/data_per
|
|
| 651 |
b93dce571e0ac493062d2fad51245f215768a562db36abe2bb8e50ca2b80e3ae tasks/data_persona_aligned_hard_50_0040.yaml
|
| 652 |
368d0e34bf22c88838c5d021770c32be32410d872885d1edab41fa9d627de4da tasks/data_persona_aligned_hard_50_0041/_env_builder_impl.py
|
| 653 |
7cd26a3a972cd04ff8f87382186ef63e0847a35f52c8f96098480dca21e66068 tasks/data_persona_aligned_hard_50_0041/env_builder.py
|
| 654 |
-
|
| 655 |
1eacd7393d74e2a684d26214b52dc96e71f2d5ec202738e725b33c362f42c048 tasks/data_persona_aligned_hard_50_0041.yaml
|
| 656 |
fe55b1d0bfd298402f6a6dc4f979acff5fe3510cde4743ad3a7884f7fdf90bee tasks/data_persona_aligned_hard_50_0042/_env_builder_impl.py
|
| 657 |
5fd181c6b52c2b26963900fcfb2a6636664a56e8adce3e8bf70797cc0b119d47 tasks/data_persona_aligned_hard_50_0042/env_builder.py
|
| 658 |
-
|
| 659 |
c61d5a1a8a457e950266bbe86a5dc1e601baa0c0f63eed573679581b0f6a3ed1 tasks/data_persona_aligned_hard_50_0042.yaml
|
| 660 |
ddd0c64952ad98b7d527bab20b85db3c2f403102ae5fb1e687f2aeab46dfd24b tasks/data_persona_aligned_hard_50_0043/_env_builder_impl.py
|
| 661 |
74c8965b40c3a1d0903a6084542ba7e77fecbc8c4a9cd0b1a91cbe65dcfb7b2a tasks/data_persona_aligned_hard_50_0043/env_builder.py
|
|
@@ -663,11 +664,11 @@ ddd0c64952ad98b7d527bab20b85db3c2f403102ae5fb1e687f2aeab46dfd24b tasks/data_per
|
|
| 663 |
9acfdb19b5742bd89764f244a16d4285f6c534c363cf619743aa7cc77cd2243d tasks/data_persona_aligned_hard_50_0043.yaml
|
| 664 |
cba1af8dcbb9be4e8ce767e2bf32bd4712022eac1a08d45cec3a77cdfcce5db1 tasks/data_persona_aligned_hard_50_0044/_env_builder_impl.py
|
| 665 |
9f2e91e8a8c10182bbad2884c67327bc1d05b0bfcd774167c2b9eb30839dc30c tasks/data_persona_aligned_hard_50_0044/env_builder.py
|
| 666 |
-
|
| 667 |
ce6178011783f0c1376190f58110c5d5243259bde9b0335b85b14423b32fe60e tasks/data_persona_aligned_hard_50_0044.yaml
|
| 668 |
2f7c3b1ba5149edfa9f168c3ad807326df9f8edc800c9b39e2a7d8c0cf61ae67 tasks/data_persona_aligned_hard_50_0045/_env_builder_impl.py
|
| 669 |
d182c408e7279f400601c244e2f1c7a71801ee692e981dd0e377321386e4bd49 tasks/data_persona_aligned_hard_50_0045/env_builder.py
|
| 670 |
-
|
| 671 |
355d9686d9318ca38b287079a45d4a50a714b19e744ec1bcc49517f35c07af68 tasks/data_persona_aligned_hard_50_0045.yaml
|
| 672 |
d31aefed27596025b838d8173ee37ea7878873a4503fe42014cccbd2f60fe200 tasks/data_persona_aligned_hard_50_0046/_env_builder_impl.py
|
| 673 |
9843e2b501ad3be64b7e6489b13804ff5bf44de0755d4780540bde37516e96dc tasks/data_persona_aligned_hard_50_0046/env_builder.py
|
|
@@ -683,11 +684,11 @@ f342edee864132c0e2defe6a8578a2de285e792382c8baa21054deec5c6638cb tasks/data_per
|
|
| 683 |
00c24ba621546cb257268342831b204cabb8062991524828b527fcbc886abf62 tasks/data_persona_aligned_hard_50_0048.yaml
|
| 684 |
bb6cc3f6e6c6aa37a8f7befe92c1610110b73cee53fc880c83bf14cae5f787b3 tasks/data_persona_aligned_hard_50_0049/_env_builder_impl.py
|
| 685 |
2d3389cd12b5cac19e2870170bfc7cd0262f8cd7d3992f9fe206933b822767c9 tasks/data_persona_aligned_hard_50_0049/env_builder.py
|
| 686 |
-
|
| 687 |
8c6f40192de673eda70c90d6d49289ab51f85284861eb2a90063c50713ba26eb tasks/data_persona_aligned_hard_50_0049.yaml
|
| 688 |
d131ba8ad15605f073159e5cfa8f59d1f61441775e05ed0b0d3fbaddfe22e956 tasks/data_persona_aligned_hard_50_0050/_env_builder_impl.py
|
| 689 |
962bc6d415f84f358a93f98c58566b35d4583c848105e62385653afc8ca4a050 tasks/data_persona_aligned_hard_50_0050/env_builder.py
|
| 690 |
-
|
| 691 |
f246d3283b5505e1dc14898df39dd637dc3f463149c433f47df715f66e462b92 tasks/data_persona_aligned_hard_50_0050.yaml
|
| 692 |
e0870061523156dcf50b3d061b41eb0b55f4f1cd500110c6baa21cc8b6c7d62f tasks/data_persona_aligned_multi_turn_50_0001/_env_builder_impl.py
|
| 693 |
aa5693f630e9cb100b535d7fa4a218b909ab9ae365224b51a708dc2cbf566fff tasks/data_persona_aligned_multi_turn_50_0001/env_builder.py
|
|
@@ -795,11 +796,11 @@ b2fc67de9d1571b98c481564aa4a9457ada54ec4e888f8241d5d40a7b631ac99 tasks/data_per
|
|
| 795 |
b442abf8cb9ee1102004f826e795e06bad43f06c5d7bde8027e7e9b1d78d90ff tasks/data_persona_aligned_multi_turn_50_0026.yaml
|
| 796 |
c0006cbabe3fdb665f6ec3447b20731e04b54f661d374135ec1a49ac4422f76f tasks/data_persona_aligned_multi_turn_50_0027/_env_builder_impl.py
|
| 797 |
d9c5cfa216c64aab5a0aaa0c743209ecbaaee7b21c208b7be1bfa5187d5c596c tasks/data_persona_aligned_multi_turn_50_0027/env_builder.py
|
| 798 |
-
|
| 799 |
44311badecf8a14f9922783009223547d2906fe3c36a785555037480e4013d00 tasks/data_persona_aligned_multi_turn_50_0027.yaml
|
| 800 |
060264e3bf2aff0a3968301b7a58b5d22ac0ba2de099fd51c7bd6899399712da tasks/data_persona_aligned_multi_turn_50_0028/_env_builder_impl.py
|
| 801 |
1309ac0d0d1c41bf3c49be4fbebf6498c370653415c3c04582a746e70cc95aa6 tasks/data_persona_aligned_multi_turn_50_0028/env_builder.py
|
| 802 |
-
|
| 803 |
a3b8b7dbb01682d4e43b260fcf37e0e7667556fa29bba9e07d8544cef22800da tasks/data_persona_aligned_multi_turn_50_0028.yaml
|
| 804 |
195613c7a4246e3cb5b333388a1cc4676097b9eb5ab5bdcba971acca63b3a7c0 tasks/data_persona_aligned_multi_turn_50_0029/_env_builder_impl.py
|
| 805 |
97fc23c9048c1c2831a9101ed991365886af0dea36ba89bf44b69df8c9b0a413 tasks/data_persona_aligned_multi_turn_50_0029/env_builder.py
|
|
@@ -811,7 +812,7 @@ e11c99d8f991b3b9daa419e47d6379d3af911f321b3dc1173d4b99862f6daa5a tasks/data_per
|
|
| 811 |
982f6d3ee34b2b08c5fed5b60bb4efa07276e7c672ccec891066334330e9936b tasks/data_persona_aligned_multi_turn_50_0030.yaml
|
| 812 |
18e2d97bb019c59ab18a075164511385e25b922d32de046ff147ba58c4cd42b6 tasks/data_persona_aligned_multi_turn_50_0031/_env_builder_impl.py
|
| 813 |
580eb15a196e6e37cc128e088dfe4ca6c1f17a6f52e42c5b60ce3a583d3f7566 tasks/data_persona_aligned_multi_turn_50_0031/env_builder.py
|
| 814 |
-
|
| 815 |
00acac9c0ec49309b8c53bb84f43bacb1457a35c26da794dc6d1c7e1d8b3a8b9 tasks/data_persona_aligned_multi_turn_50_0031.yaml
|
| 816 |
4f7e0c6b7d0085f1e41d1b0d8d734a8bb047fd9a27013a1c98ce559c73cfaabc tasks/data_persona_aligned_multi_turn_50_0032/_env_builder_impl.py
|
| 817 |
38bd56ae9faf3307e0c61e4ce5369024f9ad7988c5008c2c23817e582bba4cb2 tasks/data_persona_aligned_multi_turn_50_0032/env_builder.py
|
|
@@ -839,11 +840,11 @@ a9068ff071983d3dd611b2d5a2acc8617176707412c32a9815caa022b35fb4cc tasks/data_per
|
|
| 839 |
871eb76552d080398c78a7cec0e4b052d1346a812aa617496e9d28f323771f92 tasks/data_persona_aligned_multi_turn_50_0037.yaml
|
| 840 |
f42b5dc110a6237bf594811fba9bbd1e11c0140b9bf7123d1bc51e980b7ed502 tasks/data_persona_aligned_multi_turn_50_0038/_env_builder_impl.py
|
| 841 |
871c46ddcd3c0cc59161027154f797fce686b2f5a5c18439f2459b97d1f2353d tasks/data_persona_aligned_multi_turn_50_0038/env_builder.py
|
| 842 |
-
|
| 843 |
7d959df4fe308e26b221121fd0515965c21baf952e6188329bcd7f154f713b33 tasks/data_persona_aligned_multi_turn_50_0038.yaml
|
| 844 |
a358a8ccc640abf6f5ef8c16e4c92cefd4a4b1d60f893d4a8a8693dc21c43596 tasks/data_persona_aligned_multi_turn_50_0039/_env_builder_impl.py
|
| 845 |
f03b13c0760e04f97ec5afe38099a885868cfd26d8dd4d689e797086abf6eff1 tasks/data_persona_aligned_multi_turn_50_0039/env_builder.py
|
| 846 |
-
|
| 847 |
5fd9a8dfa951f82891bf336194bad07cd698ac839613be821416214abdc45b35 tasks/data_persona_aligned_multi_turn_50_0039.yaml
|
| 848 |
f6702cc7ca4c9a4c7766b3c19a648b0cdfb21684e0cc874e3eeba7d1b814b5cf tasks/data_persona_aligned_multi_turn_50_0040/_env_builder_impl.py
|
| 849 |
40a157919ea9f49fc56c73354ec53675312fdd40a221d32cfaafeee5a4542a6d tasks/data_persona_aligned_multi_turn_50_0040/env_builder.py
|
|
@@ -863,7 +864,7 @@ bc94a1a9d8edce537f51e3dbcdb56c5cd5c44d61effd937eb4e9b142f26e539d tasks/data_per
|
|
| 863 |
cfde3128cf17843380a7d244ba6dd2d3113594a8c35bd2a07b73716504a1e237 tasks/data_persona_aligned_multi_turn_50_0043.yaml
|
| 864 |
c7846fb438cb46bafbd8b73427e89cf9ec898258802996231e06a034e80cbc62 tasks/data_persona_aligned_multi_turn_50_0044/_env_builder_impl.py
|
| 865 |
fc215986f1c8e4d29d5474315f49b76e227d5aaf095bc23304bd0345574cf07e tasks/data_persona_aligned_multi_turn_50_0044/env_builder.py
|
| 866 |
-
|
| 867 |
48b45df848822f760f65c743e77f425971c4af190631be7e9a218c5cc83f8f3e tasks/data_persona_aligned_multi_turn_50_0044.yaml
|
| 868 |
3a4e143a8ad078eb251ca69de34ba587c270b7b6651060823cc34afe9d264e4c tasks/data_persona_aligned_multi_turn_50_0045/_env_builder_impl.py
|
| 869 |
0d51165aca6030bd0d8360e05660e6a8cd2b8351cadd0a89054551b9ea0244bc tasks/data_persona_aligned_multi_turn_50_0045/env_builder.py
|
|
@@ -887,19 +888,19 @@ d58c989e4fe9248e102558deb63fc15c0084fcbdd0ee4b0b01d77a0bcff78562 tasks/data_per
|
|
| 887 |
644ddefeb0fbee316e2f60b216062ef146f90b1a67b138051e30b005561bbced tasks/data_persona_aligned_multi_turn_50_0049.yaml
|
| 888 |
b191844585401540c79229e85dcbcb61d3229d50c24f77cf22620e30c3b83ee1 tasks/data_persona_aligned_multi_turn_50_0050/_env_builder_impl.py
|
| 889 |
71d53a790ea3c2a3cd3f2168b934cc8fa3d25acc49dc3831c2ab0a9da1663b1f tasks/data_persona_aligned_multi_turn_50_0050/env_builder.py
|
| 890 |
-
|
| 891 |
d4b7b8462bf456d77f9914c931edb42a1f03ca9de288a3caf7a72c2414cfcc2a tasks/data_persona_aligned_multi_turn_50_0050.yaml
|
| 892 |
9ba5001c18264e7492816c699544e57c474ac01319b5199ec419f613dd5d236a tasks/data_persona_aligned_skills_50_0001/_env_builder_impl.py
|
| 893 |
430f0da57468b56d4d7cd5d665c3c4233d8fd9c16ad71c99f2d44a88fc2d5b59 tasks/data_persona_aligned_skills_50_0001/env_builder.py
|
| 894 |
-
|
| 895 |
4af3e9203475eeea4f938b3afc4b9e720008b850b88561dcb8fee7d3bab40bfd tasks/data_persona_aligned_skills_50_0001.yaml
|
| 896 |
fc24bbeda0fdfbc36b8f1af148470a2d5aa53bd49cbcde7bbc69fd3d2e662351 tasks/data_persona_aligned_skills_50_0002/_env_builder_impl.py
|
| 897 |
75a883f3da5b76f3f3dc087ed2af67352131c55627aa8f1bb4bc0bcd4ecedd71 tasks/data_persona_aligned_skills_50_0002/env_builder.py
|
| 898 |
-
|
| 899 |
1b0ec155c383fb6e1132bf92c5abaf53349ca5119e232db1a0abc18400936cd0 tasks/data_persona_aligned_skills_50_0002.yaml
|
| 900 |
bfa32aa5d8614b836be8c879484034a8d62dad89e85578450f5adfb2a9ab88f1 tasks/data_persona_aligned_skills_50_0003/_env_builder_impl.py
|
| 901 |
53d248a85bb661a1cc67b1f96fbf9ea638ab2b6556d337f23e5a432f794b62e6 tasks/data_persona_aligned_skills_50_0003/env_builder.py
|
| 902 |
-
|
| 903 |
885f054d78faf097189ee04b97fe326a7944218babce1175ec330352de7dde24 tasks/data_persona_aligned_skills_50_0003.yaml
|
| 904 |
d104f49cecdae66d6a664bc99627dda16f416a6864b398dc224d76ccffde78ea tasks/data_persona_aligned_skills_50_0004/_env_builder_impl.py
|
| 905 |
0d3147dfb30a7098c44f12446ea2fa2da39af6b68c9d00775b28cb2d9217cd49 tasks/data_persona_aligned_skills_50_0004/env_builder.py
|
|
@@ -907,7 +908,7 @@ e8fa3988bfebfa0935e39b61823b5d549ae4831df5a96bb0352219d5cbf89525 tasks/data_per
|
|
| 907 |
2e41276eb8dec0024c82210103919dfc64880d3af4af90a10172a2aeede57072 tasks/data_persona_aligned_skills_50_0004.yaml
|
| 908 |
f0265e16e5276519ba1562ef3c356132b5cd8cbdae845e7c0423c8fdcb80e7b7 tasks/data_persona_aligned_skills_50_0005/_env_builder_impl.py
|
| 909 |
5ea44bc46399d477cc8ca7bc611eed0992cb0ff05fe4cc40e175362389ae41db tasks/data_persona_aligned_skills_50_0005/env_builder.py
|
| 910 |
-
|
| 911 |
b63105179c6ed7ee525a902045ac208c3f9a51df503ee9eaf708429bfb4c742b tasks/data_persona_aligned_skills_50_0005.yaml
|
| 912 |
6c24e33be7b534bc2f825b514b962335d5dee4ca6b8329af9da055993bf92072 tasks/data_persona_aligned_skills_50_0006/_env_builder_impl.py
|
| 913 |
344f2bc4bfcc1b8231fe15c7ff2b5a30f343ad02527c6c90f02904f8fd027dab tasks/data_persona_aligned_skills_50_0006/env_builder.py
|
|
@@ -931,7 +932,7 @@ a3da02eda2b217178d15b7111cf07592e6597185b66b338b6720f43c9eb5d659 tasks/data_per
|
|
| 931 |
ce5af4d9f8f8cce1cffac88c30be0075ced9d39e3288f35572041a1172a12588 tasks/data_persona_aligned_skills_50_0010.yaml
|
| 932 |
7c825463e343c1f07c463fb265309a6ee73fa3c2868230a41072e806a0d386c5 tasks/data_persona_aligned_skills_50_0011/_env_builder_impl.py
|
| 933 |
737637e643d3c9e11ce2de1b00d0d643947020efdc8f217281f67acef6ddfebd tasks/data_persona_aligned_skills_50_0011/env_builder.py
|
| 934 |
-
|
| 935 |
fe955467d70c0c91443b7cbbf1af4652139c58edeee259ae5a0d1a57ff1b1d34 tasks/data_persona_aligned_skills_50_0011.yaml
|
| 936 |
2e4c21330127825cd38bb129db319ad3da984675957158ea76755166b6d69dc6 tasks/data_persona_aligned_skills_50_0012/_env_builder_impl.py
|
| 937 |
e179c7026efddd0374bc6f841d4ba8bf44e809af7feab3e5f8a52db7f64676d1 tasks/data_persona_aligned_skills_50_0012/env_builder.py
|
|
@@ -943,15 +944,15 @@ efbff1fb446a71d149c262bc86542c0b0e81ed3c53b9d87d344d4f47186ceaa3 tasks/data_per
|
|
| 943 |
08b46e279e9768961e7099589b3fabfcd49f9f68f764234ba2426bb4a8c75944 tasks/data_persona_aligned_skills_50_0013.yaml
|
| 944 |
8c94e13b8c2e270164732c96ed73b108dc961da4c6d2c7e02c7b2807935960f9 tasks/data_persona_aligned_skills_50_0014/_env_builder_impl.py
|
| 945 |
c736803229566964a42a2eb17ec13d79bd106447f1a31890cbe22a761df25e65 tasks/data_persona_aligned_skills_50_0014/env_builder.py
|
| 946 |
-
|
| 947 |
4f04eb44f689489ea3a7733917c527d679adad8e11dcab3e1449c016b764b17c tasks/data_persona_aligned_skills_50_0014.yaml
|
| 948 |
354f87b22d9189ad51894259d7ff75bb026d010a72e660584bb326f004082ad8 tasks/data_persona_aligned_skills_50_0015/_env_builder_impl.py
|
| 949 |
aebcca1c91e3c94958570841f26677ce36520b1fe4245cb02bd50f46576a81c2 tasks/data_persona_aligned_skills_50_0015/env_builder.py
|
| 950 |
-
|
| 951 |
7a27461aa88ba0eee05a784d2a47012e839b3e5ec9c5e4f111aaad6ef7b20123 tasks/data_persona_aligned_skills_50_0015.yaml
|
| 952 |
cc779485fe3eb4f49c1e7f813deb9296b8e9d859ae5385dc74dc713b637a458a tasks/data_persona_aligned_skills_50_0016/_env_builder_impl.py
|
| 953 |
c333538022d2e41613ae1bf79dae2917581c5d09a19f38fcb2f20781844b6281 tasks/data_persona_aligned_skills_50_0016/env_builder.py
|
| 954 |
-
|
| 955 |
fe8153cfb7818ca1a90518bbf1d7e87f615e3b7fb57b4c0d1a188c94fb0b800a tasks/data_persona_aligned_skills_50_0016.yaml
|
| 956 |
b9911a24f4c2daacc3607ed812e58abc927d8b3c1b0b32ad82294352141e947e tasks/data_persona_aligned_skills_50_0017/_env_builder_impl.py
|
| 957 |
60f0d4e7033f8216a46abf7cd841b23b2222528c40857630c868a17f58df5fcd tasks/data_persona_aligned_skills_50_0017/env_builder.py
|
|
@@ -959,7 +960,7 @@ b9911a24f4c2daacc3607ed812e58abc927d8b3c1b0b32ad82294352141e947e tasks/data_per
|
|
| 959 |
8326b7b45697e7c849bcf5b52a1aef8efe8c82b7d8be56151b08d4d002a67f31 tasks/data_persona_aligned_skills_50_0017.yaml
|
| 960 |
521c60bbf958efb0e7ea8b38c32d2f617ecad0f09b460cc8313dec307499fb3e tasks/data_persona_aligned_skills_50_0018/_env_builder_impl.py
|
| 961 |
d731a7ec2ab7ccf43db400b90e85646c3342a2a614adcdc225fe8c5cd7bcc50a tasks/data_persona_aligned_skills_50_0018/env_builder.py
|
| 962 |
-
|
| 963 |
e873b6c140b7b534715ca2ceac136fe62591be2cc40503e139d504b9e82b02b0 tasks/data_persona_aligned_skills_50_0018.yaml
|
| 964 |
d9805c03d587b088b94ccccae6560b01fa66433ca2e441276e091887340f4015 tasks/data_persona_aligned_skills_50_0019/_env_builder_impl.py
|
| 965 |
fa6755f08d5e6f0d9d4f35271d7fe03042787656ac4bbbfe3444c505905473f2 tasks/data_persona_aligned_skills_50_0019/env_builder.py
|
|
@@ -971,11 +972,11 @@ ee77c6e74bfd8d74c5cbc89a3b5a3e00bb3ad9df175af90a343689784581400b tasks/data_per
|
|
| 971 |
fabd3cf3944965bb4f516774215504241e9e3db295e73a5ceb4586668d595bba tasks/data_persona_aligned_skills_50_0020.yaml
|
| 972 |
ed9434d766f1a2e81a0daae2cfdb59820535b44e852ef1dec0d051869ae4cf59 tasks/data_persona_aligned_skills_50_0021/_env_builder_impl.py
|
| 973 |
1521cab300a19371492873f2bb15ed83a2782e98109cb5e89d04043820b50694 tasks/data_persona_aligned_skills_50_0021/env_builder.py
|
| 974 |
-
|
| 975 |
87910d80f20fd04a2ef55901b74a011838ecaa511b3bc9366d9e5d1638c09df7 tasks/data_persona_aligned_skills_50_0021.yaml
|
| 976 |
06bd01da0800305da5427aa4d1c130ec5b0760ca8ff82f62ede66efa45069b1f tasks/data_persona_aligned_skills_50_0022/_env_builder_impl.py
|
| 977 |
0e56b3c683effb4992409bc0056e7936c97ec27d7719d414b08175883ab028dd tasks/data_persona_aligned_skills_50_0022/env_builder.py
|
| 978 |
-
|
| 979 |
520535d3f238adc3005c90702a47300ad23b24fb84a2e411ccd2d6340115c6e1 tasks/data_persona_aligned_skills_50_0022.yaml
|
| 980 |
e31d518422ef198098f962ba3ce48bf8249f418a3a32075093fa5b2d75803bed tasks/data_persona_aligned_skills_50_0023/_env_builder_impl.py
|
| 981 |
563dcc2509374b1a44788adfd8d17be421c2a8b77e5b2d6a2a82d4cbf2e29ad2 tasks/data_persona_aligned_skills_50_0023/env_builder.py
|
|
@@ -983,7 +984,7 @@ e31d518422ef198098f962ba3ce48bf8249f418a3a32075093fa5b2d75803bed tasks/data_per
|
|
| 983 |
4bad7c53510de37ff6813ce69fbc12d290c1ad6a3cd4cbfd1d6de0fe3244c626 tasks/data_persona_aligned_skills_50_0023.yaml
|
| 984 |
d35963fd45280725c1571f25d1d08fc82cfe2c7078b7172f235f73afd31d8d02 tasks/data_persona_aligned_skills_50_0024/_env_builder_impl.py
|
| 985 |
8799c3bdfa812fd2986a50ebda72389e9a5aeca523e9f946cc0557afa3d0b36c tasks/data_persona_aligned_skills_50_0024/env_builder.py
|
| 986 |
-
|
| 987 |
052e79a68e27e08178852a47d678a4da24baa9bd3434c20c5247c282bbdd9f1a tasks/data_persona_aligned_skills_50_0024.yaml
|
| 988 |
1efafc6fb51758486d20100fd773c07a991507c921dbb94b0e452be8119faf60 tasks/data_persona_aligned_skills_50_0025/_env_builder_impl.py
|
| 989 |
229064e628c13e26467710700e915658c662c7b346553272384169f31ce90f7e tasks/data_persona_aligned_skills_50_0025/env_builder.py
|
|
@@ -991,7 +992,7 @@ da9aec0b9f02b95f4b4a5e760f62297d9cd18d74efbe40ea33efaf240991c7f0 tasks/data_per
|
|
| 991 |
7737c2b596b3d610b399a9f33a32e46fc4fecf89204ae3e2a64545a764f5afaf tasks/data_persona_aligned_skills_50_0025.yaml
|
| 992 |
3c1bec3f4470b12e5d77dbd90a24ab2a76154e8f9a7830774549252db0ac4cd3 tasks/data_persona_aligned_skills_50_0026/_env_builder_impl.py
|
| 993 |
933416369c3bb58ba3314503c887c6c8f577e6b737f283a4f36ac119913911cb tasks/data_persona_aligned_skills_50_0026/env_builder.py
|
| 994 |
-
|
| 995 |
9c8cdb25f86d02bc56ce53359ecad12fb088425ae74ae4f0cdc4a728d0342457 tasks/data_persona_aligned_skills_50_0026.yaml
|
| 996 |
53176ff4bb81e872166aa77535ea05416588fc365381b1b6fe18921468227d13 tasks/data_persona_aligned_skills_50_0027/_env_builder_impl.py
|
| 997 |
ffa0c07465ab60eadad5fe2bae3013d5df6ea4e0291e72df7ebcef4ce378a0ea tasks/data_persona_aligned_skills_50_0027/env_builder.py
|
|
@@ -1003,7 +1004,7 @@ dd0b12f2830fc643f4f1fb0c4ce5942d9b09ac03645f5d74f933e8fab5c2bf55 tasks/data_per
|
|
| 1003 |
b512a128cdce54330a0f593481fa9c49aeee361ad5fb2c752ff030f187fe3543 tasks/data_persona_aligned_skills_50_0028.yaml
|
| 1004 |
ef11a48e0bff07f41db212d1e056641e6fb84bf7092d4de9f1cb12c89aac963e tasks/data_persona_aligned_skills_50_0029/_env_builder_impl.py
|
| 1005 |
9147038f21e5c68c2f58069a4a80d1f69400ebe6bc7b5c745e122d32461073aa tasks/data_persona_aligned_skills_50_0029/env_builder.py
|
| 1006 |
-
|
| 1007 |
ac86eb2860d2e0d9748d160e6b65a6b63c9df1013b9b983d54f81fdfe859599d tasks/data_persona_aligned_skills_50_0029.yaml
|
| 1008 |
01b4a62c7aa5471bd101e9cff336caab0e205526f20e85068e33281b15caa14f tasks/data_persona_aligned_skills_50_0030/_env_builder_impl.py
|
| 1009 |
ac362980bbf9cfb0af61bdb5ee9e393efd270650ff9c3754bcb1e5c16390b00e tasks/data_persona_aligned_skills_50_0030/env_builder.py
|
|
@@ -1019,23 +1020,23 @@ ea3faae6a1d7e79a2b97cca4b6c3f6803aa99f3f12fec72c97c7370b80df28f1 tasks/data_per
|
|
| 1019 |
c335a6527dd41dc3305842d835c57e1adae5adb7b27c99ab6ca82927d458aad4 tasks/data_persona_aligned_skills_50_0032.yaml
|
| 1020 |
ae6beef9ce164ded168785e5673e9d5ef52d2a58873256107e721f0df07d2d05 tasks/data_persona_aligned_skills_50_0033/_env_builder_impl.py
|
| 1021 |
cf492a14d6ba8cb1389d6553ee3922d1d43d8e632a80f5bba1c49c8cd8841385 tasks/data_persona_aligned_skills_50_0033/env_builder.py
|
| 1022 |
-
|
| 1023 |
feabc1f80335bc3347ec9c98941e726c6d0d9c80c1687471cd078c39679a2b7c tasks/data_persona_aligned_skills_50_0033.yaml
|
| 1024 |
c9894b735720a06bb0437dd724047e679ab9713cf7789cdbdfea17beb19a30b7 tasks/data_persona_aligned_skills_50_0034/_env_builder_impl.py
|
| 1025 |
ee0aa6e61f651e79bb533bc0cd32a830f01efd9c5aada1cbd35ccdc89f74d404 tasks/data_persona_aligned_skills_50_0034/env_builder.py
|
| 1026 |
-
|
| 1027 |
0427163956b3de9af9a5424289a4cce349e5538996f1f01b02bb1679bec12860 tasks/data_persona_aligned_skills_50_0034.yaml
|
| 1028 |
9bb3d0e5a3664de1334501d49ea7259f3cae0acf77bb3214f4d765c4023b96a3 tasks/data_persona_aligned_skills_50_0035/_env_builder_impl.py
|
| 1029 |
85c680d11531ff47dab821ace681e14aaa7f07074c471116af8225a0064a6638 tasks/data_persona_aligned_skills_50_0035/env_builder.py
|
| 1030 |
-
|
| 1031 |
19d53076922ece67067be7cb16488f31d02a81e3e50ba3fa981d18872ae92f71 tasks/data_persona_aligned_skills_50_0035.yaml
|
| 1032 |
0bdad4710b0ac257843288c516f7403c65a06f28981d5faa9e0fda4248e0b014 tasks/data_persona_aligned_skills_50_0036/_env_builder_impl.py
|
| 1033 |
5c00d5a4240ae379b108e153f893be0dc3bc4b07d020fa1f4bdd5d20aaede295 tasks/data_persona_aligned_skills_50_0036/env_builder.py
|
| 1034 |
-
|
| 1035 |
d225a42bfe56bf3c4a3d943ba4fb8e04aa3c2478adb18bb40fe52247a4b0c622 tasks/data_persona_aligned_skills_50_0036.yaml
|
| 1036 |
22aad0a3550173e6745e1cd169614aeaa7e508ea2ceb7c69fc1f6ccd332844d3 tasks/data_persona_aligned_skills_50_0037/_env_builder_impl.py
|
| 1037 |
feb57314ff7674cbb29a97127d8364fd72a2b9b1a6843f95e6365b9d8b532ecd tasks/data_persona_aligned_skills_50_0037/env_builder.py
|
| 1038 |
-
|
| 1039 |
7c9a74cdcc43bcb4d4f75e761a0dc3bb25604680f69533dd63bb4c00271665a2 tasks/data_persona_aligned_skills_50_0037.yaml
|
| 1040 |
01001db221ce59adac2d4ba0c2b97efcd0b0c2488964009f833ae938936fc90f tasks/data_persona_aligned_skills_50_0038/_env_builder_impl.py
|
| 1041 |
45d60213b88dd3693717dd38b83fb533ed6988bb7c24c14815cbfb9ee7543466 tasks/data_persona_aligned_skills_50_0038/env_builder.py
|
|
@@ -1055,7 +1056,7 @@ a0f6aa5f11ba798790b601aa8c49c0a76f4c8ca7e087a7f237aab1a9a7b21e1a tasks/data_per
|
|
| 1055 |
412d23bc38ad9f7aead3bb5f17d2c1637da3fa4193874c72afeb71c62350f67f tasks/data_persona_aligned_skills_50_0041.yaml
|
| 1056 |
140c27a7bb83249c9e2298167294af52b8985628e87b31823c767d96f07c26ea tasks/data_persona_aligned_skills_50_0042/_env_builder_impl.py
|
| 1057 |
ffbb8d53084d7fbc08206f9f75780c81246f5a4e014502fb4c067777068b1a8d tasks/data_persona_aligned_skills_50_0042/env_builder.py
|
| 1058 |
-
|
| 1059 |
d230f00e94bc52eca65dd51512f96c1d6efeae851bb868c9c4d148edfc110190 tasks/data_persona_aligned_skills_50_0042.yaml
|
| 1060 |
c075e9406486d573d4632833c728b4f60d218c14563c163faa6958c8095906a4 tasks/data_persona_aligned_skills_50_0043/_env_builder_impl.py
|
| 1061 |
cbf0a4977e35a0e14fc9312d26992a6c2206ffed2ec7e4d7738b2495f53d0a6d tasks/data_persona_aligned_skills_50_0043/env_builder.py
|
|
@@ -1063,19 +1064,19 @@ a936111f462a68a3be70135a9eb1f53eef7fb6405c6849c66bb4b49a4af8b780 tasks/data_per
|
|
| 1063 |
773bbd1b442826108f6ba98877d759011a295d8353b0b84fb6897dbac748b6f3 tasks/data_persona_aligned_skills_50_0043.yaml
|
| 1064 |
55b89991abffc6b0fd53b2660764cf9724aef3c90e75a00689fbe63c926acb81 tasks/data_persona_aligned_skills_50_0044/_env_builder_impl.py
|
| 1065 |
6a01c6cfbf804d535758152d64ec149c68447a159a97c13ac4ac4ae0ef794e6f tasks/data_persona_aligned_skills_50_0044/env_builder.py
|
| 1066 |
-
|
| 1067 |
72264c7d2c9337565af2dfdf6dd496c153e264715df0ac16724f0aef9b5fce37 tasks/data_persona_aligned_skills_50_0044.yaml
|
| 1068 |
962cc304260ff512b2f2600fae9ca9e139fe6b738f78d5d10ac4faeb79e0d23e tasks/data_persona_aligned_skills_50_0045/_env_builder_impl.py
|
| 1069 |
883b570204c8cf928af8390ec30822fda289c49b03eb0c9c38672bad4627ba6b tasks/data_persona_aligned_skills_50_0045/env_builder.py
|
| 1070 |
-
|
| 1071 |
87831e1000803c11f8aa843c009acb9111b4719565e07f191b35e3a868847dd3 tasks/data_persona_aligned_skills_50_0045.yaml
|
| 1072 |
ca397f3f94e7132c5224262ee863cbe9f04dc5b3c82661e2603dd0c1f8058413 tasks/data_persona_aligned_skills_50_0046/_env_builder_impl.py
|
| 1073 |
c6ccdc8c10e5aea49d7b5c2c2f924121eeb9f11a1953e9b4cf7bcd272128412b tasks/data_persona_aligned_skills_50_0046/env_builder.py
|
| 1074 |
-
|
| 1075 |
65e50bdafa9d8adf5ccd35aaf1570b7b21d3bc5fa81726c3e5090b349486e457 tasks/data_persona_aligned_skills_50_0046.yaml
|
| 1076 |
d00ded6ebc6b3b6d62e6db06af2909d201e355b37cd6f9b730370a9d6cee2419 tasks/data_persona_aligned_skills_50_0047/_env_builder_impl.py
|
| 1077 |
3ba4f6142e9e6719e30e69d4dd39b5335ef5d1a719af6bbf1bd989f5f7f0b7da tasks/data_persona_aligned_skills_50_0047/env_builder.py
|
| 1078 |
-
|
| 1079 |
b22b0d5e24c65817e6c535d395cf20e9641b0b43f78e93a248f3a748cc0a40b8 tasks/data_persona_aligned_skills_50_0047.yaml
|
| 1080 |
bd3211d73e553fb3a9d1c3ffad81baf1b715f6259a8e3d9bd742af362b763fa5 tasks/data_persona_aligned_skills_50_0048/_env_builder_impl.py
|
| 1081 |
a0d75c1bec36c11ab36a64aabef358d67b5f5b37588e2761e330647ea54c1374 tasks/data_persona_aligned_skills_50_0048/env_builder.py
|
|
@@ -1087,7 +1088,7 @@ ed512e153c6654337d55a183c02b8fbfd7965fc5e3e49a0af89fc0673e020d24 tasks/data_per
|
|
| 1087 |
f078c6121ad45719dd02c2e90b1b7abb171665bf20dfac83337a4868743bf04a tasks/data_persona_aligned_skills_50_0049.yaml
|
| 1088 |
1bafc5e8b098ca733508d5dd1a1986da3c60015aa57f2318a6b80a47028a4085 tasks/data_persona_aligned_skills_50_0050/_env_builder_impl.py
|
| 1089 |
30158949469822f94fd21d511b6df006c3767f9130a0425a58750bc3bb856171 tasks/data_persona_aligned_skills_50_0050/env_builder.py
|
| 1090 |
-
|
| 1091 |
bae66782f8c08b21ecba97700782f5ef09dc4b2c805d0705415ae6de41a7ca2d tasks/data_persona_aligned_skills_50_0050.yaml
|
| 1092 |
9e65f31d924406cea0ae3ec57d5a174143672d11733f9480e0acf9d1ce1459fc tasks/prompts/data_persona_aligned_base_50_0001.md
|
| 1093 |
0e92ca66c816d518f672fee4a64b357935c59b12f73c136a44a434d91331bae3 tasks/prompts/data_persona_aligned_base_50_0002.md
|
|
@@ -1389,7 +1390,7 @@ b675f14fb3a5026397130b64cd4e2ba4f7e76fa360e34ad85d5838b981d5ad32 tasks/prompts/
|
|
| 1389 |
318e330f318d95cc36aab3076c495ddcab142476156d939c2038a4378a575aaa tasks/prompts/data_persona_aligned_skills_50_0048.md
|
| 1390 |
93002945e85af62715331c5abbdd6509430ff1ae5ca8428f0ae1ede1f38624bd tasks/prompts/data_persona_aligned_skills_50_0049.md
|
| 1391 |
539d7f3471c7a25cce4874b93d01f7a03cf162fbea98c16182fa8a838107f5f5 tasks/prompts/data_persona_aligned_skills_50_0050.md
|
| 1392 |
-
|
| 1393 |
-
|
| 1394 |
-
|
| 1395 |
-
|
|
|
|
| 10 |
937eaca759b3664669c8aeb3a0705f12d2fa66a1cb40674e425dbb97048064f4 eval_manifests/skills.jsonl
|
| 11 |
2d0a464c28dc1aa380cf5740a7ba9aa76bcc33649e46ea32d8ce12ba6b601027 eval_manifests/skills.task_ids
|
| 12 |
273c0a3d6342edf14abd7ea4f10f9c9179e7982455e8d99be39c0739689d50fa import_manifest.jsonl
|
| 13 |
+
f1324a4ff79b58dc8e3e0d9dc8012627fb820e598284db40022c219dec8d5adf manifest.json
|
| 14 |
12ae83d267551b1e73808354b802a7d0efcc1a3b76453e7b84c9964c4e294503 provenance/eval_manifests/base.jsonl
|
| 15 |
72aeea0c6321b55982263dbd1cbc23ff114768b3cc21b3cfeab7ff70b7e00284 provenance/eval_manifests/base.task_ids
|
| 16 |
cdfe914540244feb618a00470b455aba9622d94761352a174dda05826f79d040 provenance/eval_manifests/hard.jsonl
|
|
|
|
| 28 |
cf3ca3b84a84ca57b8914d4fc3d08e15d04838687ae503baef3206c00888d9ac provenance/selection_summary.json
|
| 29 |
48fdd4735d4a5bae570f6436e1cfcfe10ba5d236c6522da69ec2960b115670a2 provenance/task_manifest.csv
|
| 30 |
46c5f60e5218f57b7dd190fee99eb81ca932e52f3f09b11fbf1b76861fa2ef9a provenance/validation_report.json
|
| 31 |
+
77c36f2054abdaf4ff577ee9dc1e04ab6352ce1761c1720aab69e95125b4a29d provenance/verifier_repair_manifest.jsonl
|
| 32 |
7b9957d6b41f006baa0fb5661a7b84520eaeaf2ca0baba12968c99e6e7039033 selection_manifest.jsonl
|
| 33 |
6b74f75513fad3b4fd1cdebd1e2edc931602987fb6305045f614087f917354c3 skills/data-persona-aligned-skills-50-0001-legacy-raft-parser-skill/SKILL.md
|
| 34 |
96ea388e187a635832d43c3306cb4c9988d57aed2cf144a92244875fb8c98567 skills/data-persona-aligned-skills-50-0001-legacy-raft-parser-skill/legacy_raft_parser_skill.py
|
|
|
|
| 396 |
419c473e36b05d09253cc080d90514eb79e1730c08b20d5c25a28926f4e0e976 tasks/data_persona_aligned_base_50_0026.yaml
|
| 397 |
309fe08d3f1f04be1366ea65740e959b651f91fe55d4bd13da4c41db1d679414 tasks/data_persona_aligned_base_50_0027/_env_builder_impl.py
|
| 398 |
701e904057b4ff9c724910458106eee93f4f7fc03fe7469aeee72abdecaccdfd tasks/data_persona_aligned_base_50_0027/env_builder.py
|
| 399 |
+
d182de48eacc413d96966204d22d3f85d5dbdf6d09d717ceb32db50076b4e2b1 tasks/data_persona_aligned_base_50_0027/verify_workplace.py
|
| 400 |
adf7bda9cf224903ae10b3946e8b5ceddd73f5e6d8647f3b12f0fb1d1b5efd94 tasks/data_persona_aligned_base_50_0027.yaml
|
| 401 |
99e50d5dac2bf083625b694a59f8a0f6788fef363189e9f628af378e2db19e49 tasks/data_persona_aligned_base_50_0028/_env_builder_impl.py
|
| 402 |
30376ea0cf4aee7c2dec63117aa45844e1fa81511e864a4f65b0dee849272660 tasks/data_persona_aligned_base_50_0028/env_builder.py
|
| 403 |
+
1ff86299dbe258b4d5d5a6ef331188d97aeb437ec121db349e5650fbb36ce067 tasks/data_persona_aligned_base_50_0028/verify_workplace.py
|
| 404 |
f836f191afc149f21bd1a50c7babd2eaee3c191ecd24415184456dd0209a6115 tasks/data_persona_aligned_base_50_0028.yaml
|
| 405 |
c1b63bdd52c37439a150793741e470c9ef81c1963175ce5c3b76698704154e21 tasks/data_persona_aligned_base_50_0029/_env_builder_impl.py
|
| 406 |
1cae3b31de8df3ead7017cb31c7cf86f9c80ff05175fa490d7c7488f1966dabd tasks/data_persona_aligned_base_50_0029/env_builder.py
|
|
|
|
| 412 |
94493ce13f1f732cdb9b1ce467de39300de2c4ce52ada5c5213e2c7dd5079003 tasks/data_persona_aligned_base_50_0030.yaml
|
| 413 |
2d38a884e90526b3985d2dfbefc313f7a92b9e490164dbf94fdbd7117202947d tasks/data_persona_aligned_base_50_0031/_env_builder_impl.py
|
| 414 |
962233981532626c1d8ad5a71a3502d076a57e494890127cdfb84172efb11fca tasks/data_persona_aligned_base_50_0031/env_builder.py
|
| 415 |
+
59cef9ed8531a0635ba2306939a54de0684e21ed193e5f52c0c151c475d456fe tasks/data_persona_aligned_base_50_0031/verify_workplace.py
|
| 416 |
a0c6f4af4e68ff04f39239543bd0e9b952818074c5c6827a8be58e2cd7b2edb3 tasks/data_persona_aligned_base_50_0031.yaml
|
| 417 |
a50b6379bd53a7c06a8de7cd843d681def34cbf074a926d8a400ea5450f5aeb2 tasks/data_persona_aligned_base_50_0032/_env_builder_impl.py
|
| 418 |
0d0659c5bd27644758e79b1644369f3af8f4caf6ac7b454f1e308cd87ed98a61 tasks/data_persona_aligned_base_50_0032/env_builder.py
|
|
|
|
| 440 |
e163a7719e34c46c247540197dc4ccb9b4ad22dd6e18dbf676817ef018e06e00 tasks/data_persona_aligned_base_50_0037.yaml
|
| 441 |
0a345ac8c0b22a643e0382c660b34d0bb34f9e9c768eafd84a374a8403ca7763 tasks/data_persona_aligned_base_50_0038/_env_builder_impl.py
|
| 442 |
d307444652d33c8e30fc3d2cbfa33a7be79c5f4c5205d5aad21b6a5d660f62ac tasks/data_persona_aligned_base_50_0038/env_builder.py
|
| 443 |
+
f1d2c832a21b95ed93ded2126e4fed9c1ad7adf8f80597b91ab2297f959c047f tasks/data_persona_aligned_base_50_0038/verify_workplace.py
|
| 444 |
38aae608a4c8247283e4021b8cd3d6185fa1b34f30574b23c7268ffb461a20a9 tasks/data_persona_aligned_base_50_0038.yaml
|
| 445 |
f19c5b30bd5c3a9b832b2d28d05b73994e7563a8581265b337a7ca1bf54d36b5 tasks/data_persona_aligned_base_50_0039/_env_builder_impl.py
|
| 446 |
f9116c57a7886975283b29c060c9989352a11d923624c433b5fb34cae2ef26bf tasks/data_persona_aligned_base_50_0039/env_builder.py
|
| 447 |
+
fe7bcbf69164c68d78ae425711f8af3acb5e37e4e2ccc2b616794ae571b19aaa tasks/data_persona_aligned_base_50_0039/verify_workplace.py
|
| 448 |
e4bb5d21f034ecfea41ce097f7f583ee9e21516288efc529f3122f1833fa7d98 tasks/data_persona_aligned_base_50_0039.yaml
|
| 449 |
5046ee44b9f95c4bf1f48829c6fe39e9cb840fc55f2f424782c844e3c8bddbe7 tasks/data_persona_aligned_base_50_0040/_env_builder_impl.py
|
| 450 |
fef2ef8050e166f29c89bd79ed479d597710754b3c31d00b7e11e4477c8dd9bb tasks/data_persona_aligned_base_50_0040/env_builder.py
|
|
|
|
| 464 |
bd8ff94edccc5a0673c4420fadd0b5b2ed0f97dffe2bc84678220bf7ed914a1e tasks/data_persona_aligned_base_50_0043.yaml
|
| 465 |
250b4807517b0b3bb86ac7d661dab733e27adb4928ca59e3d8e784613014d967 tasks/data_persona_aligned_base_50_0044/_env_builder_impl.py
|
| 466 |
974c8fdcd0dc2873aeb9362c3ef9aec854580103db90148adb7e1002a0c4fa45 tasks/data_persona_aligned_base_50_0044/env_builder.py
|
| 467 |
+
80a91bc78ea39b9d25e77fcfd7457e9dbf60a6cd02ea4fde5ab74a080ecc44bc tasks/data_persona_aligned_base_50_0044/verify_workplace.py
|
| 468 |
91ec50ad850b6f8c5b9dcd6d9d6b697dbd4de208694545a4e4e4c1986d12107c tasks/data_persona_aligned_base_50_0044.yaml
|
| 469 |
22503e360c49920cec2452ecb6ee9781275a8f7757bfb74f98d52b4621b2a8b1 tasks/data_persona_aligned_base_50_0045/_env_builder_impl.py
|
| 470 |
ca3933e0a647e00517baf586b4608e42df835592e854e6ff03710c594f19e0f5 tasks/data_persona_aligned_base_50_0045/env_builder.py
|
|
|
|
| 488 |
33e33f82ff35a6ad6cb1092e5e36b3f5939a8efe3f084955c9086b7508fcb579 tasks/data_persona_aligned_base_50_0049.yaml
|
| 489 |
621b6ad772a34c7de0253650134ff3ffa2965558360f7d3064aecec375da447e tasks/data_persona_aligned_base_50_0050/_env_builder_impl.py
|
| 490 |
db6022647edb92f6923877f378d15eb624578baef866632d74b05166a7cd908b tasks/data_persona_aligned_base_50_0050/env_builder.py
|
| 491 |
+
b6bc15bbdd9dbaa888ebe6358bcff82b42a33d149f05c0f5f365c7373848c15c tasks/data_persona_aligned_base_50_0050/verify_workplace.py
|
| 492 |
39985f7f65d42723fad48a0f4f9485351aeb9d3fdba74d11987c403a5a2a5c30 tasks/data_persona_aligned_base_50_0050.yaml
|
| 493 |
9892213853ca4c0261fd68c4cb4e247eaa0b21430d22b5209ea1cb29b1f4edfc tasks/data_persona_aligned_hard_50_0001/_env_builder_impl.py
|
| 494 |
3e61d1d76042916afa0bd62010e86d59370e0d27c26971e7e9f3905d86b78886 tasks/data_persona_aligned_hard_50_0001/env_builder.py
|
|
|
|
| 500 |
b14d812ae12f36674a7df36748145b7beaa7806f8e15ab0bedfe6a982e8ac1cc tasks/data_persona_aligned_hard_50_0002.yaml
|
| 501 |
3663abd9569ead92bf55f91bc1afa38f9b3cb9983f1878204bf36b10bb755a1e tasks/data_persona_aligned_hard_50_0003/_env_builder_impl.py
|
| 502 |
0565d7f925923ff2026cf8f268ca40a8e3cb64f63d0465121b5d9ba1d8743c8a tasks/data_persona_aligned_hard_50_0003/env_builder.py
|
| 503 |
+
e41fef1b657b2952adc0bdff2f90643d013b1184b94bb6ed362cc4dd54a980ad tasks/data_persona_aligned_hard_50_0003/verify_workplace.py
|
| 504 |
88ff6a2515b4135b23b5f0d99c444f0e7bc6752d16d17ed1c1679b6c55a40906 tasks/data_persona_aligned_hard_50_0003.yaml
|
| 505 |
f4d62cc9d321d62f6a3dd231a882bfc6731bb6cc8ee67be55dbc97c0307ec002 tasks/data_persona_aligned_hard_50_0004/_env_builder_impl.py
|
| 506 |
c3b2349fa5381acac97516862d5853aa61853adbe3dd0f288c5b78fa3005fcb4 tasks/data_persona_aligned_hard_50_0004/env_builder.py
|
|
|
|
| 508 |
8bfdaca55308c27902185f964ebea07c47516010a236af3b7bbea5c65b394133 tasks/data_persona_aligned_hard_50_0004.yaml
|
| 509 |
9377b5cddccdc96cffc589184fadc5dc44828a84a89d023a44ec86bc4478745f tasks/data_persona_aligned_hard_50_0005/_env_builder_impl.py
|
| 510 |
ec61a256c79a4cf56633c6cd1e401203c96ef27ba8686fc8ecae56a2a3225a45 tasks/data_persona_aligned_hard_50_0005/env_builder.py
|
| 511 |
+
087029db7a27a634ae228d64507ddf2372dfd7514f5a81e7db0ec842fca2a91b tasks/data_persona_aligned_hard_50_0005/verify_workplace.py
|
| 512 |
ef459e1e02cb3ed81b88ec63e8e574199b4d0aead843d3627f9d634effa39157 tasks/data_persona_aligned_hard_50_0005.yaml
|
| 513 |
1b8d9ed1662013c6063095a9dee57f4eb45e90e52aaccc23665e686d7d6ee285 tasks/data_persona_aligned_hard_50_0006/_env_builder_impl.py
|
| 514 |
4de8a87722a1a52230c66a4f518b0f2dc71e9dcab64c0d4ce2a5928f3bf408ba tasks/data_persona_aligned_hard_50_0006/env_builder.py
|
|
|
|
| 520 |
93ed4d1565625e3807ab2bd958b08f13eefdff0177fd2a3976191dac1559c5ff tasks/data_persona_aligned_hard_50_0007.yaml
|
| 521 |
26e506a445f77a0753ad8925746c99bdc9504359ba99d6496a7cd39c1303f7e2 tasks/data_persona_aligned_hard_50_0008/_env_builder_impl.py
|
| 522 |
342c106b617b8540cacc25ce925991e51f53b3cf7f8466705867de9aa8813c48 tasks/data_persona_aligned_hard_50_0008/env_builder.py
|
| 523 |
+
de2dc9f4f99fbd57d7296b033e941bad29bcfc4ecf3c2348fe34d9d0df734da4 tasks/data_persona_aligned_hard_50_0008/verify_workplace.py
|
| 524 |
9272346004462fd9b33b9ce938153b90b4c3ba63a20a4b3f4a238e0ae89b8b9b tasks/data_persona_aligned_hard_50_0008.yaml
|
| 525 |
81d367d74e1ab93dc2c40117acf662ee1df3e59d97836a40e7694d919ae85258 tasks/data_persona_aligned_hard_50_0009/_env_builder_impl.py
|
| 526 |
4c89bb7b35cbcede49935ea0a78d6ee5adf3225738523fbfe3d0161328ba05d1 tasks/data_persona_aligned_hard_50_0009/env_builder.py
|
|
|
|
| 528 |
0e7bc5aa1ee8327bd92ac848ac58551cef3542910c1f8816761cf79dc307d456 tasks/data_persona_aligned_hard_50_0009.yaml
|
| 529 |
aaa724cf61cbf07ae648089a1c790880da4969085fa5b6fc1b49b42134a23b66 tasks/data_persona_aligned_hard_50_0010/_env_builder_impl.py
|
| 530 |
a0b86d0d17662a9c17cbd783917140943b55b5b4264df71528558781dfd36ce6 tasks/data_persona_aligned_hard_50_0010/env_builder.py
|
| 531 |
+
87112b13fae9a46aae422580eccbf74f6d97f5dd69c776c3d3b7ddb103b91193 tasks/data_persona_aligned_hard_50_0010/verify_workplace.py
|
| 532 |
c1a09ff9086f6ae5a6150e807b971374dde5d1f90b998701c0b189fb4732b446 tasks/data_persona_aligned_hard_50_0010.yaml
|
| 533 |
06d42d54408f75e93d1b8be591f6bf259037caae86064f98f335992f619d6c3c tasks/data_persona_aligned_hard_50_0011/_env_builder_impl.py
|
| 534 |
316d452fdba8ec3f9f774b94f8a2ea6d898d280b133dff09efa1c6cc55e61cda tasks/data_persona_aligned_hard_50_0011/env_builder.py
|
|
|
|
| 560 |
d04f43e4c15c4c935c9586b61e948637ce13668e1fc131f3ec326193df779e40 tasks/data_persona_aligned_hard_50_0017.yaml
|
| 561 |
17fcd2a10401eb20c0778932a134f08aa739d51566965e4d35ba01be72a0f734 tasks/data_persona_aligned_hard_50_0018/_env_builder_impl.py
|
| 562 |
98944163bb3ed53c6d7850cd088c09f15b9a634c1b03e4b0ccabb73fc7fe07c9 tasks/data_persona_aligned_hard_50_0018/env_builder.py
|
| 563 |
+
8c39a9476c58ff7aedad44f6be1dd9240023924389b72aaa4dca5b0b45aebe7b tasks/data_persona_aligned_hard_50_0018/verify_workplace.py
|
| 564 |
5a374e07aa2bbc2ecd36b7f8706e293b1552920462256a87b4cfbc717d6e12b6 tasks/data_persona_aligned_hard_50_0018.yaml
|
| 565 |
91f2a954bcc89ee384a12b36a45675d6d1af572f8c88d1ca0a534914592bff70 tasks/data_persona_aligned_hard_50_0019/_env_builder_impl.py
|
| 566 |
765b8babb18dc5d8b9c7abc5cf3c8b527c8b3dc0718bc58486e177d68a812f70 tasks/data_persona_aligned_hard_50_0019/env_builder.py
|
|
|
|
| 588 |
6abe823a388bb7d9b4178bfe63c1364714a326172c110b39feaab026ca64665d tasks/data_persona_aligned_hard_50_0024.yaml
|
| 589 |
10e5ab67e724c6eff45567a16296e426583b4a01191c5c9657c4f053ffc9672e tasks/data_persona_aligned_hard_50_0025/_env_builder_impl.py
|
| 590 |
9623bfa7c6debc23c10fd65680189bc336c74820b51edf66d13a3256a345c3f4 tasks/data_persona_aligned_hard_50_0025/env_builder.py
|
| 591 |
+
75819647a143ebed4e408dd4bfe3d32a33d25ed7cd5fc7fffc444c7657f57b07 tasks/data_persona_aligned_hard_50_0025/verify_workplace.py
|
| 592 |
aa6e710116826c1faec4c6db3ade51b804c0ed28f3d1786c25c6c9055ba297cd tasks/data_persona_aligned_hard_50_0025.yaml
|
| 593 |
94dce0fdb078c2c0978b2d755a1ed677f12ad86f1b01eceb4a99bb2f77cbf766 tasks/data_persona_aligned_hard_50_0026/_env_builder_impl.py
|
| 594 |
b5a5760af5aa6213db8ae77365d5a324260fbeb05ac38f6183bed96d2497e3a4 tasks/data_persona_aligned_hard_50_0026/env_builder.py
|
| 595 |
+
412a1bf5111867525e7cb5058fbc43408f5f6002048e5c3e102eab94a64c5c67 tasks/data_persona_aligned_hard_50_0026/verify_workplace.py
|
| 596 |
94d37e64629a0afc19595978c77be604fd0f69e8d021eecebd606f8697e37e44 tasks/data_persona_aligned_hard_50_0026.yaml
|
| 597 |
6d71034b3da4d856404318ae3e8c6964039c746d31568bd001120f9f2ee323d8 tasks/data_persona_aligned_hard_50_0027/_env_builder_impl.py
|
| 598 |
e916a151a5dfc1216d3126e1fdc9d3e49d4ff21dfd0d8e1a69c481b99e652844 tasks/data_persona_aligned_hard_50_0027/env_builder.py
|
|
|
|
| 604 |
e9482f5c8e5e45ac6ce070706b4b16229f5411a3c59c9d266d20dcd4dd40a7bc tasks/data_persona_aligned_hard_50_0028.yaml
|
| 605 |
641130cbb094d46c4f6a6453bf48c4da4223b1c6b2f11378cea254a3d1550cd2 tasks/data_persona_aligned_hard_50_0029/_env_builder_impl.py
|
| 606 |
bedb04030f528ca6141a3a8d98870e6298ece7296c1e9427c6ef24f155292030 tasks/data_persona_aligned_hard_50_0029/env_builder.py
|
| 607 |
+
e11c99d8f991b3b9daa419e47d6379d3af911f321b3dc1173d4b99862f6daa5a tasks/data_persona_aligned_hard_50_0029/verify_workplace.py
|
| 608 |
cb3cf4435c2d8f1b84430fba628f17a187d07500152b6869ef58ba690486596e tasks/data_persona_aligned_hard_50_0029.yaml
|
| 609 |
57ec090bb1439b10bebbe4ba8effc0dd0251169a5c7afe6da44097428359edbc tasks/data_persona_aligned_hard_50_0030/_env_builder_impl.py
|
| 610 |
4c060230b3d775a246e7917095863cff5352ecf49aa0861d6ad5e4b6468337e5 tasks/data_persona_aligned_hard_50_0030/env_builder.py
|
|
|
|
| 612 |
653f70b05c6670ce5a312a40ddf98974ffdbeb079b10a62d5755dc7da3b4b47e tasks/data_persona_aligned_hard_50_0030.yaml
|
| 613 |
8a7abefe1106481b16b296adad117e7c789d97297a674e8b734d8079718d5adc tasks/data_persona_aligned_hard_50_0031/_env_builder_impl.py
|
| 614 |
1208d3209535d6a643c81fe45d9b2b2399e2c32b762ab32319642b12ee9d5040 tasks/data_persona_aligned_hard_50_0031/env_builder.py
|
| 615 |
+
59cef9ed8531a0635ba2306939a54de0684e21ed193e5f52c0c151c475d456fe tasks/data_persona_aligned_hard_50_0031/verify_workplace.py
|
| 616 |
1b61c0f4805f412a3286e128d8307900ac900e769e4e146df828df3f9be32932 tasks/data_persona_aligned_hard_50_0031.yaml
|
| 617 |
72c58b2d69f62db6115a3b44e28dc24b6a8478a8c2a50d78e413fbe588b2338d tasks/data_persona_aligned_hard_50_0032/_env_builder_impl.py
|
| 618 |
462064396cd8a259d88b6dbdc0be51924d3119170343c1871e159d51b9bab1e2 tasks/data_persona_aligned_hard_50_0032/env_builder.py
|
|
|
|
| 644 |
d6f4dac47bcfa65828f04f5b912efe77dda129fc70f4772512092faf7b764db9 tasks/data_persona_aligned_hard_50_0038.yaml
|
| 645 |
cee58c8a384c84e40e1dafdc1dd9bf1b8a8cb45bb405b164856e84d10b164b59 tasks/data_persona_aligned_hard_50_0039/_env_builder_impl.py
|
| 646 |
736d65347297195a85d31a4601ad05f4f2b5798bdc24708655c97b8055c34ab1 tasks/data_persona_aligned_hard_50_0039/env_builder.py
|
| 647 |
+
a9480f599f21eea1eefa0d41213ebc86ceeca17afd0703ac4bfbfff3b312eb52 tasks/data_persona_aligned_hard_50_0039/verify_workplace.py
|
| 648 |
03a305940543100215db9305eea51043bab58f331ff3c821170f90ceabed5f70 tasks/data_persona_aligned_hard_50_0039.yaml
|
| 649 |
cccb54a1d4689bc2d39a5d82f25367675db0b86f9081f6e754b69ce8e6793885 tasks/data_persona_aligned_hard_50_0040/_env_builder_impl.py
|
| 650 |
4aeaecc382f24f28cbb616749ecc37a92c699f6bf79e38a2a46c518a1f20d972 tasks/data_persona_aligned_hard_50_0040/env_builder.py
|
|
|
|
| 652 |
b93dce571e0ac493062d2fad51245f215768a562db36abe2bb8e50ca2b80e3ae tasks/data_persona_aligned_hard_50_0040.yaml
|
| 653 |
368d0e34bf22c88838c5d021770c32be32410d872885d1edab41fa9d627de4da tasks/data_persona_aligned_hard_50_0041/_env_builder_impl.py
|
| 654 |
7cd26a3a972cd04ff8f87382186ef63e0847a35f52c8f96098480dca21e66068 tasks/data_persona_aligned_hard_50_0041/env_builder.py
|
| 655 |
+
255c3f1d5428a6f22e64f3b6fbc5cf570632748982f8baacbfcd215741bcbeb1 tasks/data_persona_aligned_hard_50_0041/verify_workplace.py
|
| 656 |
1eacd7393d74e2a684d26214b52dc96e71f2d5ec202738e725b33c362f42c048 tasks/data_persona_aligned_hard_50_0041.yaml
|
| 657 |
fe55b1d0bfd298402f6a6dc4f979acff5fe3510cde4743ad3a7884f7fdf90bee tasks/data_persona_aligned_hard_50_0042/_env_builder_impl.py
|
| 658 |
5fd181c6b52c2b26963900fcfb2a6636664a56e8adce3e8bf70797cc0b119d47 tasks/data_persona_aligned_hard_50_0042/env_builder.py
|
| 659 |
+
c01bf548db82441bdaf99efc43738cf0bdab4f382e7b593915156e3919799be5 tasks/data_persona_aligned_hard_50_0042/verify_workplace.py
|
| 660 |
c61d5a1a8a457e950266bbe86a5dc1e601baa0c0f63eed573679581b0f6a3ed1 tasks/data_persona_aligned_hard_50_0042.yaml
|
| 661 |
ddd0c64952ad98b7d527bab20b85db3c2f403102ae5fb1e687f2aeab46dfd24b tasks/data_persona_aligned_hard_50_0043/_env_builder_impl.py
|
| 662 |
74c8965b40c3a1d0903a6084542ba7e77fecbc8c4a9cd0b1a91cbe65dcfb7b2a tasks/data_persona_aligned_hard_50_0043/env_builder.py
|
|
|
|
| 664 |
9acfdb19b5742bd89764f244a16d4285f6c534c363cf619743aa7cc77cd2243d tasks/data_persona_aligned_hard_50_0043.yaml
|
| 665 |
cba1af8dcbb9be4e8ce767e2bf32bd4712022eac1a08d45cec3a77cdfcce5db1 tasks/data_persona_aligned_hard_50_0044/_env_builder_impl.py
|
| 666 |
9f2e91e8a8c10182bbad2884c67327bc1d05b0bfcd774167c2b9eb30839dc30c tasks/data_persona_aligned_hard_50_0044/env_builder.py
|
| 667 |
+
abfe8c29f9e0673da311c9dc0c170302c4b2c1e5079b250650d41d4f52ea06fa tasks/data_persona_aligned_hard_50_0044/verify_workplace.py
|
| 668 |
ce6178011783f0c1376190f58110c5d5243259bde9b0335b85b14423b32fe60e tasks/data_persona_aligned_hard_50_0044.yaml
|
| 669 |
2f7c3b1ba5149edfa9f168c3ad807326df9f8edc800c9b39e2a7d8c0cf61ae67 tasks/data_persona_aligned_hard_50_0045/_env_builder_impl.py
|
| 670 |
d182c408e7279f400601c244e2f1c7a71801ee692e981dd0e377321386e4bd49 tasks/data_persona_aligned_hard_50_0045/env_builder.py
|
| 671 |
+
070516b9309bf8ac0ba56bb7816c92b82b6551d131902b1c5b23c58709b1fa24 tasks/data_persona_aligned_hard_50_0045/verify_workplace.py
|
| 672 |
355d9686d9318ca38b287079a45d4a50a714b19e744ec1bcc49517f35c07af68 tasks/data_persona_aligned_hard_50_0045.yaml
|
| 673 |
d31aefed27596025b838d8173ee37ea7878873a4503fe42014cccbd2f60fe200 tasks/data_persona_aligned_hard_50_0046/_env_builder_impl.py
|
| 674 |
9843e2b501ad3be64b7e6489b13804ff5bf44de0755d4780540bde37516e96dc tasks/data_persona_aligned_hard_50_0046/env_builder.py
|
|
|
|
| 684 |
00c24ba621546cb257268342831b204cabb8062991524828b527fcbc886abf62 tasks/data_persona_aligned_hard_50_0048.yaml
|
| 685 |
bb6cc3f6e6c6aa37a8f7befe92c1610110b73cee53fc880c83bf14cae5f787b3 tasks/data_persona_aligned_hard_50_0049/_env_builder_impl.py
|
| 686 |
2d3389cd12b5cac19e2870170bfc7cd0262f8cd7d3992f9fe206933b822767c9 tasks/data_persona_aligned_hard_50_0049/env_builder.py
|
| 687 |
+
48b28e1dcf1fae89659a53c448d47dcd39903bce213e818eddc4f11e5db62a90 tasks/data_persona_aligned_hard_50_0049/verify_workplace.py
|
| 688 |
8c6f40192de673eda70c90d6d49289ab51f85284861eb2a90063c50713ba26eb tasks/data_persona_aligned_hard_50_0049.yaml
|
| 689 |
d131ba8ad15605f073159e5cfa8f59d1f61441775e05ed0b0d3fbaddfe22e956 tasks/data_persona_aligned_hard_50_0050/_env_builder_impl.py
|
| 690 |
962bc6d415f84f358a93f98c58566b35d4583c848105e62385653afc8ca4a050 tasks/data_persona_aligned_hard_50_0050/env_builder.py
|
| 691 |
+
6e60424e15a09625aa2cb915e82eac189a7334d598b6deab00549c5283579de0 tasks/data_persona_aligned_hard_50_0050/verify_workplace.py
|
| 692 |
f246d3283b5505e1dc14898df39dd637dc3f463149c433f47df715f66e462b92 tasks/data_persona_aligned_hard_50_0050.yaml
|
| 693 |
e0870061523156dcf50b3d061b41eb0b55f4f1cd500110c6baa21cc8b6c7d62f tasks/data_persona_aligned_multi_turn_50_0001/_env_builder_impl.py
|
| 694 |
aa5693f630e9cb100b535d7fa4a218b909ab9ae365224b51a708dc2cbf566fff tasks/data_persona_aligned_multi_turn_50_0001/env_builder.py
|
|
|
|
| 796 |
b442abf8cb9ee1102004f826e795e06bad43f06c5d7bde8027e7e9b1d78d90ff tasks/data_persona_aligned_multi_turn_50_0026.yaml
|
| 797 |
c0006cbabe3fdb665f6ec3447b20731e04b54f661d374135ec1a49ac4422f76f tasks/data_persona_aligned_multi_turn_50_0027/_env_builder_impl.py
|
| 798 |
d9c5cfa216c64aab5a0aaa0c743209ecbaaee7b21c208b7be1bfa5187d5c596c tasks/data_persona_aligned_multi_turn_50_0027/env_builder.py
|
| 799 |
+
d182de48eacc413d96966204d22d3f85d5dbdf6d09d717ceb32db50076b4e2b1 tasks/data_persona_aligned_multi_turn_50_0027/verify_workplace.py
|
| 800 |
44311badecf8a14f9922783009223547d2906fe3c36a785555037480e4013d00 tasks/data_persona_aligned_multi_turn_50_0027.yaml
|
| 801 |
060264e3bf2aff0a3968301b7a58b5d22ac0ba2de099fd51c7bd6899399712da tasks/data_persona_aligned_multi_turn_50_0028/_env_builder_impl.py
|
| 802 |
1309ac0d0d1c41bf3c49be4fbebf6498c370653415c3c04582a746e70cc95aa6 tasks/data_persona_aligned_multi_turn_50_0028/env_builder.py
|
| 803 |
+
1ff86299dbe258b4d5d5a6ef331188d97aeb437ec121db349e5650fbb36ce067 tasks/data_persona_aligned_multi_turn_50_0028/verify_workplace.py
|
| 804 |
a3b8b7dbb01682d4e43b260fcf37e0e7667556fa29bba9e07d8544cef22800da tasks/data_persona_aligned_multi_turn_50_0028.yaml
|
| 805 |
195613c7a4246e3cb5b333388a1cc4676097b9eb5ab5bdcba971acca63b3a7c0 tasks/data_persona_aligned_multi_turn_50_0029/_env_builder_impl.py
|
| 806 |
97fc23c9048c1c2831a9101ed991365886af0dea36ba89bf44b69df8c9b0a413 tasks/data_persona_aligned_multi_turn_50_0029/env_builder.py
|
|
|
|
| 812 |
982f6d3ee34b2b08c5fed5b60bb4efa07276e7c672ccec891066334330e9936b tasks/data_persona_aligned_multi_turn_50_0030.yaml
|
| 813 |
18e2d97bb019c59ab18a075164511385e25b922d32de046ff147ba58c4cd42b6 tasks/data_persona_aligned_multi_turn_50_0031/_env_builder_impl.py
|
| 814 |
580eb15a196e6e37cc128e088dfe4ca6c1f17a6f52e42c5b60ce3a583d3f7566 tasks/data_persona_aligned_multi_turn_50_0031/env_builder.py
|
| 815 |
+
59cef9ed8531a0635ba2306939a54de0684e21ed193e5f52c0c151c475d456fe tasks/data_persona_aligned_multi_turn_50_0031/verify_workplace.py
|
| 816 |
00acac9c0ec49309b8c53bb84f43bacb1457a35c26da794dc6d1c7e1d8b3a8b9 tasks/data_persona_aligned_multi_turn_50_0031.yaml
|
| 817 |
4f7e0c6b7d0085f1e41d1b0d8d734a8bb047fd9a27013a1c98ce559c73cfaabc tasks/data_persona_aligned_multi_turn_50_0032/_env_builder_impl.py
|
| 818 |
38bd56ae9faf3307e0c61e4ce5369024f9ad7988c5008c2c23817e582bba4cb2 tasks/data_persona_aligned_multi_turn_50_0032/env_builder.py
|
|
|
|
| 840 |
871eb76552d080398c78a7cec0e4b052d1346a812aa617496e9d28f323771f92 tasks/data_persona_aligned_multi_turn_50_0037.yaml
|
| 841 |
f42b5dc110a6237bf594811fba9bbd1e11c0140b9bf7123d1bc51e980b7ed502 tasks/data_persona_aligned_multi_turn_50_0038/_env_builder_impl.py
|
| 842 |
871c46ddcd3c0cc59161027154f797fce686b2f5a5c18439f2459b97d1f2353d tasks/data_persona_aligned_multi_turn_50_0038/env_builder.py
|
| 843 |
+
f1d2c832a21b95ed93ded2126e4fed9c1ad7adf8f80597b91ab2297f959c047f tasks/data_persona_aligned_multi_turn_50_0038/verify_workplace.py
|
| 844 |
7d959df4fe308e26b221121fd0515965c21baf952e6188329bcd7f154f713b33 tasks/data_persona_aligned_multi_turn_50_0038.yaml
|
| 845 |
a358a8ccc640abf6f5ef8c16e4c92cefd4a4b1d60f893d4a8a8693dc21c43596 tasks/data_persona_aligned_multi_turn_50_0039/_env_builder_impl.py
|
| 846 |
f03b13c0760e04f97ec5afe38099a885868cfd26d8dd4d689e797086abf6eff1 tasks/data_persona_aligned_multi_turn_50_0039/env_builder.py
|
| 847 |
+
f3fef8bbab5eee0bb76fd54789f52c8613172d54b3cde315f4bf6dcb8269db16 tasks/data_persona_aligned_multi_turn_50_0039/verify_workplace.py
|
| 848 |
5fd9a8dfa951f82891bf336194bad07cd698ac839613be821416214abdc45b35 tasks/data_persona_aligned_multi_turn_50_0039.yaml
|
| 849 |
f6702cc7ca4c9a4c7766b3c19a648b0cdfb21684e0cc874e3eeba7d1b814b5cf tasks/data_persona_aligned_multi_turn_50_0040/_env_builder_impl.py
|
| 850 |
40a157919ea9f49fc56c73354ec53675312fdd40a221d32cfaafeee5a4542a6d tasks/data_persona_aligned_multi_turn_50_0040/env_builder.py
|
|
|
|
| 864 |
cfde3128cf17843380a7d244ba6dd2d3113594a8c35bd2a07b73716504a1e237 tasks/data_persona_aligned_multi_turn_50_0043.yaml
|
| 865 |
c7846fb438cb46bafbd8b73427e89cf9ec898258802996231e06a034e80cbc62 tasks/data_persona_aligned_multi_turn_50_0044/_env_builder_impl.py
|
| 866 |
fc215986f1c8e4d29d5474315f49b76e227d5aaf095bc23304bd0345574cf07e tasks/data_persona_aligned_multi_turn_50_0044/env_builder.py
|
| 867 |
+
bd4f268ac51cf356f72ef613186a695dd78392674c433d38ba0dea8f1b3a6387 tasks/data_persona_aligned_multi_turn_50_0044/verify_workplace.py
|
| 868 |
48b45df848822f760f65c743e77f425971c4af190631be7e9a218c5cc83f8f3e tasks/data_persona_aligned_multi_turn_50_0044.yaml
|
| 869 |
3a4e143a8ad078eb251ca69de34ba587c270b7b6651060823cc34afe9d264e4c tasks/data_persona_aligned_multi_turn_50_0045/_env_builder_impl.py
|
| 870 |
0d51165aca6030bd0d8360e05660e6a8cd2b8351cadd0a89054551b9ea0244bc tasks/data_persona_aligned_multi_turn_50_0045/env_builder.py
|
|
|
|
| 888 |
644ddefeb0fbee316e2f60b216062ef146f90b1a67b138051e30b005561bbced tasks/data_persona_aligned_multi_turn_50_0049.yaml
|
| 889 |
b191844585401540c79229e85dcbcb61d3229d50c24f77cf22620e30c3b83ee1 tasks/data_persona_aligned_multi_turn_50_0050/_env_builder_impl.py
|
| 890 |
71d53a790ea3c2a3cd3f2168b934cc8fa3d25acc49dc3831c2ab0a9da1663b1f tasks/data_persona_aligned_multi_turn_50_0050/env_builder.py
|
| 891 |
+
fb4ee89bee4b3766f56f37688b78d49d8c6491e99bab0cb0ce2bbfb4af274f8d tasks/data_persona_aligned_multi_turn_50_0050/verify_workplace.py
|
| 892 |
d4b7b8462bf456d77f9914c931edb42a1f03ca9de288a3caf7a72c2414cfcc2a tasks/data_persona_aligned_multi_turn_50_0050.yaml
|
| 893 |
9ba5001c18264e7492816c699544e57c474ac01319b5199ec419f613dd5d236a tasks/data_persona_aligned_skills_50_0001/_env_builder_impl.py
|
| 894 |
430f0da57468b56d4d7cd5d665c3c4233d8fd9c16ad71c99f2d44a88fc2d5b59 tasks/data_persona_aligned_skills_50_0001/env_builder.py
|
| 895 |
+
0d18b9055e349452dc45fed2d38b0ad9ea4723738988381b60c4383459e344ff tasks/data_persona_aligned_skills_50_0001/verify_workplace.py
|
| 896 |
4af3e9203475eeea4f938b3afc4b9e720008b850b88561dcb8fee7d3bab40bfd tasks/data_persona_aligned_skills_50_0001.yaml
|
| 897 |
fc24bbeda0fdfbc36b8f1af148470a2d5aa53bd49cbcde7bbc69fd3d2e662351 tasks/data_persona_aligned_skills_50_0002/_env_builder_impl.py
|
| 898 |
75a883f3da5b76f3f3dc087ed2af67352131c55627aa8f1bb4bc0bcd4ecedd71 tasks/data_persona_aligned_skills_50_0002/env_builder.py
|
| 899 |
+
052411e890e3277b5ae31abd2f5d3c970b929ebbe3f1e87cf5787db09afbfa27 tasks/data_persona_aligned_skills_50_0002/verify_workplace.py
|
| 900 |
1b0ec155c383fb6e1132bf92c5abaf53349ca5119e232db1a0abc18400936cd0 tasks/data_persona_aligned_skills_50_0002.yaml
|
| 901 |
bfa32aa5d8614b836be8c879484034a8d62dad89e85578450f5adfb2a9ab88f1 tasks/data_persona_aligned_skills_50_0003/_env_builder_impl.py
|
| 902 |
53d248a85bb661a1cc67b1f96fbf9ea638ab2b6556d337f23e5a432f794b62e6 tasks/data_persona_aligned_skills_50_0003/env_builder.py
|
| 903 |
+
e41fef1b657b2952adc0bdff2f90643d013b1184b94bb6ed362cc4dd54a980ad tasks/data_persona_aligned_skills_50_0003/verify_workplace.py
|
| 904 |
885f054d78faf097189ee04b97fe326a7944218babce1175ec330352de7dde24 tasks/data_persona_aligned_skills_50_0003.yaml
|
| 905 |
d104f49cecdae66d6a664bc99627dda16f416a6864b398dc224d76ccffde78ea tasks/data_persona_aligned_skills_50_0004/_env_builder_impl.py
|
| 906 |
0d3147dfb30a7098c44f12446ea2fa2da39af6b68c9d00775b28cb2d9217cd49 tasks/data_persona_aligned_skills_50_0004/env_builder.py
|
|
|
|
| 908 |
2e41276eb8dec0024c82210103919dfc64880d3af4af90a10172a2aeede57072 tasks/data_persona_aligned_skills_50_0004.yaml
|
| 909 |
f0265e16e5276519ba1562ef3c356132b5cd8cbdae845e7c0423c8fdcb80e7b7 tasks/data_persona_aligned_skills_50_0005/_env_builder_impl.py
|
| 910 |
5ea44bc46399d477cc8ca7bc611eed0992cb0ff05fe4cc40e175362389ae41db tasks/data_persona_aligned_skills_50_0005/env_builder.py
|
| 911 |
+
087029db7a27a634ae228d64507ddf2372dfd7514f5a81e7db0ec842fca2a91b tasks/data_persona_aligned_skills_50_0005/verify_workplace.py
|
| 912 |
b63105179c6ed7ee525a902045ac208c3f9a51df503ee9eaf708429bfb4c742b tasks/data_persona_aligned_skills_50_0005.yaml
|
| 913 |
6c24e33be7b534bc2f825b514b962335d5dee4ca6b8329af9da055993bf92072 tasks/data_persona_aligned_skills_50_0006/_env_builder_impl.py
|
| 914 |
344f2bc4bfcc1b8231fe15c7ff2b5a30f343ad02527c6c90f02904f8fd027dab tasks/data_persona_aligned_skills_50_0006/env_builder.py
|
|
|
|
| 932 |
ce5af4d9f8f8cce1cffac88c30be0075ced9d39e3288f35572041a1172a12588 tasks/data_persona_aligned_skills_50_0010.yaml
|
| 933 |
7c825463e343c1f07c463fb265309a6ee73fa3c2868230a41072e806a0d386c5 tasks/data_persona_aligned_skills_50_0011/_env_builder_impl.py
|
| 934 |
737637e643d3c9e11ce2de1b00d0d643947020efdc8f217281f67acef6ddfebd tasks/data_persona_aligned_skills_50_0011/env_builder.py
|
| 935 |
+
a9e5f27a5c24522bdbbe7455479af578efa7961e09117b9f303e2d57bde767a9 tasks/data_persona_aligned_skills_50_0011/verify_workplace.py
|
| 936 |
fe955467d70c0c91443b7cbbf1af4652139c58edeee259ae5a0d1a57ff1b1d34 tasks/data_persona_aligned_skills_50_0011.yaml
|
| 937 |
2e4c21330127825cd38bb129db319ad3da984675957158ea76755166b6d69dc6 tasks/data_persona_aligned_skills_50_0012/_env_builder_impl.py
|
| 938 |
e179c7026efddd0374bc6f841d4ba8bf44e809af7feab3e5f8a52db7f64676d1 tasks/data_persona_aligned_skills_50_0012/env_builder.py
|
|
|
|
| 944 |
08b46e279e9768961e7099589b3fabfcd49f9f68f764234ba2426bb4a8c75944 tasks/data_persona_aligned_skills_50_0013.yaml
|
| 945 |
8c94e13b8c2e270164732c96ed73b108dc961da4c6d2c7e02c7b2807935960f9 tasks/data_persona_aligned_skills_50_0014/_env_builder_impl.py
|
| 946 |
c736803229566964a42a2eb17ec13d79bd106447f1a31890cbe22a761df25e65 tasks/data_persona_aligned_skills_50_0014/env_builder.py
|
| 947 |
+
75985440766202afe1b9fc12d90d0a7fdcec966048b22419e167053ef9517e00 tasks/data_persona_aligned_skills_50_0014/verify_workplace.py
|
| 948 |
4f04eb44f689489ea3a7733917c527d679adad8e11dcab3e1449c016b764b17c tasks/data_persona_aligned_skills_50_0014.yaml
|
| 949 |
354f87b22d9189ad51894259d7ff75bb026d010a72e660584bb326f004082ad8 tasks/data_persona_aligned_skills_50_0015/_env_builder_impl.py
|
| 950 |
aebcca1c91e3c94958570841f26677ce36520b1fe4245cb02bd50f46576a81c2 tasks/data_persona_aligned_skills_50_0015/env_builder.py
|
| 951 |
+
2ec8a8f765aaa869e1dc2ce9a7e1c8c54b30ae15a1875dc350bdee5bafa200cc tasks/data_persona_aligned_skills_50_0015/verify_workplace.py
|
| 952 |
7a27461aa88ba0eee05a784d2a47012e839b3e5ec9c5e4f111aaad6ef7b20123 tasks/data_persona_aligned_skills_50_0015.yaml
|
| 953 |
cc779485fe3eb4f49c1e7f813deb9296b8e9d859ae5385dc74dc713b637a458a tasks/data_persona_aligned_skills_50_0016/_env_builder_impl.py
|
| 954 |
c333538022d2e41613ae1bf79dae2917581c5d09a19f38fcb2f20781844b6281 tasks/data_persona_aligned_skills_50_0016/env_builder.py
|
| 955 |
+
e274e884cae34708d31a9c6224f8979c5881661f16f8bc092d6a4decdef5c07b tasks/data_persona_aligned_skills_50_0016/verify_workplace.py
|
| 956 |
fe8153cfb7818ca1a90518bbf1d7e87f615e3b7fb57b4c0d1a188c94fb0b800a tasks/data_persona_aligned_skills_50_0016.yaml
|
| 957 |
b9911a24f4c2daacc3607ed812e58abc927d8b3c1b0b32ad82294352141e947e tasks/data_persona_aligned_skills_50_0017/_env_builder_impl.py
|
| 958 |
60f0d4e7033f8216a46abf7cd841b23b2222528c40857630c868a17f58df5fcd tasks/data_persona_aligned_skills_50_0017/env_builder.py
|
|
|
|
| 960 |
8326b7b45697e7c849bcf5b52a1aef8efe8c82b7d8be56151b08d4d002a67f31 tasks/data_persona_aligned_skills_50_0017.yaml
|
| 961 |
521c60bbf958efb0e7ea8b38c32d2f617ecad0f09b460cc8313dec307499fb3e tasks/data_persona_aligned_skills_50_0018/_env_builder_impl.py
|
| 962 |
d731a7ec2ab7ccf43db400b90e85646c3342a2a614adcdc225fe8c5cd7bcc50a tasks/data_persona_aligned_skills_50_0018/env_builder.py
|
| 963 |
+
8c39a9476c58ff7aedad44f6be1dd9240023924389b72aaa4dca5b0b45aebe7b tasks/data_persona_aligned_skills_50_0018/verify_workplace.py
|
| 964 |
e873b6c140b7b534715ca2ceac136fe62591be2cc40503e139d504b9e82b02b0 tasks/data_persona_aligned_skills_50_0018.yaml
|
| 965 |
d9805c03d587b088b94ccccae6560b01fa66433ca2e441276e091887340f4015 tasks/data_persona_aligned_skills_50_0019/_env_builder_impl.py
|
| 966 |
fa6755f08d5e6f0d9d4f35271d7fe03042787656ac4bbbfe3444c505905473f2 tasks/data_persona_aligned_skills_50_0019/env_builder.py
|
|
|
|
| 972 |
fabd3cf3944965bb4f516774215504241e9e3db295e73a5ceb4586668d595bba tasks/data_persona_aligned_skills_50_0020.yaml
|
| 973 |
ed9434d766f1a2e81a0daae2cfdb59820535b44e852ef1dec0d051869ae4cf59 tasks/data_persona_aligned_skills_50_0021/_env_builder_impl.py
|
| 974 |
1521cab300a19371492873f2bb15ed83a2782e98109cb5e89d04043820b50694 tasks/data_persona_aligned_skills_50_0021/env_builder.py
|
| 975 |
+
933a5f52e2f3f5ee90c596c292ac5d3353e29a7682b604ab7bb5b377acd3b75b tasks/data_persona_aligned_skills_50_0021/verify_workplace.py
|
| 976 |
87910d80f20fd04a2ef55901b74a011838ecaa511b3bc9366d9e5d1638c09df7 tasks/data_persona_aligned_skills_50_0021.yaml
|
| 977 |
06bd01da0800305da5427aa4d1c130ec5b0760ca8ff82f62ede66efa45069b1f tasks/data_persona_aligned_skills_50_0022/_env_builder_impl.py
|
| 978 |
0e56b3c683effb4992409bc0056e7936c97ec27d7719d414b08175883ab028dd tasks/data_persona_aligned_skills_50_0022/env_builder.py
|
| 979 |
+
a41f64c73b779c1718cdc013fdbababd48d715a07a6cb1f811e9b5aae883d338 tasks/data_persona_aligned_skills_50_0022/verify_workplace.py
|
| 980 |
520535d3f238adc3005c90702a47300ad23b24fb84a2e411ccd2d6340115c6e1 tasks/data_persona_aligned_skills_50_0022.yaml
|
| 981 |
e31d518422ef198098f962ba3ce48bf8249f418a3a32075093fa5b2d75803bed tasks/data_persona_aligned_skills_50_0023/_env_builder_impl.py
|
| 982 |
563dcc2509374b1a44788adfd8d17be421c2a8b77e5b2d6a2a82d4cbf2e29ad2 tasks/data_persona_aligned_skills_50_0023/env_builder.py
|
|
|
|
| 984 |
4bad7c53510de37ff6813ce69fbc12d290c1ad6a3cd4cbfd1d6de0fe3244c626 tasks/data_persona_aligned_skills_50_0023.yaml
|
| 985 |
d35963fd45280725c1571f25d1d08fc82cfe2c7078b7172f235f73afd31d8d02 tasks/data_persona_aligned_skills_50_0024/_env_builder_impl.py
|
| 986 |
8799c3bdfa812fd2986a50ebda72389e9a5aeca523e9f946cc0557afa3d0b36c tasks/data_persona_aligned_skills_50_0024/env_builder.py
|
| 987 |
+
21cc9c6b17a14453efc90a4847a0d6b398aa9af500c90323a47a077da379d719 tasks/data_persona_aligned_skills_50_0024/verify_workplace.py
|
| 988 |
052e79a68e27e08178852a47d678a4da24baa9bd3434c20c5247c282bbdd9f1a tasks/data_persona_aligned_skills_50_0024.yaml
|
| 989 |
1efafc6fb51758486d20100fd773c07a991507c921dbb94b0e452be8119faf60 tasks/data_persona_aligned_skills_50_0025/_env_builder_impl.py
|
| 990 |
229064e628c13e26467710700e915658c662c7b346553272384169f31ce90f7e tasks/data_persona_aligned_skills_50_0025/env_builder.py
|
|
|
|
| 992 |
7737c2b596b3d610b399a9f33a32e46fc4fecf89204ae3e2a64545a764f5afaf tasks/data_persona_aligned_skills_50_0025.yaml
|
| 993 |
3c1bec3f4470b12e5d77dbd90a24ab2a76154e8f9a7830774549252db0ac4cd3 tasks/data_persona_aligned_skills_50_0026/_env_builder_impl.py
|
| 994 |
933416369c3bb58ba3314503c887c6c8f577e6b737f283a4f36ac119913911cb tasks/data_persona_aligned_skills_50_0026/env_builder.py
|
| 995 |
+
8ae56914470cc69765be22fbd88b52d6c5d3543f26c4811d90685d18ee26108e tasks/data_persona_aligned_skills_50_0026/verify_workplace.py
|
| 996 |
9c8cdb25f86d02bc56ce53359ecad12fb088425ae74ae4f0cdc4a728d0342457 tasks/data_persona_aligned_skills_50_0026.yaml
|
| 997 |
53176ff4bb81e872166aa77535ea05416588fc365381b1b6fe18921468227d13 tasks/data_persona_aligned_skills_50_0027/_env_builder_impl.py
|
| 998 |
ffa0c07465ab60eadad5fe2bae3013d5df6ea4e0291e72df7ebcef4ce378a0ea tasks/data_persona_aligned_skills_50_0027/env_builder.py
|
|
|
|
| 1004 |
b512a128cdce54330a0f593481fa9c49aeee361ad5fb2c752ff030f187fe3543 tasks/data_persona_aligned_skills_50_0028.yaml
|
| 1005 |
ef11a48e0bff07f41db212d1e056641e6fb84bf7092d4de9f1cb12c89aac963e tasks/data_persona_aligned_skills_50_0029/_env_builder_impl.py
|
| 1006 |
9147038f21e5c68c2f58069a4a80d1f69400ebe6bc7b5c745e122d32461073aa tasks/data_persona_aligned_skills_50_0029/env_builder.py
|
| 1007 |
+
e11c99d8f991b3b9daa419e47d6379d3af911f321b3dc1173d4b99862f6daa5a tasks/data_persona_aligned_skills_50_0029/verify_workplace.py
|
| 1008 |
ac86eb2860d2e0d9748d160e6b65a6b63c9df1013b9b983d54f81fdfe859599d tasks/data_persona_aligned_skills_50_0029.yaml
|
| 1009 |
01b4a62c7aa5471bd101e9cff336caab0e205526f20e85068e33281b15caa14f tasks/data_persona_aligned_skills_50_0030/_env_builder_impl.py
|
| 1010 |
ac362980bbf9cfb0af61bdb5ee9e393efd270650ff9c3754bcb1e5c16390b00e tasks/data_persona_aligned_skills_50_0030/env_builder.py
|
|
|
|
| 1020 |
c335a6527dd41dc3305842d835c57e1adae5adb7b27c99ab6ca82927d458aad4 tasks/data_persona_aligned_skills_50_0032.yaml
|
| 1021 |
ae6beef9ce164ded168785e5673e9d5ef52d2a58873256107e721f0df07d2d05 tasks/data_persona_aligned_skills_50_0033/_env_builder_impl.py
|
| 1022 |
cf492a14d6ba8cb1389d6553ee3922d1d43d8e632a80f5bba1c49c8cd8841385 tasks/data_persona_aligned_skills_50_0033/env_builder.py
|
| 1023 |
+
521bfcaebb371d477bca2cba883f2d7527ed8e8dbd1d3f8dfb5fa04c86eee3dc tasks/data_persona_aligned_skills_50_0033/verify_workplace.py
|
| 1024 |
feabc1f80335bc3347ec9c98941e726c6d0d9c80c1687471cd078c39679a2b7c tasks/data_persona_aligned_skills_50_0033.yaml
|
| 1025 |
c9894b735720a06bb0437dd724047e679ab9713cf7789cdbdfea17beb19a30b7 tasks/data_persona_aligned_skills_50_0034/_env_builder_impl.py
|
| 1026 |
ee0aa6e61f651e79bb533bc0cd32a830f01efd9c5aada1cbd35ccdc89f74d404 tasks/data_persona_aligned_skills_50_0034/env_builder.py
|
| 1027 |
+
0d200a80fa6a64d3ae9151388f3595103e43a31e800445bf04eb7ce32fc541b9 tasks/data_persona_aligned_skills_50_0034/verify_workplace.py
|
| 1028 |
0427163956b3de9af9a5424289a4cce349e5538996f1f01b02bb1679bec12860 tasks/data_persona_aligned_skills_50_0034.yaml
|
| 1029 |
9bb3d0e5a3664de1334501d49ea7259f3cae0acf77bb3214f4d765c4023b96a3 tasks/data_persona_aligned_skills_50_0035/_env_builder_impl.py
|
| 1030 |
85c680d11531ff47dab821ace681e14aaa7f07074c471116af8225a0064a6638 tasks/data_persona_aligned_skills_50_0035/env_builder.py
|
| 1031 |
+
b7a1ccb588a8a997c4b3821b6f8c1aa34b3e166507e53294c3bc197684f0f695 tasks/data_persona_aligned_skills_50_0035/verify_workplace.py
|
| 1032 |
19d53076922ece67067be7cb16488f31d02a81e3e50ba3fa981d18872ae92f71 tasks/data_persona_aligned_skills_50_0035.yaml
|
| 1033 |
0bdad4710b0ac257843288c516f7403c65a06f28981d5faa9e0fda4248e0b014 tasks/data_persona_aligned_skills_50_0036/_env_builder_impl.py
|
| 1034 |
5c00d5a4240ae379b108e153f893be0dc3bc4b07d020fa1f4bdd5d20aaede295 tasks/data_persona_aligned_skills_50_0036/env_builder.py
|
| 1035 |
+
6f389d1ce610ee2b4f426647ec7000441edff1d8fc40952a994ce88b4fabaf37 tasks/data_persona_aligned_skills_50_0036/verify_workplace.py
|
| 1036 |
d225a42bfe56bf3c4a3d943ba4fb8e04aa3c2478adb18bb40fe52247a4b0c622 tasks/data_persona_aligned_skills_50_0036.yaml
|
| 1037 |
22aad0a3550173e6745e1cd169614aeaa7e508ea2ceb7c69fc1f6ccd332844d3 tasks/data_persona_aligned_skills_50_0037/_env_builder_impl.py
|
| 1038 |
feb57314ff7674cbb29a97127d8364fd72a2b9b1a6843f95e6365b9d8b532ecd tasks/data_persona_aligned_skills_50_0037/env_builder.py
|
| 1039 |
+
a9068ff071983d3dd611b2d5a2acc8617176707412c32a9815caa022b35fb4cc tasks/data_persona_aligned_skills_50_0037/verify_workplace.py
|
| 1040 |
7c9a74cdcc43bcb4d4f75e761a0dc3bb25604680f69533dd63bb4c00271665a2 tasks/data_persona_aligned_skills_50_0037.yaml
|
| 1041 |
01001db221ce59adac2d4ba0c2b97efcd0b0c2488964009f833ae938936fc90f tasks/data_persona_aligned_skills_50_0038/_env_builder_impl.py
|
| 1042 |
45d60213b88dd3693717dd38b83fb533ed6988bb7c24c14815cbfb9ee7543466 tasks/data_persona_aligned_skills_50_0038/env_builder.py
|
|
|
|
| 1056 |
412d23bc38ad9f7aead3bb5f17d2c1637da3fa4193874c72afeb71c62350f67f tasks/data_persona_aligned_skills_50_0041.yaml
|
| 1057 |
140c27a7bb83249c9e2298167294af52b8985628e87b31823c767d96f07c26ea tasks/data_persona_aligned_skills_50_0042/_env_builder_impl.py
|
| 1058 |
ffbb8d53084d7fbc08206f9f75780c81246f5a4e014502fb4c067777068b1a8d tasks/data_persona_aligned_skills_50_0042/env_builder.py
|
| 1059 |
+
c01bf548db82441bdaf99efc43738cf0bdab4f382e7b593915156e3919799be5 tasks/data_persona_aligned_skills_50_0042/verify_workplace.py
|
| 1060 |
d230f00e94bc52eca65dd51512f96c1d6efeae851bb868c9c4d148edfc110190 tasks/data_persona_aligned_skills_50_0042.yaml
|
| 1061 |
c075e9406486d573d4632833c728b4f60d218c14563c163faa6958c8095906a4 tasks/data_persona_aligned_skills_50_0043/_env_builder_impl.py
|
| 1062 |
cbf0a4977e35a0e14fc9312d26992a6c2206ffed2ec7e4d7738b2495f53d0a6d tasks/data_persona_aligned_skills_50_0043/env_builder.py
|
|
|
|
| 1064 |
773bbd1b442826108f6ba98877d759011a295d8353b0b84fb6897dbac748b6f3 tasks/data_persona_aligned_skills_50_0043.yaml
|
| 1065 |
55b89991abffc6b0fd53b2660764cf9724aef3c90e75a00689fbe63c926acb81 tasks/data_persona_aligned_skills_50_0044/_env_builder_impl.py
|
| 1066 |
6a01c6cfbf804d535758152d64ec149c68447a159a97c13ac4ac4ae0ef794e6f tasks/data_persona_aligned_skills_50_0044/env_builder.py
|
| 1067 |
+
ff0ceae8aac73c2d67883c01d112de819f8a401f4ff7d17ac7e5d2a6ea688d27 tasks/data_persona_aligned_skills_50_0044/verify_workplace.py
|
| 1068 |
72264c7d2c9337565af2dfdf6dd496c153e264715df0ac16724f0aef9b5fce37 tasks/data_persona_aligned_skills_50_0044.yaml
|
| 1069 |
962cc304260ff512b2f2600fae9ca9e139fe6b738f78d5d10ac4faeb79e0d23e tasks/data_persona_aligned_skills_50_0045/_env_builder_impl.py
|
| 1070 |
883b570204c8cf928af8390ec30822fda289c49b03eb0c9c38672bad4627ba6b tasks/data_persona_aligned_skills_50_0045/env_builder.py
|
| 1071 |
+
070516b9309bf8ac0ba56bb7816c92b82b6551d131902b1c5b23c58709b1fa24 tasks/data_persona_aligned_skills_50_0045/verify_workplace.py
|
| 1072 |
87831e1000803c11f8aa843c009acb9111b4719565e07f191b35e3a868847dd3 tasks/data_persona_aligned_skills_50_0045.yaml
|
| 1073 |
ca397f3f94e7132c5224262ee863cbe9f04dc5b3c82661e2603dd0c1f8058413 tasks/data_persona_aligned_skills_50_0046/_env_builder_impl.py
|
| 1074 |
c6ccdc8c10e5aea49d7b5c2c2f924121eeb9f11a1953e9b4cf7bcd272128412b tasks/data_persona_aligned_skills_50_0046/env_builder.py
|
| 1075 |
+
375292151b118c6d6760982a7a5ef9b416bab56ac9572b6109bf9a21a0415ea1 tasks/data_persona_aligned_skills_50_0046/verify_workplace.py
|
| 1076 |
65e50bdafa9d8adf5ccd35aaf1570b7b21d3bc5fa81726c3e5090b349486e457 tasks/data_persona_aligned_skills_50_0046.yaml
|
| 1077 |
d00ded6ebc6b3b6d62e6db06af2909d201e355b37cd6f9b730370a9d6cee2419 tasks/data_persona_aligned_skills_50_0047/_env_builder_impl.py
|
| 1078 |
3ba4f6142e9e6719e30e69d4dd39b5335ef5d1a719af6bbf1bd989f5f7f0b7da tasks/data_persona_aligned_skills_50_0047/env_builder.py
|
| 1079 |
+
5e7889cc67c56eb055dbb79c3cd259c2d2ebdcf22c08d5eef48f104d944528f7 tasks/data_persona_aligned_skills_50_0047/verify_workplace.py
|
| 1080 |
b22b0d5e24c65817e6c535d395cf20e9641b0b43f78e93a248f3a748cc0a40b8 tasks/data_persona_aligned_skills_50_0047.yaml
|
| 1081 |
bd3211d73e553fb3a9d1c3ffad81baf1b715f6259a8e3d9bd742af362b763fa5 tasks/data_persona_aligned_skills_50_0048/_env_builder_impl.py
|
| 1082 |
a0d75c1bec36c11ab36a64aabef358d67b5f5b37588e2761e330647ea54c1374 tasks/data_persona_aligned_skills_50_0048/env_builder.py
|
|
|
|
| 1088 |
f078c6121ad45719dd02c2e90b1b7abb171665bf20dfac83337a4868743bf04a tasks/data_persona_aligned_skills_50_0049.yaml
|
| 1089 |
1bafc5e8b098ca733508d5dd1a1986da3c60015aa57f2318a6b80a47028a4085 tasks/data_persona_aligned_skills_50_0050/_env_builder_impl.py
|
| 1090 |
30158949469822f94fd21d511b6df006c3767f9130a0425a58750bc3bb856171 tasks/data_persona_aligned_skills_50_0050/env_builder.py
|
| 1091 |
+
e48125b97264a1181e528a8f4164194c30b8cd0f36ad0ab9b8c66ca726551205 tasks/data_persona_aligned_skills_50_0050/verify_workplace.py
|
| 1092 |
bae66782f8c08b21ecba97700782f5ef09dc4b2c805d0705415ae6de41a7ca2d tasks/data_persona_aligned_skills_50_0050.yaml
|
| 1093 |
9e65f31d924406cea0ae3ec57d5a174143672d11733f9480e0acf9d1ce1459fc tasks/prompts/data_persona_aligned_base_50_0001.md
|
| 1094 |
0e92ca66c816d518f672fee4a64b357935c59b12f73c136a44a434d91331bae3 tasks/prompts/data_persona_aligned_base_50_0002.md
|
|
|
|
| 1390 |
318e330f318d95cc36aab3076c495ddcab142476156d939c2038a4378a575aaa tasks/prompts/data_persona_aligned_skills_50_0048.md
|
| 1391 |
93002945e85af62715331c5abbdd6509430ff1ae5ca8428f0ae1ede1f38624bd tasks/prompts/data_persona_aligned_skills_50_0049.md
|
| 1392 |
539d7f3471c7a25cce4874b93d01f7a03cf162fbea98c16182fa8a838107f5f5 tasks/prompts/data_persona_aligned_skills_50_0050.md
|
| 1393 |
+
e6d659e8f2f5b33f66cb54b50ced3065f1154fbd5ab2f5b75efb4167de655e6e verifiers/base.jsonl
|
| 1394 |
+
4f9d52e44f7195271bd07e7e0e0c5b141fb545046d278f1ad47be7cfbf894a5b verifiers/hard.jsonl
|
| 1395 |
+
98f92fb419e717d04a27e75e024a37ea8d3613331be26700ad6b792bb73188f9 verifiers/multi_turn.jsonl
|
| 1396 |
+
47b27782f0a114d7ff5aea1de765400b277c8ade64a2278b95ce8002dfdf1e6a verifiers/skills.jsonl
|
persona_aligned_mix_200/manifest.json
CHANGED
|
@@ -39,8 +39,8 @@
|
|
| 39 |
}
|
| 40 |
},
|
| 41 |
"files": {
|
| 42 |
-
"count":
|
| 43 |
-
"bytes":
|
| 44 |
"checksums": "checksums.sha256"
|
| 45 |
},
|
| 46 |
"skills": {
|
|
|
|
| 39 |
}
|
| 40 |
},
|
| 41 |
"files": {
|
| 42 |
+
"count": 1397,
|
| 43 |
+
"bytes": 6118979,
|
| 44 |
"checksums": "checksums.sha256"
|
| 45 |
},
|
| 46 |
"skills": {
|
persona_aligned_mix_200/provenance/verifier_repair_manifest.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:77c36f2054abdaf4ff577ee9dc1e04ab6352ce1761c1720aab69e95125b4a29d
|
| 3 |
+
size 32165
|
persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0027/verify_workplace.py
CHANGED
|
@@ -8,7 +8,7 @@ MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
-
# 初始化客户端,
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
@@ -17,6 +17,7 @@ client = OpenAI(
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
|
|
|
| 20 |
try:
|
| 21 |
response = client.chat.completions.create(
|
| 22 |
model=MOCK_MODEL_NAME,
|
|
@@ -31,163 +32,121 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 31 |
print(f"LLM API Error: {e}")
|
| 32 |
return False
|
| 33 |
|
| 34 |
-
def verify():
|
| 35 |
-
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 36 |
-
target_path = os.path.join(workspace, "recovery", "target.json")
|
| 37 |
-
|
| 38 |
-
total_score = 0
|
| 39 |
details = []
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
"max_score": 10,
|
| 47 |
-
"passed": True,
|
| 48 |
-
"reason": "文件 recovery/target.json 存在"
|
| 49 |
-
})
|
| 50 |
total_score += 10
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
|
|
|
| 53 |
try:
|
| 54 |
with open(target_path, "r", encoding="utf-8") as f:
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
if
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
"score":
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
"reason": "识别到了正确的崩溃 Rank ID (1495)"
|
| 89 |
-
})
|
| 90 |
-
total_score += 30
|
| 91 |
-
else:
|
| 92 |
-
details.append({
|
| 93 |
-
"item": "精准验证 rank_id",
|
| 94 |
-
"score": 0,
|
| 95 |
-
"max_score": 30,
|
| 96 |
-
"passed": False,
|
| 97 |
-
"reason": f"Rank ID 提取错误,得到 {data.get('rank_id')},预期为 1495"
|
| 98 |
-
})
|
| 99 |
-
|
| 100 |
-
# 4. 精准校验 coordinates (30分)
|
| 101 |
-
expected_coords = [24, 39, 180, 720]
|
| 102 |
-
if data.get("coordinates") == expected_coords:
|
| 103 |
-
details.append({
|
| 104 |
-
"item": "精准验证 coordinates",
|
| 105 |
-
"score": 30,
|
| 106 |
-
"max_score": 30,
|
| 107 |
-
"passed": True,
|
| 108 |
-
"reason": "准确提取出了溢出变量的多维坐标矩阵"
|
| 109 |
-
})
|
| 110 |
-
total_score += 30
|
| 111 |
-
else:
|
| 112 |
-
details.append({
|
| 113 |
-
"item": "精准验证 coordinates",
|
| 114 |
-
"score": 0,
|
| 115 |
-
"max_score": 30,
|
| 116 |
-
"passed": False,
|
| 117 |
-
"reason": f"溢出坐标提取错误,得到 {data.get('coordinates')},预期为 {expected_coords}"
|
| 118 |
-
})
|
| 119 |
-
|
| 120 |
else:
|
| 121 |
-
details.append({
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
details.append({"item": "精准验证 coordinates", "score": 0, "max_score": 30, "passed": False, "reason": "前置校验失败"})
|
| 135 |
else:
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
pass
|
| 154 |
-
|
| 155 |
-
if all_files_content.strip():
|
| 156 |
-
llm_prompt = (
|
| 157 |
-
"检查以下系统恢复目录的内容提取。任务背景中,暴躁的超算工程师强调:"
|
| 158 |
-
"【别跟我写什么一二三四的分析步骤,也别用教科书式的废话安慰我,我只要准确的 ID 和坐标!】"
|
| 159 |
-
"判断该内容中是否严格遵守了这一原则。如果该内容中包含解释性语句、大段闲聊、多余的分析或Markdown文字废话,请输出 NO。"
|
| 160 |
-
"如果内容里完全是纯净的格式化数据(比如只有干瘪干净的JSON数据),无半句废话,请输出 YES。"
|
| 161 |
-
)
|
| 162 |
-
passed_llm = llm_judge_content(llm_prompt, all_files_content)
|
| 163 |
-
if passed_llm:
|
| 164 |
-
details.append({
|
| 165 |
-
"item": "大模型语义判别:废话排查",
|
| 166 |
-
"score": 10,
|
| 167 |
-
"max_score": 10,
|
| 168 |
-
"passed": True,
|
| 169 |
-
"reason": "大模型判定输出目录干净清爽,没有任何教科书式的废话,高度符合工程师 Persona 要求"
|
| 170 |
-
})
|
| 171 |
-
total_score += 10
|
| 172 |
else:
|
| 173 |
-
details.append({
|
| 174 |
-
|
| 175 |
-
"score": 0,
|
| 176 |
-
"max_score": 10,
|
| 177 |
-
"passed": False,
|
| 178 |
-
"reason": "大模型判定内容包含了冗余的分析过程、说明文或闲聊语句,违背了业务紧急场景的指令"
|
| 179 |
-
})
|
| 180 |
-
else:
|
| 181 |
-
details.append({"item": "��模型语义判别:废话排查", "score": 0, "max_score": 10, "passed": False, "reason": "没有任何文件内容可供大模型评估"})
|
| 182 |
|
| 183 |
-
|
| 184 |
-
result_output = {
|
| 185 |
"total_score": total_score,
|
| 186 |
"details": details
|
| 187 |
}
|
| 188 |
|
| 189 |
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 190 |
-
json.dump(
|
| 191 |
|
| 192 |
if __name__ == "__main__":
|
| 193 |
-
|
|
|
|
|
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
"""用于检测非结构化文本的统一接口"""
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def verify(workspace):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
details = []
|
| 37 |
+
total_score = 0
|
| 38 |
|
| 39 |
+
target_path = os.path.join(workspace, "recovery", "target.json")
|
| 40 |
+
|
| 41 |
+
# 1. 验证结果文件是否存在 (10分)
|
| 42 |
+
if os.path.isfile(target_path):
|
| 43 |
+
details.append({"item": "检查目标文件 target.json 是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件已存在于 recovery 目录中"})
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
total_score += 10
|
| 45 |
+
else:
|
| 46 |
+
details.append({"item": "检查目标文件 target.json 是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 target.json 文件"})
|
| 47 |
|
| 48 |
+
data = None
|
| 49 |
+
if os.path.isfile(target_path):
|
| 50 |
try:
|
| 51 |
with open(target_path, "r", encoding="utf-8") as f:
|
| 52 |
+
data = json.load(f)
|
| 53 |
+
except Exception as e:
|
| 54 |
+
details.append({"item": "检查 JSON 格式合法性", "score": 0, "max_score": 15, "passed": False, "reason": f"文件不是合法的 JSON 格式,解析失败: {e}"})
|
| 55 |
|
| 56 |
+
# 2. 验证 JSON 架构完整性及无多余捏造 (15分)
|
| 57 |
+
if data is not None:
|
| 58 |
+
if not isinstance(data, dict):
|
| 59 |
+
details.append({"item": "检查 JSON 结构体", "score": 0, "max_score": 15, "passed": False, "reason": "JSON 的根节点必须是 Object/字典"})
|
| 60 |
+
else:
|
| 61 |
+
keys = set(data.keys())
|
| 62 |
+
expected_keys = {"rank_id", "coordinates"}
|
| 63 |
+
if keys == expected_keys:
|
| 64 |
+
details.append({"item": "检查 JSON 字段完整且无多余", "score": 15, "max_score": 15, "passed": True, "reason": "包含且仅包含题目要求的 rank_id 和 coordinates"})
|
| 65 |
+
total_score += 15
|
| 66 |
+
elif expected_keys.issubset(keys):
|
| 67 |
+
details.append({"item": "检查 JSON 字段完整且无多余", "score": 5, "max_score": 15, "passed": False, "reason": "包含所需字段,但存在题目未要求的捏造冗余字段,严查作弊或幻觉,轻度扣分"})
|
| 68 |
+
total_score += 5
|
| 69 |
+
else:
|
| 70 |
+
details.append({"item": "检查 JSON 字段完整且无多余", "score": 0, "max_score": 15, "passed": False, "reason": f"缺失核心键值,当前解析到的键: {list(keys)}"})
|
| 71 |
|
| 72 |
+
# 3. 验证 Rank ID (30分)
|
| 73 |
+
if "rank_id" in data:
|
| 74 |
+
rank = data["rank_id"]
|
| 75 |
+
if isinstance(rank, int) and rank == 6682:
|
| 76 |
+
details.append({"item": "核心计算: Rank ID 提取准确性", "score": 30, "max_score": 30, "passed": True, "reason": "精准锁定导致崩溃的 Rank ID (6682),且数据类型为正确的整数"})
|
| 77 |
+
total_score += 30
|
| 78 |
+
elif str(rank) == "6682":
|
| 79 |
+
details.append({"item": "核心计算: Rank ID 提取准确性", "score": 25, "max_score": 30, "passed": False, "reason": "找到正确的 Rank ID (6682),但数据类型写成了字符串,未能严格遵循整数要求"})
|
| 80 |
+
total_score += 25
|
| 81 |
+
else:
|
| 82 |
+
details.append({"item": "核心计算: Rank ID 提取准确性", "score": 0, "max_score": 30, "passed": False, "reason": f"提取的 Rank ID 错误。检测到: {rank}"})
|
| 83 |
+
else:
|
| 84 |
+
details.append({"item": "核心计算: Rank ID 提取准确性", "score": 0, "max_score": 30, "passed": False, "reason": "结果中缺失 rank_id 字段"})
|
| 85 |
|
| 86 |
+
# 4. 验证 Coordinates (35分)
|
| 87 |
+
if "coordinates" in data:
|
| 88 |
+
coords = data["coordinates"]
|
| 89 |
+
expected_coords = [108, 45, 120, 880]
|
| 90 |
+
if isinstance(coords, list) and len(coords) == 4:
|
| 91 |
+
try:
|
| 92 |
+
int_coords = [int(x) for x in coords]
|
| 93 |
+
if int_coords == expected_coords:
|
| 94 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 35, "max_score": 35, "passed": True, "reason": "准确解码并提取出了四维坐标,且严格符合 time, lev, lat, lon 的指定顺序"})
|
| 95 |
+
total_score += 35
|
| 96 |
+
elif set(int_coords) == set(expected_coords):
|
| 97 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 15, "max_score": 35, "passed": False, "reason": "提取的坐标数值本身是对的,但是未按题目要求的 time, lev, lat, lon 顺序排列"})
|
| 98 |
+
total_score += 15
|
| 99 |
+
else:
|
| 100 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 0, "max_score": 35, "passed": False, "reason": f"提取的坐标值错误。预期: {expected_coords}, 实际: {int_coords}"})
|
| 101 |
+
except ValueError:
|
| 102 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 0, "max_score": 35, "passed": False, "reason": "coordinates 数组中包含了无法转为数值的脏数据"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
else:
|
| 104 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 0, "max_score": 35, "passed": False, "reason": "coordinates 必须是长度严格为 4 的数组"})
|
| 105 |
+
else:
|
| 106 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 0, "max_score": 35, "passed": False, "reason": "结果中缺失 coordinates 字段"})
|
| 107 |
+
|
| 108 |
+
# 5. 验证极客作风:指令服从与废话检测 (10分)
|
| 109 |
+
# 题目要求:“少跟我说废话,写代码去捞数据!”
|
| 110 |
+
recovery_dir = os.path.join(workspace, "recovery")
|
| 111 |
+
extra_files = []
|
| 112 |
+
if os.path.isdir(recovery_dir):
|
| 113 |
+
for fname in os.listdir(recovery_dir):
|
| 114 |
+
if fname not in ["README.txt", "target.json"] and os.path.isfile(os.path.join(recovery_dir, fname)):
|
| 115 |
+
extra_files.append(fname)
|
| 116 |
|
| 117 |
+
if not extra_files:
|
| 118 |
+
details.append({"item": "指令服从与抗废话检测 (LLM/文件探针)", "score": 10, "max_score": 10, "passed": True, "reason": "没有生成任何多余的解释性文件,完全符合'少说废话'和'系统时间紧迫'的设定要求。"})
|
| 119 |
+
total_score += 10
|
|
|
|
| 120 |
else:
|
| 121 |
+
# 如果发现了多余的文件,利用大模型判定该文件是否为无用的人类交流废话
|
| 122 |
+
is_chatty = False
|
| 123 |
+
chatty_file = ""
|
| 124 |
+
for fname in extra_files:
|
| 125 |
+
try:
|
| 126 |
+
with open(os.path.join(recovery_dir, fname), "r", encoding="utf-8") as f:
|
| 127 |
+
content = f.read(2000) # 取前 2000 字符检测
|
| 128 |
+
prompt = "Does this file contain conversational filler, greetings, apologetic language, or unnecessary explanations of the task process? (The user explicitly commanded 'no nonsense, just data' in a highly urgent scenario). If it contains conversational/explanatory text instead of just pure data/code, say YES."
|
| 129 |
+
if llm_judge_content(prompt, content):
|
| 130 |
+
is_chatty = True
|
| 131 |
+
chatty_file = fname
|
| 132 |
+
break
|
| 133 |
+
except Exception:
|
| 134 |
+
continue
|
| 135 |
+
|
| 136 |
+
if is_chatty:
|
| 137 |
+
details.append({"item": "指令服从与抗废话检测 (LLM/文件探针)", "score": 0, "max_score": 10, "passed": False, "reason": f"LLM 探针在额外生成的 {chatty_file} 中检测到了对话废话或多余解释,严重违背极客工作规范,扣除该项全部分数。"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
else:
|
| 139 |
+
details.append({"item": "指令服从与抗废话检测 (LLM/文件探针)", "score": 5, "max_score": 10, "passed": False, "reason": "生成了未经要求的多余文件,但在 LLM 审查中未发现明显的交互式废话。因乱建文件扣除一半分数。"})
|
| 140 |
+
total_score += 5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
+
result = {
|
|
|
|
| 143 |
"total_score": total_score,
|
| 144 |
"details": details
|
| 145 |
}
|
| 146 |
|
| 147 |
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 148 |
+
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 149 |
|
| 150 |
if __name__ == "__main__":
|
| 151 |
+
ws = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 152 |
+
verify(ws)
|
persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0028/verify_workplace.py
CHANGED
|
@@ -1,15 +1,14 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
| 4 |
import httpx
|
| 5 |
-
import re
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
| 12 |
-
# 初始化客户端,必须关闭 SSL 验证
|
| 13 |
http_client = httpx.Client(verify=False)
|
| 14 |
client = OpenAI(
|
| 15 |
api_key=MOCK_API_KEY,
|
|
@@ -18,7 +17,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -33,104 +32,237 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
def main():
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 38 |
-
target_file = os.path.join(workspace, "ops_action", "kill_list.json")
|
| 39 |
-
|
| 40 |
total_score = 0
|
| 41 |
details = []
|
| 42 |
|
| 43 |
-
|
| 44 |
file_exists = os.path.exists(target_file)
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 ops_action/kill_list.json 存在"})
|
| 48 |
-
else:
|
| 49 |
-
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件 ops_action/kill_list.json 不存在"})
|
| 50 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 51 |
-
json.dump({"total_score": total_score, "details": details}, f, indent=4, ensure_ascii=False)
|
| 52 |
-
return
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
match = re.search(r"
|
| 70 |
-
```
|
| 71 |
-
|
| 72 |
-
```python
|
| 73 |
-
if match:
|
| 74 |
-
try:
|
| 75 |
-
parsed_list = json.loads(match.group(1))
|
| 76 |
-
except:
|
| 77 |
-
pass
|
| 78 |
-
|
| 79 |
-
if isinstance(parsed_list, list):
|
| 80 |
total_score += 10
|
| 81 |
-
details.append({"item": "格式合法性", "score": 10, "max_score": 10, "passed": True, "reason": "成功通过代码精确解析出 JSON 数组"})
|
| 82 |
-
else:
|
| 83 |
-
details.append({"item": "格式合法性", "score": 0, "max_score": 10, "passed": False, "reason": "文件内容不是合法的 JSON 数组,解析失败"})
|
| 84 |
-
parsed_list = [] # 初始化空数组防止后续逻辑崩溃
|
| 85 |
-
|
| 86 |
-
# 3. 检查是否准确找到僵尸机1 (20分)
|
| 87 |
-
if "i-0abcd1234efgh5678" in parsed_list:
|
| 88 |
-
total_score += 20
|
| 89 |
-
details.append({"item": "命中僵尸实例 1", "score": 20, "max_score": 20, "passed": True, "reason": "成功找出无 CostCenter 标签且无活跃日志的 GPU 实例 i-0abcd1234efgh5678"})
|
| 90 |
else:
|
| 91 |
-
details.append({"item": "
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
total_score +=
|
| 96 |
-
details.append({"item": "命中僵尸实例 2", "score": 20, "max_score": 20, "passed": True, "reason": "成功找出无 CostCenter 标签且无活跃日志的 GPU 实例 i-01112223334445556"})
|
| 97 |
else:
|
| 98 |
-
details.append({"item": "
|
| 99 |
|
| 100 |
-
#
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
else:
|
| 121 |
-
details.append({"item": "
|
|
|
|
| 122 |
|
| 123 |
-
#
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
|
|
|
|
|
|
| 127 |
total_score += 10
|
| 128 |
-
details.append({"item": "大模型内容纯净度验证", "score": 10, "max_score": 10, "passed": True, "reason": "文件内容纯净,无冗余对话,符合脚本自动化挂载的需求"})
|
| 129 |
else:
|
| 130 |
-
details.append({"item": "
|
| 131 |
|
| 132 |
-
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
if __name__ == "__main__":
|
| 136 |
main()
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
+
import yaml
|
| 5 |
import httpx
|
|
|
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
|
|
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
"""大模型统一判别接口,返回布尔值"""
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def compute_ground_truth(workspace):
|
| 36 |
+
"""通过代码重新精确计算沙盒中的Ground Truth"""
|
| 37 |
+
gpu_types = set()
|
| 38 |
+
hw_dir = os.path.join(workspace, "hw_specs")
|
| 39 |
+
|
| 40 |
+
# 1. 解析 hw_specs,提取真正的 GPU Types
|
| 41 |
+
def extract_gpu_types(data):
|
| 42 |
+
if isinstance(data, dict):
|
| 43 |
+
# 兼容多种散乱的JSON/YAML结构
|
| 44 |
+
if data.get("accelerator_type") == "GPU":
|
| 45 |
+
if "type" in data: gpu_types.add(data["type"])
|
| 46 |
+
if "instance_model" in data: gpu_types.add(data["instance_model"])
|
| 47 |
+
if "id" in data: gpu_types.add(data["id"])
|
| 48 |
+
if "specs" in data and isinstance(data["specs"], dict) and data["specs"].get("accelerator_type") == "GPU":
|
| 49 |
+
if "instance_model" in data: gpu_types.add(data["instance_model"])
|
| 50 |
+
for k, v in data.items():
|
| 51 |
+
extract_gpu_types(v)
|
| 52 |
+
elif isinstance(data, list):
|
| 53 |
+
for item in data:
|
| 54 |
+
extract_gpu_types(item)
|
| 55 |
+
|
| 56 |
+
if os.path.exists(hw_dir):
|
| 57 |
+
for root, _, files in os.walk(hw_dir):
|
| 58 |
+
for f in files:
|
| 59 |
+
path = os.path.join(root, f)
|
| 60 |
+
try:
|
| 61 |
+
with open(path, "r", encoding="utf-8") as file:
|
| 62 |
+
if f.endswith(".json"):
|
| 63 |
+
data = json.load(file)
|
| 64 |
+
extract_gpu_types(data)
|
| 65 |
+
elif f.endswith(".yaml") or f.endswith(".yml"):
|
| 66 |
+
data = yaml.safe_load(file)
|
| 67 |
+
extract_gpu_types(data)
|
| 68 |
+
except Exception:
|
| 69 |
+
pass
|
| 70 |
+
|
| 71 |
+
# 2. 解析 infra_dump 找到初步候选僵尸机
|
| 72 |
+
candidates = set()
|
| 73 |
+
dump_dir = os.path.join(workspace, "infra_dump")
|
| 74 |
+
if os.path.exists(dump_dir):
|
| 75 |
+
for root, _, files in os.walk(dump_dir):
|
| 76 |
+
for f in files:
|
| 77 |
+
if f.endswith(".log"):
|
| 78 |
+
path = os.path.join(root, f)
|
| 79 |
+
try:
|
| 80 |
+
with open(path, "r", encoding="utf-8") as file:
|
| 81 |
+
lines = file.readlines()
|
| 82 |
+
if len(lines) < 3: continue
|
| 83 |
+
delim = None
|
| 84 |
+
for line in lines[:3]:
|
| 85 |
+
if line.startswith("# DELIMITER="):
|
| 86 |
+
delim = line.strip().split("=", 1)[1]
|
| 87 |
+
break
|
| 88 |
+
if not delim: continue
|
| 89 |
+
|
| 90 |
+
header = lines[2].strip().replace("# COLUMNS: ", "").split(delim)
|
| 91 |
+
if "INSTANCE_ID" not in header: continue
|
| 92 |
+
id_idx = header.index("INSTANCE_ID")
|
| 93 |
+
type_idx = header.index("INSTANCE_TYPE")
|
| 94 |
+
state_idx = header.index("STATUS")
|
| 95 |
+
tags_idx = header.index("TAGS")
|
| 96 |
+
|
| 97 |
+
for line in lines[3:]:
|
| 98 |
+
line = line.strip()
|
| 99 |
+
if not line: continue
|
| 100 |
+
parts = line.split(delim)
|
| 101 |
+
if len(parts) > max(id_idx, type_idx, state_idx, tags_idx):
|
| 102 |
+
inst_id = parts[id_idx]
|
| 103 |
+
inst_type = parts[type_idx]
|
| 104 |
+
inst_state = parts[state_idx]
|
| 105 |
+
inst_tags = parts[tags_idx]
|
| 106 |
+
|
| 107 |
+
if inst_type in gpu_types and inst_state == "running" and "CostCenter" not in inst_tags:
|
| 108 |
+
candidates.add(inst_id)
|
| 109 |
+
except Exception:
|
| 110 |
+
pass
|
| 111 |
+
|
| 112 |
+
# 3. 解析 audit_trails,通过 readOnly: False 剔除有活动的机器
|
| 113 |
+
active_candidates = set()
|
| 114 |
+
audit_dir = os.path.join(workspace, "audit_trails")
|
| 115 |
+
if os.path.exists(audit_dir):
|
| 116 |
+
for root, _, files in os.walk(audit_dir):
|
| 117 |
+
for f in files:
|
| 118 |
+
if f.endswith(".json"):
|
| 119 |
+
path = os.path.join(root, f)
|
| 120 |
+
try:
|
| 121 |
+
with open(path, "r", encoding="utf-8") as file:
|
| 122 |
+
data = json.load(file)
|
| 123 |
+
records = data.get("Records", [])
|
| 124 |
+
for rec in records:
|
| 125 |
+
if rec.get("readOnly") is False:
|
| 126 |
+
rec_str = json.dumps(rec) # 整体转字符串匹配
|
| 127 |
+
for cid in candidates:
|
| 128 |
+
if cid in rec_str:
|
| 129 |
+
active_candidates.add(cid)
|
| 130 |
+
except Exception:
|
| 131 |
+
pass
|
| 132 |
+
|
| 133 |
+
true_zombies = candidates - active_candidates
|
| 134 |
+
return true_zombies
|
| 135 |
+
|
| 136 |
+
def check_compliance_with_llm(workspace):
|
| 137 |
+
"""利用 LLM 检查 Agent 是否留下了冗余的长篇报告(违背指令)"""
|
| 138 |
+
ops_dir = os.path.join(workspace, "ops_action")
|
| 139 |
+
if not os.path.exists(ops_dir):
|
| 140 |
+
return True, "未找到目标目录"
|
| 141 |
+
|
| 142 |
+
suspicious_files = []
|
| 143 |
+
for f in os.listdir(ops_dir):
|
| 144 |
+
if f not in ["kill_list.json", "README.md"]:
|
| 145 |
+
if f.endswith(".txt") or f.endswith(".md") or f.endswith(".log") or f.endswith(".json"):
|
| 146 |
+
suspicious_files.append(os.path.join(ops_dir, f))
|
| 147 |
+
|
| 148 |
+
# 如果目标文件存在但解析失败(包含废话),也算可疑文件进行文本检测
|
| 149 |
+
target_file = os.path.join(ops_dir, "kill_list.json")
|
| 150 |
+
is_valid_json = False
|
| 151 |
+
if os.path.exists(target_file):
|
| 152 |
+
try:
|
| 153 |
+
with open(target_file, "r") as tf:
|
| 154 |
+
data = json.load(tf)
|
| 155 |
+
if isinstance(data, list):
|
| 156 |
+
is_valid_json = True
|
| 157 |
+
except:
|
| 158 |
+
pass
|
| 159 |
+
if os.path.exists(target_file) and not is_valid_json:
|
| 160 |
+
suspicious_files.append(target_file)
|
| 161 |
+
|
| 162 |
+
if not suspicious_files:
|
| 163 |
+
return True, "未发现任何长篇分析报告或冗余说明。"
|
| 164 |
+
|
| 165 |
+
for sf in suspicious_files:
|
| 166 |
+
try:
|
| 167 |
+
with open(sf, "r", encoding="utf-8") as file:
|
| 168 |
+
content = file.read()[:2000]
|
| 169 |
+
if not content.strip():
|
| 170 |
+
continue
|
| 171 |
+
prompt_text = "The user strictly ordered: 'I do NOT want a long analysis report, I just want a pure JSON array.' Determine if the following file contains unwanted conversational text, explanations, or long analytical reports. Answer 'YES' if it violates the rule (contains long text/explanations), or 'NO' if it's just raw data, code, or brief system outputs."
|
| 172 |
+
is_violation = llm_judge_content(prompt_text, content)
|
| 173 |
+
if is_violation:
|
| 174 |
+
return False, f"检测到在文件 {os.path.basename(sf)} 中存在禁止的长篇对话/分析,违背了指令要求。"
|
| 175 |
+
except Exception:
|
| 176 |
+
pass
|
| 177 |
+
|
| 178 |
+
return True, "无冗余说明,满足纯净输出的要求。"
|
| 179 |
+
|
| 180 |
def main():
|
| 181 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
|
|
|
| 182 |
total_score = 0
|
| 183 |
details = []
|
| 184 |
|
| 185 |
+
target_file = os.path.join(workspace, "ops_action", "kill_list.json")
|
| 186 |
file_exists = os.path.exists(target_file)
|
| 187 |
+
valid_json = False
|
| 188 |
+
submitted_ids = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
+
if file_exists:
|
| 191 |
+
try:
|
| 192 |
+
with open(target_file, "r", encoding="utf-8") as f:
|
| 193 |
+
data = json.load(f)
|
| 194 |
+
if isinstance(data, list):
|
| 195 |
+
submitted_ids = data
|
| 196 |
+
valid_json = True
|
| 197 |
+
except Exception:
|
| 198 |
+
pass
|
| 199 |
|
| 200 |
+
# ==========================
|
| 201 |
+
# 评判项 1 & 2: 目标文件基础校验 (共20分)
|
| 202 |
+
# ==========================
|
| 203 |
+
if file_exists:
|
| 204 |
+
details.append({"item": "kill_list.json 是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "找到了输出文件"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
total_score += 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
else:
|
| 207 |
+
details.append({"item": "kill_list.json 是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件缺失或路径错误"})
|
| 208 |
|
| 209 |
+
if valid_json:
|
| 210 |
+
details.append({"item": "文件格式合法性", "score": 10, "max_score": 10, "passed": True, "reason": "是合法的 JSON Array"})
|
| 211 |
+
total_score += 10
|
|
|
|
| 212 |
else:
|
| 213 |
+
details.append({"item": "文件格式合法性", "score": 0, "max_score": 10, "passed": False, "reason": "无法通过标准库解析为纯净的 JSON Array"})
|
| 214 |
|
| 215 |
+
# ==========================
|
| 216 |
+
# 评判项 3 & 4: 业务精准度与查全率 (共70分)
|
| 217 |
+
# ==========================
|
| 218 |
+
if valid_json:
|
| 219 |
+
true_zombies = compute_ground_truth(workspace)
|
| 220 |
+
|
| 221 |
+
# 3. 误杀检测 (假阳性) - 极严重P0要求 (40分)
|
| 222 |
+
false_positives = [i for i in submitted_ids if i not in true_zombies]
|
| 223 |
+
fp_count = len(false_positives)
|
| 224 |
+
if fp_count == 0:
|
| 225 |
+
score_fp = 40
|
| 226 |
+
details.append({"item": "严禁误杀业务机器", "score": 40, "max_score": 40, "passed": True, "reason": "未发现任何误杀实例"})
|
| 227 |
+
else:
|
| 228 |
+
score_fp = max(0, 40 - fp_count * 10) # 每误杀1台扣10分
|
| 229 |
+
details.append({"item": "严禁误杀业务机器", "score": score_fp, "max_score": 40, "passed": False, "reason": f"发现了 {fp_count} 个误杀的机器实例(例如:{false_positives[0]})"})
|
| 230 |
+
total_score += score_fp
|
| 231 |
+
|
| 232 |
+
# 4. 漏杀检测 (假阴性) - 寻找完整性 (30分)
|
| 233 |
+
true_positives = [i for i in submitted_ids if i in true_zombies]
|
| 234 |
+
tp_count = len(true_positives)
|
| 235 |
+
total_zombies = len(true_zombies)
|
| 236 |
+
if total_zombies > 0:
|
| 237 |
+
score_tp = int((tp_count / total_zombies) * 30)
|
| 238 |
+
else:
|
| 239 |
+
score_tp = 30 # 如果随机环境未生成真正的僵尸机,无漏杀,满分
|
| 240 |
+
|
| 241 |
+
details.append({"item": "找出所有真正的僵尸实例", "score": score_tp, "max_score": 30, "passed": score_tp == 30, "reason": f"精确锁定了 {tp_count}/{total_zombies} 个隐藏的僵尸机"})
|
| 242 |
+
total_score += score_tp
|
| 243 |
else:
|
| 244 |
+
details.append({"item": "严禁误杀业务机器", "score": 0, "max_score": 40, "passed": False, "reason": "未提供有效名单,直接记0分"})
|
| 245 |
+
details.append({"item": "找出所有真正的僵尸实例", "score": 0, "max_score": 30, "passed": False, "reason": "未提供有效名单,直接记0分"})
|
| 246 |
|
| 247 |
+
# ==========================
|
| 248 |
+
# 评判项 5: 非结构化指令遵从 (10分)
|
| 249 |
+
# ==========================
|
| 250 |
+
is_compliant, reason = check_compliance_with_llm(workspace)
|
| 251 |
+
if is_compliant:
|
| 252 |
+
details.append({"item": "无冗长的分析报告 (指令遵从)", "score": 10, "max_score": 10, "passed": True, "reason": reason})
|
| 253 |
total_score += 10
|
|
|
|
| 254 |
else:
|
| 255 |
+
details.append({"item": "无冗长的分析报告 (指令遵从)", "score": 0, "max_score": 10, "passed": False, "reason": reason})
|
| 256 |
|
| 257 |
+
# ==========================
|
| 258 |
+
# 输出成绩
|
| 259 |
+
# ==========================
|
| 260 |
+
score_data = {
|
| 261 |
+
"total_score": total_score,
|
| 262 |
+
"details": details
|
| 263 |
+
}
|
| 264 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 265 |
+
json.dump(score_data, f, ensure_ascii=False, indent=2)
|
| 266 |
|
| 267 |
if __name__ == "__main__":
|
| 268 |
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0031/verify_workplace.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import re
|
| 5 |
import httpx
|
| 6 |
from openai import OpenAI
|
| 7 |
|
|
@@ -9,7 +8,7 @@ MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
| 12 |
-
# 强制关闭 SSL 验证
|
| 13 |
http_client = httpx.Client(verify=False)
|
| 14 |
client = OpenAI(
|
| 15 |
api_key=MOCK_API_KEY,
|
|
@@ -18,7 +17,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
"""大模型
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -33,106 +32,99 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
-
def
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 38 |
-
config_dir = os.path.join(workspace, "config")
|
| 39 |
-
blacklist_file = os.path.join(config_dir, "blacklist.json")
|
| 40 |
-
|
| 41 |
score_details = []
|
| 42 |
total_score = 0
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
total_score += 10
|
| 48 |
-
else:
|
| 49 |
-
score_details.append({"item": "检查 config 目录是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "目录 config 不存在"})
|
| 50 |
-
|
| 51 |
-
# 2. 检查文件 (10分)
|
| 52 |
-
if os.path.exists(blacklist_file) and os.path.isfile(blacklist_file):
|
| 53 |
-
score_details.append({"item": "检查 blacklist.json 是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 blacklist.json 存在"})
|
| 54 |
-
total_score += 10
|
| 55 |
-
|
| 56 |
-
with open(blacklist_file, "r", encoding="utf-8") as f:
|
| 57 |
-
content = f.read().strip()
|
| 58 |
-
|
| 59 |
-
# 3. 解析与格式纯粹度 (20分)
|
| 60 |
-
parsed_data = None
|
| 61 |
-
is_pure_json = True
|
| 62 |
|
| 63 |
try:
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
try:
|
| 72 |
-
parsed_data = json.loads(stripped)
|
| 73 |
-
is_pure_json = False # 触发容错说明格式不纯粹
|
| 74 |
-
except json.JSONDecodeError:
|
| 75 |
-
pass
|
| 76 |
-
|
| 77 |
-
if parsed_data is not None and isinstance(parsed_data, list):
|
| 78 |
-
if is_pure_json:
|
| 79 |
-
score_details.append({"item": "检查文件是否为纯粹合法的 JSON 数组", "score": 20, "max_score": 20, "passed": True, "reason": "文件是原生、无冗余的合法 JSON 列表结构"})
|
| 80 |
-
total_score += 20
|
| 81 |
-
else:
|
| 82 |
-
score_details.append({"item": "检查文件是否为纯粹合法的 JSON 数组", "score": 10, "max_score": 20, "passed": False, "reason": "内容需剥离 Markdown 代码块包装后才能解析为 JSON,格式不纯粹,扣除部分分数"})
|
| 83 |
-
total_score += 10
|
| 84 |
-
else:
|
| 85 |
-
score_details.append({"item": "检查文件是否为纯粹合法的 JSON 数组", "score": 0, "max_score": 20, "passed": False, "reason": "文件无法被解析为 JSON 数组(尝试容错后依然失败,或非列表结构)"})
|
| 86 |
-
|
| 87 |
-
# 4. 数据准确度与无幻觉测试 (50分)
|
| 88 |
-
expected_ips = {"120.44.55.66", "45.33.22.11", "10.0.5.200"}
|
| 89 |
-
if parsed_data is not None and isinstance(parsed_data, list):
|
| 90 |
-
extracted_ips = set(str(item).strip() for item in parsed_data)
|
| 91 |
-
missing_ips = expected_ips - extracted_ips
|
| 92 |
-
extra_ips = extracted_ips - expected_ips
|
| 93 |
-
|
| 94 |
-
content_score = 50
|
| 95 |
-
passed_content = True
|
| 96 |
|
| 97 |
-
if
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
#
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
is_pure_llm = llm_judge_content(prompt_text, content)
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
else:
|
| 123 |
-
score_details.append({"item": "
|
| 124 |
-
else:
|
| 125 |
-
score_details.append({"item": "利用大模型检查文件自然语言污染", "score": 0, "max_score": 10, "passed": False, "reason": "文件内容为空"})
|
| 126 |
|
| 127 |
else:
|
| 128 |
-
score_details.append({"item": "检查
|
| 129 |
-
score_details.append({"item": "
|
| 130 |
-
score_details.append({"item": "检查提取的恶意源 IP 是否精准完整", "score": 0, "max_score": 50, "passed": False, "reason": "文件不存在"})
|
| 131 |
-
score_details.append({"item": "利用大模型检查文件自然语言污染", "score": 0, "max_score": 10, "passed": False, "reason": "文件不存在"})
|
| 132 |
|
| 133 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 135 |
-
json.dump(
|
| 136 |
|
| 137 |
if __name__ == "__main__":
|
| 138 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
+
# 初始化客户端,强制关闭 SSL 验证
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
"""用于处理非结构化破坏情况的备用大模型兜底探针"""
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def verify_workplace():
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
|
|
|
|
|
|
| 37 |
score_details = []
|
| 38 |
total_score = 0
|
| 39 |
+
|
| 40 |
+
blacklist_path = os.path.join(workspace, "config", "blacklist.json")
|
| 41 |
+
|
| 42 |
+
# Target IPS derived from deterministic environment builder
|
| 43 |
+
target_ips = {"120.44.55.66", "45.33.22.11", "10.0.5.200"}
|
| 44 |
+
|
| 45 |
+
if os.path.exists(blacklist_path):
|
| 46 |
+
score_details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 config/blacklist.json 已生成"})
|
| 47 |
total_score += 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
try:
|
| 50 |
+
with open(blacklist_path, 'r', encoding='utf-8') as f:
|
| 51 |
+
content = f.read()
|
| 52 |
+
|
| 53 |
+
# 严格代码解析结构化数据
|
| 54 |
+
data = json.loads(content)
|
| 55 |
+
score_details.append({"item": "检查文件是否符合标准 JSON Schema", "score": 10, "max_score": 10, "passed": True, "reason": "解析器成功加载 JSON"})
|
| 56 |
+
total_score += 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
if isinstance(data, list) and all(isinstance(x, str) for x in data):
|
| 59 |
+
score_details.append({"item": "检查数据结构是否为纯粹的字符串数组", "score": 10, "max_score": 10, "passed": True, "reason": "文件顶层确认为包含字符串的 List,未夹带私货字段"})
|
| 60 |
+
total_score += 10
|
| 61 |
+
|
| 62 |
+
# 去重检查
|
| 63 |
+
extracted_ips = set(data)
|
| 64 |
+
if len(data) == len(extracted_ips) and len(data) > 0:
|
| 65 |
+
score_details.append({"item": "检查数据是否去重", "score": 10, "max_score": 10, "passed": True, "reason": "源 IP 无冗余和重复"})
|
| 66 |
+
total_score += 10
|
| 67 |
+
else:
|
| 68 |
+
score_details.append({"item": "检查数据是否去重", "score": 0, "max_score": 10, "passed": False, "reason": "数组包含重复元素或为空"})
|
| 69 |
+
|
| 70 |
+
# 严密准确度计算(满分 60分)
|
| 71 |
+
correct_count = len(extracted_ips.intersection(target_ips))
|
| 72 |
+
wrong_count = len(extracted_ips - target_ips)
|
| 73 |
+
|
| 74 |
+
accuracy_score = correct_count * 20 # 找到一个给 20 分
|
| 75 |
+
accuracy_score -= wrong_count * 15 # 抓错一个幻觉扣 15 分
|
| 76 |
|
| 77 |
+
if extracted_ips == target_ips:
|
| 78 |
+
accuracy_score = 60
|
| 79 |
+
else:
|
| 80 |
+
accuracy_score = max(0, min(accuracy_score, 59))
|
| 81 |
|
| 82 |
+
if accuracy_score == 60:
|
| 83 |
+
score_details.append({"item": "源 IP 提取准确度评估", "score": 60, "max_score": 60, "passed": True, "reason": "极其精准!捕获了全部 3 个 MALFORMED 源 IP,且没有任何干扰项或幻觉"})
|
| 84 |
+
elif accuracy_score > 0:
|
| 85 |
+
score_details.append({"item": "源 IP 提取准确度评估", "score": accuracy_score, "max_score": 60, "passed": False, "reason": f"提取了部分准确数据({correct_count} 命中),但遗漏或掺杂了非攻击 IP 幻觉({wrong_count} 错误)"})
|
| 86 |
+
else:
|
| 87 |
+
score_details.append({"item": "源 IP 提取准确度评估", "score": 0, "max_score": 60, "passed": False, "reason": "未能提取有效恶意 IP,或幻觉伪造内容过多导致准确度清零"})
|
| 88 |
+
|
| 89 |
+
total_score += accuracy_score
|
| 90 |
+
|
| 91 |
+
else:
|
| 92 |
+
score_details.append({"item": "检查数据结构是否为纯粹的字符串数组", "score": 0, "max_score": 10, "passed": False, "reason": "JSON 内部结构并非单纯的字符串数组"})
|
| 93 |
+
|
| 94 |
+
# LLM 非结构化数据挽回机制
|
| 95 |
+
prompt = "Does the following text contain ALL three of these specific IP addresses: '120.44.55.66', '45.33.22.11', '10.0.5.200'?"
|
| 96 |
+
if llm_judge_content(prompt, content):
|
| 97 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 30, "max_score": 70, "passed": False, "reason": "Agent 输出了非合规的 JSON 结构被代码解析器拦截,但 LLM 判定其内部包含了全部目标恶意 IP,发放部分容错辛苦分"})
|
| 98 |
+
total_score += 30
|
| 99 |
+
else:
|
| 100 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 0, "max_score": 70, "passed": False, "reason": "格式错误,且未能正确分析出全部的恶意源 IP"})
|
| 101 |
|
| 102 |
+
except json.JSONDecodeError:
|
| 103 |
+
score_details.append({"item": "检查文件是否符合标准 JSON Schema", "score": 0, "max_score": 10, "passed": False, "reason": "原生解析失败,文件可能包含解释性前缀、Markdown 块或其他非 JSON 格式废话"})
|
| 104 |
+
score_details.append({"item": "检查数据结构是否为纯粹的字符串数组", "score": 0, "max_score": 10, "passed": False, "reason": "前置条件失败"})
|
|
|
|
| 105 |
|
| 106 |
+
# LLM 非结构化数据挽回机制
|
| 107 |
+
with open(blacklist_path, 'r', encoding='utf-8') as f:
|
| 108 |
+
content = f.read()
|
| 109 |
+
prompt = "Does the following text contain ALL three of these specific IP addresses: '120.44.55.66', '45.33.22.11', '10.0.5.200'?"
|
| 110 |
+
if llm_judge_content(prompt, content):
|
| 111 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 30, "max_score": 70, "passed": False, "reason": "文件彻底损坏,但大模型判定其中散落了所有的目标源 IP,发放部分容错辛苦分"})
|
| 112 |
+
total_score += 30
|
| 113 |
else:
|
| 114 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 0, "max_score": 70, "passed": False, "reason": "文件彻底损坏,且错失了目标恶意源 IP"})
|
|
|
|
|
|
|
| 115 |
|
| 116 |
else:
|
| 117 |
+
score_details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": f"关键交付物 {blacklist_path} 缺失"})
|
| 118 |
+
score_details.append({"item": "结构与精准度验证", "score": 0, "max_score": 90, "passed": False, "reason": "基础文件丢失,取消剩余考核链条"})
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
# 结果强制写回
|
| 121 |
+
result = {
|
| 122 |
+
"total_score": total_score,
|
| 123 |
+
"details": score_details
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 127 |
+
json.dump(result, f, ensure_ascii=False, indent=2)
|
| 128 |
|
| 129 |
if __name__ == "__main__":
|
| 130 |
+
verify_workplace()
|
persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0038/verify_workplace.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
|
|
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
@@ -32,99 +33,168 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
-
def
|
| 36 |
-
"""移除可能的 Markdown 语法以便严格解析"""
|
| 37 |
-
s = s.strip()
|
| 38 |
-
if s.startswith("
|
| 39 |
-
```
|
| 40 |
-
|
| 41 |
-
```python
|
| 42 |
-
return "\n".join(lines[1:-1]).strip()
|
| 43 |
-
return s
|
| 44 |
-
|
| 45 |
-
def write_score(total_score, details):
|
| 46 |
-
res = {
|
| 47 |
-
"total_score": total_score,
|
| 48 |
-
"details": details
|
| 49 |
-
}
|
| 50 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 51 |
-
json.dump(res, f, indent=2, ensure_ascii=False)
|
| 52 |
-
|
| 53 |
-
def main():
|
| 54 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 55 |
-
report_file = os.path.join(workspace, "reports", "violation_root.json")
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
total_score = 0
|
| 58 |
details = []
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
else:
|
| 65 |
-
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score":
|
| 66 |
-
|
|
|
|
| 67 |
return
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
| 74 |
try:
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
details.append({"item": "解析并校验 JSON 格式", "score": 0, "max_score": 20, "passed": False, "reason": "文件不是合法的 JSON 格式,无法被严格解析"})
|
| 80 |
-
write_score(total_score, details)
|
| 81 |
-
return
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
"Check if this JSON contains verbose analysis, detailed reasoning, or long descriptive text violating the instruction 'no long analysis, just exact data'. If it contains extra long analysis, return YES. If the extra keys are just simple metadata, return NO.",
|
| 92 |
-
cleaned_content
|
| 93 |
-
)
|
| 94 |
-
if is_verbose:
|
| 95 |
-
details.append({"item": "检查多余内容(防废话)", "score": 0, "max_score": 10, "passed": False, "reason": "找到了核心键,但通过大模型判定包含了违反设定的长篇大论字段,本项被扣分"})
|
| 96 |
else:
|
| 97 |
-
|
| 98 |
-
|
|
|
|
| 99 |
else:
|
| 100 |
-
|
| 101 |
-
details.append({"item": "检查多余内容(防废话)", "score": 10, "max_score": 10, "passed": True, "reason": "严格遵守要求,JSON 仅包含预期的核心键 module_instance 和 timestamp_ps"})
|
| 102 |
else:
|
| 103 |
-
details.append({"item": "
|
| 104 |
-
# 无法继续验证具体值
|
| 105 |
-
write_score(total_score, details)
|
| 106 |
-
return
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
else:
|
| 115 |
-
details.append({"item": "时间戳
|
| 116 |
-
except (ValueError, TypeError):
|
| 117 |
-
details.append({"item": "时间戳数值的精准匹配", "score": 0, "max_score": 25, "passed": False, "reason": "timestamp_ps ��值不是有效的整数格式"})
|
| 118 |
-
|
| 119 |
-
# 5. 精确校验底层模块实例全路径 (25分)
|
| 120 |
-
mod_val = str(data["module_instance"]).strip()
|
| 121 |
-
if mod_val == "sys_top.bus_matrix.u_axi_interconnect_m0":
|
| 122 |
-
total_score += 25
|
| 123 |
-
details.append({"item": "底层实例路径的精准匹配", "score": 25, "max_score": 25, "passed": True, "reason": "成功通过混淆的 db 文件溯源到了完全准确的实例路径"})
|
| 124 |
else:
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
if __name__ == "__main__":
|
| 130 |
-
|
|
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
| 5 |
+
import re
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
+
def verify():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
| 38 |
|
| 39 |
+
# ---------------- 1. 由探针在环境中实时结算出绝对的 Ground Truth ----------------
|
| 40 |
+
target_signal = "axi_awaddr_m7"
|
| 41 |
+
target_hash = ""
|
| 42 |
+
build_info_path = os.path.join(workspace, "logs", "build_info.txt")
|
| 43 |
+
if os.path.exists(build_info_path):
|
| 44 |
+
with open(build_info_path, "r", encoding="utf-8") as f:
|
| 45 |
+
content = f.read()
|
| 46 |
+
match = re.search(r"DB_HASH:\s*([a-zA-Z0-9]+)", content)
|
| 47 |
+
if match:
|
| 48 |
+
target_hash = match.group(1)
|
| 49 |
+
|
| 50 |
+
target_module = ""
|
| 51 |
+
deprecated_modules = []
|
| 52 |
+
db_dir = os.path.join(workspace, "hw_design", "db_backups")
|
| 53 |
+
if os.path.exists(db_dir):
|
| 54 |
+
for fname in os.listdir(db_dir):
|
| 55 |
+
if fname.endswith(".db"):
|
| 56 |
+
fpath = os.path.join(db_dir, fname)
|
| 57 |
+
with open(fpath, "r", encoding="utf-8") as f:
|
| 58 |
+
text = f.read()
|
| 59 |
+
# 匹配出目标信号所在的物理连线路径
|
| 60 |
+
match_mod = re.search(r"//\s*(.*?)\s*\\\\.*?" + target_signal, text)
|
| 61 |
+
if match_mod:
|
| 62 |
+
mod = match_mod.group(1).strip()
|
| 63 |
+
if f"DB_HASH: {target_hash}" in text:
|
| 64 |
+
target_module = mod
|
| 65 |
+
else:
|
| 66 |
+
deprecated_modules.append(mod)
|
| 67 |
+
|
| 68 |
+
target_time = float('inf')
|
| 69 |
+
wave_dir = os.path.join(workspace, "sim_output", "wave_dumps")
|
| 70 |
+
if os.path.exists(wave_dir):
|
| 71 |
+
for fname in os.listdir(wave_dir):
|
| 72 |
+
if fname.endswith(".trace"):
|
| 73 |
+
fpath = os.path.join(wave_dir, fname)
|
| 74 |
+
with open(fpath, "r", encoding="utf-8") as f:
|
| 75 |
+
current_time = None
|
| 76 |
+
for line in f:
|
| 77 |
+
line = line.strip()
|
| 78 |
+
if line.startswith("@["):
|
| 79 |
+
time_str = line.strip("@[ ]")
|
| 80 |
+
try:
|
| 81 |
+
current_time = int(time_str)
|
| 82 |
+
except:
|
| 83 |
+
pass
|
| 84 |
+
elif target_signal in line and "X" in line:
|
| 85 |
+
# 收集乱序波形中最源头的 X 态污染时间
|
| 86 |
+
if current_time is not None and current_time < target_time:
|
| 87 |
+
target_time = current_time
|
| 88 |
+
|
| 89 |
+
# ---------------- 2. 对 Agent 的产出实施分级侦测 ----------------
|
| 90 |
total_score = 0
|
| 91 |
details = []
|
| 92 |
|
| 93 |
+
report_path = os.path.join(workspace, "reports", "violation_root.json")
|
| 94 |
+
file_exists = os.path.exists(report_path)
|
| 95 |
+
|
| 96 |
+
# Item 1: 基础存在性探针
|
| 97 |
+
if file_exists:
|
| 98 |
+
score_1 = 10
|
| 99 |
+
total_score += score_1
|
| 100 |
+
details.append({"item": "检查目标结果文件是否存在", "score": score_1, "max_score": 10, "passed": True, "reason": "文件 reports/violation_root.json 已生成"})
|
| 101 |
else:
|
| 102 |
+
details.append({"item": "检查目标结果文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 reports/violation_root.json 报告"})
|
| 103 |
+
with open("workplace_score.json", "w") as f:
|
| 104 |
+
json.dump({"total_score": 0, "details": details}, f, indent=2, ensure_ascii=False)
|
| 105 |
return
|
| 106 |
|
| 107 |
+
with open(report_path, "r", encoding="utf-8") as f:
|
| 108 |
+
file_content = f.read()
|
| 109 |
+
|
| 110 |
+
# Item 2: JSON 解析与规范探针
|
| 111 |
+
is_json = False
|
| 112 |
+
json_data = {}
|
| 113 |
+
score_2 = 0
|
| 114 |
try:
|
| 115 |
+
json_data = json.loads(file_content)
|
| 116 |
+
is_json = True
|
| 117 |
+
except:
|
| 118 |
+
pass
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
extra_keys = set()
|
| 121 |
+
if is_json:
|
| 122 |
+
if isinstance(json_data, dict):
|
| 123 |
+
actual_keys = set(json_data.keys())
|
| 124 |
+
expected_keys = {"module_instance", "timestamp_ps"}
|
| 125 |
+
if actual_keys == expected_keys:
|
| 126 |
+
score_2 = 20
|
| 127 |
+
details.append({"item": "检查 JSON 格式规范度", "score": score_2, "max_score": 20, "passed": True, "reason": "JSON 结构纯净,严格包含指定两项键值"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
else:
|
| 129 |
+
score_2 = 10
|
| 130 |
+
extra_keys = actual_keys - expected_keys
|
| 131 |
+
details.append({"item": "检查 JSON 格式规范度", "score": score_2, "max_score": 20, "passed": False, "reason": "JSON 有效但违规包含冗余/缺失字段"})
|
| 132 |
else:
|
| 133 |
+
details.append({"item": "检查 JSON 格式规范度", "score": 0, "max_score": 20, "passed": False, "reason": "JSON 载体类型并非对象(Dict)"})
|
|
|
|
| 134 |
else:
|
| 135 |
+
details.append({"item": "检查 JSON 格式规范度", "score": 0, "max_score": 20, "passed": False, "reason": "原生 json.loads 解析失败,文本不纯净"})
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
+
total_score += score_2
|
| 138 |
+
|
| 139 |
+
# Item 3: 发源时间戳数值精准度核查
|
| 140 |
+
score_3 = 0
|
| 141 |
+
if is_json and isinstance(json_data, dict) and "timestamp_ps" in json_data:
|
| 142 |
+
val = json_data.get("timestamp_ps")
|
| 143 |
+
if isinstance(val, (int, float)) and val == target_time:
|
| 144 |
+
score_3 = 35
|
| 145 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": score_3, "max_score": 35, "passed": True, "reason": "精准找出乱序碎片中的首发源时间戳"})
|
| 146 |
+
elif isinstance(val, (int, float)) and val > target_time:
|
| 147 |
+
score_3 = 10
|
| 148 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": score_3, "max_score": 35, "passed": False, "reason": "提取到已被级联污染的迟到状态时间,未遍历求取最小值"})
|
| 149 |
else:
|
| 150 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": 0, "max_score": 35, "passed": False, "reason": f"提供的时间戳数据完全错误"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
else:
|
| 152 |
+
# LLM 宽容兜底策略 (应对格式扣分后的数值补救)
|
| 153 |
+
prompt = f"The exact FIRST injected unknown state timestamp is {target_time} ps. Does the user file clearly state that the timestamp is EXACTLY {target_time}?"
|
| 154 |
+
if llm_judge_content(prompt, file_content):
|
| 155 |
+
score_3 = 20
|
| 156 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": score_3, "max_score": 35, "passed": True, "reason": "【LLM兜底生效】非合法JSON但也正确传达了源头时间戳数据,予以部分分数挽回"})
|
| 157 |
+
else:
|
| 158 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": 0, "max_score": 35, "passed": False, "reason": "无法获取有效的时间戳信息"})
|
| 159 |
+
|
| 160 |
+
total_score += score_3
|
| 161 |
|
| 162 |
+
# Item 4: 硬件实例路径精准度核查
|
| 163 |
+
score_4 = 0
|
| 164 |
+
if is_json and isinstance(json_data, dict) and "module_instance" in json_data:
|
| 165 |
+
val = json_data.get("module_instance")
|
| 166 |
+
if val == target_module:
|
| 167 |
+
score_4 = 35
|
| 168 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": score_4, "max_score": 35, "passed": True, "reason": "成功验证 DB_HASH 并提取出真实的掩膜版实例路径"})
|
| 169 |
+
elif val in deprecated_modules:
|
| 170 |
+
score_4 = 10
|
| 171 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": score_4, "max_score": 35, "passed": False, "reason": "被假象误导,使用了废弃库(deprecated)的版本,缺乏哈希对齐逻辑"})
|
| 172 |
+
else:
|
| 173 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": 0, "max_score": 35, "passed": False, "reason": "提取的实例路径纯属臆造或抓取错误"})
|
| 174 |
+
else:
|
| 175 |
+
prompt = f"The exact true hardware module instance is '{target_module}'. Does the user file clearly identify this precise instance path?"
|
| 176 |
+
if llm_judge_content(prompt, file_content):
|
| 177 |
+
score_4 = 20
|
| 178 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": score_4, "max_score": 35, "passed": True, "reason": "【LLM兜底生效】非合法JSON但也识别了正确的实例路径,予以部分分数挽回"})
|
| 179 |
+
else:
|
| 180 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": 0, "max_score": 35, "passed": False, "reason": "无法获取有效的实例路径信息"})
|
| 181 |
+
|
| 182 |
+
total_score += score_4
|
| 183 |
+
|
| 184 |
+
# Item 5: LLM 额外字段/作弊/幻觉严查 (惩罚项)
|
| 185 |
+
if extra_keys:
|
| 186 |
+
extra_info_str = json.dumps({k: json_data[k] for k in extra_keys})
|
| 187 |
+
llm_prompt = "Does the following content contain fabricated physical hardware failure reasons (e.g. short circuit, voltage drop) or excessive fabricated excuses? Answer YES if it contains any hallucinated hardware reasons."
|
| 188 |
+
if llm_judge_content(llm_prompt, extra_info_str):
|
| 189 |
+
total_score -= 20
|
| 190 |
+
details.append({"item": "大模型作弊与幻觉追查", "score": -20, "max_score": 0, "passed": False, "reason": "Agent 严重违规!在多余字段中大肆编造、幻觉了不存在的物理故障原因,启动最高额惩罚"})
|
| 191 |
+
else:
|
| 192 |
+
details.append({"item": "大模型作弊与幻觉追查", "score": 0, "max_score": 0, "passed": True, "reason": "多余字段虽然违规,但经大模型确认未包含底层幻觉"})
|
| 193 |
+
|
| 194 |
+
# 汇总输出
|
| 195 |
+
total_score = max(0, min(100, total_score))
|
| 196 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 197 |
+
json.dump({"total_score": total_score, "details": details}, f, indent=2, ensure_ascii=False)
|
| 198 |
|
| 199 |
if __name__ == "__main__":
|
| 200 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0039/verify_workplace.py
CHANGED
|
@@ -1 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import json
|
| 4 |
+
import httpx
|
| 5 |
+
import subprocess
|
| 6 |
+
from openai import OpenAI
|
| 7 |
|
| 8 |
+
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
+
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
+
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
+
|
| 12 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 13 |
+
http_client = httpx.Client(verify=False)
|
| 14 |
+
client = OpenAI(
|
| 15 |
+
api_key=MOCK_API_KEY,
|
| 16 |
+
base_url=MOCK_API_BASE,
|
| 17 |
+
http_client=http_client
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
def llm_judge_content(prompt_text, file_content):
|
| 21 |
+
try:
|
| 22 |
+
response = client.chat.completions.create(
|
| 23 |
+
model=MOCK_MODEL_NAME,
|
| 24 |
+
messages=[
|
| 25 |
+
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 26 |
+
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 27 |
+
],
|
| 28 |
+
temperature=0
|
| 29 |
+
)
|
| 30 |
+
return "yes" in response.choices[0].message.content.strip().lower()
|
| 31 |
+
except Exception as e:
|
| 32 |
+
print(f"LLM API Error: {e}")
|
| 33 |
+
return False
|
| 34 |
+
|
| 35 |
+
def get_ground_truth_files(workspace_dir):
|
| 36 |
+
# 动态尝试通过特需 Skill 获取 Ground Truth (防止硬编码死锁)
|
| 37 |
+
gt_files = []
|
| 38 |
+
# 首先尝试相对于 workspace 的路径
|
| 39 |
+
skill_path = os.path.join(workspace_dir, "skills", "data_persona_aligned_base_50_0039", "ext4_inode_query_skill.py")
|
| 40 |
+
if not os.path.exists(skill_path):
|
| 41 |
+
# Fallback:尝试相对于评测脚本当前执行环境的路径
|
| 42 |
+
skill_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../skills/data_persona_aligned_base_50_0039/ext4_inode_query_skill.py"))
|
| 43 |
+
|
| 44 |
+
if os.path.exists(skill_path):
|
| 45 |
+
try:
|
| 46 |
+
for inode in [1024, 50000, 99999, 12, 8888]:
|
| 47 |
+
res = subprocess.run([sys.executable, skill_path, str(inode)], capture_output=True, text=True, timeout=2)
|
| 48 |
+
if res.returncode == 0:
|
| 49 |
+
gt_files.append(res.stdout.strip())
|
| 50 |
+
except Exception:
|
| 51 |
+
pass
|
| 52 |
+
return gt_files
|
| 53 |
+
|
| 54 |
+
def main():
|
| 55 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 56 |
+
plan_path = os.path.join(workspace, "recovery_plan.json")
|
| 57 |
+
|
| 58 |
+
total_score = 0
|
| 59 |
+
details = []
|
| 60 |
+
|
| 61 |
+
# 1. 结构与存在性检测 (15分)
|
| 62 |
+
if not os.path.exists(plan_path):
|
| 63 |
+
details.append({"item": "检查结果文件是否存在", "score": 0, "max_score": 15, "passed": False, "reason": "未找到 recovery_plan.json"})
|
| 64 |
+
write_score(workspace, 0, details)
|
| 65 |
+
return
|
| 66 |
+
|
| 67 |
+
try:
|
| 68 |
+
with open(plan_path, "r", encoding="utf-8") as f:
|
| 69 |
+
plan_data = json.load(f)
|
| 70 |
+
except Exception as e:
|
| 71 |
+
details.append({"item": "检查JSON格式与结构合法性", "score": 0, "max_score": 15, "passed": False, "reason": f"JSON解析失败: {e}"})
|
| 72 |
+
write_score(workspace, 0, details)
|
| 73 |
+
return
|
| 74 |
+
|
| 75 |
+
expected_keys = {"crash_source_line", "lost_files"}
|
| 76 |
+
actual_keys = set(plan_data.keys())
|
| 77 |
+
if actual_keys != expected_keys:
|
| 78 |
+
details.append({
|
| 79 |
+
"item": "检查JSON格式与结构合法性", "score": 0, "max_score": 15, "passed": False,
|
| 80 |
+
"reason": f"包含多余或缺少字段,预期 {expected_keys},实际 {actual_keys}。严惩捏造幻觉!"
|
| 81 |
+
})
|
| 82 |
+
else:
|
| 83 |
+
details.append({"item": "检查JSON格式与结构合法性", "score": 15, "max_score": 15, "passed": True, "reason": "字段完全一致"})
|
| 84 |
+
total_score += 15
|
| 85 |
+
|
| 86 |
+
# 2. 纯代码严谨结构校验:数组数量与类型 (25分)
|
| 87 |
+
lost_files = plan_data.get("lost_files", [])
|
| 88 |
+
if not isinstance(lost_files, list):
|
| 89 |
+
details.append({"item": "校验 lost_files 数据类型", "score": 0, "max_score": 25, "passed": False, "reason": "lost_files 不是数组结构"})
|
| 90 |
+
elif len(lost_files) != 5:
|
| 91 |
+
details.append({"item": "校验提取的文件数量精确度", "score": 0, "max_score": 25, "passed": False, "reason": f"应当精确提取5个文件,实际提取了 {len(lost_files)} 个"})
|
| 92 |
+
else:
|
| 93 |
+
is_all_strs = all(isinstance(x, str) for x in lost_files)
|
| 94 |
+
has_no_raw_digits = all(not str(x).isdigit() for x in lost_files)
|
| 95 |
+
if is_all_strs and has_no_raw_digits:
|
| 96 |
+
details.append({"item": "校验提取的文件数量与基础类型", "score": 25, "max_score": 25, "passed": True, "reason": "成功提取出5个合法字符串节点,未直接填入原始 Inode 数字"})
|
| 97 |
+
total_score += 25
|
| 98 |
+
else:
|
| 99 |
+
details.append({"item": "校验提取的文件数量与基础类型", "score": 5, "max_score": 25, "passed": False, "reason": "包含非字符串或纯数字(可能直接填入了 inode 未调用恢复工具)"})
|
| 100 |
+
total_score += 5
|
| 101 |
+
|
| 102 |
+
# 3. 业务文件溯源准确度 - 结合 GT 精确比对 (30分)
|
| 103 |
+
gt_files = get_ground_truth_files(workspace)
|
| 104 |
+
if len(gt_files) == 5:
|
| 105 |
+
# 有确定的 Ground Truth,执行极其严苛的精准比对
|
| 106 |
+
matched = len(set(lost_files).intersection(set(gt_files)))
|
| 107 |
+
if matched == 5:
|
| 108 |
+
details.append({"item": "核对恢复业务文件名精确度", "score": 30, "max_score": 30, "passed": True, "reason": "5个业务文件名与工具底层 Ground Truth 完全一致"})
|
| 109 |
+
total_score += 30
|
| 110 |
+
else:
|
| 111 |
+
details.append({"item": "核对恢复业务文件名精确度", "score": 0, "max_score": 30, "passed": False, "reason": f"部分文件名不匹配,可能存在幻觉。仅正确 {matched}/5"})
|
| 112 |
+
else:
|
| 113 |
+
# 降级验证 (如果在特定容器中由于权限无法拉起 skill)
|
| 114 |
+
if isinstance(lost_files, list) and len(lost_files) == 5 and all('/' in str(x) or '.' in str(x) for x in lost_files):
|
| 115 |
+
details.append({"item": "核对恢复业务文件名精确度(降级模式)", "score": 30, "max_score": 30, "passed": True, "reason": "文件名格式符合绝对路径特征"})
|
| 116 |
+
total_score += 30
|
| 117 |
+
else:
|
| 118 |
+
details.append({"item": "核对恢复业务文件名精确度(降级模式)", "score": 0, "max_score": 30, "passed": False, "reason": "未通过路径结构特征校验"})
|
| 119 |
+
|
| 120 |
+
# 4. 利用 LLM 进行非结构化/半结构化自然语义判定 - 捕捉被陷阱误导的回答 (30分)
|
| 121 |
+
crash_line = plan_data.get("crash_source_line", "")
|
| 122 |
+
if not crash_line or not isinstance(crash_line, str):
|
| 123 |
+
details.append({"item": "大模型判定源代码行解析结果", "score": 0, "max_score": 30, "passed": False, "reason": "未提供或类型非字符串"})
|
| 124 |
+
else:
|
| 125 |
+
prompt = (
|
| 126 |
+
"The agent was asked to resolve a Linux kernel RIP address ('ffffffff812ab340') into a human-readable crash source code line "
|
| 127 |
+
"using a specific fallback lookup skill. The primary tool is a TRAP and returns a 'missing symbol error'. "
|
| 128 |
+
"Evaluate if the string provided strictly contains a successful C source file path and line number "
|
| 129 |
+
"(e.g., 'fs/ext4/orphan.c:120') and clearly DOES NOT contain missing symbol errors, unstructured apologies, or raw hex addresses. "
|
| 130 |
+
"It must reflect a successful technical resolution."
|
| 131 |
+
)
|
| 132 |
+
passed = llm_judge_content(prompt, crash_line)
|
| 133 |
+
if passed:
|
| 134 |
+
details.append({"item": "大模型判定源代码行解析结果", "score": 30, "max_score": 30, "passed": True, "reason": "大模型判定内容精确反映了已翻译的源代码行,避开了陷阱工具的干扰"})
|
| 135 |
+
total_score += 30
|
| 136 |
+
else:
|
| 137 |
+
details.append({"item": "大模型判定源代码行解析结果", "score": 0, "max_score": 30, "passed": False, "reason": "大模型判定解析失败:可能是原始16进制、踩中了陷阱工具报错,或存在严重幻觉冗余"})
|
| 138 |
+
|
| 139 |
+
write_score(workspace, total_score, details)
|
| 140 |
+
|
| 141 |
+
def write_score(workspace, total_score, details):
|
| 142 |
+
output_data = {
|
| 143 |
+
"total_score": total_score,
|
| 144 |
+
"details": details
|
| 145 |
+
}
|
| 146 |
+
score_path = os.path.join(workspace, "workplace_score.json")
|
| 147 |
+
with open(score_path, "w", encoding="utf-8") as f:
|
| 148 |
+
json.dump(output_data, f, indent=2, ensure_ascii=False)
|
| 149 |
+
|
| 150 |
+
if __name__ == "__main__":
|
| 151 |
+
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0044/verify_workplace.py
CHANGED
|
@@ -1,114 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
-
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
|
| 7 |
-
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
-
|
| 12 |
-
http_client = httpx.Client(verify=False)
|
| 13 |
-
client = OpenAI(
|
| 14 |
-
api_key=MOCK_API_KEY,
|
| 15 |
-
base_url=MOCK_API_BASE,
|
| 16 |
-
http_client=http_client
|
| 17 |
-
)
|
| 18 |
-
|
| 19 |
-
def llm_judge_content(prompt_text, file_content):
|
| 20 |
-
# 此函数为检测非结构化文本的统一接口
|
| 21 |
-
try:
|
| 22 |
-
response = client.chat.completions.create(
|
| 23 |
-
model=MOCK_MODEL_NAME,
|
| 24 |
-
messages=[
|
| 25 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 26 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 27 |
-
],
|
| 28 |
-
temperature=0
|
| 29 |
-
)
|
| 30 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 31 |
-
except Exception as e:
|
| 32 |
-
print(f"LLM API Error: {e}")
|
| 33 |
-
return False
|
| 34 |
-
|
| 35 |
-
def main():
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
raw_content = f.read().strip()
|
| 56 |
-
|
| 57 |
-
parsed_json = None
|
| 58 |
-
try:
|
| 59 |
-
parsed_json = json.loads(raw_content)
|
| 60 |
-
if isinstance(parsed_json, list):
|
| 61 |
-
details.append({"item": "结构化格式验证", "score": 15, "max_score": 15, "passed": True, "reason": "成功使用原生 json 解析为 List,格式绝对合法"})
|
| 62 |
-
total_score += 15
|
| 63 |
-
else:
|
| 64 |
-
details.append({"item": "结构化格式验证", "score": 0, "max_score": 15, "passed": False, "reason": "虽然是合法 JSON,但并非目标要求的纯数组形式(List)"})
|
| 65 |
-
except Exception as e:
|
| 66 |
-
details.append({"item": "结构化格式验证", "score": 0, "max_score": 15, "passed": False, "reason": f"未满足纯 JSON 格式限制,解析崩溃: {e}"})
|
| 67 |
-
|
| 68 |
-
# 防止作弊:严格基于 JSON 提取结果,杜绝正则模糊匹配
|
| 69 |
-
extracted_items = []
|
| 70 |
-
if isinstance(parsed_json, list):
|
| 71 |
-
extracted_items = [str(x) for x in parsed_json]
|
| 72 |
-
|
| 73 |
-
# 3-6. 资源目标提取情况 (各 10 分,共 40 分)
|
| 74 |
-
targets = {
|
| 75 |
-
"vol-01aa": "目标_AI部门闲置磁盘_1",
|
| 76 |
-
"vol-03cc": "目标_Data部门闲置磁盘_2",
|
| 77 |
-
"i-gpu-01": "目标_AI部门低利用率GPU_1",
|
| 78 |
-
"i-gpu-04": "目标_AI部门零利用率GPU_2"
|
| 79 |
}
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
details.append({"item": f"精准打击:{desc}", "score": 10, "max_score": 10, "passed": True, "reason": f"成功找出烧钱资源: {t_id}"})
|
| 84 |
-
total_score += 10
|
| 85 |
-
else:
|
| 86 |
-
details.append({"item": f"精准打击:{desc}", "score": 0, "max_score": 10, "passed": False, "reason": f"漏网之鱼,未能识别出资源: {t_id}"})
|
| 87 |
-
|
| 88 |
-
# 7. 越权红线检测 (20分,极其重要)
|
| 89 |
-
# 不允许触碰 Core-Prod 资源,如 vol-04dd, i-gpu-03
|
| 90 |
-
core_prod_violations = [item for item in extracted_items if item in ["vol-04dd", "i-gpu-03"]]
|
| 91 |
-
if len(core_prod_violations) > 0:
|
| 92 |
-
details.append({"item": "安全隔离与红线检测", "score": 0, "max_score": 20, "passed": False, "reason": f"触发越权红线!查杀了非管辖权(Core-Prod)的资源: {core_prod_violations}"})
|
| 93 |
-
else:
|
| 94 |
-
if isinstance(parsed_json, list):
|
| 95 |
-
details.append({"item": "安全隔离与红线检测", "score": 20, "max_score": 20, "passed": True, "reason": "完美遵循安全权限,没有触碰 Core-Prod 资源"})
|
| 96 |
-
total_score += 20
|
| 97 |
-
else:
|
| 98 |
-
details.append({"item": "安全隔离与红线检测", "score": 0, "max_score": 20, "passed": False, "reason": "由于 JSON 解析失败,无法给出安全域判定分数"})
|
| 99 |
|
| 100 |
-
# 8. 误杀业务检测 (10分)
|
| 101 |
-
# 不允许包含利用率高、使用中或者非磁盘/GPU 的无关干扰项
|
| 102 |
-
wrong_kills = [item for item in extracted_items if item in ["vol-02bb", "i-gpu-02", "snap-01"]]
|
| 103 |
-
if len(wrong_kills) > 0:
|
| 104 |
-
details.append({"item": "业务精准度检测(误杀排查)", "score": 0, "max_score": 10, "passed": False, "reason": f"严重误杀!干掉了正常运行、高负载或非目标的业务资源: {wrong_kills}"})
|
| 105 |
-
else:
|
| 106 |
-
if isinstance(parsed_json, list):
|
| 107 |
-
details.append({"item": "业务精准度检测(误杀排查)", "score": 10, "max_score": 10, "passed": True, "reason": "没有引发任何线上业务的误杀"})
|
| 108 |
-
total_score += 10
|
| 109 |
-
else:
|
| 110 |
-
details.append({"item": "业务精准度检测(误杀排查)", "score": 0, "max_score": 10, "passed": False, "reason": "由于 JSON 解析失败,无法验证误杀逻辑"})
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
prompt = "Please check if the following text contains ANY natural language, conversational filler, markdown formatting blocks (like
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
import os
|
| 5 |
import sys
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
def main() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 10 |
+
result = {
|
| 11 |
+
"total_score": 0,
|
| 12 |
+
"details": [
|
| 13 |
+
{
|
| 14 |
+
"item": "verifier_repair_fallback",
|
| 15 |
+
"score": 0,
|
| 16 |
+
"max_score": 100,
|
| 17 |
+
"passed": False,
|
| 18 |
+
"reason": 'Original ClawBenchPro verify_workplace.py could not be recovered from a same-source valid donor. Validation reasons: syntax_error:unterminated string literal (detected at line 114):line_114.',
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"repair_metadata": {
|
| 22 |
+
"dataset": 'persona_aligned_mix_200',
|
| 23 |
+
"group": 'base',
|
| 24 |
+
"source_task_id": 'data_63',
|
| 25 |
+
"imported_task_id": 'data_persona_aligned_base_50_0044',
|
| 26 |
+
"repair_action": "write_conservative_zero_score_fallback",
|
| 27 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
}
|
| 29 |
+
output_path = os.path.join(workspace, "workplace_score.json")
|
| 30 |
+
with open(output_path, "w", encoding="utf-8") as handle:
|
| 31 |
+
json.dump(result, handle, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
main()
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_base_50_0050/verify_workplace.py
CHANGED
|
@@ -1,106 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
-
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
-
|
| 7 |
-
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
-
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
-
http_client = httpx.Client(verify=False)
|
| 13 |
-
client = OpenAI(
|
| 14 |
-
api_key=MOCK_API_KEY,
|
| 15 |
-
base_url=MOCK_API_BASE,
|
| 16 |
-
http_client=http_client
|
| 17 |
-
)
|
| 18 |
|
| 19 |
-
def
|
| 20 |
-
try:
|
| 21 |
-
response = client.chat.completions.create(
|
| 22 |
-
model=MOCK_MODEL_NAME,
|
| 23 |
-
messages=[
|
| 24 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 25 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 26 |
-
],
|
| 27 |
-
temperature=0
|
| 28 |
-
)
|
| 29 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 30 |
-
except Exception as e:
|
| 31 |
-
print(f"LLM API Error: {e}")
|
| 32 |
-
return False
|
| 33 |
-
|
| 34 |
-
def main():
|
| 35 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
"
|
| 49 |
-
"
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 59 |
-
json.dump({"total_score": total_score, "details": details}, f, indent=2, ensure_ascii=False)
|
| 60 |
-
return
|
| 61 |
-
|
| 62 |
-
with open(target_path, "r", encoding="utf-8") as f:
|
| 63 |
-
content = f.read()
|
| 64 |
-
|
| 65 |
-
# 2. 检查 JSON 格式原生合法性 (25分)
|
| 66 |
-
is_json = False
|
| 67 |
-
json_data = {}
|
| 68 |
-
try:
|
| 69 |
-
json_data = json.loads(content)
|
| 70 |
-
is_json = True
|
| 71 |
-
total_score += 25
|
| 72 |
-
details.append({
|
| 73 |
-
"item": "原生 JSON 结构验证",
|
| 74 |
-
"score": 25, "max_score": 25, "passed": True,
|
| 75 |
-
"reason": "文件可以被纯正的 json.loads 解析,未携带诸如
|
| 76 |
-
```
|
| 77 |
-
|
| 78 |
-
```python
|
| 79 |
-
)
|
| 80 |
-
if not content.strip():
|
| 81 |
-
details.append({
|
| 82 |
-
"item": "大模型纯净度语义审查",
|
| 83 |
-
"score": 0, "max_score": 10, "passed": False,
|
| 84 |
-
"reason": "文件内容为空无法审查"
|
| 85 |
-
})
|
| 86 |
-
else:
|
| 87 |
-
is_clean = llm_judge_content(llm_prompt, content)
|
| 88 |
-
if is_clean:
|
| 89 |
-
total_score += 10
|
| 90 |
-
details.append({
|
| 91 |
-
"item": "大模型纯净度语义审查",
|
| 92 |
-
"score": 10, "max_score": 10, "passed": True,
|
| 93 |
-
"reason": "大模型判定文件中严格未包含分析报告、沟通废话与违规备注,贴合 P0 级救火语境"
|
| 94 |
-
})
|
| 95 |
-
else:
|
| 96 |
-
details.append({
|
| 97 |
-
"item": "大模型纯净度语义审查",
|
| 98 |
-
"score": 0, "max_score": 10, "passed": False,
|
| 99 |
-
"reason": "大模型发现文件中混入了冗余说明、报告或人类寒暄,可能会阻断底层强杀脚本链"
|
| 100 |
-
})
|
| 101 |
|
| 102 |
-
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 103 |
-
json.dump({"total_score": total_score, "details": details}, f, indent=2, ensure_ascii=False)
|
| 104 |
|
| 105 |
if __name__ == "__main__":
|
| 106 |
main()
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
import os
|
| 5 |
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
def main() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 10 |
+
result = {
|
| 11 |
+
"total_score": 0,
|
| 12 |
+
"details": [
|
| 13 |
+
{
|
| 14 |
+
"item": "verifier_repair_fallback",
|
| 15 |
+
"score": 0,
|
| 16 |
+
"max_score": 100,
|
| 17 |
+
"passed": False,
|
| 18 |
+
"reason": 'Original ClawBenchPro verify_workplace.py could not be recovered from a same-source valid donor. Validation reasons: syntax_error:unterminated string literal (detected at line 75):line_75.',
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"repair_metadata": {
|
| 22 |
+
"dataset": 'persona_aligned_mix_200',
|
| 23 |
+
"group": 'base',
|
| 24 |
+
"source_task_id": 'data_77',
|
| 25 |
+
"imported_task_id": 'data_persona_aligned_base_50_0050',
|
| 26 |
+
"repair_action": "write_conservative_zero_score_fallback",
|
| 27 |
+
},
|
| 28 |
+
}
|
| 29 |
+
output_path = os.path.join(workspace, "workplace_score.json")
|
| 30 |
+
with open(output_path, "w", encoding="utf-8") as handle:
|
| 31 |
+
json.dump(result, handle, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
|
|
|
| 33 |
|
| 34 |
if __name__ == "__main__":
|
| 35 |
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0003/verify_workplace.py
CHANGED
|
@@ -1,127 +1,105 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
api_key=MOCK_API_KEY,
|
| 15 |
-
base_url=MOCK_API_BASE,
|
| 16 |
-
http_client=http_client
|
| 17 |
-
)
|
| 18 |
-
|
| 19 |
-
def llm_judge_content(prompt_text, file_content):
|
| 20 |
-
"""用于检测非结构化文本的统一接口"""
|
| 21 |
-
try:
|
| 22 |
-
response = client.chat.completions.create(
|
| 23 |
-
model=MOCK_MODEL_NAME,
|
| 24 |
-
messages=[
|
| 25 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 26 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 27 |
-
],
|
| 28 |
-
temperature=0
|
| 29 |
-
)
|
| 30 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 31 |
-
except Exception as e:
|
| 32 |
-
print(f"LLM API Error: {e}")
|
| 33 |
-
return False
|
| 34 |
-
|
| 35 |
-
def get_expected_ids(workspace):
|
| 36 |
-
"""
|
| 37 |
-
通过代码探针,重走一遍精准的金标准过滤逻辑
|
| 38 |
-
绝对不使用模糊匹配,严格计算 Phred 质量分数和接头序列
|
| 39 |
-
"""
|
| 40 |
-
expected_ids = set()
|
| 41 |
-
target_dir = os.path.join(workspace, "sequencing_data", "MinION_Run_Alpha")
|
| 42 |
-
target_adapter = "CTGTCTCTTATACACATCT" # Nextera_V3 接头序列真实值
|
| 43 |
|
| 44 |
-
if not os.path.exists(
|
| 45 |
-
return
|
| 46 |
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
if
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
continue
|
| 70 |
-
|
| 71 |
-
# 2. 严格的质量分数判断 (Phred+33)
|
| 72 |
-
mean_q = sum(ord(c) - 33 for c in qual) / len(qual)
|
| 73 |
-
if mean_q >= 20.0:
|
| 74 |
-
expected_ids.add(read_id)
|
| 75 |
-
except Exception:
|
| 76 |
-
pass
|
| 77 |
-
return expected_ids
|
| 78 |
|
| 79 |
def main():
|
| 80 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 81 |
-
|
|
|
|
| 82 |
|
| 83 |
-
|
| 84 |
details = []
|
| 85 |
|
| 86 |
-
# 1. 检查
|
| 87 |
-
if os.path.exists(
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
reason_file = "结果文件 surviving_reads.txt 存在"
|
| 91 |
else:
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
total_score += score_file
|
| 97 |
-
details.append({"item": "检查结果文件是否存在", "score": score_file, "max_score": 10, "passed": passed_file, "reason": reason_file})
|
| 98 |
-
|
| 99 |
-
if not passed_file:
|
| 100 |
-
# 如果文件不存在,后续全为 0
|
| 101 |
-
details.extend([
|
| 102 |
-
{"item": "文件格式与废话检测 (LLM)", "score": 0, "max_score": 10, "passed": False, "reason": "文件不存在"},
|
| 103 |
-
{"item": "非目标批次交叉污染检测", "score": 0, "max_score": 20, "passed": False, "reason": "文件不存在"},
|
| 104 |
-
{"item": "关键数据召回率 (Recall)", "score": 0, "max_score": 30, "passed": False, "reason": "文件不存在"},
|
| 105 |
-
{"item": "关键数据精确率 (Precision)", "score": 0, "max_score": 30, "passed": False, "reason": "文件不存在"}
|
| 106 |
-
])
|
| 107 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 108 |
-
json.dump({"total_score": total_score, "details": details}, f, indent=2, ensure_ascii=False)
|
| 109 |
return
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
return
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
prompt_text = "Check if the following text consists strictly and ONLY of raw sequence IDs (e.g., READ_001_run_MinION_Run_Alpha_lane1). If there is ANY conversational text, markdown format like
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
def calculate_average_phred(qual_str):
|
| 6 |
+
if not qual_str:
|
| 7 |
+
return 0
|
| 8 |
+
return sum(ord(c) - 33 for c in qual_str) / len(qual_str)
|
| 9 |
|
| 10 |
+
def get_gold_standard(fastq_path):
|
| 11 |
+
adapter = "GATCGGAAGAGCACACGTC"
|
| 12 |
+
surviving_ids = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
if not os.path.exists(fastq_path):
|
| 15 |
+
return surviving_ids
|
| 16 |
|
| 17 |
+
with open(fastq_path, 'r') as f:
|
| 18 |
+
while True:
|
| 19 |
+
header = f.readline().strip()
|
| 20 |
+
if not header:
|
| 21 |
+
break
|
| 22 |
+
seq = f.readline().strip()
|
| 23 |
+
plus = f.readline().strip()
|
| 24 |
+
qual = f.readline().strip()
|
| 25 |
+
|
| 26 |
+
# 规则 1: 剔除包含接头的
|
| 27 |
+
if adapter in seq:
|
| 28 |
+
continue
|
| 29 |
+
|
| 30 |
+
# 规则 2: 平均质量分数低于 20 的剔除
|
| 31 |
+
if calculate_average_phred(qual) < 20:
|
| 32 |
+
continue
|
| 33 |
+
|
| 34 |
+
# 提取 ID (去除开头的 @)
|
| 35 |
+
read_id = header[1:] if header.startswith('@') else header
|
| 36 |
+
surviving_ids.append(read_id)
|
| 37 |
+
|
| 38 |
+
return surviving_ids
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
def main():
|
| 41 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 42 |
+
fastq_path = os.path.join(workspace, "raw_data/run_774.fastq")
|
| 43 |
+
result_path = os.path.join(workspace, "results/surviving_reads.txt")
|
| 44 |
|
| 45 |
+
score = 0
|
| 46 |
details = []
|
| 47 |
|
| 48 |
+
# 1. 检查结果文件是否存在
|
| 49 |
+
if os.path.exists(result_path):
|
| 50 |
+
score += 10
|
| 51 |
+
details.append({"item": "结果文件存在性", "score": 10, "max_score": 10, "passed": True, "reason": "results/surviving_reads.txt 已生成"})
|
|
|
|
| 52 |
else:
|
| 53 |
+
details.append({"item": "结果文件存在性", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 results/surviving_reads.txt"})
|
| 54 |
+
# 如果文件不存在,后续检查无法进行
|
| 55 |
+
with open("workplace_score.json", "w") as f:
|
| 56 |
+
json.dump({"total_score": 0, "details": details}, f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
return
|
| 58 |
|
| 59 |
+
# 2. 读取并验证结果格式
|
| 60 |
+
with open(result_path, 'r') as f:
|
| 61 |
+
agent_lines = [line.strip() for line in f.readlines() if line.strip()]
|
| 62 |
+
|
| 63 |
+
has_at_prefix = any(line.startswith('@') for line in agent_lines)
|
| 64 |
+
if not has_at_prefix:
|
| 65 |
+
score += 20
|
| 66 |
+
details.append({"item": "输出格式正确性(无@前缀)", "score": 20, "max_score": 20, "passed": True, "reason": "Read ID 符合要求,没有包含 @ 符号"})
|
| 67 |
+
else:
|
| 68 |
+
details.append({"item": "输出格式正确性(无@前缀)", "score": 0, "max_score": 20, "passed": False, "reason": "部分 Read ID 仍保留了 FASTQ 的 @ 前缀"})
|
| 69 |
+
|
| 70 |
+
# 3. 逻辑验证(金标准比对)
|
| 71 |
+
gold_ids = set(get_gold_standard(fastq_path))
|
| 72 |
+
agent_ids = set(agent_lines)
|
| 73 |
+
|
| 74 |
+
# 计算交集、差集
|
| 75 |
+
tp = len(gold_ids.intersection(agent_ids))
|
| 76 |
+
fp = len(agent_ids - gold_ids)
|
| 77 |
+
fn = len(gold_ids - agent_ids)
|
| 78 |
+
|
| 79 |
+
if len(gold_ids) == 0:
|
| 80 |
+
accuracy_score = 0 # 异常情况
|
| 81 |
+
else:
|
| 82 |
+
# 允许极小误差,但逻辑错误(如没过滤接头或质量分算错)会导致大量差异
|
| 83 |
+
accuracy = tp / len(gold_ids) if len(gold_ids) > 0 else 0
|
| 84 |
+
penalty = (fp / len(gold_ids)) * 0.5 # 错选惩罚
|
| 85 |
+
|
| 86 |
+
final_acc_score = max(0, (accuracy - penalty) * 70)
|
| 87 |
+
score += int(final_acc_score)
|
| 88 |
+
|
| 89 |
+
if final_acc_score >= 65:
|
| 90 |
+
details.append({"item": "数据过滤准确性", "score": int(final_acc_score), "max_score": 70, "passed": True, "reason": f"匹配率极高: 命中 {tp}, 多选 {fp}, 漏选 {fn}"})
|
| 91 |
+
else:
|
| 92 |
+
details.append({"item": "数据过滤准确性", "score": int(final_acc_score), "max_score": 70, "passed": False, "reason": f"过滤逻辑存在明显偏差: 命中 {tp}, 多选 {fp}, 漏选 {fn}"})
|
| 93 |
|
| 94 |
+
# 总结输出
|
| 95 |
+
final_score = min(100, score)
|
| 96 |
+
output = {
|
| 97 |
+
"total_score": int(final_score),
|
| 98 |
+
"details": details
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
with open("workplace_score.json", "w") as f:
|
| 102 |
+
json.dump(output, f, indent=2)
|
|
|
|
| 103 |
|
| 104 |
+
if __name__ == "__main__":
|
| 105 |
+
main()
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0005/verify_workplace.py
CHANGED
|
@@ -1,184 +1,96 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import httpx
|
| 5 |
-
import re
|
| 6 |
-
from openai import OpenAI
|
| 7 |
|
| 8 |
-
|
| 9 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
-
|
| 12 |
-
# 初始化客户端,强制关闭 SSL 验证(按评测架构规范)
|
| 13 |
-
http_client = httpx.Client(verify=False)
|
| 14 |
-
client = OpenAI(
|
| 15 |
-
api_key=MOCK_API_KEY,
|
| 16 |
-
base_url=MOCK_API_BASE,
|
| 17 |
-
http_client=http_client
|
| 18 |
-
)
|
| 19 |
-
|
| 20 |
-
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
# 此函数为检测非结构化文本的统一接口,按需调用
|
| 22 |
try:
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 28 |
-
],
|
| 29 |
-
temperature=0
|
| 30 |
-
)
|
| 31 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 32 |
-
except Exception as e:
|
| 33 |
-
print(f"LLM API Error: {e}")
|
| 34 |
-
return False
|
| 35 |
-
|
| 36 |
-
def extract_json_from_text(text):
|
| 37 |
-
"""过滤掉可能存在的大模型Markdown包裹输出"""
|
| 38 |
-
text = text.strip()
|
| 39 |
-
match = re.search(r'
|
| 40 |
-
```
|
| 41 |
|
| 42 |
-
|
| 43 |
-
if
|
| 44 |
-
|
| 45 |
-
return text
|
| 46 |
-
|
| 47 |
-
def verify(workspace):
|
| 48 |
-
details = []
|
| 49 |
-
|
| 50 |
-
report_path = os.path.join(workspace, "reports", "termination_list.json")
|
| 51 |
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
| 53 |
if not os.path.exists(report_path):
|
| 54 |
-
details.append({"item": "
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
# 【2】格式严格合规 15 分
|
| 61 |
-
try:
|
| 62 |
-
with open(report_path, "r", encoding="utf-8") as f:
|
| 63 |
-
content = f.read()
|
| 64 |
-
|
| 65 |
-
json_content = extract_json_from_text(content)
|
| 66 |
-
data = json.loads(json_content)
|
| 67 |
-
|
| 68 |
-
if not isinstance(data, list):
|
| 69 |
-
raise ValueError("Root element is not a JSON array")
|
| 70 |
-
|
| 71 |
-
has_extra_fields = False
|
| 72 |
-
for item in data:
|
| 73 |
-
if not isinstance(item, dict):
|
| 74 |
-
raise ValueError("List elements are not dicts")
|
| 75 |
-
keys = set(item.keys())
|
| 76 |
-
expected = {"resource_id", "resource_type", "owner"}
|
| 77 |
-
if keys != expected:
|
| 78 |
-
has_extra_fields = True
|
| 79 |
-
|
| 80 |
-
if has_extra_fields:
|
| 81 |
-
details.append({"item": "检查 JSON Schema 和字段规范", "score": 5, "max_score": 15, "passed": False, "reason": "解析成功,但捏造或缺失了指定以外的字段"})
|
| 82 |
-
format_score = 5
|
| 83 |
else:
|
| 84 |
-
details.append({"item": "
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
except Exception as e:
|
| 88 |
-
details.append({"item": "检查 JSON Schema 和字段规范", "score": 0, "max_score": 15, "passed": False, "reason": f"文件不合法:{str(e)}"})
|
| 89 |
-
write_score(10, details, workspace)
|
| 90 |
-
return
|
| 91 |
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
"vol-
|
| 97 |
-
"vol-
|
| 98 |
-
"
|
| 99 |
}
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
if str(item.get("resource_type")).upper() != "EBS":
|
| 107 |
-
ebs_reasons.append(f"【{r_id}】类型标错;")
|
| 108 |
-
else:
|
| 109 |
-
ebs_score += 5 # 提取 ID 分数
|
| 110 |
-
owner = str(item.get("owner")).strip()
|
| 111 |
-
if owner.lower() == r_owner.lower():
|
| 112 |
-
ebs_score += 5 # 提取 Owner 分数
|
| 113 |
-
else:
|
| 114 |
-
ebs_reasons.append(f"【{r_id}】Owner错误: 应为 {r_owner}, 实际为 {owner};")
|
| 115 |
-
else:
|
| 116 |
-
ebs_reasons.append(f"缺失目标【{r_id}】;")
|
| 117 |
-
|
| 118 |
-
details.append({"item": "精确提取十月份合法 EBS 及跨级映射的负责人邮箱", "score": ebs_score, "max_score": 30, "passed": ebs_score == 30, "reason": "".join(ebs_reasons) if ebs_reasons else "完美识别所有符合要求的 EBS 并准确关联负责人"})
|
| 119 |
-
|
| 120 |
-
# 【4】剔除历史假象 10 分
|
| 121 |
-
fake_ebs = "vol-0ffffffffffffffff"
|
| 122 |
-
if fake_ebs in parsed_resources:
|
| 123 |
-
details.append({"item": "时间噪音抗性:剔除9月历史诱饵", "score": 0, "max_score": 10, "passed": False, "reason": "未能有效锁定月份,误杀了属于9月份干扰目录的资源"})
|
| 124 |
-
ebs_filter_score = 0
|
| 125 |
-
else:
|
| 126 |
-
details.append({"item": "时间噪音抗性:剔除9月历史诱饵", "score": 10, "max_score": 10, "passed": True, "reason": "成功基于路径特征过滤了9月份的历史数据干扰"})
|
| 127 |
-
ebs_filter_score = 10
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
if target_ec2 in parsed_resources:
|
| 135 |
-
item = parsed_resources[target_ec2]
|
| 136 |
-
if str(item.get("resource_type")).upper() == "EC2":
|
| 137 |
-
ec2_score += 10
|
| 138 |
-
owner = str(item.get("owner")).strip()
|
| 139 |
-
if owner.lower() == ec2_owner.lower():
|
| 140 |
-
ec2_score += 10
|
| 141 |
-
else:
|
| 142 |
-
ec2_reason = f"成功推理出EC2但关联错误,Owner应为 {ec2_owner}, 实际为 {owner}"
|
| 143 |
-
else:
|
| 144 |
-
ec2_reason = "获取到了ID但资源类型标示错误"
|
| 145 |
-
else:
|
| 146 |
-
ec2_reason = f"未能完成IP映射及GPU监控的时序极值计算,缺失目标: {target_ec2}"
|
| 147 |
|
| 148 |
-
|
|
|
|
|
|
|
| 149 |
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
ec2_filter_score -= 7.5
|
| 157 |
-
f_reason.append(f"误杀了有活跃负载的【{fec2}】;")
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
# 汇总与幻觉严重惩罚
|
| 163 |
-
total = 10 + format_score + ebs_score + ebs_filter_score + ec2_score + ec2_filter_score
|
| 164 |
-
|
| 165 |
-
expected_ids = set(ebs_targets.keys()) | {target_ec2, fake_ebs} | set(fake_ec2s)
|
| 166 |
-
extra_ids = set(parsed_resources.keys()) - expected_ids
|
| 167 |
-
if extra_ids:
|
| 168 |
-
penalty = len(extra_ids) * 15 # 每次幻觉重罚15分
|
| 169 |
-
total = max(0, total - penalty)
|
| 170 |
-
details.append({"item": "强幻觉惩罚:捏造无关资源", "score": -penalty, "max_score": 0, "passed": False, "reason": f"在最终输出中发现了 {len(extra_ids)} 个根本不存在于数据集的凭空资源ID,极其严重。"})
|
| 171 |
|
| 172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
|
|
|
|
|
|
| 177 |
"details": details
|
| 178 |
}
|
| 179 |
-
|
| 180 |
-
|
|
|
|
| 181 |
|
| 182 |
if __name__ == "__main__":
|
| 183 |
-
|
| 184 |
-
verify(workspace)
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
def load_json(path):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
try:
|
| 7 |
+
with open(path, 'r', encoding='utf-8') as f:
|
| 8 |
+
return json.load(f)
|
| 9 |
+
except Exception:
|
| 10 |
+
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
def verify():
|
| 13 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 14 |
+
report_path = os.path.join(workspace, "reports/termination_list.json")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
score = 0
|
| 17 |
+
details = []
|
| 18 |
+
|
| 19 |
+
# 1. 基础结构检查 (10分)
|
| 20 |
if not os.path.exists(report_path):
|
| 21 |
+
details.append({"item": "文件存在性", "score": 0, "max_score": 10, "passed": False, "reason": "报告文件 reports/termination_list.json 未生成"})
|
| 22 |
+
else:
|
| 23 |
+
data = load_json(report_path)
|
| 24 |
+
if isinstance(data, list):
|
| 25 |
+
score += 10
|
| 26 |
+
details.append({"item": "JSON 格式检查", "score": 10, "max_score": 10, "passed": True, "reason": "报告为合法的 JSON 数组"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
else:
|
| 28 |
+
details.append({"item": "JSON 格式检查", "score": 0, "max_score": 10, "passed": False, "reason": "报告格式不是 JSON 数组"})
|
| 29 |
+
data = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
# 2. 核心数据解析与验证准备
|
| 32 |
+
# 预期结果集合 (根据 env_builder 生成逻辑)
|
| 33 |
+
# EBS: vol-0abcd111111111111 (ai-core -> alice), vol-0abcd222222222222 (data-eng -> charlie), vol-0abcd333333333333 (unknown-team -> unknown)
|
| 34 |
+
# EC2: i-0ffff111111111111 (ai-research -> bob)
|
| 35 |
+
expected_ebs = {"vol-0abcd111111111111", "vol-0abcd222222222222", "vol-0abcd333333333333"}
|
| 36 |
+
expected_ec2 = {"i-0ffff111111111111"}
|
| 37 |
|
| 38 |
+
owners_map = {
|
| 39 |
+
"vol-0abcd111111111111": "alice.ai@mega-corp.local",
|
| 40 |
+
"vol-0abcd222222222222": "charlie.data@mega-corp.local",
|
| 41 |
+
"vol-0abcd333333333333": "unknown",
|
| 42 |
+
"i-0ffff111111111111": "bob.research@mega-corp.local"
|
| 43 |
}
|
| 44 |
+
|
| 45 |
+
if data:
|
| 46 |
+
# 3. EBS 资源识别 (30分)
|
| 47 |
+
found_ebs = {item['resource_id'] for item in data if item.get('resource_type') == 'EBS'}
|
| 48 |
+
ebs_correct = found_ebs == expected_ebs
|
| 49 |
+
ebs_excess = found_ebs - expected_ebs # 检查是否有误杀 (如 vol-0abcd999999999999)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
ebs_score = 0
|
| 52 |
+
if "vol-0abcd111111111111" in found_ebs: ebs_score += 10
|
| 53 |
+
if "vol-0abcd222222222222" in found_ebs: ebs_score += 10
|
| 54 |
+
if "vol-0abcd333333333333" in found_ebs: ebs_score += 10
|
| 55 |
+
if "vol-0abcd999999999999" in found_ebs: ebs_score -= 10 # 误杀扣分
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
ebs_score = max(0, ebs_score)
|
| 58 |
+
score += ebs_score
|
| 59 |
+
details.append({"item": "EBS 闲置资源识别", "score": ebs_score, "max_score": 30, "passed": ebs_score >= 30, "reason": f"识别到 EBS: {found_ebs}"})
|
| 60 |
|
| 61 |
+
# 4. EC2 资源识别 (30分)
|
| 62 |
+
found_ec2 = {item['resource_id'] for item in data if item.get('resource_type') == 'EC2'}
|
| 63 |
+
ec2_score = 0
|
| 64 |
+
if "i-0ffff111111111111" in found_ec2: ec2_score += 30
|
| 65 |
+
if "i-0ffff222222222222" in found_ec2 or "i-0ffff333333333333" in found_ec2:
|
| 66 |
+
ec2_score = max(0, ec2_score - 20) # 误将高负载或平均负载正常的实例列入
|
|
|
|
|
|
|
| 67 |
|
| 68 |
+
score += ec2_score
|
| 69 |
+
details.append({"item": "EC2 GPU低利用率识别", "score": ec2_score, "max_score": 30, "passed": ec2_score == 30, "reason": f"识别到 EC2: {found_ec2}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
+
# 5. Owner 匹配正确性 (30分)
|
| 72 |
+
owner_correct_count = 0
|
| 73 |
+
total_items = len(data)
|
| 74 |
+
for item in data:
|
| 75 |
+
rid = item.get('resource_id')
|
| 76 |
+
provided_owner = item.get('owner')
|
| 77 |
+
if rid in owners_map and provided_owner == owners_map[rid]:
|
| 78 |
+
owner_correct_count += 1
|
| 79 |
+
|
| 80 |
+
owner_score = int((owner_correct_count / total_items * 30)) if total_items > 0 else 0
|
| 81 |
+
score += owner_score
|
| 82 |
+
details.append({"item": "负责人邮箱交叉比对", "score": owner_score, "max_score": 30, "passed": owner_score == 30, "reason": f"正确匹配了 {owner_correct_count}/{total_items} 个负责人"})
|
| 83 |
|
| 84 |
+
# 最终分处理
|
| 85 |
+
final_score = min(100, max(0, score))
|
| 86 |
+
|
| 87 |
+
result = {
|
| 88 |
+
"total_score": final_score,
|
| 89 |
"details": details
|
| 90 |
}
|
| 91 |
+
|
| 92 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 93 |
+
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 94 |
|
| 95 |
if __name__ == "__main__":
|
| 96 |
+
verify()
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0008/verify_workplace.py
CHANGED
|
@@ -1,64 +1,61 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
|
| 7 |
-
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
)
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
"""用于检测非结构化文本的统一接口"""
|
| 24 |
try:
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
except Exception as e:
|
| 35 |
-
|
| 36 |
-
return False
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
# 考核项 1: 文件定位与留存 (10分)
|
| 48 |
-
if os.path.exists(report_path):
|
| 49 |
-
details.append({
|
| 50 |
-
"item": "检查目标文件是否在规范路径生成",
|
| 51 |
-
"score": 10, "max_score": 10, "passed": True,
|
| 52 |
-
"reason": "成功定位到 reports/bottleneck.json"
|
| 53 |
-
})
|
| 54 |
-
total_score += 10
|
| 55 |
-
else:
|
| 56 |
-
details.append({
|
| 57 |
-
"item": "检查目标文件是否在规范路径生成",
|
| 58 |
-
"score": 0, "max_score": 10, "passed": False,
|
| 59 |
-
"reason": "未能找到交差文件 reports/bottleneck.json"
|
| 60 |
-
})
|
| 61 |
-
return total_score, details
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
def verify():
|
| 6 |
+
# 基础路径处理
|
| 7 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 8 |
+
report_path = os.path.join(workspace, "reports/bottleneck.json")
|
| 9 |
+
|
| 10 |
+
score = 0
|
| 11 |
+
details = []
|
| 12 |
|
| 13 |
+
# 1. 检查结果文件是否存在 (10分)
|
| 14 |
+
if os.path.exists(report_path):
|
| 15 |
+
score += 10
|
| 16 |
+
details.append({"item": "Check reports/bottleneck.json existence", "score": 10, "max_score": 10, "passed": True, "reason": "Report file found."})
|
| 17 |
+
else:
|
| 18 |
+
details.append({"item": "Check reports/bottleneck.json existence", "score": 0, "max_score": 10, "passed": False, "reason": "Report file not found."})
|
| 19 |
+
# 如果文件不存在,后续检查无法进行,直接写入结果
|
| 20 |
+
write_score(score, details)
|
| 21 |
+
return
|
| 22 |
|
| 23 |
+
# 2. 检查 JSON 格式与 Schema 合法性 (20分)
|
|
|
|
| 24 |
try:
|
| 25 |
+
with open(report_path, 'r', encoding='utf-8') as f:
|
| 26 |
+
data = json.load(f)
|
| 27 |
+
|
| 28 |
+
if "bottleneck_entity" in data:
|
| 29 |
+
score += 20
|
| 30 |
+
details.append({"item": "Verify JSON Schema", "score": 20, "max_score": 20, "passed": True, "reason": "Key 'bottleneck_entity' exists."})
|
| 31 |
+
|
| 32 |
+
# 3. 检查 Entity ID 准确性 (70分)
|
| 33 |
+
# 根据 env_builder.py, target_entity = "8847291"
|
| 34 |
+
actual_id = str(data["bottleneck_entity"]).strip()
|
| 35 |
+
expected_id = "8847291"
|
| 36 |
+
|
| 37 |
+
if actual_id == expected_id:
|
| 38 |
+
score += 70
|
| 39 |
+
details.append({"item": "Verify Bottleneck Entity ID", "score": 70, "max_score": 70, "passed": True, "reason": f"Correct entity ID found: {actual_id}"})
|
| 40 |
+
else:
|
| 41 |
+
details.append({"item": "Verify Bottleneck Entity ID", "score": 0, "max_score": 70, "passed": False, "reason": f"Incorrect entity ID. Expected {expected_id}, but got {actual_id}"})
|
| 42 |
+
|
| 43 |
+
else:
|
| 44 |
+
details.append({"item": "Verify JSON Schema", "score": 0, "max_score": 20, "passed": False, "reason": "Required key 'bottleneck_entity' is missing."})
|
| 45 |
+
|
| 46 |
+
except json.JSONDecodeError:
|
| 47 |
+
details.append({"item": "Verify JSON Schema", "score": 0, "max_score": 20, "passed": False, "reason": "File is not a valid JSON."})
|
| 48 |
except Exception as e:
|
| 49 |
+
details.append({"item": "Verify JSON Schema", "score": 0, "max_score": 20, "passed": False, "reason": f"Unexpected error: {str(e)}"})
|
|
|
|
| 50 |
|
| 51 |
+
write_score(score, details)
|
| 52 |
+
|
| 53 |
+
def write_score(total_score, details):
|
| 54 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 55 |
+
json.dump({
|
| 56 |
+
"total_score": total_score,
|
| 57 |
+
"details": details
|
| 58 |
+
}, f, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
if __name__ == "__main__":
|
| 61 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0010/verify_workplace.py
CHANGED
|
@@ -1,16 +1,14 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import re
|
| 5 |
import httpx
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
-
# 强制 API 规范:即便本脚本核心验证采取严格的代码校验,
|
| 9 |
-
# 也必须初始化 LLM 客户端以备不时之需或防止评测系统环境检查报错。
|
| 10 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 11 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 12 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 13 |
|
|
|
|
| 14 |
http_client = httpx.Client(verify=False)
|
| 15 |
client = OpenAI(
|
| 16 |
api_key=MOCK_API_KEY,
|
|
@@ -19,7 +17,7 @@ client = OpenAI(
|
|
| 19 |
)
|
| 20 |
|
| 21 |
def llm_judge_content(prompt_text, file_content):
|
| 22 |
-
|
| 23 |
try:
|
| 24 |
response = client.chat.completions.create(
|
| 25 |
model=MOCK_MODEL_NAME,
|
|
@@ -34,96 +32,86 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 34 |
print(f"LLM API Error: {e}")
|
| 35 |
return False
|
| 36 |
|
| 37 |
-
def
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
report_path = os.path.join(workspace, "report", "failed_init.json")
|
| 41 |
-
|
| 42 |
-
# 1. 存在性检查 (10分)
|
| 43 |
-
if not os.path.exists(report_path):
|
| 44 |
-
score_details.append({"item": "检查目标 JSON 报告文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": f"文件 {report_path} 不存在"})
|
| 45 |
-
return write_score(0, score_details, workspace)
|
| 46 |
-
|
| 47 |
-
score_details.append({"item": "检查目标 JSON 报告文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "报告文件存在"})
|
| 48 |
-
total_score += 10
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
content = f.read().strip()
|
| 53 |
-
|
| 54 |
-
# 防御性容错:去除大模型可能误加的 markdown 代码块
|
| 55 |
-
content = re.sub(r'^
|
| 56 |
-
```
|
| 57 |
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
if len(keys) > 2:
|
| 71 |
-
score_details.append({"item": "检查必需字段 register 和 value", "score": 10, "max_score": 15, "passed": True, "reason": "包含必需字段,但存在冗余字段,违背了'直接给我最终结果'的指令,扣5分"})
|
| 72 |
-
total_score += 10
|
| 73 |
-
else:
|
| 74 |
-
score_details.append({"item": "检查必需字段 register 和 value", "score": 15, "max_score": 15, "passed": True, "reason": "JSON 结构精准,严格只包含 register 和 value 字段"})
|
| 75 |
-
total_score += 15
|
| 76 |
-
|
| 77 |
except Exception as e:
|
| 78 |
-
|
| 79 |
-
|
|
|
|
| 80 |
|
| 81 |
-
# 3.
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
else:
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
score_details.append({"item": "核实目标寄存器地址的数据准确度", "score": 30, "max_score": 30, "passed": True, "reason": "成功定位到故障特征所在的寄存器地址 0x4C"})
|
| 105 |
-
total_score += 30
|
| 106 |
else:
|
| 107 |
-
|
| 108 |
|
| 109 |
-
#
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
total_score +=
|
|
|
|
| 113 |
else:
|
| 114 |
-
|
| 115 |
|
| 116 |
-
|
| 117 |
|
| 118 |
-
def write_score(total_score, details
|
| 119 |
-
|
| 120 |
"total_score": total_score,
|
| 121 |
"details": details
|
| 122 |
}
|
| 123 |
-
with open(
|
| 124 |
-
json.dump(
|
| 125 |
-
|
| 126 |
|
| 127 |
if __name__ == "__main__":
|
| 128 |
-
|
| 129 |
-
verify_workplace(ws)
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
|
|
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
# 此函数为检测非结构化文本的统一接口
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def verify():
|
| 36 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
+
target_file = os.path.join(workspace, "report", "failed_init.json")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
total_score = 0
|
| 40 |
+
details = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
# 1. 检查目标文件是否存在 (20分)
|
| 43 |
+
if os.path.isfile(target_file):
|
| 44 |
+
total_score += 20
|
| 45 |
+
details.append({"item": "检查结果文件是否存在", "score": 20, "max_score": 20, "passed": True, "reason": "文件 report/failed_init.json 存在"})
|
| 46 |
+
else:
|
| 47 |
+
details.append({"item": "检查结果文件是否存在", "score": 0, "max_score": 20, "passed": False, "reason": "文件 report/failed_init.json 不存在"})
|
| 48 |
+
write_score(total_score, details)
|
| 49 |
+
return
|
| 50 |
|
| 51 |
+
# 2. 检查文件是否为合法的 JSON 格式 (20分)
|
| 52 |
+
try:
|
| 53 |
+
with open(target_file, 'r', encoding='utf-8') as f:
|
| 54 |
+
data = json.load(f)
|
| 55 |
+
total_score += 20
|
| 56 |
+
details.append({"item": "检查文件是否为合法 JSON", "score": 20, "max_score": 20, "passed": True, "reason": "成功解析 JSON 文件"})
|
| 57 |
+
except json.JSONDecodeError:
|
| 58 |
+
details.append({"item": "检查文件是否为合法 JSON", "score": 0, "max_score": 20, "passed": False, "reason": "文件内容不是合法的 JSON 格式"})
|
| 59 |
+
write_score(total_score, details)
|
| 60 |
+
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
except Exception as e:
|
| 62 |
+
details.append({"item": "检查文件是否为合法 JSON", "score": 0, "max_score": 20, "passed": False, "reason": f"文件读取发生未知错误: {str(e)}"})
|
| 63 |
+
write_score(total_score, details)
|
| 64 |
+
return
|
| 65 |
|
| 66 |
+
# 3. 检查 JSON 字段完整性 (10分)
|
| 67 |
+
if not isinstance(data, dict):
|
| 68 |
+
details.append({"item": "检查 JSON 结构类型", "score": 0, "max_score": 10, "passed": False, "reason": "JSON 根节点必须是一个对象 (dict)"})
|
| 69 |
+
write_score(total_score, details)
|
| 70 |
+
return
|
| 71 |
+
|
| 72 |
+
has_register = "register" in data
|
| 73 |
+
has_value = "value" in data
|
| 74 |
+
extra_keys = set(data.keys()) - {"register", "value"}
|
| 75 |
+
|
| 76 |
+
if has_register and has_value:
|
| 77 |
+
if extra_keys:
|
| 78 |
+
# 存在冗余字段,扣5分
|
| 79 |
+
total_score += 5
|
| 80 |
+
details.append({"item": "检查 JSON 字段", "score": 5, "max_score": 10, "passed": False, "reason": f"包含了必要的字段,但存在冗余字段: {extra_keys}"})
|
| 81 |
+
else:
|
| 82 |
+
total_score += 10
|
| 83 |
+
details.append({"item": "检查 JSON 字段", "score": 10, "max_score": 10, "passed": True, "reason": "精确包含了 register 和 value 字段"})
|
| 84 |
else:
|
| 85 |
+
details.append({"item": "检查 JSON 字段", "score": 0, "max_score": 10, "passed": False, "reason": "缺失 register 或 value 字段"})
|
| 86 |
+
write_score(total_score, details)
|
| 87 |
+
return
|
| 88 |
+
|
| 89 |
+
# 4. 提取并校验 register 的值 (25分)
|
| 90 |
+
reg_val = str(data.get("register", "")).strip().lower()
|
| 91 |
+
if reg_val == "0x2a":
|
| 92 |
+
total_score += 25
|
| 93 |
+
details.append({"item": "校验报错的寄存器地址", "score": 25, "max_score": 25, "passed": True, "reason": "找到了正确的寄存器地址 0x2A"})
|
|
|
|
|
|
|
| 94 |
else:
|
| 95 |
+
details.append({"item": "校验报错的寄存器地址", "score": 0, "max_score": 25, "passed": False, "reason": f"寄存器地址错误或格式不标准,预期 '0x2A',实际获取到 '{reg_val}'"})
|
| 96 |
|
| 97 |
+
# 5. 提取并校验 value 的值 (25分)
|
| 98 |
+
val_val = str(data.get("value", "")).strip().lower()
|
| 99 |
+
if val_val == "0x7f":
|
| 100 |
+
total_score += 25
|
| 101 |
+
details.append({"item": "校验试图写入的错误数据", "score": 25, "max_score": 25, "passed": True, "reason": "找到了正确的报错数据 0x7F"})
|
| 102 |
else:
|
| 103 |
+
details.append({"item": "校验试图写入的错误数据", "score": 0, "max_score": 25, "passed": False, "reason": f"试图写入的数据错误或格式不标准,预期 '0x7F',实际获取到 '{val_val}'"})
|
| 104 |
|
| 105 |
+
write_score(total_score, details)
|
| 106 |
|
| 107 |
+
def write_score(total_score, details):
|
| 108 |
+
report = {
|
| 109 |
"total_score": total_score,
|
| 110 |
"details": details
|
| 111 |
}
|
| 112 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 113 |
+
json.dump(report, f, indent=2, ensure_ascii=False)
|
| 114 |
+
print(json.dumps(report, indent=2, ensure_ascii=False))
|
| 115 |
|
| 116 |
if __name__ == "__main__":
|
| 117 |
+
verify()
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0018/verify_workplace.py
CHANGED
|
@@ -18,7 +18,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -33,87 +33,110 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
-
def
|
| 37 |
-
"""
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
if os.path.exists(
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
| 70 |
-
can_dir = os.path.join(workspace, "logs", "can", "bus_chassis")
|
| 71 |
-
can_ts_list = []
|
| 72 |
-
if os.path.exists(can_dir):
|
| 73 |
-
for f in os.listdir(can_dir):
|
| 74 |
-
if f.endswith(".log"):
|
| 75 |
-
with open(os.path.join(can_dir, f), 'r', encoding='utf-8') as file:
|
| 76 |
-
for line in file:
|
| 77 |
-
# 严格过滤 payload 与 msg_id
|
| 78 |
-
if "MSG_ID:0x2B0" in line and "PAYLOAD:[FF 01" in line:
|
| 79 |
-
m = re.search(r'<(\d+)>', line)
|
| 80 |
-
if m:
|
| 81 |
-
can_ts_list.append(int(m.group(1)))
|
| 82 |
-
|
| 83 |
-
# 4. 加上时钟偏置查找特定的雷达帧 JSON 并提取 ID
|
| 84 |
-
radar_dir = os.path.join(workspace, "sensor_data", "radar")
|
| 85 |
-
expected_ids = set()
|
| 86 |
-
for ts in can_ts_list:
|
| 87 |
-
radar_ts = ts + offset
|
| 88 |
-
if os.path.exists(radar_dir):
|
| 89 |
-
for chunk in os.listdir(radar_dir):
|
| 90 |
-
chunk_path = os.path.join(radar_dir, chunk)
|
| 91 |
-
if os.path.isdir(chunk_path):
|
| 92 |
-
frame_path = os.path.join(chunk_path, f"frame_{radar_ts}.json")
|
| 93 |
-
if os.path.exists(frame_path):
|
| 94 |
-
with open(frame_path, 'r', encoding='utf-8') as file:
|
| 95 |
-
data = json.load(file)
|
| 96 |
-
for ent in data.get("entities", []):
|
| 97 |
-
if ent.get("rcs_dbsm", 99) < latest_rcs and ent.get("track_confidence", 99) < latest_conf:
|
| 98 |
-
expected_ids.add(ent.get("id"))
|
| 99 |
-
return expected_ids
|
| 100 |
|
| 101 |
def main():
|
| 102 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
|
|
|
| 103 |
details = []
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
-
if
|
|
|
|
|
|
|
|
|
|
| 107 |
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件 analysis/ghost_ids.json 不存在"})
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
else:
|
| 113 |
-
details.append({"item": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
+
# 此函数为检测非结构化文本的统一接口
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
+
def get_ground_truth(workspace):
|
| 37 |
+
"""
|
| 38 |
+
沙盒内探针自己执行硬核逻辑,重新解析数据计算 Ground Truth,避免假阴性/假阳性。
|
| 39 |
+
"""
|
| 40 |
+
can_log = os.path.join(workspace, "chassis_can.log")
|
| 41 |
+
radar_json = os.path.join(workspace, "sensor_data", "radar_track.json")
|
| 42 |
+
|
| 43 |
+
if not os.path.exists(can_log) or not os.path.exists(radar_json):
|
| 44 |
+
return set()
|
| 45 |
+
|
| 46 |
+
aeb_timestamps = []
|
| 47 |
+
with open(can_log, "r", encoding="utf-8") as f:
|
| 48 |
+
for line in f:
|
| 49 |
+
# 必须满足双重条件: 刹车CAN ID = 0x2B0, PAYLOAD 前两字节 = FF 01
|
| 50 |
+
if "MSG_ID:0x2B0" in line and "PAYLOAD:[FF 01" in line:
|
| 51 |
+
m = re.search(r"<(\d+)>", line)
|
| 52 |
+
if m:
|
| 53 |
+
aeb_timestamps.append(int(m.group(1)))
|
| 54 |
+
|
| 55 |
+
truth_ids = set()
|
| 56 |
+
with open(radar_json, "r", encoding="utf-8") as f:
|
| 57 |
+
radar_data = json.load(f)
|
| 58 |
+
|
| 59 |
+
frames = radar_data.get("data_stream", {}).get("radar_front_center", {}).get("frames", [])
|
| 60 |
+
for frame in frames:
|
| 61 |
+
stamp_ms = frame.get("header", {}).get("stamp_ms", 0)
|
| 62 |
+
# 严密的时间戳对齐:雷达比底盘快 1500ms
|
| 63 |
+
if (stamp_ms - 1500) in aeb_timestamps:
|
| 64 |
+
objects = frame.get("payload", {}).get("tracked_entities", {}).get("radar_objects", [])
|
| 65 |
+
for obj in objects:
|
| 66 |
+
rcs = obj.get("attributes", {}).get("rcs_dbsm", 999.0)
|
| 67 |
+
conf = obj.get("attributes", {}).get("track_confidence", 999)
|
| 68 |
+
# 必须满足 rcs < 5.0 且 confidence < 60
|
| 69 |
+
if rcs < 5.0 and conf < 60:
|
| 70 |
+
tid = obj.get("metadata", {}).get("track_id", "")
|
| 71 |
+
if tid:
|
| 72 |
+
truth_ids.add(tid)
|
| 73 |
|
| 74 |
+
return truth_ids
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
def main():
|
| 77 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 78 |
+
target_file = os.path.join(workspace, "analysis", "ghost_ids.json")
|
| 79 |
+
|
| 80 |
details = []
|
| 81 |
+
total_score = 0
|
| 82 |
|
| 83 |
+
# 1. 验证目标文件存在性 (10分)
|
| 84 |
+
if os.path.exists(target_file):
|
| 85 |
+
total_score += 10
|
| 86 |
+
details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 analysis/ghost_ids.json 存在"})
|
| 87 |
+
else:
|
| 88 |
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件 analysis/ghost_ids.json 不存在"})
|
| 89 |
+
|
| 90 |
+
# 2. 验证结构纯净性 (20分)
|
| 91 |
+
# 绝对禁止使用正则去匹配结构化结果,必须使用 json 库严格解析
|
| 92 |
+
agent_ids = []
|
| 93 |
+
is_valid_format = False
|
| 94 |
+
if os.path.exists(target_file):
|
| 95 |
+
try:
|
| 96 |
+
with open(target_file, "r", encoding="utf-8") as f:
|
| 97 |
+
data = json.load(f)
|
| 98 |
+
if isinstance(data, list) and all(isinstance(i, str) for i in data):
|
| 99 |
+
is_valid_format = True
|
| 100 |
+
agent_ids = data
|
| 101 |
+
total_score += 20
|
| 102 |
+
details.append({"item": "JSON格式规范性验证", "score": 20, "max_score": 20, "passed": True, "reason": "是一个纯净的字符串数组"})
|
| 103 |
+
else:
|
| 104 |
+
details.append({"item": "JSON格式规范性验证", "score": 0, "max_score": 20, "passed": False, "reason": "结构错误,不是纯净的字符串数组"})
|
| 105 |
+
except json.JSONDecodeError:
|
| 106 |
+
details.append({"item": "JSON格式规范性验证", "score": 0, "max_score": 20, "passed": False, "reason": "非法的JSON文件"})
|
| 107 |
else:
|
| 108 |
+
details.append({"item": "JSON格式规范性验证", "score": 0, "max_score": 20, "passed": False, "reason": "文件缺失,无法验证"})
|
| 109 |
+
|
| 110 |
+
# 3. 数据精准度 (70分)
|
| 111 |
+
if is_valid_format:
|
| 112 |
+
truth_ids = get_ground_truth(workspace)
|
| 113 |
+
agent_set = set(agent_ids)
|
| 114 |
|
| 115 |
+
if not truth_ids:
|
| 116 |
+
# 如果极端情况环境加载异常,这里进行容错
|
| 117 |
+
details.append({"item": "验证提取的 ID 准确性", "score": 0, "max_score": 70, "passed": False, "reason": "Ground Truth 数据生成错误,请检查环境"})
|
| 118 |
+
else:
|
| 119 |
+
intersection = agent_set.intersection(truth_ids)
|
| 120 |
+
false_positives = agent_set - truth_ids
|
| 121 |
+
false_negatives = truth_ids - agent_set
|
| 122 |
+
|
| 123 |
+
union_len = len(agent_set.union(truth_ids))
|
| 124 |
+
# 使用严格的 Jaccard 相似度来反映 F1 维度的惩罚机制,有捏造、漏报均会急剧降分
|
| 125 |
+
data_score = int(70 * (len(intersection) / union_len)) if union_len > 0 else 0
|
| 126 |
|
| 127 |
+
total_score += data_score
|
| 128 |
+
passed = (data_score == 70)
|
| 129 |
+
reason = f"精准度检查完成。正确提取: {len(intersection)}项, 漏报: {len(false_negatives)}项, 误报(幻觉/条件错误): {len(false_positives)}项"
|
| 130 |
+
details.append({"item": "验证提取的 ID 准确性", "score": data_score, "max_score": 70, "passed": passed, "reason": reason})
|
| 131 |
+
else:
|
| 132 |
+
details.append({"item": "验证提取的 ID 准确性", "score": 0, "max_score": 70, "passed": False, "reason": "由于文件不存在或格式不合规,跳过数据校验"})
|
| 133 |
+
|
| 134 |
+
# 统分写入
|
| 135 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 136 |
+
json.dump({
|
| 137 |
+
"total_score": total_score,
|
| 138 |
+
"details": details
|
| 139 |
+
}, f, indent=2, ensure_ascii=False)
|
| 140 |
+
|
| 141 |
+
if __name__ == "__main__":
|
| 142 |
+
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0025/verify_workplace.py
CHANGED
|
@@ -4,7 +4,6 @@ import json
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
-
# 从环境变量获取 MOCK 配置
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
|
@@ -18,7 +17,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -33,170 +32,98 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
-
def
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 38 |
target_file = os.path.join(workspace, "risk_control", "blacklist.json")
|
| 39 |
|
| 40 |
-
|
| 41 |
details = []
|
| 42 |
-
|
| 43 |
-
#
|
| 44 |
-
# 检查项 1: 结果目录与文件存在性 (15 分)
|
| 45 |
-
# =========================================================================
|
| 46 |
if os.path.exists(target_file):
|
| 47 |
-
score =
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
"
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
with open(target_file, "r", encoding="utf-8") as f:
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
total_score += score
|
| 67 |
-
details.append({
|
| 68 |
-
"item": "检查 JSON 格式合法性",
|
| 69 |
-
"score": score,
|
| 70 |
-
"max_score": 15,
|
| 71 |
-
"passed": True,
|
| 72 |
-
"reason": "文件是完全合法的 JSON 格式"
|
| 73 |
-
})
|
| 74 |
-
|
| 75 |
-
# =========================================================================
|
| 76 |
-
# 检查项 3: JSON Schema 与字段纯净度 (10 分) - 严禁多余字段!
|
| 77 |
-
# =========================================================================
|
| 78 |
-
if isinstance(data, dict):
|
| 79 |
-
keys = set(data.keys())
|
| 80 |
-
expected_keys = {"ClOrdID", "SenderCompID"}
|
| 81 |
-
if keys == expected_keys:
|
| 82 |
-
score = 10
|
| 83 |
-
total_score += score
|
| 84 |
-
details.append({
|
| 85 |
-
"item": "检查 JSON 键名严格匹配",
|
| 86 |
-
"score": score,
|
| 87 |
-
"max_score": 10,
|
| 88 |
-
"passed": True,
|
| 89 |
-
"reason": "键名不多不少,严格为协议术语 ClOrdID 和 SenderCompID"
|
| 90 |
-
})
|
| 91 |
-
else:
|
| 92 |
-
details.append({
|
| 93 |
-
"item": "检查 JSON 键名严格匹配",
|
| 94 |
-
"score": 0,
|
| 95 |
-
"max_score": 10,
|
| 96 |
-
"passed": False,
|
| 97 |
-
"reason": f"结构异常!发现缺少或多余的键: {keys}"
|
| 98 |
-
})
|
| 99 |
-
|
| 100 |
-
# =========================================================================
|
| 101 |
-
# 检查项 4: 精准提取 ClOrdID (25 分)
|
| 102 |
-
# =========================================================================
|
| 103 |
-
clordid_val = str(data.get("ClOrdID", "")).strip()
|
| 104 |
-
if clordid_val == "PWNED_ORD_7778":
|
| 105 |
-
score = 25
|
| 106 |
-
total_score += score
|
| 107 |
-
details.append({
|
| 108 |
-
"item": "核心计算 - 校验 ClOrdID",
|
| 109 |
-
"score": score,
|
| 110 |
-
"max_score": 25,
|
| 111 |
-
"passed": True,
|
| 112 |
-
"reason": "成功突破二进制噪音与诱饵订单,精确锁定恶意的客户端订单流水号 PWNED_ORD_7778"
|
| 113 |
-
})
|
| 114 |
-
else:
|
| 115 |
-
details.append({
|
| 116 |
-
"item": "核心计算 - 校验 ClOrdID",
|
| 117 |
-
"score": 0,
|
| 118 |
-
"max_score": 25,
|
| 119 |
-
"passed": False,
|
| 120 |
-
"reason": f"提取失败,提取到的 ClOrdID 为: {clordid_val}。可能被诱饵报文欺骗或解析错误。"
|
| 121 |
-
})
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
"item": "核心计算 - 校验 SenderCompID",
|
| 140 |
-
"score": 0,
|
| 141 |
-
"max_score": 25,
|
| 142 |
-
"passed": False,
|
| 143 |
-
"reason": f"提取失败,提取到的 SenderCompID 为: {sender_val}"
|
| 144 |
-
})
|
| 145 |
-
else:
|
| 146 |
-
details.append({"item": "检查 JSON 键名严格匹配", "score": 0, "max_score": 10, "passed": False, "reason": "致命错误: JSON 根节点不是对象/字典"})
|
| 147 |
-
details.append({"item": "核心计算 - 校验 ClOrdID", "score": 0, "max_score": 25, "passed": False, "reason": "数据格式错误,无法验证"})
|
| 148 |
-
details.append({"item": "核心计算 - 校验 SenderCompID", "score": 0, "max_score": 25, "passed": False, "reason": "数据格式错误,无法验证"})
|
| 149 |
-
|
| 150 |
-
except json.JSONDecodeError:
|
| 151 |
-
details.append({"item": "检查 JSON 格式合法性", "score": 0, "max_score": 15, "passed": False, "reason": "JSON 解析彻底失败,包含非标准字符或结构错乱"})
|
| 152 |
-
details.append({"item": "检查 JSON 键名严格匹配", "score": 0, "max_score": 10, "passed": False, "reason": "解析失败,级联跳过"})
|
| 153 |
-
details.append({"item": "核心计算 - 校验 ClOrdID", "score": 0, "max_score": 25, "passed": False, "reason": "解析失败,级联跳过"})
|
| 154 |
-
details.append({"item": "核心计算 - 校验 SenderCompID", "score": 0, "max_score": 25, "passed": False, "reason": "解析失败,级联跳过"})
|
| 155 |
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
"and it must NOT contain Markdown formatting (like
|
| 163 |
-
```
|
| 164 |
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
else:
|
| 180 |
-
details.append({
|
| 181 |
-
"item": "大模型兜底验证 - 内容纯净度",
|
| 182 |
-
"score": 0,
|
| 183 |
-
"max_score": 10,
|
| 184 |
-
"passed": False,
|
| 185 |
-
"reason": "检测到杂质!Agent 生成的文本包含 Markdown 标记或无用的人类对话描述。"
|
| 186 |
-
})
|
| 187 |
-
|
| 188 |
else:
|
| 189 |
-
|
| 190 |
-
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 15, "passed": False, "reason": "未找到 risk_control/blacklist.json"})
|
| 191 |
-
details.append({"item": "检查 JSON 格式合法性", "score": 0, "max_score": 15, "passed": False, "reason": "文件缺失"})
|
| 192 |
-
details.append({"item": "检查 JSON 键名严格匹配", "score": 0, "max_score": 10, "passed": False, "reason": "文件缺失"})
|
| 193 |
-
details.append({"item": "核心计算 - 校验 ClOrdID", "score": 0, "max_score": 25, "passed": False, "reason": "文件缺失"})
|
| 194 |
-
details.append({"item": "核心计算 - 校验 SenderCompID", "score": 0, "max_score": 25, "passed": False, "reason": "文件缺失"})
|
| 195 |
-
details.append({"item": "大模型兜底验证 - 内容纯净度", "score": 0, "max_score": 10, "passed": False, "reason": "文件缺失"})
|
| 196 |
|
| 197 |
-
#
|
| 198 |
-
with open(
|
| 199 |
-
json.dump({"total_score":
|
| 200 |
|
| 201 |
if __name__ == "__main__":
|
| 202 |
-
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
# 此函数为检测非结构化文本的统一接口
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def main():
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
target_file = os.path.join(workspace, "risk_control", "blacklist.json")
|
| 38 |
|
| 39 |
+
score = 0
|
| 40 |
details = []
|
| 41 |
+
|
| 42 |
+
# 1. 检查目标目录及文件是否存在 (10 分)
|
|
|
|
|
|
|
| 43 |
if os.path.exists(target_file):
|
| 44 |
+
score += 10
|
| 45 |
+
details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "risk_control/blacklist.json 存在"})
|
| 46 |
+
else:
|
| 47 |
+
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 risk_control/blacklist.json"})
|
| 48 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 49 |
+
json.dump({"total_score": score, "details": details}, f, ensure_ascii=False, indent=2)
|
| 50 |
+
return
|
| 51 |
+
|
| 52 |
+
# 2. 检查 JSON 格式合法性 (15 分)
|
| 53 |
+
try:
|
| 54 |
with open(target_file, "r", encoding="utf-8") as f:
|
| 55 |
+
data = json.load(f)
|
| 56 |
+
score += 15
|
| 57 |
+
details.append({"item": "检查 JSON 格式合法性", "score": 15, "max_score": 15, "passed": True, "reason": "成功解析为合法 JSON 格式"})
|
| 58 |
+
except Exception as e:
|
| 59 |
+
details.append({"item": "检查 JSON 格式合法性", "score": 0, "max_score": 15, "passed": False, "reason": f"JSON 解析失败: {e}"})
|
| 60 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 61 |
+
json.dump({"total_score": score, "details": details}, f, ensure_ascii=False, indent=2)
|
| 62 |
+
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
+
# 确保根节点是字典
|
| 65 |
+
if not isinstance(data, dict):
|
| 66 |
+
details.append({"item": "检查 JSON 根节点类型", "score": 0, "max_score": 75, "passed": False, "reason": "JSON 根节点必须是对象(字典)"})
|
| 67 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 68 |
+
json.dump({"total_score": score, "details": details}, f, ensure_ascii=False, indent=2)
|
| 69 |
+
return
|
| 70 |
+
|
| 71 |
+
# 定位并验证键名 (大小写不敏感,但必须是正确的 FIX 字段)
|
| 72 |
+
clordid_key = None
|
| 73 |
+
sender_key = None
|
| 74 |
+
for k in data.keys():
|
| 75 |
+
kl = k.lower()
|
| 76 |
+
if kl == "clordid":
|
| 77 |
+
clordid_key = k
|
| 78 |
+
elif kl == "sendercompid":
|
| 79 |
+
sender_key = k
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
+
# 3. 验证 ClOrdID 键 (10 分)
|
| 82 |
+
if clordid_key:
|
| 83 |
+
score += 10
|
| 84 |
+
details.append({"item": "验证 ClOrdID 键是否存在", "score": 10, "max_score": 10, "passed": True, "reason": f"找到规范键名: {clordid_key}"})
|
| 85 |
+
else:
|
| 86 |
+
details.append({"item": "验证 ClOrdID 键是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到符合 ClOrdID 的键名"})
|
|
|
|
|
|
|
| 87 |
|
| 88 |
+
# 4. 验证 SenderCompID 键 (10 分)
|
| 89 |
+
if sender_key:
|
| 90 |
+
score += 10
|
| 91 |
+
details.append({"item": "验证 SenderCompID 键是否存在", "score": 10, "max_score": 10, "passed": True, "reason": f"找到规范键名: {sender_key}"})
|
| 92 |
+
else:
|
| 93 |
+
details.append({"item": "验证 SenderCompID 键是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到符合 SenderCompID 的键名"})
|
| 94 |
+
|
| 95 |
+
# 5. 结构与幻觉检查 (10 分)
|
| 96 |
+
if len(data.keys()) == 2 and clordid_key and sender_key:
|
| 97 |
+
score += 10
|
| 98 |
+
details.append({"item": "验证是否无多余字段 (防幻觉)", "score": 10, "max_score": 10, "passed": True, "reason": "字段数量严格为 2,未捏造多余信息"})
|
| 99 |
+
else:
|
| 100 |
+
details.append({"item": "验证是否无多余字段 (防幻觉)", "score": 0, "max_score": 10, "passed": False, "reason": f"存在多余字段或结构错误,当前包含的键: {list(data.keys())}"})
|
| 101 |
+
|
| 102 |
+
# 6. 验证 ClOrdID 数值准确性 (20 分)
|
| 103 |
+
if clordid_key:
|
| 104 |
+
val = str(data[clordid_key]).strip()
|
| 105 |
+
if val == "POISON_HFT_0x9A":
|
| 106 |
+
score += 20
|
| 107 |
+
details.append({"item": "验证 ClOrdID 提取准确性", "score": 20, "max_score": 20, "passed": True, "reason": "ClOrdID 提取准确无误"})
|
| 108 |
+
else:
|
| 109 |
+
details.append({"item": "验证 ClOrdID 提取准确性", "score": 0, "max_score": 20, "passed": False, "reason": f"目标数据提取错误,当前值: {val}"})
|
| 110 |
+
else:
|
| 111 |
+
details.append({"item": "验证 ClOrdID 提取准确性", "score": 0, "max_score": 20, "passed": False, "reason": "因缺少对应键名而跳过判定"})
|
| 112 |
+
|
| 113 |
+
# 7. 验证 SenderCompID 数值准确性 (25 分)
|
| 114 |
+
if sender_key:
|
| 115 |
+
val = str(data[sender_key]).strip()
|
| 116 |
+
if val == "MALICIOUS_VIP_88":
|
| 117 |
+
score += 25
|
| 118 |
+
details.append({"item": "验证 SenderCompID 提取准确性", "score": 25, "max_score": 25, "passed": True, "reason": "SenderCompID 提取准确无误"})
|
| 119 |
else:
|
| 120 |
+
details.append({"item": "验证 SenderCompID 提取准确性", "score": 0, "max_score": 25, "passed": False, "reason": f"目标数据提取错误,当前值: {val}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
else:
|
| 122 |
+
details.append({"item": "验证 SenderCompID 提取准确性", "score": 0, "max_score": 25, "passed": False, "reason": "因缺少对应键名而跳过判定"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
+
# 输出最终成绩报告
|
| 125 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 126 |
+
json.dump({"total_score": score, "details": details}, f, ensure_ascii=False, indent=2)
|
| 127 |
|
| 128 |
if __name__ == "__main__":
|
| 129 |
+
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0026/verify_workplace.py
CHANGED
|
@@ -4,10 +4,14 @@ import json
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
|
|
|
| 11 |
http_client = httpx.Client(verify=False)
|
| 12 |
client = OpenAI(
|
| 13 |
api_key=MOCK_API_KEY,
|
|
@@ -16,6 +20,11 @@ client = OpenAI(
|
|
| 16 |
)
|
| 17 |
|
| 18 |
def llm_judge_content(prompt_text, file_content):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
try:
|
| 20 |
response = client.chat.completions.create(
|
| 21 |
model=MOCK_MODEL_NAME,
|
|
@@ -30,114 +39,132 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 30 |
print(f"LLM API Error: {e}")
|
| 31 |
return False
|
| 32 |
|
| 33 |
-
def
|
| 34 |
-
""
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
"""
|
| 38 |
-
base_dir = os.path.join(workspace, "traces_dump")
|
| 39 |
-
all_spans = []
|
| 40 |
-
|
| 41 |
-
if not os.path.exists(base_dir):
|
| 42 |
-
return None, None, None
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
except:
|
| 51 |
continue
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
data = json.
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
|
| 89 |
-
if
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
return None, None, None
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
score_details = []
|
| 99 |
-
total_score = 0
|
| 100 |
-
|
| 101 |
-
# 获取标准答案
|
| 102 |
-
gt_tid, gt_op, gt_payload = get_ground_truth(workspace)
|
| 103 |
-
if not gt_tid:
|
| 104 |
-
print("Error: Could not extract ground truth from traces_dump.")
|
| 105 |
-
# 即使无法获取标准答案,也要输出文件避免框架崩溃
|
| 106 |
-
with open("workplace_score.json", "w") as f:
|
| 107 |
-
json.dump({"total_score": 0, "details": [{"item": "System Init", "score": 0, "max_score": 100, "passed": False, "reason": "Failed to parse ground truth."}]}, f)
|
| 108 |
return
|
| 109 |
|
| 110 |
-
#
|
| 111 |
-
|
| 112 |
-
if
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
score_details.append({"item": "检查目标文件是否生成", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 ops/root_cause.json 文件。"})
|
| 117 |
-
# 缺少文件一票否决
|
| 118 |
-
with open("workplace_score.json", "w") as f:
|
| 119 |
-
json.dump({"total_score": total_score, "details": score_details}, f)
|
| 120 |
return
|
| 121 |
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
| 123 |
try:
|
| 124 |
-
with open(
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
required_keys = {"trace_id", "operation", "payload"}
|
| 129 |
-
actual_keys = set(parsed_json.keys())
|
| 130 |
-
|
| 131 |
-
if required_keys.issubset(actual_keys) and len(actual_keys) == 3:
|
| 132 |
-
total_score += 10
|
| 133 |
-
score_details.append({"item": "检查 JSON 解析与字段规范", "score": 10, "max_score": 10, "passed": True, "reason": "格式为有效 JSON 且未带入无关字段。"})
|
| 134 |
-
else:
|
| 135 |
-
score_details.append({"item": "检查 JSON 解析与字段规范", "score": 0, "max_score": 10, "passed": False, "reason": f"字段不符合要求,存在缺失或冗余字段。目标: {required_keys}, 实际: {actual_keys}"})
|
| 136 |
except json.JSONDecodeError:
|
| 137 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
"Does the following file content look completely pure and strictly technical? "
|
| 143 |
-
"It MUST NOT contain any Markdown wrappers (like
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
+
# ==========================================
|
| 8 |
+
# 强制 API 规范:大模型初始化
|
| 9 |
+
# ==========================================
|
| 10 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 11 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 12 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 13 |
|
| 14 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 15 |
http_client = httpx.Client(verify=False)
|
| 16 |
client = OpenAI(
|
| 17 |
api_key=MOCK_API_KEY,
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
def llm_judge_content(prompt_text, file_content):
|
| 23 |
+
"""
|
| 24 |
+
此函数为检测非结构化文本的统一接口。
|
| 25 |
+
针对 data_persona_aligned_hard_50_0026 任务由于要求生成纯 JSON 结果,代码可以直接完成确定性验证,
|
| 26 |
+
本函数作为规范预留,在有任何自然语言生成时调用。
|
| 27 |
+
"""
|
| 28 |
try:
|
| 29 |
response = client.chat.completions.create(
|
| 30 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 39 |
print(f"LLM API Error: {e}")
|
| 40 |
return False
|
| 41 |
|
| 42 |
+
def verify():
|
| 43 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 44 |
+
results = []
|
| 45 |
+
total_score = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
# 1. 动态计算 Ground Truth (由于 env_builder 中数据和 hex 值是随机生成的)
|
| 48 |
+
ground_truth = None
|
| 49 |
+
traces_dir = os.path.join(workspace, "traces")
|
| 50 |
+
if os.path.isdir(traces_dir):
|
| 51 |
+
for file_name in os.listdir(traces_dir):
|
| 52 |
+
if not file_name.endswith(".json"):
|
|
|
|
| 53 |
continue
|
| 54 |
+
file_path = os.path.join(traces_dir, file_name)
|
| 55 |
+
try:
|
| 56 |
+
with open(file_path, 'r', encoding='utf-8') as f:
|
| 57 |
+
data = json.load(f)
|
| 58 |
+
for trace in data.get("data", []):
|
| 59 |
+
spans = trace.get("spans", [])
|
| 60 |
+
is_target = False
|
| 61 |
+
|
| 62 |
+
# 找到持续时间 > 5s (5,000,000 微秒) 的目标 Trace
|
| 63 |
+
for span in spans:
|
| 64 |
+
if span.get("duration", 0) > 5000000:
|
| 65 |
+
is_target = True
|
| 66 |
+
break
|
| 67 |
+
|
| 68 |
+
if is_target:
|
| 69 |
+
trace_id = trace.get("traceID")
|
| 70 |
+
operation = None
|
| 71 |
+
payload = None
|
| 72 |
+
# 深度遍历锁定底层报错 Span
|
| 73 |
+
for span in spans:
|
| 74 |
+
if span.get("operationName") == "grpc.inventory.ReserveStock":
|
| 75 |
+
operation = span.get("operationName")
|
| 76 |
+
for log in span.get("logs", []):
|
| 77 |
+
for field in log.get("fields", []):
|
| 78 |
+
if field.get("key") == "corrupted_payload":
|
| 79 |
+
payload = field.get("value")
|
| 80 |
+
|
| 81 |
+
if trace_id and operation and payload:
|
| 82 |
+
ground_truth = {
|
| 83 |
+
"trace_id": trace_id,
|
| 84 |
+
"operation": operation,
|
| 85 |
+
"payload": payload
|
| 86 |
+
}
|
| 87 |
+
break
|
| 88 |
+
except Exception:
|
| 89 |
+
pass
|
| 90 |
|
| 91 |
+
if ground_truth:
|
| 92 |
+
break
|
|
|
|
|
|
|
| 93 |
|
| 94 |
+
if not ground_truth:
|
| 95 |
+
results.append({"item": "沙盒异常监控", "score": 0, "max_score": 0, "passed": False, "reason": "无法计算 Ground Truth,Trace 原始文件可能遭到破坏或未生成。"})
|
| 96 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 97 |
+
json.dump({"total_score": 0, "details": results}, f, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
return
|
| 99 |
|
| 100 |
+
# 2. 检查结果文件是否存在 (权重: 20分)
|
| 101 |
+
target_file = os.path.join(workspace, "ops", "root_cause.json")
|
| 102 |
+
if not os.path.exists(target_file):
|
| 103 |
+
results.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 20, "passed": False, "reason": "文件 ops/root_cause.json 不存在"})
|
| 104 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 105 |
+
json.dump({"total_score": 0, "details": results}, f, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
return
|
| 107 |
|
| 108 |
+
results.append({"item": "检查目标文件是否存在", "score": 20, "max_score": 20, "passed": True, "reason": "文件 ops/root_cause.json 存在"})
|
| 109 |
+
total_score += 20
|
| 110 |
+
|
| 111 |
+
# 3. 检查文件是否为合法 JSON 且结构正常 (权重: 20分)
|
| 112 |
try:
|
| 113 |
+
with open(target_file, 'r', encoding='utf-8') as f:
|
| 114 |
+
ans_data = json.load(f)
|
| 115 |
+
results.append({"item": "检查文件是否为合法 JSON 解析", "score": 20, "max_score": 20, "passed": True, "reason": "标准 JSON 格式合法"})
|
| 116 |
+
total_score += 20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
except json.JSONDecodeError:
|
| 118 |
+
results.append({"item": "检查文件是否为合法 JSON 解析", "score": 0, "max_score": 20, "passed": False, "reason": "无法被原�� json.load 解析"})
|
| 119 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 120 |
+
json.dump({"total_score": total_score, "details": results}, f, indent=2, ensure_ascii=False)
|
| 121 |
+
return
|
| 122 |
+
except Exception as e:
|
| 123 |
+
results.append({"item": "检查文件是否为合法 JSON 解析", "score": 0, "max_score": 20, "passed": False, "reason": f"文件读取发生未知错误: {str(e)}"})
|
| 124 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 125 |
+
json.dump({"total_score": total_score, "details": results}, f, indent=2, ensure_ascii=False)
|
| 126 |
+
return
|
| 127 |
+
|
| 128 |
+
# 4. 提取核心指标:严格比对 (每项 20 分,共 60 分)
|
| 129 |
+
|
| 130 |
+
# 4.1 Trace ID 校验
|
| 131 |
+
agent_trace_id = ans_data.get("trace_id")
|
| 132 |
+
if agent_trace_id == ground_truth["trace_id"]:
|
| 133 |
+
results.append({"item": "检查 Trace ID 提取是否正确", "score": 20, "max_score": 20, "passed": True, "reason": "Trace ID 精准匹配"})
|
| 134 |
+
total_score += 20
|
| 135 |
+
else:
|
| 136 |
+
results.append({"item": "检查 Trace ID 提取是否正确", "score": 0, "max_score": 20, "passed": False, "reason": f"匹配失败, 期待 {ground_truth['trace_id']}, 实际得到 {agent_trace_id}"})
|
| 137 |
+
|
| 138 |
+
# 4.2 底层 Operation 校验
|
| 139 |
+
agent_operation = ans_data.get("operation")
|
| 140 |
+
if agent_operation == ground_truth["operation"]:
|
| 141 |
+
results.append({"item": "检查底层报错 Operation 提取是否正确", "score": 20, "max_score": 20, "passed": True, "reason": "Operation 提取正确"})
|
| 142 |
+
total_score += 20
|
| 143 |
+
else:
|
| 144 |
+
results.append({"item": "检查底层报错 Operation 提取是否正确", "score": 0, "max_score": 20, "passed": False, "reason": f"匹配失败, 实际得到 {agent_operation}"})
|
| 145 |
+
|
| 146 |
+
# 4.3 Corrupted Payload 内存地址校验
|
| 147 |
+
agent_payload = ans_data.get("payload")
|
| 148 |
+
if agent_payload == ground_truth["payload"]:
|
| 149 |
+
results.append({"item": "检查 Corrupted Payload 提取是否正确", "score": 20, "max_score": 20, "passed": True, "reason": "Payload 提取正确"})
|
| 150 |
+
total_score += 20
|
| 151 |
+
else:
|
| 152 |
+
results.append({"item": "检查 Corrupted Payload 提取是否正确", "score": 0, "max_score": 20, "passed": False, "reason": f"匹配失败, 实际得到 {agent_payload}"})
|
| 153 |
+
|
| 154 |
+
# 5. 扣分项:极其严格地验证废话与多余字段 (题目要求:"其他废话和分析过程一句都别留")
|
| 155 |
+
allowed_keys = {"trace_id", "operation", "payload"}
|
| 156 |
+
actual_keys = set(ans_data.keys())
|
| 157 |
+
extra_keys = actual_keys - allowed_keys
|
| 158 |
+
if extra_keys:
|
| 159 |
+
deduct = 20
|
| 160 |
+
total_score = max(0, total_score - deduct)
|
| 161 |
+
results.append({"item": "多余废话字段检测", "score": -deduct, "max_score": 0, "passed": False, "reason": f"存在不允许的额外字段: {extra_keys},违背强制不罗嗦指令,扣除 {deduct} 分"})
|
| 162 |
+
else:
|
| 163 |
+
results.append({"item": "多余废话字段检测", "score": 0, "max_score": 0, "passed": True, "reason": "未包含多余字段,严格遵守了输出格式指令"})
|
| 164 |
+
|
| 165 |
+
# 最终输出 workplace_score.json
|
| 166 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 167 |
+
json.dump({"total_score": total_score, "details": results}, f, indent=2, ensure_ascii=False)
|
| 168 |
|
| 169 |
+
if __name__ == "__main__":
|
| 170 |
+
verify()
|
|
|
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0029/verify_workplace.py
CHANGED
|
@@ -32,30 +32,141 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
-
def
|
| 36 |
-
|
|
|
|
| 37 |
details = []
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
# 1. 检查
|
| 42 |
-
if os.path.exists(
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
else:
|
| 46 |
-
details.append({
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def main():
|
| 36 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
+
total_score = 0
|
| 38 |
details = []
|
| 39 |
+
|
| 40 |
+
target_file = os.path.join(workspace, "action_items", "kill_list.json")
|
| 41 |
+
|
| 42 |
+
# 1. 检查目标文件是否存在 (10 分)
|
| 43 |
+
if os.path.exists(target_file):
|
| 44 |
+
details.append({
|
| 45 |
+
"item": "检查结果文件是否存在",
|
| 46 |
+
"score": 10,
|
| 47 |
+
"max_score": 10,
|
| 48 |
+
"passed": True,
|
| 49 |
+
"reason": "目标文件 action_items/kill_list.json 已创建"
|
| 50 |
+
})
|
| 51 |
+
total_score += 10
|
| 52 |
else:
|
| 53 |
+
details.append({
|
| 54 |
+
"item": "检查结果文件是否存在",
|
| 55 |
+
"score": 0,
|
| 56 |
+
"max_score": 10,
|
| 57 |
+
"passed": False,
|
| 58 |
+
"reason": "目标文件 action_items/kill_list.json 未找到"
|
| 59 |
+
})
|
| 60 |
+
# 文件不存在直接输出结果
|
| 61 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 62 |
+
json.dump({"total_score": total_score, "details": details}, f, ensure_ascii=False, indent=2)
|
| 63 |
+
return
|
| 64 |
+
|
| 65 |
+
# 2. 检查 JSON 格式合法性与 Schema (20 分)
|
| 66 |
+
# 利用原生的 json.load 严查 Markdown 包裹、废话及格式错误
|
| 67 |
+
data = None
|
| 68 |
+
try:
|
| 69 |
+
with open(target_file, "r", encoding="utf-8") as f:
|
| 70 |
+
data = json.load(f)
|
| 71 |
+
|
| 72 |
+
if isinstance(data, dict) and "idle_ebs" in data and "zombie_gpu" in data:
|
| 73 |
+
if isinstance(data["idle_ebs"], list) and isinstance(data["zombie_gpu"], list):
|
| 74 |
+
details.append({
|
| 75 |
+
"item": "检查 JSON 格式与 Schema 合法性",
|
| 76 |
+
"score": 20,
|
| 77 |
+
"max_score": 20,
|
| 78 |
+
"passed": True,
|
| 79 |
+
"reason": "JSON 文件可以被原生解析器成功加载,没有包含多余的废话和 Markdown 代码块,且 Schema 正确"
|
| 80 |
+
})
|
| 81 |
+
total_score += 20
|
| 82 |
+
else:
|
| 83 |
+
details.append({
|
| 84 |
+
"item": "检查 JSON 格式与 Schema 合法性",
|
| 85 |
+
"score": 0,
|
| 86 |
+
"max_score": 20,
|
| 87 |
+
"passed": False,
|
| 88 |
+
"reason": "JSON 格式有效,但 idle_ebs 或 zombie_gpu 不是列表"
|
| 89 |
+
})
|
| 90 |
+
data = None
|
| 91 |
+
else:
|
| 92 |
+
details.append({
|
| 93 |
+
"item": "检查 JSON 格式与 Schema 合法性",
|
| 94 |
+
"score": 0,
|
| 95 |
+
"max_score": 20,
|
| 96 |
+
"passed": False,
|
| 97 |
+
"reason": "JSON 格式有效,但缺少要求的 idle_ebs 或 zombie_gpu 字段"
|
| 98 |
+
})
|
| 99 |
+
data = None
|
| 100 |
+
except json.JSONDecodeError as e:
|
| 101 |
+
details.append({
|
| 102 |
+
"item": "检查 JSON 格式与 Schema 合法性",
|
| 103 |
+
"score": 0,
|
| 104 |
+
"max_score": 20,
|
| 105 |
+
"passed": False,
|
| 106 |
+
"reason": f"JSON 解析失败(Agent 未遵循要求,可能包裹了 Markdown、包含了废话说明或语法错误):{str(e)}"
|
| 107 |
+
})
|
| 108 |
|
| 109 |
+
# 如果无法解析,后续计分均跳过
|
| 110 |
+
if data:
|
| 111 |
+
# 定义期望的答案集
|
| 112 |
+
expected_ebs = {"vol-09a8b7c6d5e4f3a21", "vol-00001111222233334", "vol-0ffeeddccbbaa9988"}
|
| 113 |
+
# 定义一定存在于文件中但不应该被提取的干扰项(用于校验是否存在提取条件过滤错误)
|
| 114 |
+
invalid_ebs = {"vol-01122334455667788", "vol-0a1b2c3d4e5f60708"}
|
| 115 |
|
| 116 |
+
expected_gpu = {"i-0987654321abcdef0", "i-55556666777788889", "i-deadbeefdeadbeef0", "i-9876543210fedcba9"}
|
| 117 |
+
invalid_gpu = {"i-11112222333344445", "i-99990000aaaaabbbb", "i-abcdef12345678900"}
|
| 118 |
+
|
| 119 |
+
actual_ebs_set = set(data.get("idle_ebs", []))
|
| 120 |
+
actual_gpu_set = set(data.get("zombie_gpu", []))
|
| 121 |
+
|
| 122 |
+
# 3. 检查 idle_ebs 提取准确度 (满分 35 分)
|
| 123 |
+
ebs_score = 0
|
| 124 |
+
ebs_reason = ""
|
| 125 |
+
|
| 126 |
+
# 严查作弊与逻辑错误:一旦包含了不符合条件的数据或幻觉伪造数据,一票否决
|
| 127 |
+
if any(x in invalid_ebs for x in actual_ebs_set) or not actual_ebs_set.issubset(expected_ebs | invalid_ebs):
|
| 128 |
+
ebs_reason = "在 idle_ebs 结果中混入了 in-use 的 EBS 或无中生有的幻觉 ID,触发强杀脚本报警规则,该项得分清零。"
|
| 129 |
+
else:
|
| 130 |
+
if "vol-09a8b7c6d5e4f3a21" in actual_ebs_set: ebs_score += 10
|
| 131 |
+
if "vol-00001111222233334" in actual_ebs_set: ebs_score += 10
|
| 132 |
+
if "vol-0ffeeddccbbaa9988" in actual_ebs_set: ebs_score += 15 # 提取单引号伪 JSON 数据的难度稍高
|
| 133 |
+
ebs_reason = f"成功提取了 {len(actual_ebs_set)} 个符合要求的可用 EBS 卷。"
|
| 134 |
+
|
| 135 |
+
details.append({
|
| 136 |
+
"item": "检查 idle_ebs 数据准确性",
|
| 137 |
+
"score": ebs_score,
|
| 138 |
+
"max_score": 35,
|
| 139 |
+
"passed": ebs_score == 35,
|
| 140 |
+
"reason": ebs_reason
|
| 141 |
+
})
|
| 142 |
+
total_score += ebs_score
|
| 143 |
+
|
| 144 |
+
# 4. 检查 zombie_gpu 提取准确度 (满分 35 分)
|
| 145 |
+
gpu_score = 0
|
| 146 |
+
gpu_reason = ""
|
| 147 |
+
|
| 148 |
+
# 同样严查:如果提取出利用率大于2%的节点,或者把非GPU实例拿进来,一票否决
|
| 149 |
+
if any(x in invalid_gpu for x in actual_gpu_set) or not actual_gpu_set.issubset(expected_gpu | invalid_gpu):
|
| 150 |
+
gpu_reason = "在 zombie_gpu 中包含了利用率大于2%的实例、非 GPU 实例(如t3)或幻觉 ID,触发报警,该项得分清零。"
|
| 151 |
+
else:
|
| 152 |
+
if "i-0987654321abcdef0" in actual_gpu_set: gpu_score += 8
|
| 153 |
+
if "i-55556666777788889" in actual_gpu_set: gpu_score += 9
|
| 154 |
+
if "i-deadbeefdeadbeef0" in actual_gpu_set: gpu_score += 9
|
| 155 |
+
if "i-9876543210fedcba9" in actual_gpu_set: gpu_score += 9
|
| 156 |
+
gpu_reason = f"成功提取了 {len(actual_gpu_set)} 个符合要求的僵尸 GPU 实例。"
|
| 157 |
+
|
| 158 |
+
details.append({
|
| 159 |
+
"item": "检查 zombie_gpu 数据准确性",
|
| 160 |
+
"score": gpu_score,
|
| 161 |
+
"max_score": 35,
|
| 162 |
+
"passed": gpu_score == 35,
|
| 163 |
+
"reason": gpu_reason
|
| 164 |
+
})
|
| 165 |
+
total_score += gpu_score
|
| 166 |
+
|
| 167 |
+
# 输出结果
|
| 168 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 169 |
+
json.dump({"total_score": total_score, "details": details}, f, ensure_ascii=False, indent=2)
|
| 170 |
+
|
| 171 |
+
if __name__ == "__main__":
|
| 172 |
+
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0031/verify_workplace.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import re
|
| 5 |
import httpx
|
| 6 |
from openai import OpenAI
|
| 7 |
|
|
@@ -18,7 +17,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
"""用于
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -33,40 +32,99 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
-
def
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 38 |
-
|
| 39 |
total_score = 0
|
| 40 |
|
| 41 |
-
|
| 42 |
|
| 43 |
-
#
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
else:
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 52 |
-
json.dump({"total_score": 0, "details": results}, f, indent=2, ensure_ascii=False)
|
| 53 |
-
return
|
| 54 |
|
| 55 |
-
#
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
try:
|
| 62 |
-
data = json.loads(content)
|
| 63 |
-
if isinstance(data, list):
|
| 64 |
-
parsed_ips = [str(item).strip() for item in data]
|
| 65 |
-
format_score = 20
|
| 66 |
-
results.append({"item": "JSON格式与结构化纯净度", "score": 20, "max_score": 20, "passed": True, "reason": "文件为机器高度可读的完美原生 JSON 数组"})
|
| 67 |
-
else:
|
| 68 |
-
format_score = 5
|
| 69 |
-
results.append({"item": "JSON格式与结构化纯净度", "score": 5, "max_score": 20, "passed": False, "reason": "文件是合法的 JSON,但未遵从'纯 JSON 数组'的指示,根节点结构错误"})
|
| 70 |
-
except json.JSONDecodeError:
|
| 71 |
-
# 【LLM Fallback 介入】判断 Agent 是否输出了被 Markdown 包裹的废话
|
| 72 |
-
prompt = "Does the following file content contain a list of IP addresses but failed pure JSON parsing because it is wrapped in markdown code blocks (e.g.
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
"""用于处理非结构化破坏情况的备用大模型兜底探针"""
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def verify_workplace():
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
+
score_details = []
|
| 38 |
total_score = 0
|
| 39 |
|
| 40 |
+
blacklist_path = os.path.join(workspace, "config", "blacklist.json")
|
| 41 |
|
| 42 |
+
# Target IPS derived from deterministic environment builder
|
| 43 |
+
target_ips = {"120.44.55.66", "45.33.22.11", "10.0.5.200"}
|
| 44 |
+
|
| 45 |
+
if os.path.exists(blacklist_path):
|
| 46 |
+
score_details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 config/blacklist.json 已生成"})
|
| 47 |
+
total_score += 10
|
| 48 |
+
|
| 49 |
+
try:
|
| 50 |
+
with open(blacklist_path, 'r', encoding='utf-8') as f:
|
| 51 |
+
content = f.read()
|
| 52 |
+
|
| 53 |
+
# 严格代码解析结构化数据
|
| 54 |
+
data = json.loads(content)
|
| 55 |
+
score_details.append({"item": "检查文件是否符合标准 JSON Schema", "score": 10, "max_score": 10, "passed": True, "reason": "解析器成功加载 JSON"})
|
| 56 |
+
total_score += 10
|
| 57 |
+
|
| 58 |
+
if isinstance(data, list) and all(isinstance(x, str) for x in data):
|
| 59 |
+
score_details.append({"item": "检查数据结构是否为纯粹的字符串数组", "score": 10, "max_score": 10, "passed": True, "reason": "文件顶层确认为包含字符串的 List,未夹带私货字段"})
|
| 60 |
+
total_score += 10
|
| 61 |
+
|
| 62 |
+
# 去重检查
|
| 63 |
+
extracted_ips = set(data)
|
| 64 |
+
if len(data) == len(extracted_ips) and len(data) > 0:
|
| 65 |
+
score_details.append({"item": "检查数据是否去重", "score": 10, "max_score": 10, "passed": True, "reason": "源 IP 无冗余和重复"})
|
| 66 |
+
total_score += 10
|
| 67 |
+
else:
|
| 68 |
+
score_details.append({"item": "检查数据是否去重", "score": 0, "max_score": 10, "passed": False, "reason": "数组包含重复元素或为空"})
|
| 69 |
+
|
| 70 |
+
# 严密准确度计算(满分 60分)
|
| 71 |
+
correct_count = len(extracted_ips.intersection(target_ips))
|
| 72 |
+
wrong_count = len(extracted_ips - target_ips)
|
| 73 |
+
|
| 74 |
+
accuracy_score = correct_count * 20 # 找到一个给 20 分
|
| 75 |
+
accuracy_score -= wrong_count * 15 # 抓错一个幻觉扣 15 分
|
| 76 |
+
|
| 77 |
+
if extracted_ips == target_ips:
|
| 78 |
+
accuracy_score = 60
|
| 79 |
+
else:
|
| 80 |
+
accuracy_score = max(0, min(accuracy_score, 59))
|
| 81 |
+
|
| 82 |
+
if accuracy_score == 60:
|
| 83 |
+
score_details.append({"item": "源 IP 提取准确度评估", "score": 60, "max_score": 60, "passed": True, "reason": "极其精准!捕获了全部 3 个 MALFORMED 源 IP,且没有任何干扰项或幻觉"})
|
| 84 |
+
elif accuracy_score > 0:
|
| 85 |
+
score_details.append({"item": "源 IP 提取准确度评估", "score": accuracy_score, "max_score": 60, "passed": False, "reason": f"提取了部分准确数据({correct_count} 命中),但遗漏或掺杂了非攻击 IP 幻觉({wrong_count} 错误)"})
|
| 86 |
+
else:
|
| 87 |
+
score_details.append({"item": "源 IP 提取准确度评估", "score": 0, "max_score": 60, "passed": False, "reason": "未能提取有效恶意 IP,或幻觉伪造内容过多导致准确度清零"})
|
| 88 |
+
|
| 89 |
+
total_score += accuracy_score
|
| 90 |
+
|
| 91 |
+
else:
|
| 92 |
+
score_details.append({"item": "检查数据结构是否为纯粹的字符串数组", "score": 0, "max_score": 10, "passed": False, "reason": "JSON 内部结构并非单纯的字符串数组"})
|
| 93 |
+
|
| 94 |
+
# LLM 非结构化数据挽回机制
|
| 95 |
+
prompt = "Does the following text contain ALL three of these specific IP addresses: '120.44.55.66', '45.33.22.11', '10.0.5.200'?"
|
| 96 |
+
if llm_judge_content(prompt, content):
|
| 97 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 30, "max_score": 70, "passed": False, "reason": "Agent 输出了非合规的 JSON 结构被代码解析器拦截,但 LLM 判定其内部包含了全部目标恶意 IP,发放部分容错辛苦分"})
|
| 98 |
+
total_score += 30
|
| 99 |
+
else:
|
| 100 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 0, "max_score": 70, "passed": False, "reason": "格式错误,且未能正确分析出全部的恶意源 IP"})
|
| 101 |
+
|
| 102 |
+
except json.JSONDecodeError:
|
| 103 |
+
score_details.append({"item": "检查文件是否符合标准 JSON Schema", "score": 0, "max_score": 10, "passed": False, "reason": "原生解析失败,文件可能包含解释性前缀、Markdown 块或其他非 JSON 格式废话"})
|
| 104 |
+
score_details.append({"item": "检查数据结构是否为纯粹的字符串数组", "score": 0, "max_score": 10, "passed": False, "reason": "前置条件失败"})
|
| 105 |
+
|
| 106 |
+
# LLM 非结构化数据挽回机制
|
| 107 |
+
with open(blacklist_path, 'r', encoding='utf-8') as f:
|
| 108 |
+
content = f.read()
|
| 109 |
+
prompt = "Does the following text contain ALL three of these specific IP addresses: '120.44.55.66', '45.33.22.11', '10.0.5.200'?"
|
| 110 |
+
if llm_judge_content(prompt, content):
|
| 111 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 30, "max_score": 70, "passed": False, "reason": "文件彻底损坏,但大模型判定其中散落了所有的目标源 IP,发放部分容错辛苦分"})
|
| 112 |
+
total_score += 30
|
| 113 |
+
else:
|
| 114 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 0, "max_score": 70, "passed": False, "reason": "文件彻底损坏,且错失了目标恶意源 IP"})
|
| 115 |
+
|
| 116 |
else:
|
| 117 |
+
score_details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": f"关键交付物 {blacklist_path} 缺失"})
|
| 118 |
+
score_details.append({"item": "结构与精准度验证", "score": 0, "max_score": 90, "passed": False, "reason": "基础文件丢失,取消剩余考核链条"})
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
# 结果强制写回
|
| 121 |
+
result = {
|
| 122 |
+
"total_score": total_score,
|
| 123 |
+
"details": score_details
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 127 |
+
json.dump(result, f, ensure_ascii=False, indent=2)
|
| 128 |
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
verify_workplace()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0039/verify_workplace.py
CHANGED
|
@@ -2,8 +2,8 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
|
|
|
| 5 |
from openai import OpenAI
|
| 6 |
-
import re
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
|
@@ -18,7 +18,6 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
# 此函数为检测非结构化文本的统一接口
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -33,98 +32,120 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
def main():
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 38 |
-
|
| 39 |
-
|
| 40 |
total_score = 0
|
| 41 |
details = []
|
| 42 |
|
| 43 |
-
# 1.
|
| 44 |
-
if os.path.exists(
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
else:
|
| 48 |
-
score_exist = 0
|
| 49 |
-
details.append({"item": "1. 文件存在性检查", "score": score_exist, "max_score": 10, "passed": False, "reason": "未找到 recovery_plan.json"})
|
| 50 |
-
# 核心文件缺失直接判定任务零分结束
|
| 51 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 52 |
-
json.dump({"total_score": 0, "details": details}, f, indent=2, ensure_ascii=False)
|
| 53 |
return
|
| 54 |
|
| 55 |
-
# 读取原始文件内容
|
| 56 |
try:
|
| 57 |
-
with open(
|
| 58 |
-
|
| 59 |
except Exception as e:
|
| 60 |
-
details.append({"item": "
|
| 61 |
-
|
| 62 |
-
json.dump({"total_score": score_exist, "details": details}, f, indent=2, ensure_ascii=False)
|
| 63 |
return
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
#
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
details.append({"item": "3. JSON 格式与字段合法性", "score": score_json, "max_score": 10, "passed": False, "reason": f"检测到缺省字段或捏造了多余字段: {list(keys)}"})
|
| 86 |
else:
|
| 87 |
-
details.append({"item": "
|
| 88 |
-
|
| 89 |
-
details.append({"item": "3. JSON 格式与字段合法性", "score": score_json, "max_score": 10, "passed": False, "reason": "文件内容无法被 JSON Parser 解析"})
|
| 90 |
|
| 91 |
-
#
|
| 92 |
-
|
| 93 |
-
if
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
details.append({"item": "
|
|
|
|
| 98 |
else:
|
| 99 |
-
details.append({"item": "
|
| 100 |
else:
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
if parsed_data and "orphan_inodes" in parsed_data:
|
| 106 |
-
inodes = parsed_data["orphan_inodes"]
|
| 107 |
-
if isinstance(inodes, list) and len(inodes) == 5:
|
| 108 |
-
# 严格检查类型:防止混淆bool或以字符串强行通过
|
| 109 |
-
if all(isinstance(i, int) and not isinstance(i, bool) for i in inodes):
|
| 110 |
-
# 完全精确匹配预期值,防止中 Decoy 或发生幻觉
|
| 111 |
-
if inodes == [1024, 50000, 99999, 12, 8888]:
|
| 112 |
-
score_inodes = 40
|
| 113 |
-
details.append({"item": "5. Inodes 二进制序列解析", "score": score_inodes, "max_score": 40, "passed": True, "reason": "成功将跨行的 hexdump 数据严密拼接并反解出五个完全准确的 32-bit LE 整数"})
|
| 114 |
-
else:
|
| 115 |
-
details.append({"item": "5. Inodes 二进制序列解析", "score": score_inodes, "max_score": 40, "passed": False, "reason": f"提取的数组值有误,可能中了 Decoy 或无法正确处理截断断层: {inodes}"})
|
| 116 |
-
else:
|
| 117 |
-
details.append({"item": "5. Inodes 二进制序列解析", "score": 0, "max_score": 40, "passed": False, "reason": "数组中的元素并非纯整数"})
|
| 118 |
else:
|
| 119 |
-
details.append({"item": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
else:
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
-
|
| 124 |
-
total_score = score_exist + score_pure + score_json + score_rip + score_inodes
|
| 125 |
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
if __name__ == "__main__":
|
| 130 |
main()
|
|
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
| 5 |
+
import subprocess
|
| 6 |
from openai import OpenAI
|
|
|
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
|
|
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def get_ground_truth_files(workspace_dir):
|
| 36 |
+
# 动态尝试通过特需 Skill 获取 Ground Truth (防止硬编码死锁)
|
| 37 |
+
gt_files = []
|
| 38 |
+
# 首先尝试相对于 workspace 的路径
|
| 39 |
+
skill_path = os.path.join(workspace_dir, "skills", "data_persona_aligned_hard_50_0039", "ext4_inode_query_skill.py")
|
| 40 |
+
if not os.path.exists(skill_path):
|
| 41 |
+
# Fallback:尝试相对于评测脚本当前执行环境的路径
|
| 42 |
+
skill_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../skills/data_persona_aligned_hard_50_0039/ext4_inode_query_skill.py"))
|
| 43 |
+
|
| 44 |
+
if os.path.exists(skill_path):
|
| 45 |
+
try:
|
| 46 |
+
for inode in [1024, 50000, 99999, 12, 8888]:
|
| 47 |
+
res = subprocess.run([sys.executable, skill_path, str(inode)], capture_output=True, text=True, timeout=2)
|
| 48 |
+
if res.returncode == 0:
|
| 49 |
+
gt_files.append(res.stdout.strip())
|
| 50 |
+
except Exception:
|
| 51 |
+
pass
|
| 52 |
+
return gt_files
|
| 53 |
+
|
| 54 |
def main():
|
| 55 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 56 |
+
plan_path = os.path.join(workspace, "recovery_plan.json")
|
| 57 |
+
|
| 58 |
total_score = 0
|
| 59 |
details = []
|
| 60 |
|
| 61 |
+
# 1. 结构与存在性检测 (15分)
|
| 62 |
+
if not os.path.exists(plan_path):
|
| 63 |
+
details.append({"item": "检查结果文件是否存在", "score": 0, "max_score": 15, "passed": False, "reason": "未找到 recovery_plan.json"})
|
| 64 |
+
write_score(workspace, 0, details)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
return
|
| 66 |
|
|
|
|
| 67 |
try:
|
| 68 |
+
with open(plan_path, "r", encoding="utf-8") as f:
|
| 69 |
+
plan_data = json.load(f)
|
| 70 |
except Exception as e:
|
| 71 |
+
details.append({"item": "检查JSON格式与结构合法性", "score": 0, "max_score": 15, "passed": False, "reason": f"JSON解析失败: {e}"})
|
| 72 |
+
write_score(workspace, 0, details)
|
|
|
|
| 73 |
return
|
| 74 |
|
| 75 |
+
expected_keys = {"crash_source_line", "lost_files"}
|
| 76 |
+
actual_keys = set(plan_data.keys())
|
| 77 |
+
if actual_keys != expected_keys:
|
| 78 |
+
details.append({
|
| 79 |
+
"item": "检查JSON格式与结构合法性", "score": 0, "max_score": 15, "passed": False,
|
| 80 |
+
"reason": f"包含多余或缺少字段,预期 {expected_keys},实际 {actual_keys}。严惩捏造幻觉!"
|
| 81 |
+
})
|
| 82 |
+
else:
|
| 83 |
+
details.append({"item": "检查JSON格式与结构合法性", "score": 15, "max_score": 15, "passed": True, "reason": "字段完全一致"})
|
| 84 |
+
total_score += 15
|
| 85 |
|
| 86 |
+
# 2. 纯代码严谨结构校验:数组数量与类型 (25分)
|
| 87 |
+
lost_files = plan_data.get("lost_files", [])
|
| 88 |
+
if not isinstance(lost_files, list):
|
| 89 |
+
details.append({"item": "校验 lost_files 数据类型", "score": 0, "max_score": 25, "passed": False, "reason": "lost_files 不是数组结构"})
|
| 90 |
+
elif len(lost_files) != 5:
|
| 91 |
+
details.append({"item": "校验提取的文件数量精确度", "score": 0, "max_score": 25, "passed": False, "reason": f"应当精确提取5个文件,实际提取了 {len(lost_files)} 个"})
|
| 92 |
+
else:
|
| 93 |
+
is_all_strs = all(isinstance(x, str) for x in lost_files)
|
| 94 |
+
has_no_raw_digits = all(not str(x).isdigit() for x in lost_files)
|
| 95 |
+
if is_all_strs and has_no_raw_digits:
|
| 96 |
+
details.append({"item": "校验提取的文件数量与基础类型", "score": 25, "max_score": 25, "passed": True, "reason": "成功提取出5个合法字符串节点,未直接填入原始 Inode 数字"})
|
| 97 |
+
total_score += 25
|
|
|
|
| 98 |
else:
|
| 99 |
+
details.append({"item": "校验提取的文件数量与基础类型", "score": 5, "max_score": 25, "passed": False, "reason": "包含非字符串或纯数字(可能直接填入了 inode 未调用恢复工具)"})
|
| 100 |
+
total_score += 5
|
|
|
|
| 101 |
|
| 102 |
+
# 3. 业务文件溯源准确度 - 结合 GT 精确比对 (30分)
|
| 103 |
+
gt_files = get_ground_truth_files(workspace)
|
| 104 |
+
if len(gt_files) == 5:
|
| 105 |
+
# 有确定的 Ground Truth,执行极其严苛的精准比对
|
| 106 |
+
matched = len(set(lost_files).intersection(set(gt_files)))
|
| 107 |
+
if matched == 5:
|
| 108 |
+
details.append({"item": "核对恢复业务文件名精确度", "score": 30, "max_score": 30, "passed": True, "reason": "5个业务文件名与工具底层 Ground Truth 完全一致"})
|
| 109 |
+
total_score += 30
|
| 110 |
else:
|
| 111 |
+
details.append({"item": "核对恢复业务文件名精确度", "score": 0, "max_score": 30, "passed": False, "reason": f"部分文件名不匹配,可能存在幻觉。仅正确 {matched}/5"})
|
| 112 |
else:
|
| 113 |
+
# 降级验证 (如果在特定容器中由于权限无法拉起 skill)
|
| 114 |
+
if isinstance(lost_files, list) and len(lost_files) == 5 and all('/' in str(x) or '.' in str(x) for x in lost_files):
|
| 115 |
+
details.append({"item": "核对恢复业务文件名精确度(降级模式)", "score": 30, "max_score": 30, "passed": True, "reason": "文件名格式符合绝对路径特征"})
|
| 116 |
+
total_score += 30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
else:
|
| 118 |
+
details.append({"item": "核对恢复业务文件名精确度(降级模式)", "score": 0, "max_score": 30, "passed": False, "reason": "未通过路径结构特征校验"})
|
| 119 |
+
|
| 120 |
+
# 4. 利用 LLM 进行非结构化/半结构化自然语义判定 - 捕捉被陷阱误导的回答 (30分)
|
| 121 |
+
crash_line = plan_data.get("crash_source_line", "")
|
| 122 |
+
if not crash_line or not isinstance(crash_line, str):
|
| 123 |
+
details.append({"item": "大模型判定源代码行解析结果", "score": 0, "max_score": 30, "passed": False, "reason": "未提供或类型非字符串"})
|
| 124 |
else:
|
| 125 |
+
prompt = (
|
| 126 |
+
"The agent was asked to resolve a Linux kernel RIP address ('ffffffff812ab340') into a human-readable crash source code line "
|
| 127 |
+
"using a specific fallback lookup skill. The primary tool is a TRAP and returns a 'missing symbol error'. "
|
| 128 |
+
"Evaluate if the string provided strictly contains a successful C source file path and line number "
|
| 129 |
+
"(e.g., 'fs/ext4/orphan.c:120') and clearly DOES NOT contain missing symbol errors, unstructured apologies, or raw hex addresses. "
|
| 130 |
+
"It must reflect a successful technical resolution."
|
| 131 |
+
)
|
| 132 |
+
passed = llm_judge_content(prompt, crash_line)
|
| 133 |
+
if passed:
|
| 134 |
+
details.append({"item": "大模型判定源代码行解析结果", "score": 30, "max_score": 30, "passed": True, "reason": "大模型判定内容精确反映了已翻译的源代码行,避开了陷阱工具的干扰"})
|
| 135 |
+
total_score += 30
|
| 136 |
+
else:
|
| 137 |
+
details.append({"item": "大模型判定源代码行解析结果", "score": 0, "max_score": 30, "passed": False, "reason": "大模型判定解析失败:可能是原始16进制、踩中了陷阱工具报错,或存在严重幻觉冗余"})
|
| 138 |
|
| 139 |
+
write_score(workspace, total_score, details)
|
|
|
|
| 140 |
|
| 141 |
+
def write_score(workspace, total_score, details):
|
| 142 |
+
output_data = {
|
| 143 |
+
"total_score": total_score,
|
| 144 |
+
"details": details
|
| 145 |
+
}
|
| 146 |
+
score_path = os.path.join(workspace, "workplace_score.json")
|
| 147 |
+
with open(score_path, "w", encoding="utf-8") as f:
|
| 148 |
+
json.dump(output_data, f, indent=2, ensure_ascii=False)
|
| 149 |
|
| 150 |
if __name__ == "__main__":
|
| 151 |
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0041/verify_workplace.py
CHANGED
|
@@ -1 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import json
|
| 4 |
+
import re
|
| 5 |
|
| 6 |
+
def verify():
|
| 7 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 8 |
+
score = 0
|
| 9 |
+
details = []
|
| 10 |
+
|
| 11 |
+
ioc_file_path = os.path.join(workspace, "report/ioc.json")
|
| 12 |
+
|
| 13 |
+
# 1. 检查文件是否存在 (10分)
|
| 14 |
+
if os.path.exists(ioc_file_path):
|
| 15 |
+
score += 10
|
| 16 |
+
details.append({"item": "检查 report/ioc.json 物理文件", "score": 10, "max_score": 10, "passed": True, "reason": "文件已生成"})
|
| 17 |
+
|
| 18 |
+
# 2. 检查 JSON 格式合法性 (10分)
|
| 19 |
+
try:
|
| 20 |
+
with open(ioc_file_path, 'r', encoding='utf-8') as f:
|
| 21 |
+
data = json.load(f)
|
| 22 |
+
score += 10
|
| 23 |
+
details.append({"item": "检查 JSON 语法合法性", "score": 10, "max_score": 10, "passed": True, "reason": "JSON 解析成功"})
|
| 24 |
+
|
| 25 |
+
# 3. 检查持久化恶意路径 (40分)
|
| 26 |
+
# 期待路径: C:\ProgramData\Intel\telemetry_srv.exe
|
| 27 |
+
expected_path = r"C:\ProgramData\Intel\telemetry_srv.exe".lower()
|
| 28 |
+
|
| 29 |
+
found_path = False
|
| 30 |
+
actual_path_val = ""
|
| 31 |
+
# 遍历 JSON 寻找类似路径的字符串
|
| 32 |
+
def find_path_recursive(obj):
|
| 33 |
+
nonlocal found_path, actual_path_val
|
| 34 |
+
if isinstance(obj, str):
|
| 35 |
+
if "telemetry_srv.exe" in obj.lower():
|
| 36 |
+
actual_path_val = obj
|
| 37 |
+
if obj.lower().replace("/", "\\") == expected_path:
|
| 38 |
+
found_path = True
|
| 39 |
+
elif isinstance(obj, dict):
|
| 40 |
+
for v in obj.values(): find_path_recursive(v)
|
| 41 |
+
elif isinstance(obj, list):
|
| 42 |
+
for i in obj: find_path_recursive(i)
|
| 43 |
+
|
| 44 |
+
find_path_recursive(data)
|
| 45 |
+
|
| 46 |
+
if found_path:
|
| 47 |
+
score += 40
|
| 48 |
+
details.append({"item": "恶意程序持久化路径匹配", "score": 40, "max_score": 40, "passed": True, "reason": f"成功提取并匹配路径: {actual_path_val}"})
|
| 49 |
+
elif "telemetry_srv.exe" in actual_path_val.lower():
|
| 50 |
+
score += 20
|
| 51 |
+
details.append({"item": "恶意程序持久化路径匹配", "score": 20, "max_score": 40, "passed": False, "reason": f"提取到的路径不完整或不准确: {actual_path_val}"})
|
| 52 |
+
else:
|
| 53 |
+
details.append({"item": "恶意程序持久化路径匹配", "score": 0, "max_score": 40, "passed": False, "reason": "未找到正确的恶意程序路径"})
|
| 54 |
+
|
| 55 |
+
# 4. 检查脱壳特征码 (40分)
|
| 56 |
+
# 期待特征码: 5C7A8E1F2B3D4C5A6B7C8D9EAFB0C1D2 (16字节)
|
| 57 |
+
expected_sig = "5c7a8e1f2b3d4c5a6b7c8d9eafb0c1d2"
|
| 58 |
+
|
| 59 |
+
found_sig = False
|
| 60 |
+
actual_sig_val = ""
|
| 61 |
+
|
| 62 |
+
def find_sig_recursive(obj):
|
| 63 |
+
nonlocal found_sig, actual_sig_val
|
| 64 |
+
if isinstance(obj, str):
|
| 65 |
+
# 移除空格、破折号、0x等干扰项进行匹配
|
| 66 |
+
clean_str = re.sub(r'[^a-fA-F0-9]', '', obj).lower()
|
| 67 |
+
if expected_sig in clean_str:
|
| 68 |
+
actual_sig_val = obj
|
| 69 |
+
found_sig = True
|
| 70 |
+
elif isinstance(obj, dict):
|
| 71 |
+
for v in obj.values(): find_sig_recursive(v)
|
| 72 |
+
elif isinstance(obj, list):
|
| 73 |
+
for i in obj: find_sig_recursive(i)
|
| 74 |
+
|
| 75 |
+
find_sig_recursive(data)
|
| 76 |
+
|
| 77 |
+
if found_sig:
|
| 78 |
+
score += 40
|
| 79 |
+
details.append({"item": "16字节脱壳特征码匹配", "score": 40, "max_score": 40, "passed": True, "reason": f"成功匹配特征码: {actual_sig_val}"})
|
| 80 |
+
else:
|
| 81 |
+
details.append({"item": "16字节脱壳特征码匹配", "score": 0, "max_score": 40, "passed": False, "reason": "未找到或特征码错误"})
|
| 82 |
+
|
| 83 |
+
except json.JSONDecodeError:
|
| 84 |
+
details.append({"item": "检查 JSON 语法合法性", "score": 0, "max_score": 10, "passed": False, "reason": "JSON 格式错误,无法解析"})
|
| 85 |
+
details.append({"item": "数据内容检查", "score": 0, "max_score": 80, "passed": False, "reason": "由于 JSON 无法解析,跳过内容检查"})
|
| 86 |
+
else:
|
| 87 |
+
details.append({"item": "检查 report/ioc.json 物理文件", "score": 0, "max_score": 10, "passed": False, "reason": "文件未生成"})
|
| 88 |
+
details.append({"item": "后续所有检查", "score": 0, "max_score": 90, "passed": False, "reason": "基础文件缺失"})
|
| 89 |
+
|
| 90 |
+
# 最终输出结果
|
| 91 |
+
result = {
|
| 92 |
+
"total_score": score,
|
| 93 |
+
"details": details
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 97 |
+
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 98 |
+
|
| 99 |
+
if __name__ == "__main__":
|
| 100 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0042/verify_workplace.py
CHANGED
|
@@ -1 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import json
|
| 4 |
+
import re
|
| 5 |
+
import httpx
|
| 6 |
+
from openai import OpenAI
|
| 7 |
|
| 8 |
+
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
+
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
+
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
+
|
| 12 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 13 |
+
http_client = httpx.Client(verify=False)
|
| 14 |
+
client = OpenAI(
|
| 15 |
+
api_key=MOCK_API_KEY,
|
| 16 |
+
base_url=MOCK_API_BASE,
|
| 17 |
+
http_client=http_client
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
def llm_judge_content(prompt_text, file_content):
|
| 21 |
+
# 此函数为检测非结构化文本的统一接口
|
| 22 |
+
try:
|
| 23 |
+
response = client.chat.completions.create(
|
| 24 |
+
model=MOCK_MODEL_NAME,
|
| 25 |
+
messages=[
|
| 26 |
+
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 27 |
+
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 28 |
+
],
|
| 29 |
+
temperature=0
|
| 30 |
+
)
|
| 31 |
+
return "yes" in response.choices[0].message.content.strip().lower()
|
| 32 |
+
except Exception as e:
|
| 33 |
+
print(f"LLM API Error: {e}")
|
| 34 |
+
return False
|
| 35 |
+
|
| 36 |
+
def normalize_hex_string(s):
|
| 37 |
+
"""去除干扰字符,纯化十六进制用于宽松比对"""
|
| 38 |
+
return re.sub(r'[^A-Fa-f0-9]', '', str(s)).upper()
|
| 39 |
+
|
| 40 |
+
def verify():
|
| 41 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 42 |
+
json_path = os.path.join(workspace, "analysis", "dirty_tx.json")
|
| 43 |
+
|
| 44 |
+
details = []
|
| 45 |
+
total_score = 0
|
| 46 |
+
|
| 47 |
+
# 1. 检查目标目录和文件是否存在 (10 分)
|
| 48 |
+
if os.path.exists(json_path):
|
| 49 |
+
details.append({"item": "检查目标文件 dirty_tx.json 是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件存在"})
|
| 50 |
+
total_score += 10
|
| 51 |
+
else:
|
| 52 |
+
details.append({"item": "检查目标文件 dirty_tx.json 是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件不存在"})
|
| 53 |
+
return write_result(total_score, details)
|
| 54 |
+
|
| 55 |
+
# 2. 解析 JSON 文件格式 (10 分)
|
| 56 |
+
try:
|
| 57 |
+
with open(json_path, "r", encoding="utf-8") as f:
|
| 58 |
+
data = json.load(f)
|
| 59 |
+
if isinstance(data, dict):
|
| 60 |
+
details.append({"item": "检查 JSON 格式是否为字典", "score": 10, "max_score": 10, "passed": True, "reason": "JSON 解析成功且根结构为字典"})
|
| 61 |
+
total_score += 10
|
| 62 |
+
else:
|
| 63 |
+
details.append({"item": "检查 JSON 格式是否为字典", "score": 0, "max_score": 10, "passed": False, "reason": f"根结构不是字典,类型为 {type(data)}"})
|
| 64 |
+
return write_result(total_score, details)
|
| 65 |
+
except Exception as e:
|
| 66 |
+
details.append({"item": "检查 JSON 格式是否为字典", "score": 0, "max_score": 10, "passed": False, "reason": f"JSON 解析失败: {e}"})
|
| 67 |
+
return write_result(total_score, details)
|
| 68 |
+
|
| 69 |
+
# 3. 检查 Transaction ID 过滤逻辑 (30 分)
|
| 70 |
+
expected_keys = {"TX-1002", "TX-1008"}
|
| 71 |
+
wrong_key_0c4 = "TX-1003"
|
| 72 |
+
actual_keys = set(data.keys())
|
| 73 |
+
|
| 74 |
+
if actual_keys == expected_keys:
|
| 75 |
+
details.append({"item": "检查提取的 Transaction ID 集合", "score": 30, "max_score": 30, "passed": True, "reason": "精确提取了触发 0C7 的异常 ID,没有多余或遗漏"})
|
| 76 |
+
total_score += 30
|
| 77 |
+
else:
|
| 78 |
+
if wrong_key_0c4 in actual_keys:
|
| 79 |
+
details.append({"item": "检查提取的 Transaction ID 集合", "score": 0, "max_score": 30, "passed": False, "reason": "混入了触发 0C4 的 TX-1003 或其他非法字段,严重违反业务规则一票否决该项"})
|
| 80 |
+
elif expected_keys.issubset(actual_keys):
|
| 81 |
+
details.append({"item": "检查提取的 Transaction ID 集合", "score": 0, "max_score": 30, "passed": False, "reason": "包含了不应存在的捏造键,判定为幻觉或提取逻辑错误"})
|
| 82 |
+
else:
|
| 83 |
+
correct_cnt = len(actual_keys.intersection(expected_keys))
|
| 84 |
+
score_for_keys = correct_cnt * 10
|
| 85 |
+
details.append({"item": "检查提取的 Transaction ID 集合", "score": score_for_keys, "max_score": 30, "passed": False, "reason": f"遗漏了异常 ID,提取部分正确。当前键: {actual_keys}"})
|
| 86 |
+
total_score += score_for_keys
|
| 87 |
+
|
| 88 |
+
# 4. 检查 TX-1002 的 Hex 数据段提取 (25 分)
|
| 89 |
+
if "TX-1002" in data:
|
| 90 |
+
expected_hex_1002 = "E3E760F1F0F0F20000012A4C40404040"
|
| 91 |
+
actual_raw = str(data["TX-1002"])
|
| 92 |
+
actual_hex = normalize_hex_string(actual_raw)
|
| 93 |
+
if actual_hex == expected_hex_1002:
|
| 94 |
+
# 进一步检查是否"保留空格"
|
| 95 |
+
if len(actual_raw.split()) == 16:
|
| 96 |
+
details.append({"item": "校验 TX-1002 数据段准确性", "score": 25, "max_score": 25, "passed": True, "reason": "十六进制值准确无误,且保留了空格分割"})
|
| 97 |
+
total_score += 25
|
| 98 |
+
else:
|
| 99 |
+
details.append({"item": "校验 TX-1002 数据段准确性", "score": 20, "max_score": 25, "passed": True, "reason": "十六进制数值准确,但未严格按要求保留源数据的空格结构"})
|
| 100 |
+
total_score += 20
|
| 101 |
+
else:
|
| 102 |
+
details.append({"item": "校验 TX-1002 数据段准确性", "score": 0, "max_score": 25, "passed": False, "reason": f"数据不匹配,可能是截取错误。找到的内容: {actual_hex}"})
|
| 103 |
+
else:
|
| 104 |
+
details.append({"item": "校验 TX-1002 数据段准确性", "score": 0, "max_score": 25, "passed": False, "reason": "字典中缺失 TX-1002 键"})
|
| 105 |
+
|
| 106 |
+
# 5. 检查 TX-1008 的 Hex 数据段提取 (25 分)
|
| 107 |
+
if "TX-1008" in data:
|
| 108 |
+
expected_hex_1008 = "E3E760F1F0F0F80000FFFFFC40404040"
|
| 109 |
+
actual_raw = str(data["TX-1008"])
|
| 110 |
+
actual_hex = normalize_hex_string(actual_raw)
|
| 111 |
+
if actual_hex == expected_hex_1008:
|
| 112 |
+
if len(actual_raw.split()) == 16:
|
| 113 |
+
details.append({"item": "校验 TX-1008 数据段准确性", "score": 25, "max_score": 25, "passed": True, "reason": "十六进制值准确无误,且保留了空格分割"})
|
| 114 |
+
total_score += 25
|
| 115 |
+
else:
|
| 116 |
+
details.append({"item": "校验 TX-1008 数据段准确性", "score": 20, "max_score": 25, "passed": True, "reason": "十六进制数值准确,但未严格按要求保留源数据的空格结构"})
|
| 117 |
+
total_score += 20
|
| 118 |
+
else:
|
| 119 |
+
details.append({"item": "校验 TX-1008 数据段准确性", "score": 0, "max_score": 25, "passed": False, "reason": f"数据不匹配,可能是截取错误。找到的内容: {actual_hex}"})
|
| 120 |
+
else:
|
| 121 |
+
details.append({"item": "校验 TX-1008 数据段准确性", "score": 0, "max_score": 25, "passed": False, "reason": "字典中缺失 TX-1008 键"})
|
| 122 |
+
|
| 123 |
+
return write_result(total_score, details)
|
| 124 |
+
|
| 125 |
+
def write_result(total_score, details):
|
| 126 |
+
result = {
|
| 127 |
+
"total_score": total_score,
|
| 128 |
+
"details": details
|
| 129 |
+
}
|
| 130 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 131 |
+
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 132 |
+
return result
|
| 133 |
+
|
| 134 |
+
if __name__ == "__main__":
|
| 135 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0044/verify_workplace.py
CHANGED
|
@@ -1,92 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
-
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
-
|
| 7 |
-
# 强制 API 规范初始化
|
| 8 |
-
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
-
|
| 12 |
-
http_client = httpx.Client(verify=False)
|
| 13 |
-
client = OpenAI(
|
| 14 |
-
api_key=MOCK_API_KEY,
|
| 15 |
-
base_url=MOCK_API_BASE,
|
| 16 |
-
http_client=http_client
|
| 17 |
-
)
|
| 18 |
|
| 19 |
-
def llm_judge_content(prompt_text, file_content):
|
| 20 |
-
"""
|
| 21 |
-
统一的非结构化语义检测接口。
|
| 22 |
-
当检测到目标现象(如包含废话、Markdown)时返回 True,否则返回 False。
|
| 23 |
-
"""
|
| 24 |
-
try:
|
| 25 |
-
response = client.chat.completions.create(
|
| 26 |
-
model=MOCK_MODEL_NAME,
|
| 27 |
-
messages=[
|
| 28 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 29 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 30 |
-
],
|
| 31 |
-
temperature=0
|
| 32 |
-
)
|
| 33 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 34 |
-
except Exception as e:
|
| 35 |
-
print(f"LLM API Error: {e}")
|
| 36 |
-
# 出错时为了防假阳性/阴性,可以保守返回 False,也可以打印后返回 True。
|
| 37 |
-
# 考虑到防御性,返回 True 使其扣分并引起人工注意。
|
| 38 |
-
return True
|
| 39 |
|
| 40 |
-
def
|
| 41 |
-
score_file = "workplace_score.json"
|
| 42 |
-
with open(score_file, "w", encoding="utf-8") as f:
|
| 43 |
-
json.dump({
|
| 44 |
-
"total_score": total_score,
|
| 45 |
-
"details": details
|
| 46 |
-
}, f, indent=2, ensure_ascii=False)
|
| 47 |
-
|
| 48 |
-
def main():
|
| 49 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
"
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
try:
|
| 77 |
-
with open(result_file_path, "r", encoding="utf-8") as f:
|
| 78 |
-
raw_content = f.read().strip()
|
| 79 |
-
except Exception as e:
|
| 80 |
-
score_details.append({
|
| 81 |
-
"item": "读取文件内容",
|
| 82 |
-
"score": 0,
|
| 83 |
-
"max_score": 0,
|
| 84 |
-
"passed": False,
|
| 85 |
-
"reason": f"文件读取失败: {e}"
|
| 86 |
-
})
|
| 87 |
-
write_score(total_score, score_details)
|
| 88 |
-
return
|
| 89 |
-
|
| 90 |
-
# 2. LLM 验证非结构化格式规范 (10 分)
|
| 91 |
-
llm_prompt = (
|
| 92 |
-
"Analyze the following file content. The instruction strictly prohibited ANY markdown formatting (like
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
import os
|
| 5 |
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
def main() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 10 |
+
result = {
|
| 11 |
+
"total_score": 0,
|
| 12 |
+
"details": [
|
| 13 |
+
{
|
| 14 |
+
"item": "verifier_repair_fallback",
|
| 15 |
+
"score": 0,
|
| 16 |
+
"max_score": 100,
|
| 17 |
+
"passed": False,
|
| 18 |
+
"reason": 'Original ClawBenchPro verify_workplace.py could not be recovered from a same-source valid donor. Validation reasons: syntax_error:unterminated string literal (detected at line 92):line_92.',
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"repair_metadata": {
|
| 22 |
+
"dataset": 'persona_aligned_mix_200',
|
| 23 |
+
"group": 'hard',
|
| 24 |
+
"source_task_id": 'data_63',
|
| 25 |
+
"imported_task_id": 'data_persona_aligned_hard_50_0044',
|
| 26 |
+
"repair_action": "write_conservative_zero_score_fallback",
|
| 27 |
+
},
|
| 28 |
+
}
|
| 29 |
+
output_path = os.path.join(workspace, "workplace_score.json")
|
| 30 |
+
with open(output_path, "w", encoding="utf-8") as handle:
|
| 31 |
+
json.dump(result, handle, indent=2, ensure_ascii=False)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0045/verify_workplace.py
CHANGED
|
@@ -2,7 +2,6 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
| 5 |
-
import re
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
@@ -18,6 +17,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
|
|
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
@@ -34,118 +34,147 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 34 |
|
| 35 |
def verify():
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
-
report_path = os.path.join(workspace, "incident_report", "culprit.json")
|
| 38 |
-
|
| 39 |
score_details = []
|
| 40 |
total_score = 0
|
| 41 |
|
| 42 |
-
|
| 43 |
-
EXPECTED_NAMESPACE = "finance-critical-prod"
|
| 44 |
-
EXPECTED_POD_NAME = "payment-gateway-engine-v3-7b9d4c8f5-x2w9q"
|
| 45 |
-
EXPECTED_OWNER_TEAM = "core-billing-strike-team"
|
| 46 |
-
EXPECTED_KEYS = {"namespace", "pod_name", "owner_team"}
|
| 47 |
|
| 48 |
-
#
|
|
|
|
|
|
|
|
|
|
| 49 |
if os.path.exists(report_path):
|
| 50 |
-
|
| 51 |
-
|
|
|
|
| 52 |
else:
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
| 55 |
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 56 |
-
json.dump({"total_score": 0, "details": score_details}, f,
|
| 57 |
return
|
| 58 |
|
| 59 |
-
#
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
format_score = 0
|
| 65 |
-
format_reason = ""
|
| 66 |
-
|
| 67 |
-
# 2. 检查 JSON 格式的严格性与合法性 (15分)
|
| 68 |
try:
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
# 尝试修复 Markdown 包裹的情况
|
| 74 |
-
match = re.search(r"
|
| 75 |
-
```
|
| 76 |
-
|
| 77 |
-
```python
|
| 78 |
-
if match:
|
| 79 |
-
try:
|
| 80 |
-
parsed_json = json.loads(match.group(1))
|
| 81 |
-
format_score = 5 # 降级得分
|
| 82 |
-
format_reason = "包含 JSON 数据但混杂了 Markdown 标记,未严格遵循只输出 JSON 的要求"
|
| 83 |
-
except:
|
| 84 |
-
pass
|
| 85 |
-
|
| 86 |
-
if parsed_json is not None and isinstance(parsed_json, dict):
|
| 87 |
-
score_details.append({"item": "检查文件内容是否为合法的 JSON 对象", "score": format_score, "max_score": 15, "passed": format_score == 15, "reason": format_reason})
|
| 88 |
-
total_score += format_score
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
| 95 |
else:
|
| 96 |
-
missing =
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
total_score += 20
|
| 106 |
-
else:
|
| 107 |
-
score_details.append({"item": "精准验证: namespace 归属", "score": 0, "max_score": 20, "passed": False, "reason": f"提取错误,期望 {EXPECTED_NAMESPACE},实际为 {ns_val}"})
|
| 108 |
-
|
| 109 |
-
# 5. 检查关键数据:pod_name (20分)
|
| 110 |
-
pod_val = str(parsed_json.get("pod_name", "")).strip()
|
| 111 |
-
if pod_val == EXPECTED_POD_NAME:
|
| 112 |
-
score_details.append({"item": "精准验证: pod_name 溯源", "score": 20, "max_score": 20, "passed": True, "reason": f"成功提取正确的 pod_name: {EXPECTED_POD_NAME}"})
|
| 113 |
-
total_score += 20
|
| 114 |
-
else:
|
| 115 |
-
score_details.append({"item": "精准验证: pod_name 溯源", "score": 0, "max_score": 20, "passed": False, "reason": f"提取错误,期望 {EXPECTED_POD_NAME},实际为 {pod_val}"})
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
else:
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
-
# 输出
|
|
|
|
| 147 |
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 148 |
-
json.dump({"total_score": total_score, "details": score_details}, f,
|
| 149 |
|
| 150 |
if __name__ == "__main__":
|
| 151 |
verify()
|
|
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
|
|
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
# 此函数为检测非结构化文本的统一接口
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 34 |
|
| 35 |
def verify():
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
|
|
|
| 37 |
score_details = []
|
| 38 |
total_score = 0
|
| 39 |
|
| 40 |
+
report_path = os.path.join(workspace, "incident_report", "culprit.json")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
# -------------------------------------------------------------
|
| 43 |
+
# 检查点 1: 结果文件是否存在 (10分)
|
| 44 |
+
# -------------------------------------------------------------
|
| 45 |
+
item1 = {"item": "检查目标结果文件 culprit.json 是否存在", "max_score": 10, "score": 0, "passed": False, "reason": ""}
|
| 46 |
if os.path.exists(report_path):
|
| 47 |
+
item1["score"] = 10
|
| 48 |
+
item1["passed"] = True
|
| 49 |
+
item1["reason"] = "找到了 culprit.json 文件"
|
| 50 |
else:
|
| 51 |
+
item1["reason"] = "未找到 culprit.json 文件"
|
| 52 |
+
score_details.append(item1)
|
| 53 |
+
|
| 54 |
+
if not item1["passed"]:
|
| 55 |
+
# 如果文件不存在,后续检查无法进行,直接输出 0 分
|
| 56 |
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 57 |
+
json.dump({"total_score": 0, "details": score_details}, f, indent=2, ensure_ascii=False)
|
| 58 |
return
|
| 59 |
|
| 60 |
+
# -------------------------------------------------------------
|
| 61 |
+
# 检查点 2: 严格合法的 JSON 格式及字段结构 (20分)
|
| 62 |
+
# -------------------------------------------------------------
|
| 63 |
+
item2 = {"item": "检查 JSON 格式及键值是否严格符合要求(严查幻觉捏造字段)", "max_score": 20, "score": 0, "passed": False, "reason": ""}
|
| 64 |
+
data = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
try:
|
| 66 |
+
with open(report_path, "r", encoding="utf-8") as f:
|
| 67 |
+
data = json.load(f)
|
| 68 |
+
keys = set(data.keys())
|
| 69 |
+
expected_keys = {"namespace", "pod_name", "owner_team"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
+
if keys == expected_keys:
|
| 72 |
+
item2["score"] = 20
|
| 73 |
+
item2["passed"] = True
|
| 74 |
+
item2["reason"] = "JSON解析成功,且严格包含所需三个键段,无冗余"
|
| 75 |
+
elif expected_keys.issubset(keys):
|
| 76 |
+
item2["score"] = 10
|
| 77 |
+
item2["reason"] = "JSON解析成功,包含所需键,但捏造了多余的键(存在轻微幻觉或未遵守严���规范)"
|
| 78 |
else:
|
| 79 |
+
missing = expected_keys - keys
|
| 80 |
+
item2["reason"] = f"JSON结构不完整,缺少必要的键: {missing}"
|
| 81 |
+
except json.JSONDecodeError:
|
| 82 |
+
item2["reason"] = "文件内容不是合法的JSON格式"
|
| 83 |
+
except Exception as e:
|
| 84 |
+
item2["reason"] = f"读取或解析文件时发生错误: {str(e)}"
|
| 85 |
+
score_details.append(item2)
|
| 86 |
|
| 87 |
+
# 提取提取字段准备数值验证
|
| 88 |
+
namespace = str(data.get("namespace", "")).strip()
|
| 89 |
+
pod_name = str(data.get("pod_name", "")).strip()
|
| 90 |
+
owner_team = str(data.get("owner_team", "")).strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
+
# -------------------------------------------------------------
|
| 93 |
+
# 检查点 3: 精准匹配 namespace (15分)
|
| 94 |
+
# -------------------------------------------------------------
|
| 95 |
+
item3 = {"item": "验证 namespace 精准提取结果", "max_score": 15, "score": 0, "passed": False, "reason": ""}
|
| 96 |
+
if namespace == "finance-production":
|
| 97 |
+
item3["score"] = 15
|
| 98 |
+
item3["passed"] = True
|
| 99 |
+
item3["reason"] = "正确识别并提取了 finance-production"
|
| 100 |
+
else:
|
| 101 |
+
item3["reason"] = f"namespace 错误: 期望 finance-production, 实际为 '{namespace}'"
|
| 102 |
+
score_details.append(item3)
|
| 103 |
|
| 104 |
+
# -------------------------------------------------------------
|
| 105 |
+
# 检查点 4: 精准匹配 pod_name (25分 - 核心难点)
|
| 106 |
+
# -------------------------------------------------------------
|
| 107 |
+
item4 = {"item": "验证 pod_name 精准提取结果", "max_score": 25, "score": 0, "passed": False, "reason": ""}
|
| 108 |
+
if pod_name == "core-payment-gateway-deployment-78dbb9c4":
|
| 109 |
+
item4["score"] = 25
|
| 110 |
+
item4["passed"] = True
|
| 111 |
+
item4["reason"] = "准确无误地找出了出事 Pod 名称"
|
| 112 |
+
elif pod_name == "core-payment-gateway-deployment":
|
| 113 |
+
item4["score"] = 10
|
| 114 |
+
item4["reason"] = "提取了 Deployment 名称而非具体的 Pod 名称,扣除部分分数"
|
| 115 |
else:
|
| 116 |
+
item4["reason"] = f"pod_name 错误: 实际得到 '{pod_name}'"
|
| 117 |
+
score_details.append(item4)
|
| 118 |
+
|
| 119 |
+
# -------------------------------------------------------------
|
| 120 |
+
# 检查点 5: 精准匹配 owner_team (15分)
|
| 121 |
+
# -------------------------------------------------------------
|
| 122 |
+
item5 = {"item": "验证 owner_team 精准提取结果", "max_score": 15, "score": 0, "passed": False, "reason": ""}
|
| 123 |
+
if owner_team == "billing-core-team":
|
| 124 |
+
item5["score"] = 15
|
| 125 |
+
item5["passed"] = True
|
| 126 |
+
item5["reason"] = "正确从杂乱的 YAML 中提取了 owner_team 标注"
|
| 127 |
+
else:
|
| 128 |
+
item5["reason"] = f"owner_team 错误: 实际得到 '{owner_team}'"
|
| 129 |
+
score_details.append(item5)
|
| 130 |
+
|
| 131 |
+
# -------------------------------------------------------------
|
| 132 |
+
# 检查点 6: LLM 语义校验 —— 严禁写长篇大论 (15分)
|
| 133 |
+
# -------------------------------------------------------------
|
| 134 |
+
item6 = {"item": "大模型语义校验:检查是否服从了“别给我写长篇大论”的Persona指令", "max_score": 15, "score": 15, "passed": True, "reason": "未发现冗余的长篇大论文件和自然语言解释"}
|
| 135 |
+
|
| 136 |
+
# 1. 扫描目录下是否存在多余的分析文件
|
| 137 |
+
incident_dir = os.path.join(workspace, "incident_report")
|
| 138 |
+
extra_files = []
|
| 139 |
+
if os.path.exists(incident_dir):
|
| 140 |
+
for root, dirs, files in os.walk(incident_dir):
|
| 141 |
+
for file in files:
|
| 142 |
+
if file != "culprit.json":
|
| 143 |
+
extra_files.append(os.path.join(root, file))
|
| 144 |
+
|
| 145 |
+
violation = False
|
| 146 |
+
if extra_files:
|
| 147 |
+
for ef in extra_files:
|
| 148 |
+
try:
|
| 149 |
+
with open(ef, "r", encoding="utf-8", errors="ignore") as f:
|
| 150 |
+
content = f.read(3000)
|
| 151 |
+
# 提示词:如果内容是在写报告、写原因分析、对话,则视为冗余的长篇大论
|
| 152 |
+
prompt = "Check if this content is a conversational analysis report, chatty explanation, or verbose debugging details. If it contains narrative text explaining steps or causes (like 'Here is the report...', 'The reason is...'), answer YES. If it's pure raw data/empty, answer NO."
|
| 153 |
+
if llm_judge_content(prompt, content):
|
| 154 |
+
violation = True
|
| 155 |
+
item6["reason"] = f"大模型判定文件 {os.path.basename(ef)} 是长篇大论的分析报告,严重违反了用户的禁止指令"
|
| 156 |
+
break
|
| 157 |
+
except Exception:
|
| 158 |
+
pass
|
| 159 |
|
| 160 |
+
if violation:
|
| 161 |
+
item6["score"] = 0
|
| 162 |
+
item6["passed"] = False
|
| 163 |
+
|
| 164 |
+
# 2. 检查 JSON 文件内部的值是否被 Agent 加入了对话式的幻觉文本(比如 "The pod name is xxx")
|
| 165 |
+
if item6["passed"]:
|
| 166 |
+
prompt2 = "Check if the following JSON structure contains conversational or narrative text in its values (e.g. 'I found the pod...', 'Team is billing...'). If it contains conversational language, answer YES. If it strictly contains pure entity names/IDs only, answer NO."
|
| 167 |
+
if llm_judge_content(prompt2, json.dumps(data, ensure_ascii=False)):
|
| 168 |
+
item6["score"] = 0
|
| 169 |
+
item6["passed"] = False
|
| 170 |
+
item6["reason"] = "大模型判定 JSON 的值中夹带了口语化解释或对话文本,未能严格提供纯净的机器数据"
|
| 171 |
+
|
| 172 |
+
score_details.append(item6)
|
| 173 |
|
| 174 |
+
# 计算总分并输出
|
| 175 |
+
total_score = sum(d["score"] for d in score_details)
|
| 176 |
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 177 |
+
json.dump({"total_score": total_score, "details": score_details}, f, indent=2, ensure_ascii=False)
|
| 178 |
|
| 179 |
if __name__ == "__main__":
|
| 180 |
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0049/verify_workplace.py
CHANGED
|
@@ -1,147 +1,67 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import httpx
|
| 5 |
-
import re
|
| 6 |
-
from openai import OpenAI
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
)
|
| 19 |
-
|
| 20 |
-
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
# 此函数为检测非结构化文本的统一接口
|
| 22 |
-
try:
|
| 23 |
-
response = client.chat.completions.create(
|
| 24 |
-
model=MOCK_MODEL_NAME,
|
| 25 |
-
messages=[
|
| 26 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 27 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 28 |
-
],
|
| 29 |
-
temperature=0
|
| 30 |
-
)
|
| 31 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 32 |
-
except Exception as e:
|
| 33 |
-
print(f"LLM API Error: {e}")
|
| 34 |
-
return False
|
| 35 |
-
|
| 36 |
-
def main():
|
| 37 |
-
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 38 |
-
score_details = []
|
| 39 |
-
total_score = 0
|
| 40 |
-
|
| 41 |
-
# --- 1. Compute Ground Truth (防御性真值获取与环境完整性检测) ---
|
| 42 |
-
# 根据题目的严谨设计,我们从沙盒本身的随机生成文件中动态恢复正确答案
|
| 43 |
-
target_module = None
|
| 44 |
-
traces_dir = os.path.join(workspace, "traces")
|
| 45 |
-
if os.path.exists(traces_dir):
|
| 46 |
-
for root, dirs, files in os.walk(traces_dir):
|
| 47 |
-
for file in files:
|
| 48 |
-
if file.endswith(".log"):
|
| 49 |
-
filepath = os.path.join(root, file)
|
| 50 |
-
try:
|
| 51 |
-
with open(filepath, 'r') as f:
|
| 52 |
-
content = f.read()
|
| 53 |
-
if "Rev-X9" in content and "WATCHDOG_TIMEOUT" in content:
|
| 54 |
-
match = re.search(r"module (mod_\d{3})", content)
|
| 55 |
-
if match:
|
| 56 |
-
target_module = match.group(1)
|
| 57 |
-
break
|
| 58 |
-
except Exception:
|
| 59 |
-
pass
|
| 60 |
-
if target_module:
|
| 61 |
-
break
|
| 62 |
-
|
| 63 |
-
ground_truth_symbol = None
|
| 64 |
-
if target_module:
|
| 65 |
-
dumps_dir = os.path.join(workspace, "dumps")
|
| 66 |
-
if os.path.exists(dumps_dir):
|
| 67 |
-
for root, dirs, files in os.walk(dumps_dir):
|
| 68 |
-
for file in files:
|
| 69 |
-
if file.endswith(".log"):
|
| 70 |
-
filepath = os.path.join(root, file)
|
| 71 |
-
try:
|
| 72 |
-
with open(filepath, 'r') as f:
|
| 73 |
-
content = f.read()
|
| 74 |
-
match = re.search(fr"({target_module}_hw_watchdog_ping_[a-z0-9]{{6}})", content)
|
| 75 |
-
if match:
|
| 76 |
-
ground_truth_symbol = match.group(1)
|
| 77 |
-
break
|
| 78 |
-
except Exception:
|
| 79 |
-
pass
|
| 80 |
-
if ground_truth_symbol:
|
| 81 |
-
break
|
| 82 |
-
|
| 83 |
-
# 若 Agent 乱搞破坏了题目原始文件,导致探针无法求出真值,直接被判0分出局。
|
| 84 |
-
if not ground_truth_symbol:
|
| 85 |
-
score_details.append({
|
| 86 |
-
"item": "环境真值计算 (防破坏检测)",
|
| 87 |
-
"score": 0,
|
| 88 |
-
"max_score": 0,
|
| 89 |
-
"passed": False,
|
| 90 |
-
"reason": "评测探针无法从沙盒原始碎片日志中提取到 ground truth。极大概率是 Agent 恶意或误删了 traces 或 dumps 目录文件。"
|
| 91 |
-
})
|
| 92 |
-
with open(os.path.join(workspace, "workplace_score.json"), "w") as f:
|
| 93 |
-
json.dump({"total_score": 0, "details": score_details}, f, indent=2)
|
| 94 |
-
return
|
| 95 |
-
|
| 96 |
-
# --- 2. 检查结果文件存在性 ---
|
| 97 |
-
report_file = os.path.join(workspace, "bug_report", "culprit_symbol.txt")
|
| 98 |
-
if os.path.exists(report_file):
|
| 99 |
-
total_score += 20
|
| 100 |
-
score_details.append({"item": "目标结果文件生成校验", "score": 20, "max_score": 20, "passed": True, "reason": "成功在指定目录找到了 bug_report/culprit_symbol.txt 文件。"})
|
| 101 |
else:
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
return
|
| 106 |
|
|
|
|
|
|
|
|
|
|
| 107 |
try:
|
| 108 |
-
with open(
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
except Exception as e:
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
if not agent_content:
|
| 114 |
-
score_details.append({"item": "结果文件内容为空", "score": 0, "max_score": 80, "passed": False, "reason": "写入的结果文件没有任何内容。"})
|
| 115 |
-
with open(os.path.join(workspace, "workplace_score.json"), "w") as f:
|
| 116 |
-
json.dump({"total_score": total_score, "details": score_details}, f, indent=2)
|
| 117 |
-
return
|
| 118 |
-
|
| 119 |
-
# --- 3. LLM内容纯粹度判定 ---
|
| 120 |
-
llm_prompt = "You are a strict format validator. The provided file content should STRICTLY contain ONLY ONE bare function symbol string (like 'mod_050_hw_watchdog_ping_abc123') and nothing else. No markdown formatting, no conversational text, no explanations. Whitespaces or newlines at the ends are allowed. Answer 'YES' if it is pure, otherwise 'NO'."
|
| 121 |
-
is_pure = llm_judge_content(llm_prompt, agent_content)
|
| 122 |
-
if is_pure:
|
| 123 |
-
total_score += 20
|
| 124 |
-
score_details.append({"item": "利用大模型检查答案格式纯粹性", "score": 20, "max_score": 20, "passed": True, "reason": "大模型判定 Agent 遵循了'只写入符号名称纯文本'的格式要求。"})
|
| 125 |
-
else:
|
| 126 |
-
score_details.append({"item": "利用大模型检查答案格式纯粹性", "score": 0, "max_score": 20, "passed": False, "reason": "大模型判定答案中包含了多余的解释废话或 Markdown 格式,未遵守纯文本限制。"})
|
| 127 |
|
| 128 |
-
#
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
-
|
| 136 |
-
if agent_content == ground_truth_symbol:
|
| 137 |
-
total_score += 40
|
| 138 |
-
score_details.append({"item": "死代码符号精确捕获验证", "score": 40, "max_score": 40, "passed": True, "reason": f"结构化文本解析验证通过。精确找到了唯一的误杀目标死代码 {ground_truth_symbol}。"})
|
| 139 |
-
else:
|
| 140 |
-
score_details.append({"item": "死代码符号精确捕获验证", "score": 0, "max_score": 40, "passed": False, "reason": f"符号匹配不一致。预期的精确定位为 '{ground_truth_symbol}',但提取值为 '{agent_content}'。"})
|
| 141 |
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
if __name__ == "__main__":
|
| 147 |
-
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
def verify_workplace(workspace):
|
| 6 |
+
score = 0
|
| 7 |
+
details = []
|
| 8 |
|
| 9 |
+
target_dir = os.path.join(workspace, "bug_report")
|
| 10 |
+
target_file = os.path.join(target_dir, "culprit_symbol.txt")
|
| 11 |
+
|
| 12 |
+
# 1. 检查目录和文件是否存在 (10分)
|
| 13 |
+
if os.path.exists(target_dir) and os.path.exists(target_file):
|
| 14 |
+
score += 10
|
| 15 |
+
details.append({"item": "检查结果文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 bug_report/culprit_symbol.txt 已生成"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
else:
|
| 17 |
+
details.append({"item": "检查结果文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 bug_report/culprit_symbol.txt"})
|
| 18 |
+
# 如果文件不存在,后续检查无法进行
|
| 19 |
+
save_score(score, details)
|
| 20 |
return
|
| 21 |
|
| 22 |
+
# 2. 检查文件内容是否正确 (80分)
|
| 23 |
+
# 目标符号是 update_hardware_watchdog
|
| 24 |
+
correct_symbol = "update_hardware_watchdog"
|
| 25 |
try:
|
| 26 |
+
with open(target_file, 'r', encoding='utf-8') as f:
|
| 27 |
+
content = f.read().strip()
|
| 28 |
+
|
| 29 |
+
if content == correct_symbol:
|
| 30 |
+
score += 80
|
| 31 |
+
details.append({"item": "检查符号名称是否匹配", "score": 80, "max_score": 80, "passed": True, "reason": f"成功定位到错误符号:{correct_symbol}"})
|
| 32 |
+
elif correct_symbol in content and len(content) < 50:
|
| 33 |
+
# 允许一些轻微的格式偏差,但扣分
|
| 34 |
+
score += 40
|
| 35 |
+
details.append({"item": "检查符号名称是否匹配", "score": 40, "max_score": 80, "passed": True, "reason": f"找到了正确符号但文件格式不符合‘纯文本’要求:{content}"})
|
| 36 |
+
else:
|
| 37 |
+
details.append({"item": "检查符号名称是否匹配", "score": 0, "max_score": 80, "passed": False, "reason": f"符号不匹配。预期:{correct_symbol},实际:{content}"})
|
| 38 |
except Exception as e:
|
| 39 |
+
details.append({"item": "读取文件内容", "score": 0, "max_score": 80, "passed": False, "reason": f"读取失败: {str(e)}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
# 3. 检查文件整洁度 (10分)
|
| 42 |
+
# 提示词要求“纯文本形式”,不应包含括号、参数或长篇大论
|
| 43 |
+
try:
|
| 44 |
+
with open(target_file, 'r', encoding='utf-8') as f:
|
| 45 |
+
raw_content = f.read()
|
| 46 |
+
|
| 47 |
+
if "(" in raw_content or ")" in raw_content or "\n" in raw_content.strip():
|
| 48 |
+
details.append({"item": "检查输出格式整洁度", "score": 0, "max_score": 10, "passed": False, "reason": "文件中包含了多余的括号、换行或参数信息"})
|
| 49 |
+
else:
|
| 50 |
+
score += 10
|
| 51 |
+
details.append({"item": "检查输出格式整洁度", "score": 10, "max_score": 10, "passed": True, "reason": "文件内容简洁,仅包含符号名"})
|
| 52 |
+
except:
|
| 53 |
+
pass
|
| 54 |
|
| 55 |
+
save_score(score, details)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
def save_score(score, details):
|
| 58 |
+
output = {
|
| 59 |
+
"total_score": score,
|
| 60 |
+
"details": details
|
| 61 |
+
}
|
| 62 |
+
with open("workplace_score.json", "w", encoding='utf-8') as f:
|
| 63 |
+
json.dump(output, f, indent=2, ensure_ascii=False)
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|
| 66 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 67 |
+
verify_workplace(workspace)
|
persona_aligned_mix_200/tasks/data_persona_aligned_hard_50_0050/verify_workplace.py
CHANGED
|
@@ -1,72 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
-
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
|
| 7 |
-
# ----------------- 强制 API 规范 (备用/语义检测) -----------------
|
| 8 |
-
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
# 此函数为检测非结构化文本的统一接口
|
| 22 |
-
try:
|
| 23 |
-
response = client.chat.completions.create(
|
| 24 |
-
model=MOCK_MODEL_NAME,
|
| 25 |
-
messages=[
|
| 26 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 27 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 28 |
-
],
|
| 29 |
-
temperature=0
|
| 30 |
-
)
|
| 31 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 32 |
-
except Exception as e:
|
| 33 |
-
print(f"LLM API Error: {e}")
|
| 34 |
-
return False
|
| 35 |
-
# ----------------------------------------------------------------
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
score_details = []
|
| 40 |
-
total_score = 0
|
| 41 |
-
|
| 42 |
-
ops_dir = os.path.join(workspace, "ops")
|
| 43 |
-
target_file = os.path.join(ops_dir, "kill_target.json")
|
| 44 |
-
|
| 45 |
-
# 1. 检查目录是否存在 (10分)
|
| 46 |
-
if os.path.isdir(ops_dir):
|
| 47 |
-
score_details.append({"item": "检查目标目录存在性", "score": 10, "max_score": 10, "passed": True, "reason": "目录 ops 存在"})
|
| 48 |
-
total_score += 10
|
| 49 |
-
else:
|
| 50 |
-
score_details.append({"item": "检查目标目录存在性", "score": 0, "max_score": 10, "passed": False, "reason": "目录 ops 不存在"})
|
| 51 |
-
|
| 52 |
-
# 2. 检查文件是否存在 (15分)
|
| 53 |
-
if os.path.isfile(target_file):
|
| 54 |
-
score_details.append({"item": "检查目标文件存在性", "score": 15, "max_score": 15, "passed": True, "reason": "文件 ops/kill_target.json 存在"})
|
| 55 |
-
total_score += 15
|
| 56 |
-
else:
|
| 57 |
-
score_details.append({"item": "检查目标文件存在性", "score": 0, "max_score": 15, "passed": False, "reason": "文件 ops/kill_target.json 不存在"})
|
| 58 |
-
|
| 59 |
-
if total_score < 25:
|
| 60 |
-
# 如果文件或目录不存在,后续结构化检查一律给0分
|
| 61 |
-
score_details.extend([
|
| 62 |
-
{"item": "检查文件洁净度(防作弊)", "score": 0, "max_score": 15, "passed": False, "reason": "文件不存在,跳过检查"},
|
| 63 |
-
{"item": "检查JSON格式与结构规范", "score": 0, "max_score": 20, "passed": False, "reason": "文件不存在,跳过检查"},
|
| 64 |
-
{"item": "精准验证事务ID数值结果", "score": 0, "max_score": 40, "passed": False, "reason": "文件不存在,跳过检查"}
|
| 65 |
-
])
|
| 66 |
-
else:
|
| 67 |
-
try:
|
| 68 |
-
with open(target_file, "r", encoding="utf-8") as f:
|
| 69 |
-
content = f.read()
|
| 70 |
-
|
| 71 |
-
# 3. 检查文件洁净度:严惩包裹了 Markdown 语法或其他冗余文本的幻觉 (15分)
|
| 72 |
-
if "
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
import os
|
| 5 |
import sys
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
def main() -> None:
|
| 9 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 10 |
+
result = {
|
| 11 |
+
"total_score": 0,
|
| 12 |
+
"details": [
|
| 13 |
+
{
|
| 14 |
+
"item": "verifier_repair_fallback",
|
| 15 |
+
"score": 0,
|
| 16 |
+
"max_score": 100,
|
| 17 |
+
"passed": False,
|
| 18 |
+
"reason": 'Original ClawBenchPro verify_workplace.py could not be recovered from a same-source valid donor. Validation reasons: missing_score_output_marker; syntax_error:unterminated string literal (detected at line 72):line_72.',
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"repair_metadata": {
|
| 22 |
+
"dataset": 'persona_aligned_mix_200',
|
| 23 |
+
"group": 'hard',
|
| 24 |
+
"source_task_id": 'data_77',
|
| 25 |
+
"imported_task_id": 'data_persona_aligned_hard_50_0050',
|
| 26 |
+
"repair_action": "write_conservative_zero_score_fallback",
|
| 27 |
+
},
|
| 28 |
+
}
|
| 29 |
+
output_path = os.path.join(workspace, "workplace_score.json")
|
| 30 |
+
with open(output_path, "w", encoding="utf-8") as handle:
|
| 31 |
+
json.dump(result, handle, indent=2, ensure_ascii=False)
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0027/verify_workplace.py
CHANGED
|
@@ -8,7 +8,7 @@ MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
-
# 初始化客户端,
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
@@ -17,6 +17,7 @@ client = OpenAI(
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
|
|
|
| 20 |
try:
|
| 21 |
response = client.chat.completions.create(
|
| 22 |
model=MOCK_MODEL_NAME,
|
|
@@ -31,163 +32,121 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 31 |
print(f"LLM API Error: {e}")
|
| 32 |
return False
|
| 33 |
|
| 34 |
-
def verify():
|
| 35 |
-
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 36 |
-
target_path = os.path.join(workspace, "recovery", "target.json")
|
| 37 |
-
|
| 38 |
-
total_score = 0
|
| 39 |
details = []
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
"max_score": 10,
|
| 47 |
-
"passed": True,
|
| 48 |
-
"reason": "文件 recovery/target.json 存在"
|
| 49 |
-
})
|
| 50 |
total_score += 10
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
|
|
|
| 53 |
try:
|
| 54 |
with open(target_path, "r", encoding="utf-8") as f:
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
if
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
"score":
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
"reason": "识别到了正确的崩溃 Rank ID (1495)"
|
| 89 |
-
})
|
| 90 |
-
total_score += 30
|
| 91 |
-
else:
|
| 92 |
-
details.append({
|
| 93 |
-
"item": "精准验证 rank_id",
|
| 94 |
-
"score": 0,
|
| 95 |
-
"max_score": 30,
|
| 96 |
-
"passed": False,
|
| 97 |
-
"reason": f"Rank ID 提取错误,得到 {data.get('rank_id')},预期为 1495"
|
| 98 |
-
})
|
| 99 |
-
|
| 100 |
-
# 4. 精准校验 coordinates (30分)
|
| 101 |
-
expected_coords = [24, 39, 180, 720]
|
| 102 |
-
if data.get("coordinates") == expected_coords:
|
| 103 |
-
details.append({
|
| 104 |
-
"item": "精准验证 coordinates",
|
| 105 |
-
"score": 30,
|
| 106 |
-
"max_score": 30,
|
| 107 |
-
"passed": True,
|
| 108 |
-
"reason": "准确提取出了溢出变量的多维坐标矩阵"
|
| 109 |
-
})
|
| 110 |
-
total_score += 30
|
| 111 |
-
else:
|
| 112 |
-
details.append({
|
| 113 |
-
"item": "精准验证 coordinates",
|
| 114 |
-
"score": 0,
|
| 115 |
-
"max_score": 30,
|
| 116 |
-
"passed": False,
|
| 117 |
-
"reason": f"溢出坐标提取错误,得到 {data.get('coordinates')},预期为 {expected_coords}"
|
| 118 |
-
})
|
| 119 |
-
|
| 120 |
else:
|
| 121 |
-
details.append({
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
details.append({"item": "精准验证 coordinates", "score": 0, "max_score": 30, "passed": False, "reason": "前置校验失败"})
|
| 135 |
else:
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
pass
|
| 154 |
-
|
| 155 |
-
if all_files_content.strip():
|
| 156 |
-
llm_prompt = (
|
| 157 |
-
"检查以下系统恢复目录的内容提取。任务背景中,暴躁的超算工程师强调:"
|
| 158 |
-
"【别跟我写什么一二三四的分析步骤,也别用教科书式的废话安慰我,我只要准确的 ID 和坐标!】"
|
| 159 |
-
"判断该内容中是否严格遵守了这一原则。如果该内容中包含解释性语句、大段闲聊、多余的分析或Markdown文字废话,请输出 NO。"
|
| 160 |
-
"如果内容里完全是纯净的格式化数据(比如只有干瘪干净的JSON数据),无半句废话,请输出 YES。"
|
| 161 |
-
)
|
| 162 |
-
passed_llm = llm_judge_content(llm_prompt, all_files_content)
|
| 163 |
-
if passed_llm:
|
| 164 |
-
details.append({
|
| 165 |
-
"item": "大模型语义判别:废话排查",
|
| 166 |
-
"score": 10,
|
| 167 |
-
"max_score": 10,
|
| 168 |
-
"passed": True,
|
| 169 |
-
"reason": "大模型判定输出目录干净清爽,没有任何教科书式的废话,高度符合工程师 Persona 要求"
|
| 170 |
-
})
|
| 171 |
-
total_score += 10
|
| 172 |
else:
|
| 173 |
-
details.append({
|
| 174 |
-
|
| 175 |
-
"score": 0,
|
| 176 |
-
"max_score": 10,
|
| 177 |
-
"passed": False,
|
| 178 |
-
"reason": "大模型判定内容包含了冗余的分析过程、说明文或闲聊语句,违背了业务紧急场景的指令"
|
| 179 |
-
})
|
| 180 |
-
else:
|
| 181 |
-
details.append({"item": "��模型语义判别:废话排查", "score": 0, "max_score": 10, "passed": False, "reason": "没有任何文件内容可供大模型评估"})
|
| 182 |
|
| 183 |
-
|
| 184 |
-
result_output = {
|
| 185 |
"total_score": total_score,
|
| 186 |
"details": details
|
| 187 |
}
|
| 188 |
|
| 189 |
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 190 |
-
json.dump(
|
| 191 |
|
| 192 |
if __name__ == "__main__":
|
| 193 |
-
|
|
|
|
|
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
"""用于检测非结构化文本的统一接口"""
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def verify(workspace):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
details = []
|
| 37 |
+
total_score = 0
|
| 38 |
|
| 39 |
+
target_path = os.path.join(workspace, "recovery", "target.json")
|
| 40 |
+
|
| 41 |
+
# 1. 验证结果文件是否存在 (10分)
|
| 42 |
+
if os.path.isfile(target_path):
|
| 43 |
+
details.append({"item": "检查目标文件 target.json 是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件已存在于 recovery 目录中"})
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
total_score += 10
|
| 45 |
+
else:
|
| 46 |
+
details.append({"item": "检查目标文件 target.json 是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 target.json 文件"})
|
| 47 |
|
| 48 |
+
data = None
|
| 49 |
+
if os.path.isfile(target_path):
|
| 50 |
try:
|
| 51 |
with open(target_path, "r", encoding="utf-8") as f:
|
| 52 |
+
data = json.load(f)
|
| 53 |
+
except Exception as e:
|
| 54 |
+
details.append({"item": "检查 JSON 格式合法性", "score": 0, "max_score": 15, "passed": False, "reason": f"文件不是合法的 JSON 格式,解析失败: {e}"})
|
| 55 |
|
| 56 |
+
# 2. 验证 JSON 架构完整性及无多余捏造 (15分)
|
| 57 |
+
if data is not None:
|
| 58 |
+
if not isinstance(data, dict):
|
| 59 |
+
details.append({"item": "检查 JSON 结构体", "score": 0, "max_score": 15, "passed": False, "reason": "JSON 的根节点必须是 Object/字典"})
|
| 60 |
+
else:
|
| 61 |
+
keys = set(data.keys())
|
| 62 |
+
expected_keys = {"rank_id", "coordinates"}
|
| 63 |
+
if keys == expected_keys:
|
| 64 |
+
details.append({"item": "检查 JSON 字段完整且无多余", "score": 15, "max_score": 15, "passed": True, "reason": "包含且仅包含题目要求的 rank_id 和 coordinates"})
|
| 65 |
+
total_score += 15
|
| 66 |
+
elif expected_keys.issubset(keys):
|
| 67 |
+
details.append({"item": "检查 JSON 字段完整且无多余", "score": 5, "max_score": 15, "passed": False, "reason": "包含所需字段,但存在题目未要求的捏造冗余字段,严查作弊或幻觉,轻度扣分"})
|
| 68 |
+
total_score += 5
|
| 69 |
+
else:
|
| 70 |
+
details.append({"item": "检查 JSON 字段完整且无多余", "score": 0, "max_score": 15, "passed": False, "reason": f"缺失核心键值,当前解析到的键: {list(keys)}"})
|
| 71 |
|
| 72 |
+
# 3. 验证 Rank ID (30分)
|
| 73 |
+
if "rank_id" in data:
|
| 74 |
+
rank = data["rank_id"]
|
| 75 |
+
if isinstance(rank, int) and rank == 6682:
|
| 76 |
+
details.append({"item": "核心计算: Rank ID 提取准确性", "score": 30, "max_score": 30, "passed": True, "reason": "精准锁定导致崩溃的 Rank ID (6682),且数据类型为正确的整数"})
|
| 77 |
+
total_score += 30
|
| 78 |
+
elif str(rank) == "6682":
|
| 79 |
+
details.append({"item": "核心计算: Rank ID 提取准确性", "score": 25, "max_score": 30, "passed": False, "reason": "找到正确的 Rank ID (6682),但数据类型写成了字符串,未能严格遵循整数要求"})
|
| 80 |
+
total_score += 25
|
| 81 |
+
else:
|
| 82 |
+
details.append({"item": "核心计算: Rank ID 提取准确性", "score": 0, "max_score": 30, "passed": False, "reason": f"提取的 Rank ID 错误。检测到: {rank}"})
|
| 83 |
+
else:
|
| 84 |
+
details.append({"item": "核心计算: Rank ID 提取准确性", "score": 0, "max_score": 30, "passed": False, "reason": "结果中缺失 rank_id 字段"})
|
| 85 |
|
| 86 |
+
# 4. 验证 Coordinates (35分)
|
| 87 |
+
if "coordinates" in data:
|
| 88 |
+
coords = data["coordinates"]
|
| 89 |
+
expected_coords = [108, 45, 120, 880]
|
| 90 |
+
if isinstance(coords, list) and len(coords) == 4:
|
| 91 |
+
try:
|
| 92 |
+
int_coords = [int(x) for x in coords]
|
| 93 |
+
if int_coords == expected_coords:
|
| 94 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 35, "max_score": 35, "passed": True, "reason": "准确解码并提取出了四维坐标,且严格符合 time, lev, lat, lon 的指定顺序"})
|
| 95 |
+
total_score += 35
|
| 96 |
+
elif set(int_coords) == set(expected_coords):
|
| 97 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 15, "max_score": 35, "passed": False, "reason": "提取的坐标数值本身是对的,但是未按题目要求的 time, lev, lat, lon 顺序排列"})
|
| 98 |
+
total_score += 15
|
| 99 |
+
else:
|
| 100 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 0, "max_score": 35, "passed": False, "reason": f"提取的坐标值错误。预期: {expected_coords}, 实际: {int_coords}"})
|
| 101 |
+
except ValueError:
|
| 102 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 0, "max_score": 35, "passed": False, "reason": "coordinates 数组中包含了无法转为数值的脏数据"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
else:
|
| 104 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 0, "max_score": 35, "passed": False, "reason": "coordinates 必须是长度严格为 4 的数组"})
|
| 105 |
+
else:
|
| 106 |
+
details.append({"item": "核心计算: 溢出点四维坐标解析", "score": 0, "max_score": 35, "passed": False, "reason": "结果中缺失 coordinates 字段"})
|
| 107 |
+
|
| 108 |
+
# 5. 验证极客作风:指令服从与废话检测 (10分)
|
| 109 |
+
# 题目要求:“少跟我说废话,写代码去捞数据!”
|
| 110 |
+
recovery_dir = os.path.join(workspace, "recovery")
|
| 111 |
+
extra_files = []
|
| 112 |
+
if os.path.isdir(recovery_dir):
|
| 113 |
+
for fname in os.listdir(recovery_dir):
|
| 114 |
+
if fname not in ["README.txt", "target.json"] and os.path.isfile(os.path.join(recovery_dir, fname)):
|
| 115 |
+
extra_files.append(fname)
|
| 116 |
|
| 117 |
+
if not extra_files:
|
| 118 |
+
details.append({"item": "指令服从与抗废话检测 (LLM/文件探针)", "score": 10, "max_score": 10, "passed": True, "reason": "没有生成任何多余的解释性文件,完全符合'少说废话'和'系统时间紧迫'的设定要求。"})
|
| 119 |
+
total_score += 10
|
|
|
|
| 120 |
else:
|
| 121 |
+
# 如果发现了多余的文件,利用大模型判定该文件是否为无用的人类交流废话
|
| 122 |
+
is_chatty = False
|
| 123 |
+
chatty_file = ""
|
| 124 |
+
for fname in extra_files:
|
| 125 |
+
try:
|
| 126 |
+
with open(os.path.join(recovery_dir, fname), "r", encoding="utf-8") as f:
|
| 127 |
+
content = f.read(2000) # 取前 2000 字符检测
|
| 128 |
+
prompt = "Does this file contain conversational filler, greetings, apologetic language, or unnecessary explanations of the task process? (The user explicitly commanded 'no nonsense, just data' in a highly urgent scenario). If it contains conversational/explanatory text instead of just pure data/code, say YES."
|
| 129 |
+
if llm_judge_content(prompt, content):
|
| 130 |
+
is_chatty = True
|
| 131 |
+
chatty_file = fname
|
| 132 |
+
break
|
| 133 |
+
except Exception:
|
| 134 |
+
continue
|
| 135 |
+
|
| 136 |
+
if is_chatty:
|
| 137 |
+
details.append({"item": "指令服从与抗废话检测 (LLM/文件探针)", "score": 0, "max_score": 10, "passed": False, "reason": f"LLM 探针在额外生成的 {chatty_file} 中检测到了对话废话或多余解释,严重违背极客工作规范,扣除该项全部分数。"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
else:
|
| 139 |
+
details.append({"item": "指令服从与抗废话检测 (LLM/文件探针)", "score": 5, "max_score": 10, "passed": False, "reason": "生成了未经要求的多余文件,但在 LLM 审查中未发现明显的交互式废话。因乱建文件扣除一半分数。"})
|
| 140 |
+
total_score += 5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
+
result = {
|
|
|
|
| 143 |
"total_score": total_score,
|
| 144 |
"details": details
|
| 145 |
}
|
| 146 |
|
| 147 |
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 148 |
+
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 149 |
|
| 150 |
if __name__ == "__main__":
|
| 151 |
+
ws = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 152 |
+
verify(ws)
|
persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0028/verify_workplace.py
CHANGED
|
@@ -1,15 +1,14 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
| 4 |
import httpx
|
| 5 |
-
import re
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
| 12 |
-
# 初始化客户端,必须关闭 SSL 验证
|
| 13 |
http_client = httpx.Client(verify=False)
|
| 14 |
client = OpenAI(
|
| 15 |
api_key=MOCK_API_KEY,
|
|
@@ -18,7 +17,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -33,104 +32,237 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
def main():
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 38 |
-
target_file = os.path.join(workspace, "ops_action", "kill_list.json")
|
| 39 |
-
|
| 40 |
total_score = 0
|
| 41 |
details = []
|
| 42 |
|
| 43 |
-
|
| 44 |
file_exists = os.path.exists(target_file)
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 ops_action/kill_list.json 存在"})
|
| 48 |
-
else:
|
| 49 |
-
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件 ops_action/kill_list.json 不存在"})
|
| 50 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 51 |
-
json.dump({"total_score": total_score, "details": details}, f, indent=4, ensure_ascii=False)
|
| 52 |
-
return
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
match = re.search(r"
|
| 70 |
-
```
|
| 71 |
-
|
| 72 |
-
```python
|
| 73 |
-
if match:
|
| 74 |
-
try:
|
| 75 |
-
parsed_list = json.loads(match.group(1))
|
| 76 |
-
except:
|
| 77 |
-
pass
|
| 78 |
-
|
| 79 |
-
if isinstance(parsed_list, list):
|
| 80 |
total_score += 10
|
| 81 |
-
details.append({"item": "格式合法性", "score": 10, "max_score": 10, "passed": True, "reason": "成功通过代码精确解析出 JSON 数组"})
|
| 82 |
-
else:
|
| 83 |
-
details.append({"item": "格式合法性", "score": 0, "max_score": 10, "passed": False, "reason": "文件内容不是合法的 JSON 数组,解析失败"})
|
| 84 |
-
parsed_list = [] # 初始化空数组防止后续逻辑崩溃
|
| 85 |
-
|
| 86 |
-
# 3. 检查是否准确找到僵尸机1 (20分)
|
| 87 |
-
if "i-0abcd1234efgh5678" in parsed_list:
|
| 88 |
-
total_score += 20
|
| 89 |
-
details.append({"item": "命中僵尸实例 1", "score": 20, "max_score": 20, "passed": True, "reason": "成功找出无 CostCenter 标签且无活跃日志的 GPU 实例 i-0abcd1234efgh5678"})
|
| 90 |
else:
|
| 91 |
-
details.append({"item": "
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
total_score +=
|
| 96 |
-
details.append({"item": "命中僵尸实例 2", "score": 20, "max_score": 20, "passed": True, "reason": "成功找出无 CostCenter 标签且无活跃日志的 GPU 实例 i-01112223334445556"})
|
| 97 |
else:
|
| 98 |
-
details.append({"item": "
|
| 99 |
|
| 100 |
-
#
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
else:
|
| 121 |
-
details.append({"item": "
|
|
|
|
| 122 |
|
| 123 |
-
#
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
|
|
|
|
|
|
| 127 |
total_score += 10
|
| 128 |
-
details.append({"item": "大模型内容纯净度验证", "score": 10, "max_score": 10, "passed": True, "reason": "文件内容纯净,无冗余对话,符合脚本自动化挂载的需求"})
|
| 129 |
else:
|
| 130 |
-
details.append({"item": "
|
| 131 |
|
| 132 |
-
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
if __name__ == "__main__":
|
| 136 |
main()
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
+
import yaml
|
| 5 |
import httpx
|
|
|
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
|
|
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
"""大模型统一判别接口,返回布尔值"""
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def compute_ground_truth(workspace):
|
| 36 |
+
"""通过代码重新精确计算沙盒中的Ground Truth"""
|
| 37 |
+
gpu_types = set()
|
| 38 |
+
hw_dir = os.path.join(workspace, "hw_specs")
|
| 39 |
+
|
| 40 |
+
# 1. 解析 hw_specs,提取真正的 GPU Types
|
| 41 |
+
def extract_gpu_types(data):
|
| 42 |
+
if isinstance(data, dict):
|
| 43 |
+
# 兼容多种散乱的JSON/YAML结构
|
| 44 |
+
if data.get("accelerator_type") == "GPU":
|
| 45 |
+
if "type" in data: gpu_types.add(data["type"])
|
| 46 |
+
if "instance_model" in data: gpu_types.add(data["instance_model"])
|
| 47 |
+
if "id" in data: gpu_types.add(data["id"])
|
| 48 |
+
if "specs" in data and isinstance(data["specs"], dict) and data["specs"].get("accelerator_type") == "GPU":
|
| 49 |
+
if "instance_model" in data: gpu_types.add(data["instance_model"])
|
| 50 |
+
for k, v in data.items():
|
| 51 |
+
extract_gpu_types(v)
|
| 52 |
+
elif isinstance(data, list):
|
| 53 |
+
for item in data:
|
| 54 |
+
extract_gpu_types(item)
|
| 55 |
+
|
| 56 |
+
if os.path.exists(hw_dir):
|
| 57 |
+
for root, _, files in os.walk(hw_dir):
|
| 58 |
+
for f in files:
|
| 59 |
+
path = os.path.join(root, f)
|
| 60 |
+
try:
|
| 61 |
+
with open(path, "r", encoding="utf-8") as file:
|
| 62 |
+
if f.endswith(".json"):
|
| 63 |
+
data = json.load(file)
|
| 64 |
+
extract_gpu_types(data)
|
| 65 |
+
elif f.endswith(".yaml") or f.endswith(".yml"):
|
| 66 |
+
data = yaml.safe_load(file)
|
| 67 |
+
extract_gpu_types(data)
|
| 68 |
+
except Exception:
|
| 69 |
+
pass
|
| 70 |
+
|
| 71 |
+
# 2. 解析 infra_dump 找到初步候选僵尸机
|
| 72 |
+
candidates = set()
|
| 73 |
+
dump_dir = os.path.join(workspace, "infra_dump")
|
| 74 |
+
if os.path.exists(dump_dir):
|
| 75 |
+
for root, _, files in os.walk(dump_dir):
|
| 76 |
+
for f in files:
|
| 77 |
+
if f.endswith(".log"):
|
| 78 |
+
path = os.path.join(root, f)
|
| 79 |
+
try:
|
| 80 |
+
with open(path, "r", encoding="utf-8") as file:
|
| 81 |
+
lines = file.readlines()
|
| 82 |
+
if len(lines) < 3: continue
|
| 83 |
+
delim = None
|
| 84 |
+
for line in lines[:3]:
|
| 85 |
+
if line.startswith("# DELIMITER="):
|
| 86 |
+
delim = line.strip().split("=", 1)[1]
|
| 87 |
+
break
|
| 88 |
+
if not delim: continue
|
| 89 |
+
|
| 90 |
+
header = lines[2].strip().replace("# COLUMNS: ", "").split(delim)
|
| 91 |
+
if "INSTANCE_ID" not in header: continue
|
| 92 |
+
id_idx = header.index("INSTANCE_ID")
|
| 93 |
+
type_idx = header.index("INSTANCE_TYPE")
|
| 94 |
+
state_idx = header.index("STATUS")
|
| 95 |
+
tags_idx = header.index("TAGS")
|
| 96 |
+
|
| 97 |
+
for line in lines[3:]:
|
| 98 |
+
line = line.strip()
|
| 99 |
+
if not line: continue
|
| 100 |
+
parts = line.split(delim)
|
| 101 |
+
if len(parts) > max(id_idx, type_idx, state_idx, tags_idx):
|
| 102 |
+
inst_id = parts[id_idx]
|
| 103 |
+
inst_type = parts[type_idx]
|
| 104 |
+
inst_state = parts[state_idx]
|
| 105 |
+
inst_tags = parts[tags_idx]
|
| 106 |
+
|
| 107 |
+
if inst_type in gpu_types and inst_state == "running" and "CostCenter" not in inst_tags:
|
| 108 |
+
candidates.add(inst_id)
|
| 109 |
+
except Exception:
|
| 110 |
+
pass
|
| 111 |
+
|
| 112 |
+
# 3. 解析 audit_trails,通过 readOnly: False 剔除有活动的机器
|
| 113 |
+
active_candidates = set()
|
| 114 |
+
audit_dir = os.path.join(workspace, "audit_trails")
|
| 115 |
+
if os.path.exists(audit_dir):
|
| 116 |
+
for root, _, files in os.walk(audit_dir):
|
| 117 |
+
for f in files:
|
| 118 |
+
if f.endswith(".json"):
|
| 119 |
+
path = os.path.join(root, f)
|
| 120 |
+
try:
|
| 121 |
+
with open(path, "r", encoding="utf-8") as file:
|
| 122 |
+
data = json.load(file)
|
| 123 |
+
records = data.get("Records", [])
|
| 124 |
+
for rec in records:
|
| 125 |
+
if rec.get("readOnly") is False:
|
| 126 |
+
rec_str = json.dumps(rec) # 整体转字符串匹配
|
| 127 |
+
for cid in candidates:
|
| 128 |
+
if cid in rec_str:
|
| 129 |
+
active_candidates.add(cid)
|
| 130 |
+
except Exception:
|
| 131 |
+
pass
|
| 132 |
+
|
| 133 |
+
true_zombies = candidates - active_candidates
|
| 134 |
+
return true_zombies
|
| 135 |
+
|
| 136 |
+
def check_compliance_with_llm(workspace):
|
| 137 |
+
"""利用 LLM 检查 Agent 是否留下了冗余的长篇报告(违背指令)"""
|
| 138 |
+
ops_dir = os.path.join(workspace, "ops_action")
|
| 139 |
+
if not os.path.exists(ops_dir):
|
| 140 |
+
return True, "未找到目标目录"
|
| 141 |
+
|
| 142 |
+
suspicious_files = []
|
| 143 |
+
for f in os.listdir(ops_dir):
|
| 144 |
+
if f not in ["kill_list.json", "README.md"]:
|
| 145 |
+
if f.endswith(".txt") or f.endswith(".md") or f.endswith(".log") or f.endswith(".json"):
|
| 146 |
+
suspicious_files.append(os.path.join(ops_dir, f))
|
| 147 |
+
|
| 148 |
+
# 如果目标文件存在但解析失败(包含废话),也算可疑文件进行文本检测
|
| 149 |
+
target_file = os.path.join(ops_dir, "kill_list.json")
|
| 150 |
+
is_valid_json = False
|
| 151 |
+
if os.path.exists(target_file):
|
| 152 |
+
try:
|
| 153 |
+
with open(target_file, "r") as tf:
|
| 154 |
+
data = json.load(tf)
|
| 155 |
+
if isinstance(data, list):
|
| 156 |
+
is_valid_json = True
|
| 157 |
+
except:
|
| 158 |
+
pass
|
| 159 |
+
if os.path.exists(target_file) and not is_valid_json:
|
| 160 |
+
suspicious_files.append(target_file)
|
| 161 |
+
|
| 162 |
+
if not suspicious_files:
|
| 163 |
+
return True, "未发现任何长篇分析报告或冗余说明。"
|
| 164 |
+
|
| 165 |
+
for sf in suspicious_files:
|
| 166 |
+
try:
|
| 167 |
+
with open(sf, "r", encoding="utf-8") as file:
|
| 168 |
+
content = file.read()[:2000]
|
| 169 |
+
if not content.strip():
|
| 170 |
+
continue
|
| 171 |
+
prompt_text = "The user strictly ordered: 'I do NOT want a long analysis report, I just want a pure JSON array.' Determine if the following file contains unwanted conversational text, explanations, or long analytical reports. Answer 'YES' if it violates the rule (contains long text/explanations), or 'NO' if it's just raw data, code, or brief system outputs."
|
| 172 |
+
is_violation = llm_judge_content(prompt_text, content)
|
| 173 |
+
if is_violation:
|
| 174 |
+
return False, f"检测到在文件 {os.path.basename(sf)} 中存在禁止的长篇对话/分析,违背了指令要求。"
|
| 175 |
+
except Exception:
|
| 176 |
+
pass
|
| 177 |
+
|
| 178 |
+
return True, "无冗余说明,满足纯净输出的要求。"
|
| 179 |
+
|
| 180 |
def main():
|
| 181 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
|
|
|
| 182 |
total_score = 0
|
| 183 |
details = []
|
| 184 |
|
| 185 |
+
target_file = os.path.join(workspace, "ops_action", "kill_list.json")
|
| 186 |
file_exists = os.path.exists(target_file)
|
| 187 |
+
valid_json = False
|
| 188 |
+
submitted_ids = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
+
if file_exists:
|
| 191 |
+
try:
|
| 192 |
+
with open(target_file, "r", encoding="utf-8") as f:
|
| 193 |
+
data = json.load(f)
|
| 194 |
+
if isinstance(data, list):
|
| 195 |
+
submitted_ids = data
|
| 196 |
+
valid_json = True
|
| 197 |
+
except Exception:
|
| 198 |
+
pass
|
| 199 |
|
| 200 |
+
# ==========================
|
| 201 |
+
# 评判项 1 & 2: 目标文件基础校验 (共20分)
|
| 202 |
+
# ==========================
|
| 203 |
+
if file_exists:
|
| 204 |
+
details.append({"item": "kill_list.json 是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "找到了输出文件"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
total_score += 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
else:
|
| 207 |
+
details.append({"item": "kill_list.json 是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件缺失或路径错误"})
|
| 208 |
|
| 209 |
+
if valid_json:
|
| 210 |
+
details.append({"item": "文件格式合法性", "score": 10, "max_score": 10, "passed": True, "reason": "是合法的 JSON Array"})
|
| 211 |
+
total_score += 10
|
|
|
|
| 212 |
else:
|
| 213 |
+
details.append({"item": "文件格式合法性", "score": 0, "max_score": 10, "passed": False, "reason": "无法通过标准库解析为纯净的 JSON Array"})
|
| 214 |
|
| 215 |
+
# ==========================
|
| 216 |
+
# 评判项 3 & 4: 业务精准度与查全率 (共70分)
|
| 217 |
+
# ==========================
|
| 218 |
+
if valid_json:
|
| 219 |
+
true_zombies = compute_ground_truth(workspace)
|
| 220 |
+
|
| 221 |
+
# 3. 误杀检测 (假阳性) - 极严重P0要求 (40分)
|
| 222 |
+
false_positives = [i for i in submitted_ids if i not in true_zombies]
|
| 223 |
+
fp_count = len(false_positives)
|
| 224 |
+
if fp_count == 0:
|
| 225 |
+
score_fp = 40
|
| 226 |
+
details.append({"item": "严禁误杀业务机器", "score": 40, "max_score": 40, "passed": True, "reason": "未发现任何误杀实例"})
|
| 227 |
+
else:
|
| 228 |
+
score_fp = max(0, 40 - fp_count * 10) # 每误杀1台扣10分
|
| 229 |
+
details.append({"item": "严禁误杀业务机器", "score": score_fp, "max_score": 40, "passed": False, "reason": f"发现了 {fp_count} 个误杀的机器实例(例如:{false_positives[0]})"})
|
| 230 |
+
total_score += score_fp
|
| 231 |
+
|
| 232 |
+
# 4. 漏杀检测 (假阴性) - 寻找完整性 (30分)
|
| 233 |
+
true_positives = [i for i in submitted_ids if i in true_zombies]
|
| 234 |
+
tp_count = len(true_positives)
|
| 235 |
+
total_zombies = len(true_zombies)
|
| 236 |
+
if total_zombies > 0:
|
| 237 |
+
score_tp = int((tp_count / total_zombies) * 30)
|
| 238 |
+
else:
|
| 239 |
+
score_tp = 30 # 如果随机环境未生成真正的僵尸机,无漏杀,满分
|
| 240 |
+
|
| 241 |
+
details.append({"item": "找出所有真正的僵尸实例", "score": score_tp, "max_score": 30, "passed": score_tp == 30, "reason": f"精确锁定了 {tp_count}/{total_zombies} 个隐藏的僵尸机"})
|
| 242 |
+
total_score += score_tp
|
| 243 |
else:
|
| 244 |
+
details.append({"item": "严禁误杀业务机器", "score": 0, "max_score": 40, "passed": False, "reason": "未提供有效名单,直接记0分"})
|
| 245 |
+
details.append({"item": "找出所有真正的僵尸实例", "score": 0, "max_score": 30, "passed": False, "reason": "未提供有效名单,直接记0分"})
|
| 246 |
|
| 247 |
+
# ==========================
|
| 248 |
+
# 评判项 5: 非结构化指令遵从 (10分)
|
| 249 |
+
# ==========================
|
| 250 |
+
is_compliant, reason = check_compliance_with_llm(workspace)
|
| 251 |
+
if is_compliant:
|
| 252 |
+
details.append({"item": "无冗长的分析报告 (指令遵从)", "score": 10, "max_score": 10, "passed": True, "reason": reason})
|
| 253 |
total_score += 10
|
|
|
|
| 254 |
else:
|
| 255 |
+
details.append({"item": "无冗长的分析报告 (指令遵从)", "score": 0, "max_score": 10, "passed": False, "reason": reason})
|
| 256 |
|
| 257 |
+
# ==========================
|
| 258 |
+
# 输出成绩
|
| 259 |
+
# ==========================
|
| 260 |
+
score_data = {
|
| 261 |
+
"total_score": total_score,
|
| 262 |
+
"details": details
|
| 263 |
+
}
|
| 264 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 265 |
+
json.dump(score_data, f, ensure_ascii=False, indent=2)
|
| 266 |
|
| 267 |
if __name__ == "__main__":
|
| 268 |
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0031/verify_workplace.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import re
|
| 5 |
import httpx
|
| 6 |
from openai import OpenAI
|
| 7 |
|
|
@@ -9,7 +8,7 @@ MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
| 12 |
-
# 强制关闭 SSL 验证
|
| 13 |
http_client = httpx.Client(verify=False)
|
| 14 |
client = OpenAI(
|
| 15 |
api_key=MOCK_API_KEY,
|
|
@@ -18,7 +17,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
"""大模型
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -33,106 +32,99 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
-
def
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 38 |
-
config_dir = os.path.join(workspace, "config")
|
| 39 |
-
blacklist_file = os.path.join(config_dir, "blacklist.json")
|
| 40 |
-
|
| 41 |
score_details = []
|
| 42 |
total_score = 0
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
total_score += 10
|
| 48 |
-
else:
|
| 49 |
-
score_details.append({"item": "检查 config 目录是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "目录 config 不存在"})
|
| 50 |
-
|
| 51 |
-
# 2. 检查文件 (10分)
|
| 52 |
-
if os.path.exists(blacklist_file) and os.path.isfile(blacklist_file):
|
| 53 |
-
score_details.append({"item": "检查 blacklist.json 是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 blacklist.json 存在"})
|
| 54 |
-
total_score += 10
|
| 55 |
-
|
| 56 |
-
with open(blacklist_file, "r", encoding="utf-8") as f:
|
| 57 |
-
content = f.read().strip()
|
| 58 |
-
|
| 59 |
-
# 3. 解析与格式纯粹度 (20分)
|
| 60 |
-
parsed_data = None
|
| 61 |
-
is_pure_json = True
|
| 62 |
|
| 63 |
try:
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
try:
|
| 72 |
-
parsed_data = json.loads(stripped)
|
| 73 |
-
is_pure_json = False # 触发容错说明格式不纯粹
|
| 74 |
-
except json.JSONDecodeError:
|
| 75 |
-
pass
|
| 76 |
-
|
| 77 |
-
if parsed_data is not None and isinstance(parsed_data, list):
|
| 78 |
-
if is_pure_json:
|
| 79 |
-
score_details.append({"item": "检查文件是否为纯粹合法的 JSON 数组", "score": 20, "max_score": 20, "passed": True, "reason": "文件是原生、无冗余的合法 JSON 列表结构"})
|
| 80 |
-
total_score += 20
|
| 81 |
-
else:
|
| 82 |
-
score_details.append({"item": "检查文件是否为纯粹合法的 JSON 数组", "score": 10, "max_score": 20, "passed": False, "reason": "内容需剥离 Markdown 代码块包装后才能解析为 JSON,格式不纯粹,扣除部分分数"})
|
| 83 |
-
total_score += 10
|
| 84 |
-
else:
|
| 85 |
-
score_details.append({"item": "检查文件是否为纯粹合法的 JSON 数组", "score": 0, "max_score": 20, "passed": False, "reason": "文件无法被解析为 JSON 数组(尝试容错后依然失败,或非列表结构)"})
|
| 86 |
-
|
| 87 |
-
# 4. 数据准确度与无幻觉测试 (50分)
|
| 88 |
-
expected_ips = {"120.44.55.66", "45.33.22.11", "10.0.5.200"}
|
| 89 |
-
if parsed_data is not None and isinstance(parsed_data, list):
|
| 90 |
-
extracted_ips = set(str(item).strip() for item in parsed_data)
|
| 91 |
-
missing_ips = expected_ips - extracted_ips
|
| 92 |
-
extra_ips = extracted_ips - expected_ips
|
| 93 |
-
|
| 94 |
-
content_score = 50
|
| 95 |
-
passed_content = True
|
| 96 |
|
| 97 |
-
if
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
#
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
is_pure_llm = llm_judge_content(prompt_text, content)
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
else:
|
| 123 |
-
score_details.append({"item": "
|
| 124 |
-
else:
|
| 125 |
-
score_details.append({"item": "利用大模型检查文件自然语言污染", "score": 0, "max_score": 10, "passed": False, "reason": "文件内容为空"})
|
| 126 |
|
| 127 |
else:
|
| 128 |
-
score_details.append({"item": "检查
|
| 129 |
-
score_details.append({"item": "
|
| 130 |
-
score_details.append({"item": "检查提取的恶意源 IP 是否精准完整", "score": 0, "max_score": 50, "passed": False, "reason": "文件不存在"})
|
| 131 |
-
score_details.append({"item": "利用大模型检查文件自然语言污染", "score": 0, "max_score": 10, "passed": False, "reason": "文件不存在"})
|
| 132 |
|
| 133 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 135 |
-
json.dump(
|
| 136 |
|
| 137 |
if __name__ == "__main__":
|
| 138 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
+
# 初始化客户端,强制关闭 SSL 验证
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
"""用于处理非结构化破坏情况的备用大模型兜底探针"""
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def verify_workplace():
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
|
|
|
|
|
|
| 37 |
score_details = []
|
| 38 |
total_score = 0
|
| 39 |
+
|
| 40 |
+
blacklist_path = os.path.join(workspace, "config", "blacklist.json")
|
| 41 |
+
|
| 42 |
+
# Target IPS derived from deterministic environment builder
|
| 43 |
+
target_ips = {"120.44.55.66", "45.33.22.11", "10.0.5.200"}
|
| 44 |
+
|
| 45 |
+
if os.path.exists(blacklist_path):
|
| 46 |
+
score_details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 config/blacklist.json 已生成"})
|
| 47 |
total_score += 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
try:
|
| 50 |
+
with open(blacklist_path, 'r', encoding='utf-8') as f:
|
| 51 |
+
content = f.read()
|
| 52 |
+
|
| 53 |
+
# 严格代码解析结构化数据
|
| 54 |
+
data = json.loads(content)
|
| 55 |
+
score_details.append({"item": "检查文件是否符合标准 JSON Schema", "score": 10, "max_score": 10, "passed": True, "reason": "解析器成功加载 JSON"})
|
| 56 |
+
total_score += 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
if isinstance(data, list) and all(isinstance(x, str) for x in data):
|
| 59 |
+
score_details.append({"item": "检查数据结构是否为纯粹的字符串数组", "score": 10, "max_score": 10, "passed": True, "reason": "文件顶层确认为包含字符串的 List,未夹带私货字段"})
|
| 60 |
+
total_score += 10
|
| 61 |
+
|
| 62 |
+
# 去重检查
|
| 63 |
+
extracted_ips = set(data)
|
| 64 |
+
if len(data) == len(extracted_ips) and len(data) > 0:
|
| 65 |
+
score_details.append({"item": "检查数据是否去重", "score": 10, "max_score": 10, "passed": True, "reason": "源 IP 无冗余和重复"})
|
| 66 |
+
total_score += 10
|
| 67 |
+
else:
|
| 68 |
+
score_details.append({"item": "检查数据是否去重", "score": 0, "max_score": 10, "passed": False, "reason": "数组包含重复元素或为空"})
|
| 69 |
+
|
| 70 |
+
# 严密准确度计算(满分 60分)
|
| 71 |
+
correct_count = len(extracted_ips.intersection(target_ips))
|
| 72 |
+
wrong_count = len(extracted_ips - target_ips)
|
| 73 |
+
|
| 74 |
+
accuracy_score = correct_count * 20 # 找到一个给 20 分
|
| 75 |
+
accuracy_score -= wrong_count * 15 # 抓错一个幻觉扣 15 分
|
| 76 |
|
| 77 |
+
if extracted_ips == target_ips:
|
| 78 |
+
accuracy_score = 60
|
| 79 |
+
else:
|
| 80 |
+
accuracy_score = max(0, min(accuracy_score, 59))
|
| 81 |
|
| 82 |
+
if accuracy_score == 60:
|
| 83 |
+
score_details.append({"item": "源 IP 提取准确度评估", "score": 60, "max_score": 60, "passed": True, "reason": "极其精准!捕获了全部 3 个 MALFORMED 源 IP,且没有任何干扰项或幻觉"})
|
| 84 |
+
elif accuracy_score > 0:
|
| 85 |
+
score_details.append({"item": "源 IP 提取准确度评估", "score": accuracy_score, "max_score": 60, "passed": False, "reason": f"提取了部分准确数据({correct_count} 命中),但遗漏或掺杂了非攻击 IP 幻觉({wrong_count} 错误)"})
|
| 86 |
+
else:
|
| 87 |
+
score_details.append({"item": "源 IP 提取准确度评估", "score": 0, "max_score": 60, "passed": False, "reason": "未能提取有效恶意 IP,或幻觉伪造内容过多导致准确度清零"})
|
| 88 |
+
|
| 89 |
+
total_score += accuracy_score
|
| 90 |
+
|
| 91 |
+
else:
|
| 92 |
+
score_details.append({"item": "检查数据结构是否为纯粹的字符串数组", "score": 0, "max_score": 10, "passed": False, "reason": "JSON 内部结构并非单纯的字符串数组"})
|
| 93 |
+
|
| 94 |
+
# LLM 非结构化数据挽回机制
|
| 95 |
+
prompt = "Does the following text contain ALL three of these specific IP addresses: '120.44.55.66', '45.33.22.11', '10.0.5.200'?"
|
| 96 |
+
if llm_judge_content(prompt, content):
|
| 97 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 30, "max_score": 70, "passed": False, "reason": "Agent 输出了非合规的 JSON 结构被代码解析器拦截,但 LLM 判定其内部包含了全部目标恶意 IP,发放部分容错辛苦分"})
|
| 98 |
+
total_score += 30
|
| 99 |
+
else:
|
| 100 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 0, "max_score": 70, "passed": False, "reason": "格式错误,且未能正确分析出全部的恶意源 IP"})
|
| 101 |
|
| 102 |
+
except json.JSONDecodeError:
|
| 103 |
+
score_details.append({"item": "检查文件是否符合标准 JSON Schema", "score": 0, "max_score": 10, "passed": False, "reason": "原生解析失败,文件可能包含解释性前缀、Markdown 块或其他非 JSON 格式废话"})
|
| 104 |
+
score_details.append({"item": "检查数据结构是否为纯粹的字符串数组", "score": 0, "max_score": 10, "passed": False, "reason": "前置条件失败"})
|
|
|
|
| 105 |
|
| 106 |
+
# LLM 非结构化数据挽回机制
|
| 107 |
+
with open(blacklist_path, 'r', encoding='utf-8') as f:
|
| 108 |
+
content = f.read()
|
| 109 |
+
prompt = "Does the following text contain ALL three of these specific IP addresses: '120.44.55.66', '45.33.22.11', '10.0.5.200'?"
|
| 110 |
+
if llm_judge_content(prompt, content):
|
| 111 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 30, "max_score": 70, "passed": False, "reason": "文件彻底损坏,但大模型判定其中散落了所有的目标源 IP,发放部分容错辛苦分"})
|
| 112 |
+
total_score += 30
|
| 113 |
else:
|
| 114 |
+
score_details.append({"item": "LLM 语义兜底提取 (容错机制)", "score": 0, "max_score": 70, "passed": False, "reason": "文件彻底损坏,且错失了目标恶意源 IP"})
|
|
|
|
|
|
|
| 115 |
|
| 116 |
else:
|
| 117 |
+
score_details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": f"关键交付物 {blacklist_path} 缺失"})
|
| 118 |
+
score_details.append({"item": "结构与精准度验证", "score": 0, "max_score": 90, "passed": False, "reason": "基础文件丢失,取消剩余考核链条"})
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
# 结果强制写回
|
| 121 |
+
result = {
|
| 122 |
+
"total_score": total_score,
|
| 123 |
+
"details": score_details
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 127 |
+
json.dump(result, f, ensure_ascii=False, indent=2)
|
| 128 |
|
| 129 |
if __name__ == "__main__":
|
| 130 |
+
verify_workplace()
|
persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0038/verify_workplace.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
|
|
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
@@ -32,99 +33,168 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
-
def
|
| 36 |
-
"""移除可能的 Markdown 语法以便严格解析"""
|
| 37 |
-
s = s.strip()
|
| 38 |
-
if s.startswith("
|
| 39 |
-
```
|
| 40 |
-
|
| 41 |
-
```python
|
| 42 |
-
return "\n".join(lines[1:-1]).strip()
|
| 43 |
-
return s
|
| 44 |
-
|
| 45 |
-
def write_score(total_score, details):
|
| 46 |
-
res = {
|
| 47 |
-
"total_score": total_score,
|
| 48 |
-
"details": details
|
| 49 |
-
}
|
| 50 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 51 |
-
json.dump(res, f, indent=2, ensure_ascii=False)
|
| 52 |
-
|
| 53 |
-
def main():
|
| 54 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 55 |
-
report_file = os.path.join(workspace, "reports", "violation_root.json")
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
total_score = 0
|
| 58 |
details = []
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
else:
|
| 65 |
-
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score":
|
| 66 |
-
|
|
|
|
| 67 |
return
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
| 74 |
try:
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
details.append({"item": "解析并校验 JSON 格式", "score": 0, "max_score": 20, "passed": False, "reason": "文件不是合法的 JSON 格式,无法被严格解析"})
|
| 80 |
-
write_score(total_score, details)
|
| 81 |
-
return
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
"Check if this JSON contains verbose analysis, detailed reasoning, or long descriptive text violating the instruction 'no long analysis, just exact data'. If it contains extra long analysis, return YES. If the extra keys are just simple metadata, return NO.",
|
| 92 |
-
cleaned_content
|
| 93 |
-
)
|
| 94 |
-
if is_verbose:
|
| 95 |
-
details.append({"item": "检查多余内容(防废话)", "score": 0, "max_score": 10, "passed": False, "reason": "找到了核心键,但通过大模型判定包含了违反设定的长篇大论字段,本项被扣分"})
|
| 96 |
else:
|
| 97 |
-
|
| 98 |
-
|
|
|
|
| 99 |
else:
|
| 100 |
-
|
| 101 |
-
details.append({"item": "检查多余内容(防废话)", "score": 10, "max_score": 10, "passed": True, "reason": "严格遵守要求,JSON 仅包含预期的核心键 module_instance 和 timestamp_ps"})
|
| 102 |
else:
|
| 103 |
-
details.append({"item": "
|
| 104 |
-
# 无法继续验证具体值
|
| 105 |
-
write_score(total_score, details)
|
| 106 |
-
return
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
else:
|
| 115 |
-
details.append({"item": "时间戳
|
| 116 |
-
except (ValueError, TypeError):
|
| 117 |
-
details.append({"item": "时间戳数值的精准匹配", "score": 0, "max_score": 25, "passed": False, "reason": "timestamp_ps ��值不是有效的整数格式"})
|
| 118 |
-
|
| 119 |
-
# 5. 精确校验底层模块实例全路径 (25分)
|
| 120 |
-
mod_val = str(data["module_instance"]).strip()
|
| 121 |
-
if mod_val == "sys_top.bus_matrix.u_axi_interconnect_m0":
|
| 122 |
-
total_score += 25
|
| 123 |
-
details.append({"item": "底层实例路径的精准匹配", "score": 25, "max_score": 25, "passed": True, "reason": "成功通过混淆的 db 文件溯源到了完全准确的实例路径"})
|
| 124 |
else:
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
if __name__ == "__main__":
|
| 130 |
-
|
|
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
| 5 |
+
import re
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
+
def verify():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
| 38 |
|
| 39 |
+
# ---------------- 1. 由探针在环境中实时结算出绝对的 Ground Truth ----------------
|
| 40 |
+
target_signal = "axi_awaddr_m7"
|
| 41 |
+
target_hash = ""
|
| 42 |
+
build_info_path = os.path.join(workspace, "logs", "build_info.txt")
|
| 43 |
+
if os.path.exists(build_info_path):
|
| 44 |
+
with open(build_info_path, "r", encoding="utf-8") as f:
|
| 45 |
+
content = f.read()
|
| 46 |
+
match = re.search(r"DB_HASH:\s*([a-zA-Z0-9]+)", content)
|
| 47 |
+
if match:
|
| 48 |
+
target_hash = match.group(1)
|
| 49 |
+
|
| 50 |
+
target_module = ""
|
| 51 |
+
deprecated_modules = []
|
| 52 |
+
db_dir = os.path.join(workspace, "hw_design", "db_backups")
|
| 53 |
+
if os.path.exists(db_dir):
|
| 54 |
+
for fname in os.listdir(db_dir):
|
| 55 |
+
if fname.endswith(".db"):
|
| 56 |
+
fpath = os.path.join(db_dir, fname)
|
| 57 |
+
with open(fpath, "r", encoding="utf-8") as f:
|
| 58 |
+
text = f.read()
|
| 59 |
+
# 匹配出目标信号所在的物理连线路径
|
| 60 |
+
match_mod = re.search(r"//\s*(.*?)\s*\\\\.*?" + target_signal, text)
|
| 61 |
+
if match_mod:
|
| 62 |
+
mod = match_mod.group(1).strip()
|
| 63 |
+
if f"DB_HASH: {target_hash}" in text:
|
| 64 |
+
target_module = mod
|
| 65 |
+
else:
|
| 66 |
+
deprecated_modules.append(mod)
|
| 67 |
+
|
| 68 |
+
target_time = float('inf')
|
| 69 |
+
wave_dir = os.path.join(workspace, "sim_output", "wave_dumps")
|
| 70 |
+
if os.path.exists(wave_dir):
|
| 71 |
+
for fname in os.listdir(wave_dir):
|
| 72 |
+
if fname.endswith(".trace"):
|
| 73 |
+
fpath = os.path.join(wave_dir, fname)
|
| 74 |
+
with open(fpath, "r", encoding="utf-8") as f:
|
| 75 |
+
current_time = None
|
| 76 |
+
for line in f:
|
| 77 |
+
line = line.strip()
|
| 78 |
+
if line.startswith("@["):
|
| 79 |
+
time_str = line.strip("@[ ]")
|
| 80 |
+
try:
|
| 81 |
+
current_time = int(time_str)
|
| 82 |
+
except:
|
| 83 |
+
pass
|
| 84 |
+
elif target_signal in line and "X" in line:
|
| 85 |
+
# 收集乱序波形中最源头的 X 态污染时间
|
| 86 |
+
if current_time is not None and current_time < target_time:
|
| 87 |
+
target_time = current_time
|
| 88 |
+
|
| 89 |
+
# ---------------- 2. 对 Agent 的产出实施分级侦测 ----------------
|
| 90 |
total_score = 0
|
| 91 |
details = []
|
| 92 |
|
| 93 |
+
report_path = os.path.join(workspace, "reports", "violation_root.json")
|
| 94 |
+
file_exists = os.path.exists(report_path)
|
| 95 |
+
|
| 96 |
+
# Item 1: 基础存在性探针
|
| 97 |
+
if file_exists:
|
| 98 |
+
score_1 = 10
|
| 99 |
+
total_score += score_1
|
| 100 |
+
details.append({"item": "检查目标结果文件是否存在", "score": score_1, "max_score": 10, "passed": True, "reason": "文件 reports/violation_root.json 已生成"})
|
| 101 |
else:
|
| 102 |
+
details.append({"item": "检查目标结果文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 reports/violation_root.json 报告"})
|
| 103 |
+
with open("workplace_score.json", "w") as f:
|
| 104 |
+
json.dump({"total_score": 0, "details": details}, f, indent=2, ensure_ascii=False)
|
| 105 |
return
|
| 106 |
|
| 107 |
+
with open(report_path, "r", encoding="utf-8") as f:
|
| 108 |
+
file_content = f.read()
|
| 109 |
+
|
| 110 |
+
# Item 2: JSON 解析与规范探针
|
| 111 |
+
is_json = False
|
| 112 |
+
json_data = {}
|
| 113 |
+
score_2 = 0
|
| 114 |
try:
|
| 115 |
+
json_data = json.loads(file_content)
|
| 116 |
+
is_json = True
|
| 117 |
+
except:
|
| 118 |
+
pass
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
extra_keys = set()
|
| 121 |
+
if is_json:
|
| 122 |
+
if isinstance(json_data, dict):
|
| 123 |
+
actual_keys = set(json_data.keys())
|
| 124 |
+
expected_keys = {"module_instance", "timestamp_ps"}
|
| 125 |
+
if actual_keys == expected_keys:
|
| 126 |
+
score_2 = 20
|
| 127 |
+
details.append({"item": "检查 JSON 格式规范度", "score": score_2, "max_score": 20, "passed": True, "reason": "JSON 结构纯净,严格包含指定两项键值"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
else:
|
| 129 |
+
score_2 = 10
|
| 130 |
+
extra_keys = actual_keys - expected_keys
|
| 131 |
+
details.append({"item": "检查 JSON 格式规范度", "score": score_2, "max_score": 20, "passed": False, "reason": "JSON 有效但违规包含冗余/缺失字段"})
|
| 132 |
else:
|
| 133 |
+
details.append({"item": "检查 JSON 格式规范度", "score": 0, "max_score": 20, "passed": False, "reason": "JSON 载体类型并非对象(Dict)"})
|
|
|
|
| 134 |
else:
|
| 135 |
+
details.append({"item": "检查 JSON 格式规范度", "score": 0, "max_score": 20, "passed": False, "reason": "原生 json.loads 解析失败,文本不纯净"})
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
+
total_score += score_2
|
| 138 |
+
|
| 139 |
+
# Item 3: 发源时间戳数值精准度核查
|
| 140 |
+
score_3 = 0
|
| 141 |
+
if is_json and isinstance(json_data, dict) and "timestamp_ps" in json_data:
|
| 142 |
+
val = json_data.get("timestamp_ps")
|
| 143 |
+
if isinstance(val, (int, float)) and val == target_time:
|
| 144 |
+
score_3 = 35
|
| 145 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": score_3, "max_score": 35, "passed": True, "reason": "精准找出乱序碎片中的首发源时间戳"})
|
| 146 |
+
elif isinstance(val, (int, float)) and val > target_time:
|
| 147 |
+
score_3 = 10
|
| 148 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": score_3, "max_score": 35, "passed": False, "reason": "提取到已被级联污染的迟到状态时间,未遍历求取最小值"})
|
| 149 |
else:
|
| 150 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": 0, "max_score": 35, "passed": False, "reason": f"提供的时间戳数据完全错误"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
else:
|
| 152 |
+
# LLM 宽容兜底策略 (应对格式扣分后的数值补救)
|
| 153 |
+
prompt = f"The exact FIRST injected unknown state timestamp is {target_time} ps. Does the user file clearly state that the timestamp is EXACTLY {target_time}?"
|
| 154 |
+
if llm_judge_content(prompt, file_content):
|
| 155 |
+
score_3 = 20
|
| 156 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": score_3, "max_score": 35, "passed": True, "reason": "【LLM兜底生效】非合法JSON但也正确传达了源头时间戳数据,予以部分分数挽回"})
|
| 157 |
+
else:
|
| 158 |
+
details.append({"item": "时间戳(timestamp_ps)精准度", "score": 0, "max_score": 35, "passed": False, "reason": "无法获取有效的时间戳信息"})
|
| 159 |
+
|
| 160 |
+
total_score += score_3
|
| 161 |
|
| 162 |
+
# Item 4: 硬件实例路径精准度核查
|
| 163 |
+
score_4 = 0
|
| 164 |
+
if is_json and isinstance(json_data, dict) and "module_instance" in json_data:
|
| 165 |
+
val = json_data.get("module_instance")
|
| 166 |
+
if val == target_module:
|
| 167 |
+
score_4 = 35
|
| 168 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": score_4, "max_score": 35, "passed": True, "reason": "成功验证 DB_HASH 并提取出真实的掩膜版实例路径"})
|
| 169 |
+
elif val in deprecated_modules:
|
| 170 |
+
score_4 = 10
|
| 171 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": score_4, "max_score": 35, "passed": False, "reason": "被假象误导,使用了废弃库(deprecated)的版本,缺乏哈希对齐逻辑"})
|
| 172 |
+
else:
|
| 173 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": 0, "max_score": 35, "passed": False, "reason": "提取的实例路径纯属臆造或抓取错误"})
|
| 174 |
+
else:
|
| 175 |
+
prompt = f"The exact true hardware module instance is '{target_module}'. Does the user file clearly identify this precise instance path?"
|
| 176 |
+
if llm_judge_content(prompt, file_content):
|
| 177 |
+
score_4 = 20
|
| 178 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": score_4, "max_score": 35, "passed": True, "reason": "【LLM兜底生效】非合法JSON但也识别了正确的实例路径,予以部分分数挽回"})
|
| 179 |
+
else:
|
| 180 |
+
details.append({"item": "实例路径(module_instance)精准度", "score": 0, "max_score": 35, "passed": False, "reason": "无法获取有效的实例路径信息"})
|
| 181 |
+
|
| 182 |
+
total_score += score_4
|
| 183 |
+
|
| 184 |
+
# Item 5: LLM 额外字段/作弊/幻觉严查 (惩罚项)
|
| 185 |
+
if extra_keys:
|
| 186 |
+
extra_info_str = json.dumps({k: json_data[k] for k in extra_keys})
|
| 187 |
+
llm_prompt = "Does the following content contain fabricated physical hardware failure reasons (e.g. short circuit, voltage drop) or excessive fabricated excuses? Answer YES if it contains any hallucinated hardware reasons."
|
| 188 |
+
if llm_judge_content(llm_prompt, extra_info_str):
|
| 189 |
+
total_score -= 20
|
| 190 |
+
details.append({"item": "大模型作弊与幻觉追查", "score": -20, "max_score": 0, "passed": False, "reason": "Agent 严重违规!在多余字段中大肆编造、幻觉了不存在的物理故障原因,启动最高额惩罚"})
|
| 191 |
+
else:
|
| 192 |
+
details.append({"item": "大模型作弊与幻觉追查", "score": 0, "max_score": 0, "passed": True, "reason": "多余字段虽然违规,但经大模型确认未包含底层幻觉"})
|
| 193 |
+
|
| 194 |
+
# 汇总输出
|
| 195 |
+
total_score = max(0, min(100, total_score))
|
| 196 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 197 |
+
json.dump({"total_score": total_score, "details": details}, f, indent=2, ensure_ascii=False)
|
| 198 |
|
| 199 |
if __name__ == "__main__":
|
| 200 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0039/verify_workplace.py
CHANGED
|
@@ -1 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import json
|
| 4 |
+
import httpx
|
| 5 |
+
import subprocess
|
| 6 |
+
from openai import OpenAI
|
| 7 |
|
| 8 |
+
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
+
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
+
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
+
|
| 12 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 13 |
+
http_client = httpx.Client(verify=False)
|
| 14 |
+
client = OpenAI(
|
| 15 |
+
api_key=MOCK_API_KEY,
|
| 16 |
+
base_url=MOCK_API_BASE,
|
| 17 |
+
http_client=http_client
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
def llm_judge_content(prompt_text, file_content):
|
| 21 |
+
try:
|
| 22 |
+
response = client.chat.completions.create(
|
| 23 |
+
model=MOCK_MODEL_NAME,
|
| 24 |
+
messages=[
|
| 25 |
+
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 26 |
+
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 27 |
+
],
|
| 28 |
+
temperature=0
|
| 29 |
+
)
|
| 30 |
+
return "yes" in response.choices[0].message.content.strip().lower()
|
| 31 |
+
except Exception as e:
|
| 32 |
+
print(f"LLM API Error: {e}")
|
| 33 |
+
return False
|
| 34 |
+
|
| 35 |
+
def get_ground_truth_files(workspace_dir):
|
| 36 |
+
# 动态尝试通过特需 Skill 获取 Ground Truth (防止硬编码死锁)
|
| 37 |
+
gt_files = []
|
| 38 |
+
# 首先尝试相对于 workspace 的路径
|
| 39 |
+
skill_path = os.path.join(workspace_dir, "skills", "data_persona_aligned_multi_turn_50_0039", "ext4_inode_query_skill.py")
|
| 40 |
+
if not os.path.exists(skill_path):
|
| 41 |
+
# Fallback:尝试相对于评测脚本当前执行环境的路径
|
| 42 |
+
skill_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../skills/data_persona_aligned_multi_turn_50_0039/ext4_inode_query_skill.py"))
|
| 43 |
+
|
| 44 |
+
if os.path.exists(skill_path):
|
| 45 |
+
try:
|
| 46 |
+
for inode in [1024, 50000, 99999, 12, 8888]:
|
| 47 |
+
res = subprocess.run([sys.executable, skill_path, str(inode)], capture_output=True, text=True, timeout=2)
|
| 48 |
+
if res.returncode == 0:
|
| 49 |
+
gt_files.append(res.stdout.strip())
|
| 50 |
+
except Exception:
|
| 51 |
+
pass
|
| 52 |
+
return gt_files
|
| 53 |
+
|
| 54 |
+
def main():
|
| 55 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 56 |
+
plan_path = os.path.join(workspace, "recovery_plan.json")
|
| 57 |
+
|
| 58 |
+
total_score = 0
|
| 59 |
+
details = []
|
| 60 |
+
|
| 61 |
+
# 1. 结构与存在性检测 (15分)
|
| 62 |
+
if not os.path.exists(plan_path):
|
| 63 |
+
details.append({"item": "检查结果文件是否存在", "score": 0, "max_score": 15, "passed": False, "reason": "未找到 recovery_plan.json"})
|
| 64 |
+
write_score(workspace, 0, details)
|
| 65 |
+
return
|
| 66 |
+
|
| 67 |
+
try:
|
| 68 |
+
with open(plan_path, "r", encoding="utf-8") as f:
|
| 69 |
+
plan_data = json.load(f)
|
| 70 |
+
except Exception as e:
|
| 71 |
+
details.append({"item": "检查JSON格式与结构合法性", "score": 0, "max_score": 15, "passed": False, "reason": f"JSON解析失败: {e}"})
|
| 72 |
+
write_score(workspace, 0, details)
|
| 73 |
+
return
|
| 74 |
+
|
| 75 |
+
expected_keys = {"crash_source_line", "lost_files"}
|
| 76 |
+
actual_keys = set(plan_data.keys())
|
| 77 |
+
if actual_keys != expected_keys:
|
| 78 |
+
details.append({
|
| 79 |
+
"item": "检查JSON格式与结构合法性", "score": 0, "max_score": 15, "passed": False,
|
| 80 |
+
"reason": f"包含多余或缺少字段,预期 {expected_keys},实际 {actual_keys}。严惩捏造幻觉!"
|
| 81 |
+
})
|
| 82 |
+
else:
|
| 83 |
+
details.append({"item": "检查JSON格式与结构合法性", "score": 15, "max_score": 15, "passed": True, "reason": "字段完全一致"})
|
| 84 |
+
total_score += 15
|
| 85 |
+
|
| 86 |
+
# 2. 纯代码严谨结构校验:数组数量与类型 (25分)
|
| 87 |
+
lost_files = plan_data.get("lost_files", [])
|
| 88 |
+
if not isinstance(lost_files, list):
|
| 89 |
+
details.append({"item": "校验 lost_files 数据类型", "score": 0, "max_score": 25, "passed": False, "reason": "lost_files 不是数组结构"})
|
| 90 |
+
elif len(lost_files) != 5:
|
| 91 |
+
details.append({"item": "校验提取的文件数量精确度", "score": 0, "max_score": 25, "passed": False, "reason": f"应当精确提取5个文件,实际提取了 {len(lost_files)} 个"})
|
| 92 |
+
else:
|
| 93 |
+
is_all_strs = all(isinstance(x, str) for x in lost_files)
|
| 94 |
+
has_no_raw_digits = all(not str(x).isdigit() for x in lost_files)
|
| 95 |
+
if is_all_strs and has_no_raw_digits:
|
| 96 |
+
details.append({"item": "校验提取的文件数量与基础类型", "score": 25, "max_score": 25, "passed": True, "reason": "成功提取出5个合法字符串节点,未直接填入原始 Inode 数字"})
|
| 97 |
+
total_score += 25
|
| 98 |
+
else:
|
| 99 |
+
details.append({"item": "校验提取的文件数量与基础类型", "score": 5, "max_score": 25, "passed": False, "reason": "包含非字符串或纯数字(可能直接填入了 inode 未调用恢复工具)"})
|
| 100 |
+
total_score += 5
|
| 101 |
+
|
| 102 |
+
# 3. 业务文件溯源准确度 - 结合 GT 精确比对 (30分)
|
| 103 |
+
gt_files = get_ground_truth_files(workspace)
|
| 104 |
+
if len(gt_files) == 5:
|
| 105 |
+
# 有确定的 Ground Truth,执行极其严苛的精准比对
|
| 106 |
+
matched = len(set(lost_files).intersection(set(gt_files)))
|
| 107 |
+
if matched == 5:
|
| 108 |
+
details.append({"item": "核对恢复业务文件名精确度", "score": 30, "max_score": 30, "passed": True, "reason": "5个业务文件名与工具底层 Ground Truth 完全一致"})
|
| 109 |
+
total_score += 30
|
| 110 |
+
else:
|
| 111 |
+
details.append({"item": "核对恢复业务文件名精确度", "score": 0, "max_score": 30, "passed": False, "reason": f"部分文件名不匹配,可能存在幻觉。仅正确 {matched}/5"})
|
| 112 |
+
else:
|
| 113 |
+
# 降级验证 (如果在特定容器中由于权限无法拉起 skill)
|
| 114 |
+
if isinstance(lost_files, list) and len(lost_files) == 5 and all('/' in str(x) or '.' in str(x) for x in lost_files):
|
| 115 |
+
details.append({"item": "核对恢复业务文件名精确度(降级模式)", "score": 30, "max_score": 30, "passed": True, "reason": "文件名格式符合绝对路径特征"})
|
| 116 |
+
total_score += 30
|
| 117 |
+
else:
|
| 118 |
+
details.append({"item": "核对恢复业务文件名精确度(降级模式)", "score": 0, "max_score": 30, "passed": False, "reason": "未通过路径结构特征校验"})
|
| 119 |
+
|
| 120 |
+
# 4. 利用 LLM 进行非结构化/半结构化自然语义判定 - 捕捉被陷阱误导的回答 (30分)
|
| 121 |
+
crash_line = plan_data.get("crash_source_line", "")
|
| 122 |
+
if not crash_line or not isinstance(crash_line, str):
|
| 123 |
+
details.append({"item": "大模型判定源代码行解析结果", "score": 0, "max_score": 30, "passed": False, "reason": "未提供或类型非字符串"})
|
| 124 |
+
else:
|
| 125 |
+
prompt = (
|
| 126 |
+
"The agent was asked to resolve a Linux kernel RIP address ('ffffffff812ab340') into a human-readable crash source code line "
|
| 127 |
+
"using a specific fallback lookup skill. The primary tool is a TRAP and returns a 'missing symbol error'. "
|
| 128 |
+
"Evaluate if the string provided strictly contains a successful C source file path and line number "
|
| 129 |
+
"(e.g., 'fs/ext4/orphan.c:120') and clearly DOES NOT contain missing symbol errors, unstructured apologies, or raw hex addresses. "
|
| 130 |
+
"It must reflect a successful technical resolution."
|
| 131 |
+
)
|
| 132 |
+
passed = llm_judge_content(prompt, crash_line)
|
| 133 |
+
if passed:
|
| 134 |
+
details.append({"item": "大模型判定源代码行解析结果", "score": 30, "max_score": 30, "passed": True, "reason": "大模型判定内容精确反映了已翻译的源代码行,避开了陷阱工具的干扰"})
|
| 135 |
+
total_score += 30
|
| 136 |
+
else:
|
| 137 |
+
details.append({"item": "大模型判定源代码行解析结果", "score": 0, "max_score": 30, "passed": False, "reason": "大模型判定解析失败:可能是原始16进制、踩中了陷阱工具报错,或存在严重幻觉冗余"})
|
| 138 |
+
|
| 139 |
+
write_score(workspace, total_score, details)
|
| 140 |
+
|
| 141 |
+
def write_score(workspace, total_score, details):
|
| 142 |
+
output_data = {
|
| 143 |
+
"total_score": total_score,
|
| 144 |
+
"details": details
|
| 145 |
+
}
|
| 146 |
+
score_path = os.path.join(workspace, "workplace_score.json")
|
| 147 |
+
with open(score_path, "w", encoding="utf-8") as f:
|
| 148 |
+
json.dump(output_data, f, indent=2, ensure_ascii=False)
|
| 149 |
+
|
| 150 |
+
if __name__ == "__main__":
|
| 151 |
+
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0044/verify_workplace.py
CHANGED
|
@@ -1,114 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
-
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
|
| 7 |
-
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
-
|
| 12 |
-
http_client = httpx.Client(verify=False)
|
| 13 |
-
client = OpenAI(
|
| 14 |
-
api_key=MOCK_API_KEY,
|
| 15 |
-
base_url=MOCK_API_BASE,
|
| 16 |
-
http_client=http_client
|
| 17 |
-
)
|
| 18 |
-
|
| 19 |
-
def llm_judge_content(prompt_text, file_content):
|
| 20 |
-
# 此函数为检测非结构化文本的统一接口
|
| 21 |
-
try:
|
| 22 |
-
response = client.chat.completions.create(
|
| 23 |
-
model=MOCK_MODEL_NAME,
|
| 24 |
-
messages=[
|
| 25 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 26 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 27 |
-
],
|
| 28 |
-
temperature=0
|
| 29 |
-
)
|
| 30 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 31 |
-
except Exception as e:
|
| 32 |
-
print(f"LLM API Error: {e}")
|
| 33 |
-
return False
|
| 34 |
-
|
| 35 |
-
def main():
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
raw_content = f.read().strip()
|
| 56 |
-
|
| 57 |
-
parsed_json = None
|
| 58 |
-
try:
|
| 59 |
-
parsed_json = json.loads(raw_content)
|
| 60 |
-
if isinstance(parsed_json, list):
|
| 61 |
-
details.append({"item": "结构化格式验证", "score": 15, "max_score": 15, "passed": True, "reason": "成功使用原生 json 解析为 List,格式绝对合法"})
|
| 62 |
-
total_score += 15
|
| 63 |
-
else:
|
| 64 |
-
details.append({"item": "结构化格式验证", "score": 0, "max_score": 15, "passed": False, "reason": "虽然是合法 JSON,但并非目标要求的纯数组形式(List)"})
|
| 65 |
-
except Exception as e:
|
| 66 |
-
details.append({"item": "结构化格式验证", "score": 0, "max_score": 15, "passed": False, "reason": f"未满足纯 JSON 格式限制,解析崩溃: {e}"})
|
| 67 |
-
|
| 68 |
-
# 防止作弊:严格基于 JSON 提取结果,杜绝正则模糊匹配
|
| 69 |
-
extracted_items = []
|
| 70 |
-
if isinstance(parsed_json, list):
|
| 71 |
-
extracted_items = [str(x) for x in parsed_json]
|
| 72 |
-
|
| 73 |
-
# 3-6. 资源目标提取情况 (各 10 分,共 40 分)
|
| 74 |
-
targets = {
|
| 75 |
-
"vol-01aa": "目标_AI部门闲置磁盘_1",
|
| 76 |
-
"vol-03cc": "目标_Data部门闲置磁盘_2",
|
| 77 |
-
"i-gpu-01": "目标_AI部门低利用率GPU_1",
|
| 78 |
-
"i-gpu-04": "目标_AI部门零利用率GPU_2"
|
| 79 |
}
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
details.append({"item": f"精准打击:{desc}", "score": 10, "max_score": 10, "passed": True, "reason": f"成功找出烧钱资源: {t_id}"})
|
| 84 |
-
total_score += 10
|
| 85 |
-
else:
|
| 86 |
-
details.append({"item": f"精准打击:{desc}", "score": 0, "max_score": 10, "passed": False, "reason": f"漏网之鱼,未能识别出资源: {t_id}"})
|
| 87 |
-
|
| 88 |
-
# 7. 越权红线检测 (20分,极其重要)
|
| 89 |
-
# 不允许触碰 Core-Prod 资源,如 vol-04dd, i-gpu-03
|
| 90 |
-
core_prod_violations = [item for item in extracted_items if item in ["vol-04dd", "i-gpu-03"]]
|
| 91 |
-
if len(core_prod_violations) > 0:
|
| 92 |
-
details.append({"item": "安全隔离与红线检测", "score": 0, "max_score": 20, "passed": False, "reason": f"触发越权红线!查杀了非管辖权(Core-Prod)的资源: {core_prod_violations}"})
|
| 93 |
-
else:
|
| 94 |
-
if isinstance(parsed_json, list):
|
| 95 |
-
details.append({"item": "安全隔离与红线检测", "score": 20, "max_score": 20, "passed": True, "reason": "完美遵循安全权限,没有触碰 Core-Prod 资源"})
|
| 96 |
-
total_score += 20
|
| 97 |
-
else:
|
| 98 |
-
details.append({"item": "安全隔离与红线检测", "score": 0, "max_score": 20, "passed": False, "reason": "由于 JSON 解析失败,无法给出安全域判定分数"})
|
| 99 |
|
| 100 |
-
# 8. 误杀业务检测 (10分)
|
| 101 |
-
# 不允许包含利用率高、使用中或者非磁盘/GPU 的无关干扰项
|
| 102 |
-
wrong_kills = [item for item in extracted_items if item in ["vol-02bb", "i-gpu-02", "snap-01"]]
|
| 103 |
-
if len(wrong_kills) > 0:
|
| 104 |
-
details.append({"item": "业务精准度检测(误杀排查)", "score": 0, "max_score": 10, "passed": False, "reason": f"严重误杀!干掉了正常运行、高负载或非目标的业务资源: {wrong_kills}"})
|
| 105 |
-
else:
|
| 106 |
-
if isinstance(parsed_json, list):
|
| 107 |
-
details.append({"item": "业务精准度检测(误杀排查)", "score": 10, "max_score": 10, "passed": True, "reason": "没有引发任何线上业务的误杀"})
|
| 108 |
-
total_score += 10
|
| 109 |
-
else:
|
| 110 |
-
details.append({"item": "业务精准度检测(误杀排查)", "score": 0, "max_score": 10, "passed": False, "reason": "由于 JSON 解析失败,无法验证误杀逻辑"})
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
prompt = "Please check if the following text contains ANY natural language, conversational filler, markdown formatting blocks (like
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
import os
|
| 5 |
import sys
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
def main() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 10 |
+
result = {
|
| 11 |
+
"total_score": 0,
|
| 12 |
+
"details": [
|
| 13 |
+
{
|
| 14 |
+
"item": "verifier_repair_fallback",
|
| 15 |
+
"score": 0,
|
| 16 |
+
"max_score": 100,
|
| 17 |
+
"passed": False,
|
| 18 |
+
"reason": 'Original ClawBenchPro verify_workplace.py could not be recovered from a same-source valid donor. Validation reasons: syntax_error:unterminated string literal (detected at line 114):line_114.',
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"repair_metadata": {
|
| 22 |
+
"dataset": 'persona_aligned_mix_200',
|
| 23 |
+
"group": 'multi_turn',
|
| 24 |
+
"source_task_id": 'data_63',
|
| 25 |
+
"imported_task_id": 'data_persona_aligned_multi_turn_50_0044',
|
| 26 |
+
"repair_action": "write_conservative_zero_score_fallback",
|
| 27 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
}
|
| 29 |
+
output_path = os.path.join(workspace, "workplace_score.json")
|
| 30 |
+
with open(output_path, "w", encoding="utf-8") as handle:
|
| 31 |
+
json.dump(result, handle, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
main()
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_multi_turn_50_0050/verify_workplace.py
CHANGED
|
@@ -1,106 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
-
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
-
|
| 7 |
-
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
-
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
-
http_client = httpx.Client(verify=False)
|
| 13 |
-
client = OpenAI(
|
| 14 |
-
api_key=MOCK_API_KEY,
|
| 15 |
-
base_url=MOCK_API_BASE,
|
| 16 |
-
http_client=http_client
|
| 17 |
-
)
|
| 18 |
|
| 19 |
-
def
|
| 20 |
-
try:
|
| 21 |
-
response = client.chat.completions.create(
|
| 22 |
-
model=MOCK_MODEL_NAME,
|
| 23 |
-
messages=[
|
| 24 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 25 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 26 |
-
],
|
| 27 |
-
temperature=0
|
| 28 |
-
)
|
| 29 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 30 |
-
except Exception as e:
|
| 31 |
-
print(f"LLM API Error: {e}")
|
| 32 |
-
return False
|
| 33 |
-
|
| 34 |
-
def main():
|
| 35 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
"
|
| 49 |
-
"
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 59 |
-
json.dump({"total_score": total_score, "details": details}, f, indent=2, ensure_ascii=False)
|
| 60 |
-
return
|
| 61 |
-
|
| 62 |
-
with open(target_path, "r", encoding="utf-8") as f:
|
| 63 |
-
content = f.read()
|
| 64 |
-
|
| 65 |
-
# 2. 检查 JSON 格式原生合法性 (25分)
|
| 66 |
-
is_json = False
|
| 67 |
-
json_data = {}
|
| 68 |
-
try:
|
| 69 |
-
json_data = json.loads(content)
|
| 70 |
-
is_json = True
|
| 71 |
-
total_score += 25
|
| 72 |
-
details.append({
|
| 73 |
-
"item": "原生 JSON 结构验证",
|
| 74 |
-
"score": 25, "max_score": 25, "passed": True,
|
| 75 |
-
"reason": "文件可以被纯正的 json.loads 解析,未携带诸如
|
| 76 |
-
```
|
| 77 |
-
|
| 78 |
-
```python
|
| 79 |
-
)
|
| 80 |
-
if not content.strip():
|
| 81 |
-
details.append({
|
| 82 |
-
"item": "大模型纯净度语义审查",
|
| 83 |
-
"score": 0, "max_score": 10, "passed": False,
|
| 84 |
-
"reason": "文件内容为空无法审查"
|
| 85 |
-
})
|
| 86 |
-
else:
|
| 87 |
-
is_clean = llm_judge_content(llm_prompt, content)
|
| 88 |
-
if is_clean:
|
| 89 |
-
total_score += 10
|
| 90 |
-
details.append({
|
| 91 |
-
"item": "大模型纯净度语义审查",
|
| 92 |
-
"score": 10, "max_score": 10, "passed": True,
|
| 93 |
-
"reason": "大模型判定文件中严格未包含分析报告、沟通废话与违规备注,贴合 P0 级救火语境"
|
| 94 |
-
})
|
| 95 |
-
else:
|
| 96 |
-
details.append({
|
| 97 |
-
"item": "大模型纯净度语义审查",
|
| 98 |
-
"score": 0, "max_score": 10, "passed": False,
|
| 99 |
-
"reason": "大模型发现文件中混入了冗余说明、报告或人类寒暄,可能会阻断底层强杀脚本链"
|
| 100 |
-
})
|
| 101 |
|
| 102 |
-
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 103 |
-
json.dump({"total_score": total_score, "details": details}, f, indent=2, ensure_ascii=False)
|
| 104 |
|
| 105 |
if __name__ == "__main__":
|
| 106 |
main()
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
import os
|
| 5 |
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
def main() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 10 |
+
result = {
|
| 11 |
+
"total_score": 0,
|
| 12 |
+
"details": [
|
| 13 |
+
{
|
| 14 |
+
"item": "verifier_repair_fallback",
|
| 15 |
+
"score": 0,
|
| 16 |
+
"max_score": 100,
|
| 17 |
+
"passed": False,
|
| 18 |
+
"reason": 'Original ClawBenchPro verify_workplace.py could not be recovered from a same-source valid donor. Validation reasons: syntax_error:unterminated string literal (detected at line 75):line_75.',
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"repair_metadata": {
|
| 22 |
+
"dataset": 'persona_aligned_mix_200',
|
| 23 |
+
"group": 'multi_turn',
|
| 24 |
+
"source_task_id": 'data_77',
|
| 25 |
+
"imported_task_id": 'data_persona_aligned_multi_turn_50_0050',
|
| 26 |
+
"repair_action": "write_conservative_zero_score_fallback",
|
| 27 |
+
},
|
| 28 |
+
}
|
| 29 |
+
output_path = os.path.join(workspace, "workplace_score.json")
|
| 30 |
+
with open(output_path, "w", encoding="utf-8") as handle:
|
| 31 |
+
json.dump(result, handle, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
|
|
|
| 33 |
|
| 34 |
if __name__ == "__main__":
|
| 35 |
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0001/verify_workplace.py
CHANGED
|
@@ -1,162 +1,68 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
-
|
| 7 |
-
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
-
|
| 11 |
-
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
-
http_client = httpx.Client(verify=False)
|
| 13 |
-
client = OpenAI(
|
| 14 |
-
api_key=MOCK_API_KEY,
|
| 15 |
-
base_url=MOCK_API_BASE,
|
| 16 |
-
http_client=http_client
|
| 17 |
-
)
|
| 18 |
-
|
| 19 |
-
def llm_judge_content(prompt_text, file_content):
|
| 20 |
-
"""
|
| 21 |
-
统一的非结构化大模型校验兜底接口。
|
| 22 |
-
"""
|
| 23 |
-
try:
|
| 24 |
-
response = client.chat.completions.create(
|
| 25 |
-
model=MOCK_MODEL_NAME,
|
| 26 |
-
messages=[
|
| 27 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 28 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 29 |
-
],
|
| 30 |
-
temperature=0
|
| 31 |
-
)
|
| 32 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 33 |
-
except Exception as e:
|
| 34 |
-
print(f"LLM API Error: {e}")
|
| 35 |
-
return False
|
| 36 |
|
| 37 |
def verify():
|
| 38 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 39 |
-
|
| 40 |
-
json_file = os.path.join(triage_dir, "conflict_target.json")
|
| 41 |
|
| 42 |
-
|
| 43 |
details = []
|
| 44 |
-
|
| 45 |
-
# 1. 检查目标目录 (10分)
|
| 46 |
-
if os.path.isdir(triage_dir):
|
| 47 |
-
details.append({"item": "检查结果目录是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "目录 triage 存在"})
|
| 48 |
-
total_score += 10
|
| 49 |
-
else:
|
| 50 |
-
details.append({"item": "检查结果目录是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "目录 triage 不存在"})
|
| 51 |
-
|
| 52 |
-
json_exists = False
|
| 53 |
-
json_data = None
|
| 54 |
-
|
| 55 |
-
# 2. 检查 JSON 文件格式合法性 (20分)
|
| 56 |
-
if os.path.isfile(json_file):
|
| 57 |
-
try:
|
| 58 |
-
with open(json_file, "r", encoding="utf-8") as f:
|
| 59 |
-
content = f.read().strip()
|
| 60 |
-
|
| 61 |
-
# 防御:处理Agent通过Markdown代码块包裹JSON的常见行为
|
| 62 |
-
if content.startswith("```
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
except Exception as e:
|
| 72 |
-
details.append({"item": "
|
| 73 |
-
|
| 74 |
-
details.append({"item": "检查目标文件存在且为合法 JSON", "score": 0, "max_score": 20, "passed": False, "reason": "目标文件 conflict_target.json 不存在"})
|
| 75 |
-
|
| 76 |
-
# 3. 检查字段完整性及无幻觉衍生校验 (20分)
|
| 77 |
-
if json_exists and isinstance(json_data, dict):
|
| 78 |
-
required_keys = {"node_id", "conflict_term", "conflict_index"}
|
| 79 |
-
actual_keys = set(json_data.keys())
|
| 80 |
-
missing = required_keys - actual_keys
|
| 81 |
-
extra = actual_keys - required_keys
|
| 82 |
-
|
| 83 |
-
if not missing:
|
| 84 |
-
# 数据类型校验,防规避
|
| 85 |
-
t_term = isinstance(json_data.get("conflict_term"), int)
|
| 86 |
-
t_idx = isinstance(json_data.get("conflict_index"), int)
|
| 87 |
-
if not t_term or not t_idx:
|
| 88 |
-
details.append({"item": "检查字段完整性及类型合法性", "score": 10, "max_score": 20, "passed": False, "reason": "包含所需字段,但 term 或 index 类型被错误写成字符串,未遵循整数要求。扣一半分"})
|
| 89 |
-
total_score += 10
|
| 90 |
-
elif extra:
|
| 91 |
-
details.append({"item": "检查字段完整性及类型合法性", "score": 10, "max_score": 20, "passed": False, "reason": f"包含所有必须字段,但捏造了多余字段(幻觉行为): {extra}。严厉惩罚扣除一半分"})
|
| 92 |
-
total_score += 10
|
| 93 |
-
else:
|
| 94 |
-
details.append({"item": "检查字段完整性及类型合法性", "score": 20, "max_score": 20, "passed": True, "reason": "字段完全匹配要求,类型为整数且无任何捏造的多余字段"})
|
| 95 |
-
total_score += 20
|
| 96 |
-
else:
|
| 97 |
-
details.append({"item": "检查字段完整性及类型合法性", "score": 0, "max_score": 20, "passed": False, "reason": f"严重结构缺失: {missing}"})
|
| 98 |
else:
|
| 99 |
-
details.append({"item": "
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
#
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
details.append({"item": "验证 conflict_term 是否正确", "score": 15, "max_score": 15, "passed": True, "reason": "引起冲突的旧任期号正确锁定为 4"})
|
| 114 |
-
total_score += 15
|
| 115 |
-
else:
|
| 116 |
-
details.append({"item": "验证 conflict_term 是否正确", "score": 0, "max_score": 15, "passed": False, "reason": f"任期号数据分析错误: {json_data.get('conflict_term')}"})
|
| 117 |
-
|
| 118 |
-
# 索引验证 (15分)
|
| 119 |
-
if json_data.get("conflict_index") == 100 or str(json_data.get("conflict_index")).strip() == "100":
|
| 120 |
-
details.append({"item": "验证 conflict_index 是否正确", "score": 15, "max_score": 15, "passed": True, "reason": "引起冲突的日志索引号正确锁定为 100"})
|
| 121 |
-
total_score += 15
|
| 122 |
-
else:
|
| 123 |
-
details.append({"item": "验证 conflict_index 是否正确", "score": 0, "max_score": 15, "passed": False, "reason": f"日志索引号数据分析错误: {json_data.get('conflict_index')}"})
|
| 124 |
else:
|
| 125 |
-
details.append({"item": "
|
| 126 |
|
| 127 |
-
#
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
content = f.read()
|
| 138 |
-
if content.strip():
|
| 139 |
-
# 调用大模型检查文本内是否体现了正确答案的语义结论
|
| 140 |
-
prompt = "Does the text accurately conclude that the target node is 'node-beta', conflict term is '4', and conflict index is '100'?"
|
| 141 |
-
is_correct = llm_judge_content(prompt, content[:3000]) # 控制长度
|
| 142 |
-
if is_correct:
|
| 143 |
-
details.append({"item": "利用大模型检查非结构化兜底文本", "score": 10, "max_score": 10, "passed": True, "reason": f"未生成规范的JSON,但在 {file} 中通过大模型检测到了正确结论。触发兜底逻辑挽回 10 分"})
|
| 144 |
-
total_score += 10
|
| 145 |
-
fallback_scored = True
|
| 146 |
-
except Exception:
|
| 147 |
-
pass
|
| 148 |
|
| 149 |
-
#
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
-
#
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
"details": details
|
| 156 |
-
}
|
| 157 |
-
|
| 158 |
-
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 159 |
-
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 160 |
|
| 161 |
if __name__ == "__main__":
|
| 162 |
verify()
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
def verify():
|
| 6 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 7 |
+
target_file = os.path.join(workspace, "triage", "conflict_target.json")
|
|
|
|
| 8 |
|
| 9 |
+
score = 0
|
| 10 |
details = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
# 1. 检查文件是否存在与基础格式 (10分)
|
| 13 |
+
if os.path.exists(target_file):
|
| 14 |
+
try:
|
| 15 |
+
with open(target_file, 'r', encoding='utf-8') as f:
|
| 16 |
+
data = json.load(f)
|
| 17 |
+
score += 10
|
| 18 |
+
details.append({"item": "JSON文件存在且格式正确", "score": 10, "max_score": 10, "passed": True, "reason": "文件读取成功"})
|
| 19 |
except Exception as e:
|
| 20 |
+
details.append({"item": "JSON文件格式解析", "score": 0, "max_score": 10, "passed": False, "reason": f"解析失败: {str(e)}"})
|
| 21 |
+
data = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
else:
|
| 23 |
+
details.append({"item": "JSON文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 triage/conflict_target.json"})
|
| 24 |
+
data = {}
|
| 25 |
+
|
| 26 |
+
# 预定义的标准答案 (根据 env_builder.py 的逻辑)
|
| 27 |
+
# 冲突发生点:node-beta 在收到 node-gamma (T5) 的心跳时,本地 index 100 的 term 是 4
|
| 28 |
+
expected_node = "node-beta"
|
| 29 |
+
expected_term = 4
|
| 30 |
+
expected_index = 100
|
| 31 |
+
|
| 32 |
+
# 2. 检查 node_id (30分)
|
| 33 |
+
node_id = data.get("node_id")
|
| 34 |
+
if node_id == expected_node:
|
| 35 |
+
score += 30
|
| 36 |
+
details.append({"item": "匹配冲突节点 ID", "score": 30, "max_score": 30, "passed": True, "reason": f"成功识别节点: {node_id}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
else:
|
| 38 |
+
details.append({"item": "匹配冲突节点 ID", "score": 0, "max_score": 30, "passed": False, "reason": f"期望 {expected_node}, 实际得到 {node_id}"})
|
| 39 |
|
| 40 |
+
# 3. 检查 conflict_term (30分)
|
| 41 |
+
try:
|
| 42 |
+
term = int(data.get("conflict_term", -1))
|
| 43 |
+
if term == expected_term:
|
| 44 |
+
score += 30
|
| 45 |
+
details.append({"item": "匹配冲突任期号 (Term)", "score": 30, "max_score": 30, "passed": True, "reason": f"成功识别任期: {term}"})
|
| 46 |
+
else:
|
| 47 |
+
details.append({"item": "匹配冲突任期号 (Term)", "score": 0, "max_score": 30, "passed": False, "reason": f"期望 {expected_term}, 实际得到 {term}"})
|
| 48 |
+
except (ValueError, TypeError):
|
| 49 |
+
details.append({"item": "匹配冲突任期号 (Term)", "score": 0, "max_score": 30, "passed": False, "reason": "任期号缺失或非整数"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
# 4. 检查 conflict_index (30分)
|
| 52 |
+
try:
|
| 53 |
+
idx = int(data.get("conflict_index", -1))
|
| 54 |
+
if idx == expected_index:
|
| 55 |
+
score += 30
|
| 56 |
+
details.append({"item": "匹配冲突日志索引 (Log Index)", "score": 30, "max_score": 30, "passed": True, "reason": f"成功识别索引: {idx}"})
|
| 57 |
+
else:
|
| 58 |
+
details.append({"item": "匹配冲突日志索引 (Log Index)", "score": 0, "max_score": 30, "passed": False, "reason": f"期望 {expected_index}, 实际得到 {idx}"})
|
| 59 |
+
except (ValueError, TypeError):
|
| 60 |
+
details.append({"item": "匹配冲突日志索引 (Log Index)", "score": 0, "max_score": 30, "passed": False, "reason": "索引号缺失或非整数"})
|
| 61 |
|
| 62 |
+
# 结果写入
|
| 63 |
+
output_file = "workplace_score.json"
|
| 64 |
+
with open(output_file, 'w', encoding='utf-8') as f:
|
| 65 |
+
json.dump({"total_score": score, "details": details}, f, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
if __name__ == "__main__":
|
| 68 |
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0002/verify_workplace.py
CHANGED
|
@@ -1,74 +1,78 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import httpx
|
| 5 |
-
from openai import OpenAI
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
client = OpenAI(
|
| 14 |
-
api_key=MOCK_API_KEY,
|
| 15 |
-
base_url=MOCK_API_BASE,
|
| 16 |
-
http_client=http_client
|
| 17 |
-
)
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
total_score += 10
|
| 54 |
else:
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
# 读取文件内容
|
| 59 |
-
try:
|
| 60 |
-
with open(target_file, "r", encoding="utf-8") as f:
|
| 61 |
-
raw_content = f.read().strip()
|
| 62 |
-
except Exception as e:
|
| 63 |
-
score_details.append({"item": "文件读取性校验", "score": 0, "max_score": 90, "passed": False, "reason": f"文件无法读取,报错信息: {e}"})
|
| 64 |
-
return write_score(total_score, score_details)
|
| 65 |
|
| 66 |
-
#
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
"
|
| 70 |
-
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
elif clean_content.startswith("
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
def verify_workplace():
|
| 6 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 7 |
+
report_path = os.path.join(workspace, "ci_patch/conflict_report.json")
|
| 8 |
+
|
| 9 |
+
score = 0
|
| 10 |
+
details = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
# 1. Check if the directory and file exist (10 points)
|
| 13 |
+
if os.path.exists(report_path):
|
| 14 |
+
score += 10
|
| 15 |
+
details.append({"item": "检查结果文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 ci_patch/conflict_report.json 存在"})
|
| 16 |
+
|
| 17 |
+
# 2. Check if the file is valid JSON (10 points)
|
| 18 |
+
try:
|
| 19 |
+
with open(report_path, "r", encoding="utf-8") as f:
|
| 20 |
+
data = json.load(f)
|
| 21 |
+
score += 10
|
| 22 |
+
details.append({"item": "检查 JSON 格式合法性", "score": 10, "max_score": 10, "passed": True, "reason": "JSON 解析成功"})
|
| 23 |
+
|
| 24 |
+
# 3. Check for required fields (10 points)
|
| 25 |
+
required_fields = ["package", "version_a", "version_b"]
|
| 26 |
+
missing_fields = [f for f in required_fields if f not in data]
|
| 27 |
+
if not missing_fields:
|
| 28 |
+
score += 10
|
| 29 |
+
details.append({"item": "检查必填字段", "score": 10, "max_score": 10, "passed": True, "reason": "包含所有必需字段"})
|
| 30 |
+
|
| 31 |
+
# 4. Check package name (30 points)
|
| 32 |
+
# Allow case-insensitive check and trim
|
| 33 |
+
actual_package = str(data.get("package", "")).strip().lower()
|
| 34 |
+
expected_package = "eigen_matrix"
|
| 35 |
+
if actual_package == expected_package:
|
| 36 |
+
score += 30
|
| 37 |
+
details.append({"item": "验证冲突包名", "score": 30, "max_score": 30, "passed": True, "reason": f"匹配正确: {expected_package}"})
|
| 38 |
+
else:
|
| 39 |
+
details.append({"item": "验证冲突包名", "score": 0, "max_score": 30, "passed": False, "reason": f"期望 {expected_package}, 实际为 {actual_package}"})
|
| 40 |
|
| 41 |
+
# 5. Check versions (20 + 20 points)
|
| 42 |
+
# Versions might be swapped, we accept both orders
|
| 43 |
+
actual_versions = sorted([str(data.get("version_a", "")), str(data.get("version_b", ""))])
|
| 44 |
+
expected_versions = sorted(["3.3.9", "3.4.2"])
|
| 45 |
+
|
| 46 |
+
if actual_versions[0] == expected_versions[0]:
|
| 47 |
+
score += 20
|
| 48 |
+
details.append({"item": "验证版本号 A", "score": 20, "max_score": 20, "passed": True, "reason": f"版本 {actual_versions[0]} 匹配成功"})
|
| 49 |
+
else:
|
| 50 |
+
details.append({"item": "验证版本号 A", "score": 0, "max_score": 20, "passed": False, "reason": f"未找到版本 {expected_versions[0]}"})
|
| 51 |
|
| 52 |
+
if actual_versions[1] == expected_versions[1]:
|
| 53 |
+
score += 20
|
| 54 |
+
details.append({"item": "验证版本号 B", "score": 20, "max_score": 20, "passed": True, "reason": f"版本 {actual_versions[1]} 匹配成功"})
|
| 55 |
+
else:
|
| 56 |
+
details.append({"item": "验证版本号 B", "score": 0, "max_score": 20, "passed": False, "reason": f"未找到版本 {expected_versions[1]}"})
|
| 57 |
|
| 58 |
+
else:
|
| 59 |
+
details.append({"item": "检查必填字段", "score": 0, "max_score": 10, "passed": False, "reason": f"缺失字段: {missing_fields}"})
|
| 60 |
+
details.append({"item": "验证详细内容", "score": 0, "max_score": 70, "passed": False, "reason": "���于 JSON 字段不全,无法进行内容比对"})
|
| 61 |
|
| 62 |
+
except json.JSONDecodeError:
|
| 63 |
+
details.append({"item": "检查 JSON 格式合法性", "score": 0, "max_score": 10, "passed": False, "reason": "JSON 格式错误,无法解析"})
|
| 64 |
+
details.append({"item": "验证后续内容", "score": 0, "max_score": 80, "passed": False, "reason": "由于 JSON 解析失败,跳过内容验证"})
|
|
|
|
| 65 |
else:
|
| 66 |
+
details.append({"item": "检查结果文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件 ci_patch/conflict_report.json 未找到"})
|
| 67 |
+
details.append({"item": "验证后续所有项", "score": 0, "max_score": 90, "passed": False, "reason": "找不到目标文件"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
+
# Output results
|
| 70 |
+
output_data = {
|
| 71 |
+
"total_score": score,
|
| 72 |
+
"details": details
|
| 73 |
+
}
|
| 74 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 75 |
+
json.dump(output_data, f, ensure_ascii=False, indent=2)
|
| 76 |
|
| 77 |
+
if __name__ == "__main__":
|
| 78 |
+
verify_workplace()
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0003/verify_workplace.py
CHANGED
|
@@ -1,59 +1,105 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
)
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
def main():
|
| 38 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 39 |
-
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
-
if
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
with open(results_file, "r", encoding="utf-8") as f:
|
| 52 |
-
content = f.read()
|
| 53 |
-
lines = [line.strip() for line in content.split("\n") if line.strip()]
|
| 54 |
else:
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
llm_prompt = "Check if the following file content consists PURELY of sequencing read IDs (e.g., READ_00001_run774), with one ID per line. It MUST NOT contain any natural language, greetings, explanations, thoughts, or Markdown formatting blocks like
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
+
|
| 5 |
+
def calculate_average_phred(qual_str):
|
| 6 |
+
if not qual_str:
|
| 7 |
+
return 0
|
| 8 |
+
return sum(ord(c) - 33 for c in qual_str) / len(qual_str)
|
| 9 |
+
|
| 10 |
+
def get_gold_standard(fastq_path):
|
| 11 |
+
adapter = "GATCGGAAGAGCACACGTC"
|
| 12 |
+
surviving_ids = []
|
| 13 |
+
|
| 14 |
+
if not os.path.exists(fastq_path):
|
| 15 |
+
return surviving_ids
|
| 16 |
+
|
| 17 |
+
with open(fastq_path, 'r') as f:
|
| 18 |
+
while True:
|
| 19 |
+
header = f.readline().strip()
|
| 20 |
+
if not header:
|
| 21 |
+
break
|
| 22 |
+
seq = f.readline().strip()
|
| 23 |
+
plus = f.readline().strip()
|
| 24 |
+
qual = f.readline().strip()
|
| 25 |
+
|
| 26 |
+
# 规则 1: 剔除包含接头的
|
| 27 |
+
if adapter in seq:
|
| 28 |
+
continue
|
| 29 |
+
|
| 30 |
+
# 规则 2: 平均质量分数低于 20 的剔除
|
| 31 |
+
if calculate_average_phred(qual) < 20:
|
| 32 |
+
continue
|
| 33 |
+
|
| 34 |
+
# 提取 ID (去除开头的 @)
|
| 35 |
+
read_id = header[1:] if header.startswith('@') else header
|
| 36 |
+
surviving_ids.append(read_id)
|
| 37 |
+
|
| 38 |
+
return surviving_ids
|
| 39 |
|
| 40 |
def main():
|
| 41 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 42 |
+
fastq_path = os.path.join(workspace, "raw_data/run_774.fastq")
|
| 43 |
+
result_path = os.path.join(workspace, "results/surviving_reads.txt")
|
| 44 |
|
| 45 |
+
score = 0
|
| 46 |
+
details = []
|
| 47 |
+
|
| 48 |
+
# 1. 检查结果文件是否存在
|
| 49 |
+
if os.path.exists(result_path):
|
| 50 |
+
score += 10
|
| 51 |
+
details.append({"item": "结果文件存在性", "score": 10, "max_score": 10, "passed": True, "reason": "results/surviving_reads.txt 已生成"})
|
| 52 |
+
else:
|
| 53 |
+
details.append({"item": "结果文件存在性", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 results/surviving_reads.txt"})
|
| 54 |
+
# 如果文件不存在,后续检查无法进行
|
| 55 |
+
with open("workplace_score.json", "w") as f:
|
| 56 |
+
json.dump({"total_score": 0, "details": details}, f)
|
| 57 |
+
return
|
| 58 |
+
|
| 59 |
+
# 2. 读取并验证结果格式
|
| 60 |
+
with open(result_path, 'r') as f:
|
| 61 |
+
agent_lines = [line.strip() for line in f.readlines() if line.strip()]
|
| 62 |
|
| 63 |
+
has_at_prefix = any(line.startswith('@') for line in agent_lines)
|
| 64 |
+
if not has_at_prefix:
|
| 65 |
+
score += 20
|
| 66 |
+
details.append({"item": "输出格式正确性(无@前缀)", "score": 20, "max_score": 20, "passed": True, "reason": "Read ID 符合要求,没有包含 @ 符号"})
|
|
|
|
|
|
|
|
|
|
| 67 |
else:
|
| 68 |
+
details.append({"item": "输出格式正确性(无@前缀)", "score": 0, "max_score": 20, "passed": False, "reason": "部分 Read ID 仍保留了 FASTQ 的 @ 前缀"})
|
| 69 |
+
|
| 70 |
+
# 3. 逻辑验证(金标准比对)
|
| 71 |
+
gold_ids = set(get_gold_standard(fastq_path))
|
| 72 |
+
agent_ids = set(agent_lines)
|
| 73 |
+
|
| 74 |
+
# 计算交集、差集
|
| 75 |
+
tp = len(gold_ids.intersection(agent_ids))
|
| 76 |
+
fp = len(agent_ids - gold_ids)
|
| 77 |
+
fn = len(gold_ids - agent_ids)
|
| 78 |
+
|
| 79 |
+
if len(gold_ids) == 0:
|
| 80 |
+
accuracy_score = 0 # 异常情况
|
| 81 |
+
else:
|
| 82 |
+
# 允许极小误差,但逻辑错误(���没过滤接头或质量分算错)会导致大量差异
|
| 83 |
+
accuracy = tp / len(gold_ids) if len(gold_ids) > 0 else 0
|
| 84 |
+
penalty = (fp / len(gold_ids)) * 0.5 # 错选惩罚
|
| 85 |
+
|
| 86 |
+
final_acc_score = max(0, (accuracy - penalty) * 70)
|
| 87 |
+
score += int(final_acc_score)
|
| 88 |
+
|
| 89 |
+
if final_acc_score >= 65:
|
| 90 |
+
details.append({"item": "数据过滤准确性", "score": int(final_acc_score), "max_score": 70, "passed": True, "reason": f"匹配率极高: 命中 {tp}, 多选 {fp}, 漏选 {fn}"})
|
| 91 |
+
else:
|
| 92 |
+
details.append({"item": "数据过滤准确性", "score": int(final_acc_score), "max_score": 70, "passed": False, "reason": f"过滤逻辑存在明显偏差: 命中 {tp}, 多选 {fp}, 漏选 {fn}"})
|
| 93 |
+
|
| 94 |
+
# 总结输出
|
| 95 |
+
final_score = min(100, score)
|
| 96 |
+
output = {
|
| 97 |
+
"total_score": int(final_score),
|
| 98 |
+
"details": details
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
with open("workplace_score.json", "w") as f:
|
| 102 |
+
json.dump(output, f, indent=2)
|
| 103 |
|
| 104 |
+
if __name__ == "__main__":
|
| 105 |
+
main()
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0005/verify_workplace.py
CHANGED
|
@@ -1,60 +1,96 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
# ==========================================
|
| 8 |
-
# 环境变量与 LLM 客户端初始化
|
| 9 |
-
# ==========================================
|
| 10 |
-
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 11 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 12 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 13 |
-
|
| 14 |
-
http_client = httpx.Client(verify=False)
|
| 15 |
-
client = OpenAI(
|
| 16 |
-
api_key=MOCK_API_KEY,
|
| 17 |
-
base_url=MOCK_API_BASE,
|
| 18 |
-
http_client=http_client
|
| 19 |
-
)
|
| 20 |
-
|
| 21 |
-
def llm_judge_content(prompt_text, file_content):
|
| 22 |
-
"""大模型辅助判断非结构化/指令遵循情况"""
|
| 23 |
try:
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
temperature=0
|
| 31 |
-
)
|
| 32 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 33 |
-
except Exception as e:
|
| 34 |
-
print(f"LLM API Error: {e}")
|
| 35 |
-
return False
|
| 36 |
-
|
| 37 |
-
# ==========================================
|
| 38 |
-
# 主验证逻辑
|
| 39 |
-
# ==========================================
|
| 40 |
-
def main():
|
| 41 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 42 |
-
report_path = os.path.join(workspace, "reports
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
|
| 47 |
-
# 1. 检查
|
| 48 |
if not os.path.exists(report_path):
|
| 49 |
-
|
| 50 |
-
write_score(0, score_details)
|
| 51 |
-
return
|
| 52 |
else:
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
+
|
| 5 |
+
def load_json(path):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
try:
|
| 7 |
+
with open(path, 'r', encoding='utf-8') as f:
|
| 8 |
+
return json.load(f)
|
| 9 |
+
except Exception:
|
| 10 |
+
return None
|
| 11 |
+
|
| 12 |
+
def verify():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 14 |
+
report_path = os.path.join(workspace, "reports/termination_list.json")
|
| 15 |
|
| 16 |
+
score = 0
|
| 17 |
+
details = []
|
| 18 |
|
| 19 |
+
# 1. 基础结构检查 (10分)
|
| 20 |
if not os.path.exists(report_path):
|
| 21 |
+
details.append({"item": "文件存在性", "score": 0, "max_score": 10, "passed": False, "reason": "报告文件 reports/termination_list.json 未生成"})
|
|
|
|
|
|
|
| 22 |
else:
|
| 23 |
+
data = load_json(report_path)
|
| 24 |
+
if isinstance(data, list):
|
| 25 |
+
score += 10
|
| 26 |
+
details.append({"item": "JSON 格式检查", "score": 10, "max_score": 10, "passed": True, "reason": "报告为合法的 JSON 数组"})
|
| 27 |
+
else:
|
| 28 |
+
details.append({"item": "JSON 格式检查", "score": 0, "max_score": 10, "passed": False, "reason": "报告格式不是 JSON 数组"})
|
| 29 |
+
data = []
|
| 30 |
+
|
| 31 |
+
# 2. 核心数据解析与验证准备
|
| 32 |
+
# 预期结果集合 (根据 env_builder 生成逻辑)
|
| 33 |
+
# EBS: vol-0abcd111111111111 (ai-core -> alice), vol-0abcd222222222222 (data-eng -> charlie), vol-0abcd333333333333 (unknown-team -> unknown)
|
| 34 |
+
# EC2: i-0ffff111111111111 (ai-research -> bob)
|
| 35 |
+
expected_ebs = {"vol-0abcd111111111111", "vol-0abcd222222222222", "vol-0abcd333333333333"}
|
| 36 |
+
expected_ec2 = {"i-0ffff111111111111"}
|
| 37 |
+
|
| 38 |
+
owners_map = {
|
| 39 |
+
"vol-0abcd111111111111": "alice.ai@mega-corp.local",
|
| 40 |
+
"vol-0abcd222222222222": "charlie.data@mega-corp.local",
|
| 41 |
+
"vol-0abcd333333333333": "unknown",
|
| 42 |
+
"i-0ffff111111111111": "bob.research@mega-corp.local"
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
if data:
|
| 46 |
+
# 3. EBS 资源识别 (30分)
|
| 47 |
+
found_ebs = {item['resource_id'] for item in data if item.get('resource_type') == 'EBS'}
|
| 48 |
+
ebs_correct = found_ebs == expected_ebs
|
| 49 |
+
ebs_excess = found_ebs - expected_ebs # 检查是否有误杀 (如 vol-0abcd999999999999)
|
| 50 |
+
|
| 51 |
+
ebs_score = 0
|
| 52 |
+
if "vol-0abcd111111111111" in found_ebs: ebs_score += 10
|
| 53 |
+
if "vol-0abcd222222222222" in found_ebs: ebs_score += 10
|
| 54 |
+
if "vol-0abcd333333333333" in found_ebs: ebs_score += 10
|
| 55 |
+
if "vol-0abcd999999999999" in found_ebs: ebs_score -= 10 # 误杀扣分
|
| 56 |
+
|
| 57 |
+
ebs_score = max(0, ebs_score)
|
| 58 |
+
score += ebs_score
|
| 59 |
+
details.append({"item": "EBS 闲置资源识别", "score": ebs_score, "max_score": 30, "passed": ebs_score >= 30, "reason": f"识别到 EBS: {found_ebs}"})
|
| 60 |
|
| 61 |
+
# 4. EC2 资源识别 (30分)
|
| 62 |
+
found_ec2 = {item['resource_id'] for item in data if item.get('resource_type') == 'EC2'}
|
| 63 |
+
ec2_score = 0
|
| 64 |
+
if "i-0ffff111111111111" in found_ec2: ec2_score += 30
|
| 65 |
+
if "i-0ffff222222222222" in found_ec2 or "i-0ffff333333333333" in found_ec2:
|
| 66 |
+
ec2_score = max(0, ec2_score - 20) # 误将高负载或平均负载正常的实例列入
|
| 67 |
+
|
| 68 |
+
score += ec2_score
|
| 69 |
+
details.append({"item": "EC2 GPU低利用率识别", "score": ec2_score, "max_score": 30, "passed": ec2_score == 30, "reason": f"识别到 EC2: {found_ec2}"})
|
| 70 |
+
|
| 71 |
+
# 5. Owner 匹配正确性 (30分)
|
| 72 |
+
owner_correct_count = 0
|
| 73 |
+
total_items = len(data)
|
| 74 |
+
for item in data:
|
| 75 |
+
rid = item.get('resource_id')
|
| 76 |
+
provided_owner = item.get('owner')
|
| 77 |
+
if rid in owners_map and provided_owner == owners_map[rid]:
|
| 78 |
+
owner_correct_count += 1
|
| 79 |
+
|
| 80 |
+
owner_score = int((owner_correct_count / total_items * 30)) if total_items > 0 else 0
|
| 81 |
+
score += owner_score
|
| 82 |
+
details.append({"item": "负责人邮箱交叉比对", "score": owner_score, "max_score": 30, "passed": owner_score == 30, "reason": f"正确匹配了 {owner_correct_count}/{total_items} 个负责人"})
|
| 83 |
+
|
| 84 |
+
# 最终分处理
|
| 85 |
+
final_score = min(100, max(0, score))
|
| 86 |
+
|
| 87 |
+
result = {
|
| 88 |
+
"total_score": final_score,
|
| 89 |
+
"details": details
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 93 |
+
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 94 |
|
| 95 |
+
if __name__ == "__main__":
|
| 96 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0011/verify_workplace.py
CHANGED
|
@@ -1,147 +1,74 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import httpx
|
| 5 |
-
import hashlib
|
| 6 |
-
import re
|
| 7 |
-
from openai import OpenAI
|
| 8 |
|
| 9 |
-
|
| 10 |
-
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 11 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 12 |
-
|
| 13 |
-
# 初始化客户端,强制关闭 SSL 验证
|
| 14 |
-
http_client = httpx.Client(verify=False)
|
| 15 |
-
client = OpenAI(
|
| 16 |
-
api_key=MOCK_API_KEY,
|
| 17 |
-
base_url=MOCK_API_BASE,
|
| 18 |
-
http_client=http_client
|
| 19 |
-
)
|
| 20 |
-
|
| 21 |
-
def llm_judge_content(prompt_text, file_content):
|
| 22 |
-
"""
|
| 23 |
-
大模型语义检测接口
|
| 24 |
-
用于检查输出内容中是否存在长篇大论、无用分析和违反题意的废话
|
| 25 |
-
"""
|
| 26 |
-
try:
|
| 27 |
-
response = client.chat.completions.create(
|
| 28 |
-
model=MOCK_MODEL_NAME,
|
| 29 |
-
messages=[
|
| 30 |
-
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 31 |
-
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
| 32 |
-
],
|
| 33 |
-
temperature=0
|
| 34 |
-
)
|
| 35 |
-
return "yes" in response.choices[0].message.content.strip().lower()
|
| 36 |
-
except Exception as e:
|
| 37 |
-
print(f"LLM API Error: {e}")
|
| 38 |
-
return False
|
| 39 |
-
|
| 40 |
-
def main():
|
| 41 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 42 |
-
|
| 43 |
-
score_file = os.path.join(workspace, "workplace_score.json")
|
| 44 |
-
|
| 45 |
-
total_score = 0
|
| 46 |
details = []
|
| 47 |
|
| 48 |
-
|
| 49 |
-
expected_pid = 14920
|
| 50 |
-
expected_xid = 9948271
|
| 51 |
-
salt = "DBA_EMERGENCY_KILL_SECRET"
|
| 52 |
-
raw_string = f"AUTH-{expected_pid}-{expected_xid}-{salt}"
|
| 53 |
-
expected_token = "KILL_TOKEN:" + hashlib.md5(raw_string.encode('utf-8')).hexdigest()[:16]
|
| 54 |
-
|
| 55 |
-
# 维度1:检查目标目录及文件存在性
|
| 56 |
-
if not os.path.exists(target_file):
|
| 57 |
-
details.append({"item": "检查目标文件 ops/kill_target.json 是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件不存在,未生成符合物理预期的目标产物"})
|
| 58 |
-
with open(score_file, "w") as f:
|
| 59 |
-
json.dump({"total_score": 0, "details": details}, f, indent=2)
|
| 60 |
-
return
|
| 61 |
-
|
| 62 |
-
details.append({"item": "检查目标文件 ops/kill_target.json 是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "物理文件已建立成功"})
|
| 63 |
-
total_score += 10
|
| 64 |
-
|
| 65 |
-
with open(target_file, "r") as f:
|
| 66 |
-
content = f.read().strip()
|
| 67 |
-
|
| 68 |
-
# 维度2:JSON 严格规范与合法解析 (包含应对模型常见 Markdown 附加符号的容错清洗)
|
| 69 |
-
parsed_json = None
|
| 70 |
-
json_text = content
|
| 71 |
-
# 去除 Markdown 标记
|
| 72 |
-
match = re.search(r'```
|
| 73 |
-
|
| 74 |
-
```', content, re.DOTALL)
|
| 75 |
-
if match:
|
| 76 |
-
json_text = match.group(1)
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
# 严格防止捏造无用字段
|
| 82 |
-
if len(parsed_json.keys()) > 3:
|
| 83 |
-
details.append({"item": "JSON Schema及数据完整性验证", "score": 10, "max_score": 20, "passed": False, "reason": "成功解析,但Agent多事地捏造了要求之外的额外属性"})
|
| 84 |
-
total_score += 10
|
| 85 |
-
else:
|
| 86 |
-
details.append({"item": "JSON Schema及数据完整性验证", "score": 20, "max_score": 20, "passed": True, "reason": "格式完全合法且严格仅包含 pid, xid, kill_token"})
|
| 87 |
-
total_score += 20
|
| 88 |
-
else:
|
| 89 |
-
details.append({"item": "JSON Schema及数据完整性验证", "score": 5, "max_score": 20, "passed": False, "reason": "JSON 格式可解析,但缺失必要的必需结构化字段,未遵守接口契约"})
|
| 90 |
-
total_score += 5
|
| 91 |
-
except Exception as e:
|
| 92 |
-
details.append({"item": "JSON Schema及数据完整性验证", "score": 0, "max_score": 20, "passed": False, "reason": f"结构化数据遭破坏,无法解析 JSON: {str(e)}"})
|
| 93 |
|
| 94 |
-
#
|
| 95 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
try:
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
else:
|
| 102 |
-
details.append({"item": "
|
| 103 |
-
except ValueError:
|
| 104 |
-
details.append({"item": "锁依赖阻塞源头 PID 提取正确性", "score": 0, "max_score": 20, "passed": False, "reason": "PID 字段不是合法的整数格式"})
|
| 105 |
-
else:
|
| 106 |
-
details.append({"item": "锁依赖阻塞源头 PID 提取正确性", "score": 0, "max_score": 20, "passed": False, "reason": "前置 JSON 崩溃,无法进行细粒度属性检查"})
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
details.append({"item": "对应事务 XID 信息匹配正确性", "score": 20, "max_score": 20, "passed": True, "reason": "成功从特殊分隔符的杂乱日志中,抽取出事务ID: 9948271"})
|
| 114 |
-
total_score += 20
|
| 115 |
else:
|
| 116 |
-
details.append({"item": "
|
| 117 |
-
except ValueError:
|
| 118 |
-
details.append({"item": "对应事务 XID 信息匹配正确性", "score": 0, "max_score": 20, "passed": False, "reason": "XID 字段不是合法的整数格式"})
|
| 119 |
-
else:
|
| 120 |
-
details.append({"item": "对应事务 XID 信息匹配正确性", "score": 0, "max_score": 20, "passed": False, "reason": "前置 JSON 崩溃,无法进行细粒度属性检查"})
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
details.append({"item": "高危操作鉴权 Token 生成正确性", "score": 0, "max_score": 20, "passed": False, "reason": "前置 JSON 崩溃,无法进行细粒度属性检查"})
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
details.append({"item": "利用LLM进行指令服从与精炼度检测", "score": 10, "max_score": 10, "passed": True, "reason": "大模型判定内容极致精炼,没有夹带令人焦躁的教科书式的冗余废话,符合紧急故障处理要求"})
|
| 138 |
-
total_score += 10
|
| 139 |
else:
|
| 140 |
-
details.append({"item": "
|
| 141 |
|
| 142 |
-
# 写入
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
if __name__ == "__main__":
|
| 147 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
def verify():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 7 |
+
score = 0
|
|
|
|
|
|
|
|
|
|
| 8 |
details = []
|
| 9 |
|
| 10 |
+
target_file = os.path.join(workspace, "ops/kill_target.json")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
# 预期结果
|
| 13 |
+
EXPECTED_PID = 14920
|
| 14 |
+
EXPECTED_XID = 9948271
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
# 1. 检查文件是否存在 (10分)
|
| 17 |
+
if os.path.exists(target_file):
|
| 18 |
+
score += 10
|
| 19 |
+
details.append({"item": "文件检查", "score": 10, "max_score": 10, "passed": True, "reason": "ops/kill_target.json 存在"})
|
| 20 |
+
|
| 21 |
+
# 2. 检查 JSON 格式与合法性 (20分)
|
| 22 |
try:
|
| 23 |
+
with open(target_file, 'r', encoding='utf-8') as f:
|
| 24 |
+
data = json.load(f)
|
| 25 |
+
|
| 26 |
+
score += 20
|
| 27 |
+
details.append({"item": "JSON格式验证", "score": 20, "max_score": 20, "passed": True, "reason": "JSON 解析成功"})
|
| 28 |
+
|
| 29 |
+
# 3. 检查 PID 是否正确 (30分)
|
| 30 |
+
actual_pid = data.get("pid")
|
| 31 |
+
if actual_pid == EXPECTED_PID:
|
| 32 |
+
score += 30
|
| 33 |
+
details.append({"item": "PID 识别", "score": 30, "max_score": 30, "passed": True, "reason": "成功识别罪魁祸首 PID: 14920"})
|
| 34 |
+
elif str(actual_pid) == "0x3a48":
|
| 35 |
+
score += 15
|
| 36 |
+
details.append({"item": "PID 识别", "score": 15, "max_score": 30, "passed": False, "reason": "未将 PID 从十六进制转换为十进制"})
|
| 37 |
else:
|
| 38 |
+
details.append({"item": "PID 识别", "score": 0, "max_score": 30, "passed": False, "reason": f"PID 错误,识别为 {actual_pid}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
# 4. 检查 XID 是否正确 (30分)
|
| 41 |
+
actual_xid = data.get("xid")
|
| 42 |
+
if actual_xid == EXPECTED_XID:
|
| 43 |
+
score += 30
|
| 44 |
+
details.append({"item": "XID 识别", "score": 30, "max_score": 30, "passed": True, "reason": "成功识别事务 ID: 9948271"})
|
|
|
|
|
|
|
| 45 |
else:
|
| 46 |
+
details.append({"item": "XID 识别", "score": 0, "max_score": 30, "passed": False, "reason": f"XID 错误,识别为 {actual_xid}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
# 5. 检查是否存在多余字段或干扰项 (10分)
|
| 49 |
+
# 要求只有 pid 和 xid
|
| 50 |
+
allowed_keys = {"pid", "xid"}
|
| 51 |
+
actual_keys = set(data.keys())
|
| 52 |
+
if actual_keys == allowed_keys:
|
| 53 |
+
score += 10
|
| 54 |
+
details.append({"item": "字段精简度", "score": 10, "max_score": 10, "passed": True, "reason": "输出字段精准,无多余分析"})
|
| 55 |
+
else:
|
| 56 |
+
details.append({"item": "字段精简度", "score": 0, "max_score": 10, "passed": False, "reason": f"包含多余字段: {actual_keys - allowed_keys}"})
|
|
|
|
| 57 |
|
| 58 |
+
except json.JSONDecodeError:
|
| 59 |
+
details.append({"item": "JSON格式验证", "score": 0, "max_score": 20, "passed": False, "reason": "JSON 格式非法"})
|
| 60 |
+
except Exception as e:
|
| 61 |
+
details.append({"item": "异常错误", "score": 0, "max_score": 0, "passed": False, "reason": str(e)})
|
|
|
|
|
|
|
| 62 |
else:
|
| 63 |
+
details.append({"item": "文件检查", "score": 0, "max_score": 10, "passed": False, "reason": "ops/kill_target.json 不存在"})
|
| 64 |
|
| 65 |
+
# 写入评分结果
|
| 66 |
+
output_result = {
|
| 67 |
+
"total_score": score,
|
| 68 |
+
"details": details
|
| 69 |
+
}
|
| 70 |
+
with open("workplace_score.json", "w", encoding='utf-8') as f:
|
| 71 |
+
json.dump(output_result, f, indent=2, ensure_ascii=False)
|
| 72 |
|
| 73 |
if __name__ == "__main__":
|
| 74 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0014/verify_workplace.py
CHANGED
|
@@ -1,68 +1,93 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import httpx
|
| 5 |
-
import re
|
| 6 |
-
from openai import OpenAI
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
)
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
# 此函数为检测非结构化文本的统一接口
|
| 22 |
try:
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
except Exception as e:
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
def format_hex(value):
|
| 37 |
-
"""Normalize hex string for comparison (e.g., '0X5C' or '0x5c' -> '0x5C')"""
|
| 38 |
-
if not isinstance(value, str):
|
| 39 |
-
return str(value)
|
| 40 |
-
val = value.strip().lower()
|
| 41 |
-
if val.startswith("0x"):
|
| 42 |
-
return "0x" + val[2:].upper()
|
| 43 |
-
return val.upper()
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
details = []
|
| 50 |
-
total_score = 0
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
else:
|
| 58 |
-
details.append({"item": "
|
| 59 |
-
# 核心文件丢失,直接输出 0 分返回
|
| 60 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 61 |
-
json.dump({"total_score": 0, "details": details}, f, indent=2, ensure_ascii=False)
|
| 62 |
-
return
|
| 63 |
|
| 64 |
-
#
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
def verify():
|
| 6 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 7 |
+
report_path = os.path.join(workspace, "report/root_cause.json")
|
| 8 |
+
score = 0
|
| 9 |
+
details = []
|
| 10 |
+
|
| 11 |
+
# 1. Check Directory and File Existence (10 points)
|
| 12 |
+
if os.path.exists(os.path.join(workspace, "report")):
|
| 13 |
+
score += 5
|
| 14 |
+
details.append({"item": "检查报告目录", "score": 5, "max_score": 5, "passed": True, "reason": "目录 report 存在"})
|
| 15 |
+
else:
|
| 16 |
+
details.append({"item": "检查报告目录", "score": 0, "max_score": 5, "passed": False, "reason": "目录 report 不存在"})
|
| 17 |
|
| 18 |
+
if os.path.exists(report_path):
|
| 19 |
+
score += 5
|
| 20 |
+
details.append({"item": "检查报告文件是否存在", "score": 5, "max_score": 5, "passed": True, "reason": "文件 root_cause.json 存在"})
|
| 21 |
+
else:
|
| 22 |
+
details.append({"item": "检查报告文件是否存在", "score": 0, "max_score": 5, "passed": False, "reason": "文件 root_cause.json 不存在"})
|
| 23 |
+
# If the file doesn't exist, we can't perform further checks
|
| 24 |
+
save_results(score, details)
|
| 25 |
+
return
|
| 26 |
|
| 27 |
+
# 2. JSON Validity and Structure (20 points)
|
|
|
|
| 28 |
try:
|
| 29 |
+
with open(report_path, 'r', encoding='utf-8') as f:
|
| 30 |
+
data = json.load(f)
|
| 31 |
+
score += 10
|
| 32 |
+
details.append({"item": "检查JSON格式合法性", "score": 10, "max_score": 10, "passed": True, "reason": "JSON解析成功"})
|
| 33 |
+
|
| 34 |
+
required_keys = ["device_address", "register_address", "illegal_value"]
|
| 35 |
+
missing_keys = [k for k in required_keys if k not in data]
|
| 36 |
+
if not missing_keys:
|
| 37 |
+
score += 10
|
| 38 |
+
details.append({"item": "检查JSON关键字段", "score": 10, "max_score": 10, "passed": True, "reason": "包含所有必需字段"})
|
| 39 |
+
else:
|
| 40 |
+
details.append({"item": "检查JSON关键字段", "score": 0, "max_score": 10, "passed": False, "reason": f"缺失字段: {missing_keys}"})
|
| 41 |
except Exception as e:
|
| 42 |
+
details.append({"item": "检查JSON格式合法性", "score": 0, "max_score": 20, "passed": False, "reason": f"JSON解析失败: {str(e)}"})
|
| 43 |
+
save_results(score, details)
|
| 44 |
+
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+
# 3. Content Accuracy (70 points)
|
| 47 |
+
# Target Values based on env_builder.py:
|
| 48 |
+
# device_address: 0x5C, register_address: 0x10, illegal_value: 0x4B
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
+
def normalize_hex(val):
|
| 51 |
+
if not isinstance(val, str): return None
|
| 52 |
+
try:
|
| 53 |
+
return hex(int(val, 16)).lower()
|
| 54 |
+
except:
|
| 55 |
+
return None
|
| 56 |
+
|
| 57 |
+
dev_addr = normalize_hex(data.get("device_address"))
|
| 58 |
+
reg_addr = normalize_hex(data.get("register_address"))
|
| 59 |
+
ill_val = normalize_hex(data.get("illegal_value"))
|
| 60 |
+
|
| 61 |
+
# Device Address (20 points)
|
| 62 |
+
if dev_addr == "0x5c":
|
| 63 |
+
score += 20
|
| 64 |
+
details.append({"item": "验证设备地址 (device_address)", "score": 20, "max_score": 20, "passed": True, "reason": "正确识别 PMIC 地址 0x5C"})
|
| 65 |
else:
|
| 66 |
+
details.append({"item": "验证设备地址 (device_address)", "score": 0, "max_score": 20, "passed": False, "reason": f"预期 0x5C, 实际得到 {data.get('device_address')}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
+
# Register Address (20 points)
|
| 69 |
+
if reg_addr == "0x10":
|
| 70 |
+
score += 20
|
| 71 |
+
details.append({"item": "验证寄存器地址 (register_address)", "score": 20, "max_score": 20, "passed": True, "reason": "正确识别核心电压寄存器 0x10"})
|
| 72 |
+
else:
|
| 73 |
+
details.append({"item": "验证寄存器地址 (register_address)", "score": 0, "max_score": 20, "passed": False, "reason": f"预期 0x10, 实际得到 {data.get('register_address')}"})
|
| 74 |
+
|
| 75 |
+
# Illegal Value (30 points)
|
| 76 |
+
if ill_val == "0x4b":
|
| 77 |
+
score += 30
|
| 78 |
+
details.append({"item": "验证非法写入值 (illegal_value)", "score": 30, "max_score": 30, "passed": True, "reason": "正确锁定导致崩溃的非法值 0x4B (超过 0x3F)"})
|
| 79 |
+
else:
|
| 80 |
+
details.append({"item": "验证非法写入值 (illegal_value)", "score": 0, "max_score": 30, "passed": False, "reason": f"预期 0x4B, 实际得到 {data.get('illegal_value')}"})
|
| 81 |
+
|
| 82 |
+
save_results(score, details)
|
| 83 |
+
|
| 84 |
+
def save_results(score, details):
|
| 85 |
+
output = {
|
| 86 |
+
"total_score": score,
|
| 87 |
+
"details": details
|
| 88 |
+
}
|
| 89 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 90 |
+
json.dump(output, f, indent=2, ensure_ascii=False)
|
| 91 |
+
|
| 92 |
+
if __name__ == "__main__":
|
| 93 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0015/verify_workplace.py
CHANGED
|
@@ -4,11 +4,11 @@ import json
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
-
# ----------------- 强制 API 规范与初始化 -----------------
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-
|
| 11 |
|
|
|
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
@@ -17,7 +17,7 @@ client = OpenAI(
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
-
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
@@ -32,107 +32,83 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
details = []
|
| 38 |
total_score = 0
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
# 1. 检查物理结构与文件存在性 (10分)
|
| 43 |
if os.path.exists(target_file):
|
| 44 |
-
details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason":
|
| 45 |
total_score += 10
|
| 46 |
else:
|
| 47 |
-
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "
|
| 48 |
-
|
|
|
|
| 49 |
|
| 50 |
-
#
|
|
|
|
| 51 |
try:
|
| 52 |
with open(target_file, "r", encoding="utf-8") as f:
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
details.append({"item": "读取目标文件", "score": 0, "max_score": 0, "passed": False, "reason": f"读取失败: {e}"})
|
| 56 |
-
return total_score, details
|
| 57 |
-
|
| 58 |
-
# 2. 语义合规性验证:大模型检查是否包含长篇大论的废话 (10分)
|
| 59 |
-
prompt = "检查以下文本。用户的要求是'别给我整长篇大论的密码学原理解释'。如果文本中除了必要的 JSON 数据之外,还包含了超过2句话的解释性废话、Markdown格式的分析总结,请回答 'YES'(表示存在违规废话)。如果纯粹只有数据,回答 'NO'(表示合规)。"
|
| 60 |
-
has_nonsense = llm_judge_content(prompt, raw_content)
|
| 61 |
-
if has_nonsense:
|
| 62 |
-
details.append({"item": "检查是否包含冗余废话", "score": 0, "max_score": 10, "passed": False, "reason": "文件内包含了不必要的长篇大论或密码学解释,违反 Prompt 要求"})
|
| 63 |
-
else:
|
| 64 |
-
details.append({"item": "检查是否包含冗余废话", "score": 10, "max_score": 10, "passed": True, "reason": "内容干净,未包含多余的废话和解释"})
|
| 65 |
total_score += 10
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
# 3.
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
details.append({"item": "JSON Schema 合法性检查", "score": 20, "max_score": 20, "passed": True, "reason": "成功解析为标准 JSON"})
|
| 72 |
-
total_score += 20
|
| 73 |
-
except json.JSONDecodeError:
|
| 74 |
-
# 尝试容错解析(如果加了 ```
|
| 75 |
-
|
| 76 |
-
``` 等 markdown 标签)但扣除格式分
|
| 77 |
-
import re
|
| 78 |
-
match = re.search(r'\[.*\]', raw_content, re.DOTALL)
|
| 79 |
-
if match:
|
| 80 |
-
try:
|
| 81 |
-
parsed_json = json.loads(match.group(0))
|
| 82 |
-
details.append({"item": "JSON Schema 合法性检查", "score": 5, "max_score": 20, "passed": False, "reason": "JSON 格式不标准(带有 Markdown 代码块或其他冗余字符),勉强解析成功但大幅扣分"})
|
| 83 |
-
total_score += 5
|
| 84 |
-
except:
|
| 85 |
-
pass
|
| 86 |
-
if parsed_json is None:
|
| 87 |
-
details.append({"item": "JSON Schema 合法性检查", "score": 0, "max_score": 20, "passed": False, "reason": "完全无法作为 JSON Array 解析,判定失效"})
|
| 88 |
-
return total_score, details
|
| 89 |
-
|
| 90 |
-
# 4. 数据结构规范性 (10分)
|
| 91 |
-
if isinstance(parsed_json, list) and len(parsed_json) == 3 and all(isinstance(x, str) for x in parsed_json):
|
| 92 |
-
details.append({"item": "数组结构检查", "score": 10, "max_score": 10, "passed": True, "reason": "精确包含3个字符串元素"})
|
| 93 |
total_score += 10
|
| 94 |
else:
|
| 95 |
-
details.append({"item": "
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
#
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
"item": "
|
| 110 |
-
|
| 111 |
-
"max_score": 30,
|
| 112 |
-
"passed": match_count == 3,
|
| 113 |
-
"reason": f"找出了 {match_count}/3 个目标 Gate"
|
| 114 |
-
})
|
| 115 |
-
|
| 116 |
-
# 严格降序检查 (20分)
|
| 117 |
-
if match_count == 3:
|
| 118 |
-
if parsed_json == EXPECTED_GATES:
|
| 119 |
-
details.append({"item": "通信载荷降序排列验证", "score": 20, "max_score": 20, "passed": True, "reason": "3个 Gate 严格按照载荷大小从大到小完美排序"})
|
| 120 |
-
total_score += 20
|
| 121 |
-
else:
|
| 122 |
-
details.append({"item": "通信载荷降序排列验证", "score": 0, "max_score": 20, "passed": False, "reason": "找出了正确的3个门,但未按照数据量从大到小严格排序"})
|
| 123 |
else:
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
-
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
result = {
|
| 133 |
-
"total_score": score,
|
| 134 |
"details": details
|
| 135 |
}
|
| 136 |
-
|
| 137 |
-
with open(
|
| 138 |
-
json.dump(
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
+
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
# 此函数为检测非结构化文本的统一接口
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def verify():
|
| 36 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
+
target_file = os.path.join(workspace, "optimizations", "target_gates.json")
|
| 38 |
+
|
| 39 |
details = []
|
| 40 |
total_score = 0
|
| 41 |
|
| 42 |
+
# 1. 检查目标文件是否存在 (10分)
|
|
|
|
|
|
|
| 43 |
if os.path.exists(target_file):
|
| 44 |
+
details.append({"item": "检查目标文件 target_gates.json 是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件已建立"})
|
| 45 |
total_score += 10
|
| 46 |
else:
|
| 47 |
+
details.append({"item": "检查目标文件 target_gates.json 是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件不存在,未按要求输出"})
|
| 48 |
+
write_score(total_score, details)
|
| 49 |
+
return
|
| 50 |
|
| 51 |
+
# 2. 检查 JSON 格式合法性 (10分)
|
| 52 |
+
# 此处严禁对结构化数据进行模糊匹配,必须原生解析
|
| 53 |
try:
|
| 54 |
with open(target_file, "r", encoding="utf-8") as f:
|
| 55 |
+
data = json.load(f)
|
| 56 |
+
details.append({"item": "检查 JSON 格式合法性", "score": 10, "max_score": 10, "passed": True, "reason": "可成功解析为 JSON"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
total_score += 10
|
| 58 |
+
except Exception as e:
|
| 59 |
+
details.append({"item": "检查 JSON 格式合法性", "score": 0, "max_score": 10, "passed": False, "reason": f"非合法 JSON 格式,解析报错: {e}"})
|
| 60 |
+
write_score(total_score, details)
|
| 61 |
+
return
|
| 62 |
|
| 63 |
+
# 3. 检查 Schema 数据结构合规性 (10分)
|
| 64 |
+
# 题目明确要求输出 3 个逻辑门的 ID
|
| 65 |
+
if isinstance(data, list) and len(data) == 3 and all(isinstance(x, str) for x in data):
|
| 66 |
+
details.append({"item": "检查 Schema(含有3个字符串的数组)", "score": 10, "max_score": 10, "passed": True, "reason": "结构符合要求:一个包含3个字符串元素的列表"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
total_score += 10
|
| 68 |
else:
|
| 69 |
+
details.append({"item": "检查 Schema(含有3个字符串的数组)", "score": 0, "max_score": 10, "passed": False, "reason": f"未返回仅包含 3 个字符串的数组。当前数据:{data}"})
|
| 70 |
+
# 结构不对扣光后续分数,结束验证
|
| 71 |
+
write_score(total_score, details)
|
| 72 |
+
return
|
| 73 |
+
|
| 74 |
+
# 4. 检查内容:命中率 (30分,每个关键 ID 10分)
|
| 75 |
+
# 根据底层注入规则:数据量最大的 3 个门固定为 F9A1, F9A2, F9A3
|
| 76 |
+
expected_gates = {"GATE_F9A1", "GATE_F9A2", "GATE_F9A3"}
|
| 77 |
+
matched = set(data).intersection(expected_gates)
|
| 78 |
+
hit_count = len(matched)
|
| 79 |
+
hit_score = hit_count * 10
|
| 80 |
|
| 81 |
+
if hit_count == 3:
|
| 82 |
+
details.append({"item": "检查提取目标门 ID 的精确度", "score": 30, "max_score": 30, "passed": True, "reason": "完美找出所有 3 个异常通信量的逻辑门"})
|
| 83 |
+
else:
|
| 84 |
+
missing = expected_gates - set(data)
|
| 85 |
+
details.append({"item": "检查提取目标门 ID 的精确度", "score": hit_score, "max_score": 30, "passed": False, "reason": f"找到了 {hit_count} 个异常逻辑门, 缺失 {missing}"})
|
| 86 |
+
total_score += hit_score
|
| 87 |
|
| 88 |
+
# 5. 检查内容:排序正确性 (40分)
|
| 89 |
+
# 数据量排序:GATE_F9A1(3500B) > GATE_F9A2(2800B) > GATE_F9A3(2100B)
|
| 90 |
+
expected_order = ["GATE_F9A1", "GATE_F9A2", "GATE_F9A3"]
|
| 91 |
+
if data == expected_order:
|
| 92 |
+
details.append({"item": "检查数组降序排序正确性", "score": 40, "max_score": 40, "passed": True, "reason": "元素严格按数据载荷大小从大到小排列"})
|
| 93 |
+
total_score += 40
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
else:
|
| 95 |
+
# 如果找齐了三个,但排序错误,可给出部分分数 10 分以作梯度区分,如果没找齐则得 0 分。
|
| 96 |
+
if hit_count == 3:
|
| 97 |
+
details.append({"item": "检查数组降序排序正确性", "score": 10, "max_score": 40, "passed": False, "reason": f"找出了所有门但排序错误,期望 {expected_order},实际 {data}"})
|
| 98 |
+
total_score += 10
|
| 99 |
+
else:
|
| 100 |
+
details.append({"item": "检查数组降序排序正确性", "score": 0, "max_score": 40, "passed": False, "reason": "由于存在找错的门,排序亦判定为完全失败"})
|
| 101 |
|
| 102 |
+
write_score(total_score, details)
|
| 103 |
|
| 104 |
+
def write_score(total_score, details):
|
| 105 |
+
res = {
|
| 106 |
+
"total_score": total_score,
|
|
|
|
|
|
|
|
|
|
| 107 |
"details": details
|
| 108 |
}
|
| 109 |
+
# 确保写入工作目录下的 workplace_score.json
|
| 110 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 111 |
+
json.dump(res, f, ensure_ascii=False, indent=2)
|
| 112 |
+
|
| 113 |
+
if __name__ == "__main__":
|
| 114 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0016/verify_workplace.py
CHANGED
|
@@ -1,14 +1,15 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-
|
| 10 |
|
| 11 |
-
#
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
@@ -17,9 +18,6 @@ client = OpenAI(
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
-
"""
|
| 21 |
-
LLM 裁判统一接口:用于对输出文件中的非结构化/意图文本进行判决。
|
| 22 |
-
"""
|
| 23 |
try:
|
| 24 |
response = client.chat.completions.create(
|
| 25 |
model=MOCK_MODEL_NAME,
|
|
@@ -34,87 +32,129 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 34 |
print(f"LLM API Error: {e}")
|
| 35 |
return False
|
| 36 |
|
| 37 |
-
def
|
| 38 |
-
report = {
|
| 39 |
-
"total_score": total_score,
|
| 40 |
-
"details": details
|
| 41 |
-
}
|
| 42 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 43 |
-
json.dump(report, f, indent=2, ensure_ascii=False)
|
| 44 |
-
print(f"Verification complete. Total Score: {total_score}")
|
| 45 |
-
|
| 46 |
-
def main():
|
| 47 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 48 |
-
|
| 49 |
|
|
|
|
| 50 |
total_score = 0
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
if
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
return
|
| 58 |
else:
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
else:
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
| 83 |
else:
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
#
|
| 88 |
-
if
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
else:
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
#
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
details.append({"item": "常规可用轨迹找回情况", "score": score, "max_score": 20, "passed": True, "reason": f"仅找回了部分正常轨迹: {normal_ids}"})
|
| 102 |
-
total_score += score
|
| 103 |
else:
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
#
|
| 107 |
-
|
| 108 |
-
if
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
else:
|
| 115 |
-
|
| 116 |
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
if __name__ == "__main__":
|
| 120 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
+
import re
|
| 5 |
import httpx
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
+
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
| 12 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 13 |
http_client = httpx.Client(verify=False)
|
| 14 |
client = OpenAI(
|
| 15 |
api_key=MOCK_API_KEY,
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
|
|
|
|
|
|
|
|
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def verify():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
+
target_file = os.path.join(workspace, "processed", "clean_traj_ids.txt")
|
| 38 |
|
| 39 |
+
score_details = []
|
| 40 |
total_score = 0
|
| 41 |
+
|
| 42 |
+
# 1. 检查目标文件是否存在 (15分)
|
| 43 |
+
file_exists = os.path.exists(target_file) and os.path.isfile(target_file)
|
| 44 |
+
if file_exists:
|
| 45 |
+
score_details.append({"item": "检查目标文件是否存在", "score": 15, "max_score": 15, "passed": True, "reason": "成功找到 `processed/clean_traj_ids.txt`"})
|
| 46 |
+
total_score += 15
|
|
|
|
| 47 |
else:
|
| 48 |
+
score_details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 15, "passed": False, "reason": "未找到目标文件 `processed/clean_traj_ids.txt`"})
|
| 49 |
+
|
| 50 |
+
extracted_ids = []
|
| 51 |
+
pure_format = False
|
| 52 |
+
|
| 53 |
+
if file_exists:
|
| 54 |
+
try:
|
| 55 |
+
with open(target_file, "r", encoding="utf-8") as f:
|
| 56 |
+
lines = f.readlines()
|
| 57 |
+
|
| 58 |
+
# 清理空行并解析
|
| 59 |
+
raw_lines = [line.strip() for line in lines if line.strip()]
|
| 60 |
+
|
| 61 |
+
# 2. 检查输出纯净度 (10分)
|
| 62 |
+
# 要求:别整那些没用的报告,只要 ID。所有的非空行应当全都是形如 T-xxxx 的格式。
|
| 63 |
+
pure_format = all(re.match(r'^T-\d+$', line) for line in raw_lines)
|
| 64 |
+
if pure_format and len(raw_lines) > 0:
|
| 65 |
+
score_details.append({"item": "检查输出纯净度", "score": 10, "max_score": 10, "passed": True, "reason": "输出无冗余报告废话,每行格式均为合法的 ID"})
|
| 66 |
+
total_score += 10
|
| 67 |
+
else:
|
| 68 |
+
score_details.append({"item": "检查输出纯净度", "score": 0, "max_score": 10, "passed": False, "reason": "输出中混杂了自然语言报告、无效格式或文件全空"})
|
| 69 |
+
|
| 70 |
+
# 尝试提取出里面看起来像ID的串用于进一步逻辑验证
|
| 71 |
+
extracted_ids = []
|
| 72 |
+
for line in raw_lines:
|
| 73 |
+
# 若包含自然语言,则利用正则从中强行提取 T-xxx 评估实质清洗逻辑
|
| 74 |
+
matches = re.findall(r'T-\d+', line)
|
| 75 |
+
extracted_ids.extend(matches)
|
| 76 |
+
|
| 77 |
+
except Exception as e:
|
| 78 |
+
score_details.append({"item": "检查输出纯净度", "score": 0, "max_score": 10, "passed": False, "reason": f"文件读取异常: {e}"})
|
| 79 |
else:
|
| 80 |
+
score_details.append({"item": "检查输出纯净度", "score": 0, "max_score": 10, "passed": False, "reason": "文件不存在,跳过纯净度检查"})
|
| 81 |
+
|
| 82 |
+
extracted_set = set(extracted_ids)
|
| 83 |
+
|
| 84 |
+
# 3. 检查乱码与损坏数据过滤能力 (15分)
|
| 85 |
+
# T-1005 (json未闭合) 和 T-1006 (十六进制乱码前缀) 不应存在
|
| 86 |
+
if file_exists:
|
| 87 |
+
if "T-1005" not in extracted_set and "T-1006" not in extracted_set:
|
| 88 |
+
score_details.append({"item": "过滤损坏的JSON与乱码数据", "score": 15, "max_score": 15, "passed": True, "reason": "正确剔除了无法被正常解析的 T-1005 和 T-1006"})
|
| 89 |
+
total_score += 15
|
| 90 |
+
else:
|
| 91 |
+
score_details.append({"item": "过滤损坏的JSON与乱码数据", "score": 0, "max_score": 15, "passed": False, "reason": "未正确拦截格式残缺或含乱码前缀的脏数据"})
|
| 92 |
else:
|
| 93 |
+
score_details.append({"item": "过滤损坏的JSON与乱码数据", "score": 0, "max_score": 15, "passed": False, "reason": "文件不存在,该项记 0 分"})
|
| 94 |
+
|
| 95 |
+
# 4. 检查 Token 截断数据的过滤能力 (15分)
|
| 96 |
+
# T-1003 (finish_reason = length) 不应存在
|
| 97 |
+
if file_exists:
|
| 98 |
+
if "T-1003" not in extracted_set:
|
| 99 |
+
score_details.append({"item": "过滤严重截断数据", "score": 15, "max_score": 15, "passed": True, "reason": "正确剔除了因为 max_tokens 截断(length)的残缺数据 T-1003"})
|
| 100 |
+
total_score += 15
|
| 101 |
+
else:
|
| 102 |
+
score_details.append({"item": "过滤严重截断数据", "score": 0, "max_score": 15, "passed": False, "reason": "未正确拦截 finish_reason 为 length 的数据"})
|
| 103 |
else:
|
| 104 |
+
score_details.append({"item": "过滤严重截断数据", "score": 0, "max_score": 15, "passed": False, "reason": "文件不存在,该项记 0 分"})
|
| 105 |
+
|
| 106 |
+
# 5. 检查 Agent 死循环数据的过滤能力 (15分)
|
| 107 |
+
# T-1002 (连续相同的 tool calls) 不应存在
|
| 108 |
+
if file_exists:
|
| 109 |
+
if "T-1002" not in extracted_set:
|
| 110 |
+
score_details.append({"item": "过滤陷入死循环的工具调用数据", "score": 15, "max_score": 15, "passed": True, "reason": "正确剔除了陷入无意义重复调用的 T-1002 数据"})
|
| 111 |
+
total_score += 15
|
| 112 |
+
else:
|
| 113 |
+
score_details.append({"item": "过滤陷入死循环的工具调用数据", "score": 0, "max_score": 15, "passed": False, "reason": "未正确拦截呈现死循环特征的轨迹数据 T-1002"})
|
|
|
|
|
|
|
| 114 |
else:
|
| 115 |
+
score_details.append({"item": "过滤陷入死循环的工具调用数据", "score": 0, "max_score": 15, "passed": False, "reason": "文件不存在,该项记 0 分"})
|
| 116 |
+
|
| 117 |
+
# 6. 检查健康轨迹的全量留存与拒答幻觉情况 (30分)
|
| 118 |
+
# 正确的数据集应当只包含:T-1001, T-1004, T-1007
|
| 119 |
+
if file_exists:
|
| 120 |
+
expected_ids = {"T-1001", "T-1004", "T-1007"}
|
| 121 |
+
missing_ids = expected_ids - extracted_set
|
| 122 |
+
# 计算提取列表中多出的且不在剔除名单里的虚构 ID (幻觉)
|
| 123 |
+
dirty_ids = {"T-1002", "T-1003", "T-1005", "T-1006"}
|
| 124 |
+
hallucinated_ids = extracted_set - expected_ids - dirty_ids
|
| 125 |
+
|
| 126 |
+
health_score = 30
|
| 127 |
+
penalties = []
|
| 128 |
+
|
| 129 |
+
if len(missing_ids) > 0:
|
| 130 |
+
penalty = len(missing_ids) * 10
|
| 131 |
+
health_score -= penalty
|
| 132 |
+
penalties.append(f"遗漏了合法数据 {missing_ids},扣 {penalty} 分")
|
| 133 |
+
|
| 134 |
+
if len(hallucinated_ids) > 0:
|
| 135 |
+
penalty = len(hallucinated_ids) * 10
|
| 136 |
+
health_score -= penalty
|
| 137 |
+
penalties.append(f"捏造了不存在的数据 ID {hallucinated_ids},扣 {penalty} 分")
|
| 138 |
+
|
| 139 |
+
health_score = max(0, health_score)
|
| 140 |
+
|
| 141 |
+
if health_score == 30:
|
| 142 |
+
score_details.append({"item": "精准留存合法数据与幻觉抑制", "score": 30, "max_score": 30, "passed": True, "reason": "完美找出了所有的健康数据 T-1001, T-1004, T-1007,且无捏造或多余数据!"})
|
| 143 |
+
else:
|
| 144 |
+
score_details.append({"item": "精准留存合法数据与幻觉抑制", "score": health_score, "max_score": 30, "passed": False, "reason": "; ".join(penalties)})
|
| 145 |
+
|
| 146 |
+
total_score += health_score
|
| 147 |
else:
|
| 148 |
+
score_details.append({"item": "精准留存合法数据与幻觉抑制", "score": 0, "max_score": 30, "passed": False, "reason": "文件不存在,该项记 0 分"})
|
| 149 |
|
| 150 |
+
# 保存评分文件
|
| 151 |
+
score_data = {
|
| 152 |
+
"total_score": total_score,
|
| 153 |
+
"details": score_details
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 157 |
+
json.dump(score_data, f, ensure_ascii=False, indent=2)
|
| 158 |
|
| 159 |
if __name__ == "__main__":
|
| 160 |
+
verify()
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0018/verify_workplace.py
CHANGED
|
@@ -5,11 +5,11 @@ import re
|
|
| 5 |
import httpx
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
-
# ================= 强制的 API Mock 规范 =================
|
| 9 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 10 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 11 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 12 |
|
|
|
|
| 13 |
http_client = httpx.Client(verify=False)
|
| 14 |
client = OpenAI(
|
| 15 |
api_key=MOCK_API_KEY,
|
|
@@ -18,7 +18,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -33,71 +33,110 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
def main():
|
| 38 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
| 39 |
|
| 40 |
-
can_log_path = os.path.join(workspace, "chassis_can.log")
|
| 41 |
-
radar_json_path = os.path.join(workspace, "sensor_data", "radar_track.json")
|
| 42 |
-
hidden_db_path = os.path.join(workspace, "sensor_data", ".hidden_conf_db.json")
|
| 43 |
-
output_path = os.path.join(workspace, "analysis", "ghost_ids.json")
|
| 44 |
-
|
| 45 |
details = []
|
| 46 |
total_score = 0
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
for line in f:
|
| 55 |
-
if "MSG_ID:0x2B0" in line and "PAYLOAD:[FF 01" in line:
|
| 56 |
-
try:
|
| 57 |
-
start = line.index("<") + 1
|
| 58 |
-
end = line.index(">")
|
| 59 |
-
can_ts = int(line[start:end])
|
| 60 |
-
# 雷达时间快 1500 毫秒
|
| 61 |
-
aeb_radar_timestamps.append(can_ts + 1500)
|
| 62 |
-
except ValueError:
|
| 63 |
-
pass
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
for
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
expected_ghost_ids.add(track_id)
|
| 85 |
-
except Exception as e:
|
| 86 |
-
print(f"Failed to generate ground truth: {e}")
|
| 87 |
|
| 88 |
-
#
|
| 89 |
-
if
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
else:
|
| 94 |
-
details.append({"item": "
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
"Analyze the following file content. Does it contain any of the following: "
|
| 102 |
-
"1. Conversational text (e.g., 'Here is the output', 'Sure'). "
|
| 103 |
-
"2. Markdown code blocks (e.g.,
|
|
|
|
| 5 |
import httpx
|
| 6 |
from openai import OpenAI
|
| 7 |
|
|
|
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
| 12 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 13 |
http_client = httpx.Client(verify=False)
|
| 14 |
client = OpenAI(
|
| 15 |
api_key=MOCK_API_KEY,
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
+
# 此函数为检测非结构化文本的统一接口
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 33 |
print(f"LLM API Error: {e}")
|
| 34 |
return False
|
| 35 |
|
| 36 |
+
def get_ground_truth(workspace):
|
| 37 |
+
"""
|
| 38 |
+
沙盒内探针自己执行硬核逻辑,重新解析数据计算 Ground Truth,避免假阴性/假阳性。
|
| 39 |
+
"""
|
| 40 |
+
can_log = os.path.join(workspace, "chassis_can.log")
|
| 41 |
+
radar_json = os.path.join(workspace, "sensor_data", "radar_track.json")
|
| 42 |
+
|
| 43 |
+
if not os.path.exists(can_log) or not os.path.exists(radar_json):
|
| 44 |
+
return set()
|
| 45 |
+
|
| 46 |
+
aeb_timestamps = []
|
| 47 |
+
with open(can_log, "r", encoding="utf-8") as f:
|
| 48 |
+
for line in f:
|
| 49 |
+
# 必须满足双重条件: 刹车CAN ID = 0x2B0, PAYLOAD 前两字节 = FF 01
|
| 50 |
+
if "MSG_ID:0x2B0" in line and "PAYLOAD:[FF 01" in line:
|
| 51 |
+
m = re.search(r"<(\d+)>", line)
|
| 52 |
+
if m:
|
| 53 |
+
aeb_timestamps.append(int(m.group(1)))
|
| 54 |
+
|
| 55 |
+
truth_ids = set()
|
| 56 |
+
with open(radar_json, "r", encoding="utf-8") as f:
|
| 57 |
+
radar_data = json.load(f)
|
| 58 |
+
|
| 59 |
+
frames = radar_data.get("data_stream", {}).get("radar_front_center", {}).get("frames", [])
|
| 60 |
+
for frame in frames:
|
| 61 |
+
stamp_ms = frame.get("header", {}).get("stamp_ms", 0)
|
| 62 |
+
# 严密的时间戳对齐:雷达比底盘快 1500ms
|
| 63 |
+
if (stamp_ms - 1500) in aeb_timestamps:
|
| 64 |
+
objects = frame.get("payload", {}).get("tracked_entities", {}).get("radar_objects", [])
|
| 65 |
+
for obj in objects:
|
| 66 |
+
rcs = obj.get("attributes", {}).get("rcs_dbsm", 999.0)
|
| 67 |
+
conf = obj.get("attributes", {}).get("track_confidence", 999)
|
| 68 |
+
# 必须满足 rcs < 5.0 且 confidence < 60
|
| 69 |
+
if rcs < 5.0 and conf < 60:
|
| 70 |
+
tid = obj.get("metadata", {}).get("track_id", "")
|
| 71 |
+
if tid:
|
| 72 |
+
truth_ids.add(tid)
|
| 73 |
+
|
| 74 |
+
return truth_ids
|
| 75 |
+
|
| 76 |
def main():
|
| 77 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 78 |
+
target_file = os.path.join(workspace, "analysis", "ghost_ids.json")
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
details = []
|
| 81 |
total_score = 0
|
| 82 |
+
|
| 83 |
+
# 1. 验证目标文件存在性 (10分)
|
| 84 |
+
if os.path.exists(target_file):
|
| 85 |
+
total_score += 10
|
| 86 |
+
details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 analysis/ghost_ids.json 存在"})
|
| 87 |
+
else:
|
| 88 |
+
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件 analysis/ghost_ids.json 不存在"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
+
# 2. 验证结构纯净性 (20分)
|
| 91 |
+
# 绝对禁止使用正则去匹配结构化结果,必须使用 json 库严格解析
|
| 92 |
+
agent_ids = []
|
| 93 |
+
is_valid_format = False
|
| 94 |
+
if os.path.exists(target_file):
|
| 95 |
+
try:
|
| 96 |
+
with open(target_file, "r", encoding="utf-8") as f:
|
| 97 |
+
data = json.load(f)
|
| 98 |
+
if isinstance(data, list) and all(isinstance(i, str) for i in data):
|
| 99 |
+
is_valid_format = True
|
| 100 |
+
agent_ids = data
|
| 101 |
+
total_score += 20
|
| 102 |
+
details.append({"item": "JSON格式规范性验证", "score": 20, "max_score": 20, "passed": True, "reason": "是一个纯净的字符串数组"})
|
| 103 |
+
else:
|
| 104 |
+
details.append({"item": "JSON格式规范性验证", "score": 0, "max_score": 20, "passed": False, "reason": "结构错误,不是纯净的字符串数组"})
|
| 105 |
+
except json.JSONDecodeError:
|
| 106 |
+
details.append({"item": "JSON格式规范性验证", "score": 0, "max_score": 20, "passed": False, "reason": "非法的JSON文件"})
|
| 107 |
+
else:
|
| 108 |
+
details.append({"item": "JSON格式规范性验证", "score": 0, "max_score": 20, "passed": False, "reason": "文件缺失,无法验证"})
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
+
# 3. 数据精准度 (70分)
|
| 111 |
+
if is_valid_format:
|
| 112 |
+
truth_ids = get_ground_truth(workspace)
|
| 113 |
+
agent_set = set(agent_ids)
|
| 114 |
+
|
| 115 |
+
if not truth_ids:
|
| 116 |
+
# 如果极端情况环境加载异常,这里进行容错
|
| 117 |
+
details.append({"item": "验证提取的 ID 准确性", "score": 0, "max_score": 70, "passed": False, "reason": "Ground Truth 数据生成错误,请检查环境"})
|
| 118 |
+
else:
|
| 119 |
+
intersection = agent_set.intersection(truth_ids)
|
| 120 |
+
false_positives = agent_set - truth_ids
|
| 121 |
+
false_negatives = truth_ids - agent_set
|
| 122 |
+
|
| 123 |
+
union_len = len(agent_set.union(truth_ids))
|
| 124 |
+
# 使用严格的 Jaccard 相似度来反映 F1 维度的惩罚机制,有捏造、漏报均会急剧降分
|
| 125 |
+
data_score = int(70 * (len(intersection) / union_len)) if union_len > 0 else 0
|
| 126 |
+
|
| 127 |
+
total_score += data_score
|
| 128 |
+
passed = (data_score == 70)
|
| 129 |
+
reason = f"精准度检查完成。正确提取: {len(intersection)}项, 漏报: {len(false_negatives)}项, 误报(幻觉/条件错误): {len(false_positives)}项"
|
| 130 |
+
details.append({"item": "验证提取的 ID 准确性", "score": data_score, "max_score": 70, "passed": passed, "reason": reason})
|
| 131 |
else:
|
| 132 |
+
details.append({"item": "验证提取的 ID 准确性", "score": 0, "max_score": 70, "passed": False, "reason": "由于文件不存在或格式不合规,跳过数据校验"})
|
| 133 |
+
|
| 134 |
+
# 统分写入
|
| 135 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 136 |
+
json.dump({
|
| 137 |
+
"total_score": total_score,
|
| 138 |
+
"details": details
|
| 139 |
+
}, f, indent=2, ensure_ascii=False)
|
| 140 |
|
| 141 |
+
if __name__ == "__main__":
|
| 142 |
+
main()
|
|
|
|
|
|
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0021/verify_workplace.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import re
|
| 5 |
import httpx
|
|
|
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
@@ -18,7 +18,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
"""用于
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
@@ -34,91 +34,181 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 34 |
return False
|
| 35 |
|
| 36 |
def verify():
|
|
|
|
| 37 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
| 41 |
details = []
|
| 42 |
-
|
| 43 |
-
# 【检测点 1】检查结果目录和目标文件是否存在 (10 分)
|
| 44 |
-
if os.path.exists(target_file):
|
| 45 |
-
score += 10
|
| 46 |
-
details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 debug/root_cause.json 成功创建"})
|
| 47 |
-
else:
|
| 48 |
-
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 debug/root_cause.json 文件"})
|
| 49 |
-
return {"total_score": score, "details": details}
|
| 50 |
-
|
| 51 |
-
with open(target_file, "r", encoding="utf-8") as f:
|
| 52 |
-
content = f.read().strip()
|
| 53 |
-
|
| 54 |
-
# 【检测点 2】使用大模型检测非结构化边界:判断是否输出了绝对纯净的 JSON (10 分)
|
| 55 |
-
# 目的:严惩输出中带废话(如 "Here is the result:" 或是多余 markdown 的 ```
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
else:
|
| 63 |
-
details.append({
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
expected_keys = {"device_addr", "reg_addr", "bad_value"}
|
| 80 |
-
actual_keys = set(
|
|
|
|
| 81 |
if actual_keys == expected_keys:
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
else:
|
| 89 |
-
details.append({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
-
#
|
| 92 |
-
|
| 93 |
-
if
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
else:
|
| 101 |
-
details.append({
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
if reg_addr == "0x6b":
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
else:
|
| 109 |
-
details.append({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
-
#
|
| 112 |
-
bad_value = str(
|
| 113 |
if bad_value == "0x80":
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
else:
|
| 117 |
-
details.append({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
|
|
|
|
|
|
|
| 120 |
|
| 121 |
if __name__ == "__main__":
|
| 122 |
-
|
| 123 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 124 |
-
json.dump(result, f, indent=2, ensure_ascii=False)
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
| 4 |
import httpx
|
| 5 |
+
import re
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
+
"""用于对非结构化文本内容进行兜底或辅助语义判定"""
|
| 22 |
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 34 |
return False
|
| 35 |
|
| 36 |
def verify():
|
| 37 |
+
# 动态获取沙盒挂载的工作区路径
|
| 38 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 39 |
+
target_json_path = os.path.join(workspace, "debug", "root_cause.json")
|
| 40 |
|
| 41 |
+
total_score = 0
|
| 42 |
details = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
# 1. 检查物理文件是否存在 (10 分)
|
| 45 |
+
if not os.path.exists(target_json_path):
|
| 46 |
+
details.append({
|
| 47 |
+
"item": "检查目标文件是否存在",
|
| 48 |
+
"score": 0,
|
| 49 |
+
"max_score": 10,
|
| 50 |
+
"passed": False,
|
| 51 |
+
"reason": "未找到 debug/root_cause.json 文件,Agent 未能在指定路径输出结果"
|
| 52 |
+
})
|
| 53 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 54 |
+
json.dump({"total_score": 0, "details": details}, f, indent=2, ensure_ascii=False)
|
| 55 |
+
return
|
| 56 |
else:
|
| 57 |
+
details.append({
|
| 58 |
+
"item": "检查目标文件是否存在",
|
| 59 |
+
"score": 10,
|
| 60 |
+
"max_score": 10,
|
| 61 |
+
"passed": True,
|
| 62 |
+
"reason": "文件 debug/root_cause.json 存在"
|
| 63 |
+
})
|
| 64 |
+
total_score += 10
|
| 65 |
+
|
| 66 |
+
# 2. 检查 JSON 语法合法性 (10 分)
|
| 67 |
+
try:
|
| 68 |
+
with open(target_json_path, "r", encoding="utf-8") as f:
|
| 69 |
+
data = json.load(f)
|
| 70 |
+
details.append({
|
| 71 |
+
"item": "JSON 格式解析",
|
| 72 |
+
"score": 10,
|
| 73 |
+
"max_score": 10,
|
| 74 |
+
"passed": True,
|
| 75 |
+
"reason": "JSON 格式合法且可被标准库解析"
|
| 76 |
+
})
|
| 77 |
+
total_score += 10
|
| 78 |
+
except Exception as e:
|
| 79 |
+
details.append({
|
| 80 |
+
"item": "JSON 格式解析",
|
| 81 |
+
"score": 0,
|
| 82 |
+
"max_score": 10,
|
| 83 |
+
"passed": False,
|
| 84 |
+
"reason": f"解析失败,可能混入了多余字符或 markdown 格式: {e}"
|
| 85 |
+
})
|
| 86 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 87 |
+
json.dump({"total_score": total_score, "details": details}, f, indent=2, ensure_ascii=False)
|
| 88 |
+
return
|
| 89 |
+
|
| 90 |
+
# 3. 检查 JSON Schema 完整性与数据类型 (20 分)
|
| 91 |
+
# 不允许少任何一个键,也不允许多出胡编乱造的键
|
| 92 |
expected_keys = {"device_addr", "reg_addr", "bad_value"}
|
| 93 |
+
actual_keys = set(data.keys()) if isinstance(data, dict) else set()
|
| 94 |
+
|
| 95 |
if actual_keys == expected_keys:
|
| 96 |
+
if all(isinstance(data[k], str) for k in expected_keys):
|
| 97 |
+
# 严格检查值是否为 "0x" 加上两个十六进制字符(大小写均可)
|
| 98 |
+
format_pass = all(re.match(r"^0x[0-9a-fA-F]{2}$", data[k]) for k in expected_keys)
|
| 99 |
+
if format_pass:
|
| 100 |
+
details.append({
|
| 101 |
+
"item": "Schema 完整性与类型验证",
|
| 102 |
+
"score": 20,
|
| 103 |
+
"max_score": 20,
|
| 104 |
+
"passed": True,
|
| 105 |
+
"reason": "所有必填键均存在,无幻觉字段,且值严格遵循标准的 0xXX 字符串格式"
|
| 106 |
+
})
|
| 107 |
+
total_score += 20
|
| 108 |
+
else:
|
| 109 |
+
details.append({
|
| 110 |
+
"item": "Schema 完整性与类型验证",
|
| 111 |
+
"score": 10,
|
| 112 |
+
"max_score": 20,
|
| 113 |
+
"passed": False,
|
| 114 |
+
"reason": "键正确且为字符串,但值未严格遵循 0xXX 的标准两位十六进制格式"
|
| 115 |
+
})
|
| 116 |
+
total_score += 10
|
| 117 |
else:
|
| 118 |
+
details.append({
|
| 119 |
+
"item": "Schema 完整性与类型验证",
|
| 120 |
+
"score": 5,
|
| 121 |
+
"max_score": 20,
|
| 122 |
+
"passed": False,
|
| 123 |
+
"reason": "键正确,但部分数据不是纯字符串类型(如被写为整数或包含其它嵌套结构)"
|
| 124 |
+
})
|
| 125 |
+
total_score += 5
|
| 126 |
+
else:
|
| 127 |
+
missing = expected_keys - actual_keys
|
| 128 |
+
extra = actual_keys - expected_keys
|
| 129 |
+
reason_parts = []
|
| 130 |
+
if missing: reason_parts.append(f"缺少必填键: {missing}")
|
| 131 |
+
if extra: reason_parts.append(f"捏造或多余键: {extra}")
|
| 132 |
+
details.append({
|
| 133 |
+
"item": "Schema 完整性与类型验证",
|
| 134 |
+
"score": 0,
|
| 135 |
+
"max_score": 20,
|
| 136 |
+
"passed": False,
|
| 137 |
+
"reason": " | ".join(reason_parts)
|
| 138 |
+
})
|
| 139 |
|
| 140 |
+
# 4. 严格值校验: device_addr (20 分)
|
| 141 |
+
device_addr = str(data.get("device_addr", "")).strip().lower()
|
| 142 |
+
if device_addr == "0x68":
|
| 143 |
+
details.append({
|
| 144 |
+
"item": "校验设备地址(device_addr)",
|
| 145 |
+
"score": 20,
|
| 146 |
+
"max_score": 20,
|
| 147 |
+
"passed": True,
|
| 148 |
+
"reason": "准确提取 I2C 基地址 0x68"
|
| 149 |
+
})
|
| 150 |
+
total_score += 20
|
| 151 |
+
elif device_addr == "0xd0":
|
| 152 |
+
details.append({
|
| 153 |
+
"item": "校验设备地址(device_addr)",
|
| 154 |
+
"score": 10,
|
| 155 |
+
"max_score": 20,
|
| 156 |
+
"passed": False,
|
| 157 |
+
"reason": "提取到 0xD0 (这是带 Write 位偏移后的传输地址),虽然对应了抓包字节,但规范的 Base Addr 应为 0x68"
|
| 158 |
+
})
|
| 159 |
+
total_score += 10
|
| 160 |
else:
|
| 161 |
+
details.append({
|
| 162 |
+
"item": "校验设备地址(device_addr)",
|
| 163 |
+
"score": 0,
|
| 164 |
+
"max_score": 20,
|
| 165 |
+
"passed": False,
|
| 166 |
+
"reason": f"提取错误: {device_addr}"
|
| 167 |
+
})
|
| 168 |
+
|
| 169 |
+
# 5. 严格值校验: reg_addr (20 分)
|
| 170 |
+
reg_addr = str(data.get("reg_addr", "")).strip().lower()
|
| 171 |
if reg_addr == "0x6b":
|
| 172 |
+
details.append({
|
| 173 |
+
"item": "校验寄存器地址(reg_addr)",
|
| 174 |
+
"score": 20,
|
| 175 |
+
"max_score": 20,
|
| 176 |
+
"passed": True,
|
| 177 |
+
"reason": "准确提取触发死锁的 PWR_MGMT_1 寄存器地址 0x6B"
|
| 178 |
+
})
|
| 179 |
+
total_score += 20
|
| 180 |
else:
|
| 181 |
+
details.append({
|
| 182 |
+
"item": "校验寄存器地址(reg_addr)",
|
| 183 |
+
"score": 0,
|
| 184 |
+
"max_score": 20,
|
| 185 |
+
"passed": False,
|
| 186 |
+
"reason": f"寄存器地址提取错误: {reg_addr}"
|
| 187 |
+
})
|
| 188 |
|
| 189 |
+
# 6. 严格值校验: bad_value (20 分)
|
| 190 |
+
bad_value = str(data.get("bad_value", "")).strip().lower()
|
| 191 |
if bad_value == "0x80":
|
| 192 |
+
details.append({
|
| 193 |
+
"item": "校验致死错值(bad_value)",
|
| 194 |
+
"score": 20,
|
| 195 |
+
"max_score": 20,
|
| 196 |
+
"passed": True,
|
| 197 |
+
"reason": "准确提取触发 Errata 并导致看门狗复位的脏值 0x80"
|
| 198 |
+
})
|
| 199 |
+
total_score += 20
|
| 200 |
else:
|
| 201 |
+
details.append({
|
| 202 |
+
"item": "校验致死错值(bad_value)",
|
| 203 |
+
"score": 0,
|
| 204 |
+
"max_score": 20,
|
| 205 |
+
"passed": False,
|
| 206 |
+
"reason": f"错误值提取错误: {bad_value}"
|
| 207 |
+
})
|
| 208 |
|
| 209 |
+
# 写入最终判卷结果
|
| 210 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding="utf-8") as f:
|
| 211 |
+
json.dump({"total_score": total_score, "details": details}, f, indent=2, ensure_ascii=False)
|
| 212 |
|
| 213 |
if __name__ == "__main__":
|
| 214 |
+
verify()
|
|
|
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0022/verify_workplace.py
CHANGED
|
@@ -4,13 +4,11 @@ import json
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
-
# ==========================================================
|
| 8 |
-
# 强制环境变量与 LLM 客户端初始化(禁用 SSL 验证)
|
| 9 |
-
# ==========================================================
|
| 10 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 11 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 12 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-4")
|
| 13 |
|
|
|
|
| 14 |
http_client = httpx.Client(verify=False)
|
| 15 |
client = OpenAI(
|
| 16 |
api_key=MOCK_API_KEY,
|
|
@@ -19,9 +17,7 @@ client = OpenAI(
|
|
| 19 |
)
|
| 20 |
|
| 21 |
def llm_judge_content(prompt_text, file_content):
|
| 22 |
-
|
| 23 |
-
统一的 LLM 判定接口,负责针对非结构化语义、越狱/冗余文字进行严格检测
|
| 24 |
-
"""
|
| 25 |
try:
|
| 26 |
response = client.chat.completions.create(
|
| 27 |
model=MOCK_MODEL_NAME,
|
|
@@ -36,111 +32,86 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 36 |
print(f"LLM API Error: {e}")
|
| 37 |
return False
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
# ==========================================================
|
| 42 |
-
def verify():
|
| 43 |
-
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 44 |
-
patch_file = os.path.join(workspace, "pipeline_fixes", "patch.json")
|
| 45 |
-
|
| 46 |
-
total_score = 0
|
| 47 |
details = []
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
else:
|
| 54 |
-
details.append({"item": "检查目
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
except Exception as e:
|
| 62 |
-
details.append({"item": "读取文件", "score": 0, "max_score": 0, "passed": False, "reason": f"文件读取引发异常: {e}"})
|
| 63 |
-
return total_score, details
|
| 64 |
-
|
| 65 |
-
# 预处理:剔除 Agent 可能包裹的 Markdown ```
|
| 66 |
-
|
| 67 |
-
```"):
|
| 68 |
-
lines = cleaned_content.splitlines()
|
| 69 |
-
if len(lines) > 1 and lines[0].startswith("```
|
| 70 |
-
|
| 71 |
-
```"):
|
| 72 |
-
lines = lines[:-1]
|
| 73 |
-
cleaned_content = "\n".join(lines).strip()
|
| 74 |
-
|
| 75 |
-
# 2. 检查数据文件格式合法性 (10分) - 坚决拒绝对结构化数据进行文本级别的 grep
|
| 76 |
-
try:
|
| 77 |
-
data = json.loads(cleaned_content)
|
| 78 |
-
total_score += 10
|
| 79 |
-
details.append({"item": "检查 JSON 格式合法性", "score": 10, "max_score": 10, "passed": True, "reason": "代码可通过原生 json.loads 成功解析产物"})
|
| 80 |
-
except Exception as e:
|
| 81 |
-
details.append({"item": "检查 JSON 格式合法性", "score": 0, "max_score": 10, "passed": False, "reason": f"文件非合法 JSON,解析崩溃: {e}"})
|
| 82 |
-
return total_score, details
|
| 83 |
-
|
| 84 |
-
# 3. 检查 Schema 与指令贴合度 (20分)
|
| 85 |
-
if not isinstance(data, dict):
|
| 86 |
-
details.append({"item": "检查 JSON 结构约束", "score": 0, "max_score": 20, "passed": False, "reason": "JSON 的最外层结构不合法(非对象/字典)"})
|
| 87 |
else:
|
| 88 |
-
|
| 89 |
-
expected_keys = {"broken_node", "missing_texture"}
|
| 90 |
-
if keys == expected_keys:
|
| 91 |
-
total_score += 20
|
| 92 |
-
details.append({"item": "检查 JSON 结构约束", "score": 20, "max_score": 20, "passed": True, "reason": "字段仅且恰好包含指令要求的 'broken_node' 与 'missing_texture'"})
|
| 93 |
-
elif expected_keys.issubset(keys):
|
| 94 |
-
# Agent 自作主张加入了无关字段,未遵守 "里面只需要给我塞两个字段" 的强指令
|
| 95 |
-
total_score += 5
|
| 96 |
-
details.append({"item": "检查 JSON 结构约束", "score": 5, "max_score": 20, "passed": False, "reason": "包含了核心字段,但 Agent 捏造了多余的无用字段,未严格遵循指令,严重扣分"})
|
| 97 |
-
else:
|
| 98 |
-
details.append({"item": "检查 JSON 结构约束", "score": 0, "max_score": 20, "passed": False, "reason": f"核心字段缺失。当前有的字段: {list(keys)}"})
|
| 99 |
-
|
| 100 |
-
# 4. 精准值域检查:broken_node (25分)
|
| 101 |
-
if isinstance(data, dict) and "broken_node" in data:
|
| 102 |
-
broken_node_val = str(data["broken_node"]).strip()
|
| 103 |
-
expected_node = "SHD_Flesh_Subsurface_09"
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
#
|
| 116 |
-
if isinstance(data, dict)
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
total_score += 25
|
| 122 |
-
details.append({"item": "原代码精确值检测:missing_texture", "score": 25, "max_score": 25, "passed": True, "reason": "贴图的绝对路径追溯正确"})
|
| 123 |
else:
|
| 124 |
-
details.append({"item": "
|
| 125 |
-
|
| 126 |
-
#
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
-
if
|
| 132 |
-
details.append({"item": "
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
details.append({"item": "利用大模型检查语义纯净度", "score": 10, "max_score": 10, "passed": True, "reason": "大模型验证通过:文件结构纯净,无闲聊与幻觉语言注入"})
|
| 136 |
-
|
| 137 |
-
return total_score, details
|
| 138 |
-
|
| 139 |
-
if __name__ == "__main__":
|
| 140 |
-
score, details = verify()
|
| 141 |
result = {
|
| 142 |
"total_score": score,
|
| 143 |
"details": details
|
| 144 |
}
|
|
|
|
| 145 |
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 146 |
json.dump(result, f, ensure_ascii=False, indent=2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
+
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
# 此函数为检测非结构化文本的统一接口
|
|
|
|
|
|
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def verify_workplace(workspace):
|
| 36 |
+
score = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
details = []
|
| 38 |
|
| 39 |
+
# 目标路径配置
|
| 40 |
+
target_dir = os.path.join(workspace, "pipeline_fixes")
|
| 41 |
+
target_file = os.path.join(target_dir, "patch.json")
|
| 42 |
+
|
| 43 |
+
# 真实数据源(防止基于大模型的幻觉或模糊匹配,必须通过精准代码强校验)
|
| 44 |
+
truth_node = "SHD_Flesh_Subsurface_09"
|
| 45 |
+
truth_texture = "/prod/show/SC043/assets/chars/mutant/tex/v003/diffuse_UDIM_1001.tx"
|
| 46 |
+
|
| 47 |
+
# 1. 验证目标目录是否存在 (10分)
|
| 48 |
+
if os.path.isdir(target_dir):
|
| 49 |
+
score += 10
|
| 50 |
+
details.append({"item": "检查 pipeline_fixes 目录是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "成功创建 pipeline_fixes 目录"})
|
| 51 |
else:
|
| 52 |
+
details.append({"item": "检查 pipeline_fixes 目录是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 pipeline_fixes 目录"})
|
| 53 |
+
|
| 54 |
+
# 2. 验证热修复文件是否存在 (10分)
|
| 55 |
+
file_exists = os.path.isfile(target_file)
|
| 56 |
+
if file_exists:
|
| 57 |
+
score += 10
|
| 58 |
+
details.append({"item": "检查 patch.json 文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "成功找到 patch.json 文件"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
else:
|
| 60 |
+
details.append({"item": "检查 patch.json 文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到 patch.json 文件"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
# 3. 严格验证 JSON 格式合法性及 Schema 字段约束 (20分)
|
| 63 |
+
data = None
|
| 64 |
+
if file_exists:
|
| 65 |
+
try:
|
| 66 |
+
with open(target_file, "r", encoding="utf-8") as f:
|
| 67 |
+
data = json.load(f)
|
| 68 |
+
|
| 69 |
+
# 使用强代码检查,严查任何画蛇添足的解释字段
|
| 70 |
+
if isinstance(data, dict):
|
| 71 |
+
keys = set(data.keys())
|
| 72 |
+
expected_keys = {"broken_node", "missing_texture"}
|
| 73 |
+
if keys == expected_keys:
|
| 74 |
+
score += 20
|
| 75 |
+
details.append({"item": "检查 JSON 格式与 Schema 合法性", "score": 20, "max_score": 20, "passed": True, "reason": "JSON 解析成功,且仅包含题目严格约束的两个字段,无冗余内容"})
|
| 76 |
+
else:
|
| 77 |
+
details.append({"item": "检查 JSON 格式与 Schema 合法性", "score": 0, "max_score": 20, "passed": False, "reason": f"格式违规:包含预期外的字段或缺失字段,当前键集合:{list(keys)}"})
|
| 78 |
+
else:
|
| 79 |
+
details.append({"item": "检查 JSON 格式与 Schema 合法性", "score": 0, "max_score": 20, "passed": False, "reason": "JSON 根节点非字典(Object)类型"})
|
| 80 |
+
except json.JSONDecodeError:
|
| 81 |
+
details.append({"item": "检查 JSON 格式与 Schema 合法性", "score": 0, "max_score": 20, "passed": False, "reason": "文件不是合法的 JSON 格式,无法解析"})
|
| 82 |
+
else:
|
| 83 |
+
details.append({"item": "检查 JSON 格式与 Schema 合法性", "score": 0, "max_score": 20, "passed": False, "reason": "因文件不存在,无法进行格式校验"})
|
| 84 |
|
| 85 |
+
# 4. 验证核心数据:故障节点名的精准提取 (30分)
|
| 86 |
+
if data and isinstance(data, dict):
|
| 87 |
+
node_val = data.get("broken_node", "")
|
| 88 |
+
if node_val == truth_node:
|
| 89 |
+
score += 30
|
| 90 |
+
details.append({"item": "校验 broken_node 提取准确度", "score": 30, "max_score": 30, "passed": True, "reason": "成功在海量渲染日志的栈转储与十六进制报错中提取出真正的崩溃节点名"})
|
|
|
|
|
|
|
| 91 |
else:
|
| 92 |
+
details.append({"item": "校验 broken_node 提取准确度", "score": 0, "max_score": 30, "passed": False, "reason": f"节点提取错误,期望 [{truth_node}],实际得到 [{node_val}]"})
|
| 93 |
+
|
| 94 |
+
# 5. 验证核心数据:丢失贴图路径的精准解析与追踪 (30分)
|
| 95 |
+
if data and isinstance(data, dict):
|
| 96 |
+
tex_val = data.get("missing_texture", "")
|
| 97 |
+
if tex_val == truth_texture:
|
| 98 |
+
score += 30
|
| 99 |
+
details.append({"item": "校验 missing_texture 提取准确度", "score": 30, "max_score": 30, "passed": True, "reason": "成功在深层嵌套(拓扑极度复杂)的场景树中穿透干扰项,定位到了关联的贴图绝对路径"})
|
| 100 |
+
else:
|
| 101 |
+
details.append({"item": "校验 missing_texture 提取准确度", "score": 0, "max_score": 30, "passed": False, "reason": f"贴图路径追踪失败,期望 [{truth_texture}],实际得到 [{tex_val}]"})
|
| 102 |
|
| 103 |
+
if not data or not isinstance(data, dict):
|
| 104 |
+
details.append({"item": "校验 broken_node 提取准确度", "score": 0, "max_score": 30, "passed": False, "reason": "JSON 结构无效,无法校验提取准确度"})
|
| 105 |
+
details.append({"item": "校验 missing_texture 提取准确度", "score": 0, "max_score": 30, "passed": False, "reason": "JSON 结构无效,无法校验提取准确度"})
|
| 106 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
result = {
|
| 108 |
"total_score": score,
|
| 109 |
"details": details
|
| 110 |
}
|
| 111 |
+
|
| 112 |
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 113 |
json.dump(result, f, ensure_ascii=False, indent=2)
|
| 114 |
+
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
workspace_dir = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 117 |
+
verify_workplace(workspace_dir)
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0024/verify_workplace.py
CHANGED
|
@@ -1,15 +1,14 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
-
import re
|
| 5 |
import httpx
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
-
# 强制 API 规范:LLM 客户端初始化,关闭 SSL 验证
|
| 9 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 10 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 11 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 12 |
|
|
|
|
| 13 |
http_client = httpx.Client(verify=False)
|
| 14 |
client = OpenAI(
|
| 15 |
api_key=MOCK_API_KEY,
|
|
@@ -18,10 +17,7 @@ client = OpenAI(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
def llm_judge_content(prompt_text, file_content):
|
| 21 |
-
|
| 22 |
-
统一接口:利用大模型检测非结构化文本的语义。
|
| 23 |
-
在 Agent 输出非标准结构化内容(混杂自然语言)时进行兜底提取验证。
|
| 24 |
-
"""
|
| 25 |
try:
|
| 26 |
response = client.chat.completions.create(
|
| 27 |
model=MOCK_MODEL_NAME,
|
|
@@ -36,134 +32,91 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 36 |
print(f"LLM API Error: {e}")
|
| 37 |
return False
|
| 38 |
|
| 39 |
-
def
|
| 40 |
-
"""尝试清理包裹了 markdown 语法的 JSON 字符串"""
|
| 41 |
-
content = content.strip()
|
| 42 |
-
if content.startswith("```
|
| 43 |
-
|
| 44 |
-
```(?:json)?\n", "", content)
|
| 45 |
-
content = re.sub(r"\n```$", "", content)
|
| 46 |
-
return content
|
| 47 |
-
|
| 48 |
-
def verify():
|
| 49 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 50 |
-
|
|
|
|
| 51 |
total_score = 0
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
if os.path.isdir(hotfix_dir):
|
| 58 |
-
score = 10
|
| 59 |
-
total_score += score
|
| 60 |
-
results.append({"item": "检查 hotfix 目录是否存在", "score": score, "max_score": 10, "passed": True, "reason": "hotfix 目录存在"})
|
| 61 |
-
else:
|
| 62 |
-
results.append({"item": "检查 hotfix 目录是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "hotfix 目录不存在"})
|
| 63 |
-
|
| 64 |
-
# 2. 检查文件 (10分)
|
| 65 |
-
file_exists = os.path.isfile(target_file)
|
| 66 |
if file_exists:
|
| 67 |
-
score
|
| 68 |
-
total_score +=
|
| 69 |
-
results.append({"item": "检查 version_pin.json 文件是否存在", "score": score, "max_score": 10, "passed": True, "reason": "version_pin.json 文件存在"})
|
| 70 |
else:
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
if parsed_data and isinstance(parsed_data, dict):
|
| 94 |
-
# 3.1 Schema 结构审查 (20分)
|
| 95 |
-
required_keys = {"conflict_pkg", "bad_version", "system_version"}
|
| 96 |
-
actual_keys = set(parsed_data.keys())
|
| 97 |
-
if actual_keys == required_keys:
|
| 98 |
-
total_score += 20
|
| 99 |
-
results.append({"item": "JSON Schema及字段严谨性校验", "score": 20, "max_score": 20, "passed": True, "reason": "完全包含且仅包含三个强制要求字段,无捏造"})
|
| 100 |
-
elif required_keys.issubset(actual_keys):
|
| 101 |
-
# 扣减分:有多余的无用字段
|
| 102 |
total_score += 10
|
| 103 |
-
results.append({"item": "JSON Schema及字段严谨性校验", "score": 10, "max_score": 20, "passed": False, "reason": "包含了必需字段,但存在 Agent 幻觉捏造的多余字段"})
|
| 104 |
else:
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
#
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
total_score +=
|
| 111 |
-
results.append({"item": "精准提取: conflict_pkg", "score": 20, "max_score": 20, "passed": True, "reason": "正确锁定冲突的 Python 依赖包"})
|
| 112 |
else:
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
#
|
| 116 |
-
|
| 117 |
-
if
|
|
|
|
| 118 |
total_score += 20
|
| 119 |
-
results.append({"item": "精准提取: bad_version", "score": 20, "max_score": 20, "passed": True, "reason": "正确提取到导致崩溃的高版本 1.81.0"})
|
| 120 |
else:
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
#
|
| 124 |
-
|
| 125 |
-
if
|
|
|
|
| 126 |
total_score += 20
|
| 127 |
-
results.append({"item": "精准提取: system_version", "score": 20, "max_score": 20, "passed": True, "reason": "正确提取到 CMDB 中的底座版本 1.74.0"})
|
| 128 |
else:
|
| 129 |
-
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
else:
|
| 132 |
-
#
|
| 133 |
-
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
-
|
| 137 |
-
if llm_judge_content(prompt_pkg, raw_content):
|
| 138 |
-
total_score += 15
|
| 139 |
-
results.append({"item": "语义提取: conflict_pkg", "score": 15, "max_score": 20, "passed": True, "reason": "通过 LLM 从非结构化文本中识别到正确包名 (格式不合规扣5分)"})
|
| 140 |
-
else:
|
| 141 |
-
results.append({"item": "语义提取: conflict_pkg", "score": 0, "max_score": 20, "passed": False, "reason": "未在文本中找到正确的冲突包名"})
|
| 142 |
-
|
| 143 |
-
prompt_bad_ver = "Does the content clearly state that the bad version or high version (that caused the error) is '1.81.0'?"
|
| 144 |
-
if llm_judge_content(prompt_bad_ver, raw_content):
|
| 145 |
-
total_score += 15
|
| 146 |
-
results.append({"item": "语义提取: bad_version", "score": 15, "max_score": 20, "passed": True, "reason": "通过 LLM 从非结构化文本中识别到正确的高版本 (格式不合规扣5分)"})
|
| 147 |
-
else:
|
| 148 |
-
results.append({"item": "语义提取: bad_version", "score": 0, "max_score": 20, "passed": False, "reason": "未在文本中找到正确的错误高版本 1.81.0"})
|
| 149 |
-
|
| 150 |
-
prompt_sys_ver = "Does the content clearly state that the system version or CMDB bottom version is '1.74.0'?"
|
| 151 |
-
if llm_judge_content(prompt_sys_ver, raw_content):
|
| 152 |
-
total_score += 15
|
| 153 |
-
results.append({"item": "语义提取: system_version", "score": 15, "max_score": 20, "passed": True, "reason": "通过 LLM 从非结构化文本中识别到正确的底座版本 (格式不合规扣5分)"})
|
| 154 |
-
else:
|
| 155 |
-
results.append({"item": "语义提取: system_version", "score": 0, "max_score": 20, "passed": False, "reason": "未在文本中找到正确的系统底座版本 1.74.0"})
|
| 156 |
-
|
| 157 |
-
write_score(total_score, results, workspace)
|
| 158 |
-
|
| 159 |
-
def write_score(total_score, results, workspace):
|
| 160 |
-
output = {
|
| 161 |
"total_score": total_score,
|
| 162 |
-
"details":
|
| 163 |
}
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
|
| 168 |
if __name__ == "__main__":
|
| 169 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import json
|
|
|
|
| 4 |
import httpx
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
# 此函数为检测非结构化文本的统一接口
|
|
|
|
|
|
|
|
|
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 37 |
+
|
| 38 |
+
score_details = []
|
| 39 |
total_score = 0
|
| 40 |
+
|
| 41 |
+
target_file = os.path.join(workspace, "hotfix", "version_pin.json")
|
| 42 |
+
|
| 43 |
+
# Check 1: File Existence (10 points)
|
| 44 |
+
file_exists = os.path.exists(target_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
if file_exists:
|
| 46 |
+
score_details.append({"item": "检查热更配置文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 hotfix/version_pin.json 存在"})
|
| 47 |
+
total_score += 10
|
|
|
|
| 48 |
else:
|
| 49 |
+
score_details.append({"item": "检查热更配置文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件 hotfix/version_pin.json 缺失"})
|
| 50 |
+
|
| 51 |
+
data = None
|
| 52 |
+
if file_exists:
|
| 53 |
+
# Check 2: JSON format (10 points)
|
| 54 |
+
try:
|
| 55 |
+
with open(target_file, "r", encoding="utf-8") as f:
|
| 56 |
+
data = json.load(f)
|
| 57 |
+
score_details.append({"item": "检查文件是否为合法 JSON", "score": 10, "max_score": 10, "passed": True, "reason": "成功解析 JSON 格式"})
|
| 58 |
+
total_score += 10
|
| 59 |
+
except Exception as e:
|
| 60 |
+
score_details.append({"item": "检查文件是否为合法 JSON", "score": 0, "max_score": 10, "passed": False, "reason": f"JSON 解析失败: {e}"})
|
| 61 |
+
|
| 62 |
+
if data and isinstance(data, dict):
|
| 63 |
+
# Check 3: Required Fields Presence (10 points)
|
| 64 |
+
required_fields = {"conflict_pkg", "bad_version", "system_version"}
|
| 65 |
+
actual_fields = set(data.keys())
|
| 66 |
+
missing = required_fields - actual_fields
|
| 67 |
+
extra = actual_fields - required_fields
|
| 68 |
+
|
| 69 |
+
if not missing:
|
| 70 |
+
score_details.append({"item": "检查是否包含全部必填字段", "score": 10, "max_score": 10, "passed": True, "reason": "需要的三个核心字段全部存在"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
total_score += 10
|
|
|
|
| 72 |
else:
|
| 73 |
+
score_details.append({"item": "检查是否包含全部必填字段", "score": 0, "max_score": 10, "passed": False, "reason": f"缺失必要字段: {missing}"})
|
| 74 |
+
|
| 75 |
+
# Check 4: No Extra Fields (10 points)
|
| 76 |
+
if not extra:
|
| 77 |
+
score_details.append({"item": "检查是否捏造多余字段防幻觉", "score": 10, "max_score": 10, "passed": True, "reason": "未发现多余字段,输出符合最简结构要求"})
|
| 78 |
+
total_score += 10
|
|
|
|
| 79 |
else:
|
| 80 |
+
score_details.append({"item": "检查是否捏造多余字段防幻觉", "score": 0, "max_score": 10, "passed": False, "reason": f"包含不被允许的额外字段: {extra}"})
|
| 81 |
+
|
| 82 |
+
# Check 5: conflict_pkg accuracy (20 points)
|
| 83 |
+
conflict_pkg = data.get("conflict_pkg", "")
|
| 84 |
+
if isinstance(conflict_pkg, str) and (conflict_pkg.strip() == "boost-python-deps" or conflict_pkg.strip() == "boost_python_deps"):
|
| 85 |
+
score_details.append({"item": "准确提取导致崩溃的冲突包名", "score": 20, "max_score": 20, "passed": True, "reason": f"正确识别引发崩溃的 Python 依赖库: {conflict_pkg}"})
|
| 86 |
total_score += 20
|
|
|
|
| 87 |
else:
|
| 88 |
+
score_details.append({"item": "准确提取导致崩溃的冲突包名", "score": 0, "max_score": 20, "passed": False, "reason": f"识别的冲突包错误或类型异常: {conflict_pkg}"})
|
| 89 |
+
|
| 90 |
+
# Check 6: bad_version accuracy (20 points)
|
| 91 |
+
bad_version = data.get("bad_version", "")
|
| 92 |
+
if isinstance(bad_version, str) and bad_version.strip() == "1.81.0":
|
| 93 |
+
score_details.append({"item": "精确提取错误注入的库高版本号", "score": 20, "max_score": 20, "passed": True, "reason": "完美匹配错误的高版本 1.81.0"})
|
| 94 |
total_score += 20
|
|
|
|
| 95 |
else:
|
| 96 |
+
score_details.append({"item": "精确提取错误注入的库高版本号", "score": 0, "max_score": 20, "passed": False, "reason": f"版本号抽取错误: {bad_version}"})
|
| 97 |
|
| 98 |
+
# Check 7: system_version accuracy (20 points)
|
| 99 |
+
system_version = data.get("system_version", "")
|
| 100 |
+
if isinstance(system_version, str) and system_version.strip() == "1.74.0":
|
| 101 |
+
score_details.append({"item": "精确探测系统底层所需底座版本号", "score": 20, "max_score": 20, "passed": True, "reason": "成功反查到系统真实预期的 C++ 底座版本 1.74.0"})
|
| 102 |
+
total_score += 20
|
| 103 |
+
else:
|
| 104 |
+
score_details.append({"item": "精确探测系统底层所需底座版本号", "score": 0, "max_score": 20, "passed": False, "reason": f"提取系统底座版本号错误: {system_version}"})
|
| 105 |
else:
|
| 106 |
+
# Fallback for failing condition 3-7 when dict parsing fails
|
| 107 |
+
score_details.append({"item": "检查是否包含全部必填字段", "score": 0, "max_score": 10, "passed": False, "reason": "非有效 JSON 字典"})
|
| 108 |
+
score_details.append({"item": "检查是否捏造多余字段防幻觉", "score": 0, "max_score": 10, "passed": False, "reason": "非有效 JSON 字典"})
|
| 109 |
+
score_details.append({"item": "准确提取导致崩溃的冲突包名", "score": 0, "max_score": 20, "passed": False, "reason": "无法读取字段"})
|
| 110 |
+
score_details.append({"item": "精确提取错误注入的库高版本号", "score": 0, "max_score": 20, "passed": False, "reason": "无法读取字段"})
|
| 111 |
+
score_details.append({"item": "精确探测系统底层所需底座版本号", "score": 0, "max_score": 20, "passed": False, "reason": "无法读取字段"})
|
| 112 |
|
| 113 |
+
result = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
"total_score": total_score,
|
| 115 |
+
"details": score_details
|
| 116 |
}
|
| 117 |
+
|
| 118 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 119 |
+
json.dump(result, f, indent=4, ensure_ascii=False)
|
| 120 |
|
| 121 |
if __name__ == "__main__":
|
| 122 |
+
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0026/verify_workplace.py
CHANGED
|
@@ -2,18 +2,16 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
| 5 |
-
import glob
|
| 6 |
-
import re
|
| 7 |
from openai import OpenAI
|
| 8 |
|
| 9 |
-
# ==========================================
|
| 10 |
-
#
|
| 11 |
-
# ==========================================
|
| 12 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 13 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 14 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 15 |
|
| 16 |
-
#
|
| 17 |
http_client = httpx.Client(verify=False)
|
| 18 |
client = OpenAI(
|
| 19 |
api_key=MOCK_API_KEY,
|
|
@@ -23,8 +21,9 @@ client = OpenAI(
|
|
| 23 |
|
| 24 |
def llm_judge_content(prompt_text, file_content):
|
| 25 |
"""
|
| 26 |
-
|
| 27 |
-
|
|
|
|
| 28 |
"""
|
| 29 |
try:
|
| 30 |
response = client.chat.completions.create(
|
|
@@ -40,106 +39,132 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 40 |
print(f"LLM API Error: {e}")
|
| 41 |
return False
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
由于
|
| 49 |
-
|
| 50 |
-
"""
|
| 51 |
traces_dir = os.path.join(workspace, "traces")
|
| 52 |
-
if
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
for
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
details = []
|
| 73 |
-
total_score = 0
|
| 74 |
-
target_file = os.path.join(workspace, "ops", "root_cause.json")
|
| 75 |
-
|
| 76 |
-
# ------------------ 检查点 1:目录与文件结构检查 (10分) ------------------
|
| 77 |
-
if os.path.exists(target_file):
|
| 78 |
-
details.append({"item": "检查目标文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 ops/root_cause.json 存在"})
|
| 79 |
-
total_score += 10
|
| 80 |
-
else:
|
| 81 |
-
details.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "未找到要求的产出文件 ops/root_cause.json"})
|
| 82 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 83 |
-
json.dump({"total_score": 0, "details": details}, f, ensure_ascii=False, indent=2)
|
| 84 |
return
|
| 85 |
-
|
| 86 |
-
with open(target_file, "r", encoding="utf-8") as f:
|
| 87 |
-
content = f.read()
|
| 88 |
|
| 89 |
-
#
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
"
|
| 93 |
-
|
|
|
|
|
|
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
parsed_json = json.loads(cleaned)
|
| 98 |
-
except Exception:
|
| 99 |
-
parsed_json = None
|
| 100 |
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
with open(
|
| 104 |
-
json.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
return
|
| 106 |
|
| 107 |
-
#
|
| 108 |
-
real_trace_id = find_anomaly_trace_id(workspace)
|
| 109 |
-
agent_trace_id = parsed_json.get("trace_id", "")
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
total_score += 20
|
| 114 |
else:
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
#
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
total_score += 25
|
| 123 |
else:
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
#
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
| 131 |
else:
|
| 132 |
-
|
| 133 |
|
| 134 |
-
#
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 138 |
-
json.dump({
|
| 139 |
-
"total_score": total_score,
|
| 140 |
-
"details": details
|
| 141 |
-
}, f, ensure_ascii=False, indent=2)
|
| 142 |
|
| 143 |
if __name__ == "__main__":
|
| 144 |
-
|
| 145 |
-
verify(work_dir)
|
|
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
|
|
|
|
|
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
+
# ==========================================
|
| 8 |
+
# 强制 API 规范:大模型初始化
|
| 9 |
+
# ==========================================
|
| 10 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 11 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 12 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 13 |
|
| 14 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 15 |
http_client = httpx.Client(verify=False)
|
| 16 |
client = OpenAI(
|
| 17 |
api_key=MOCK_API_KEY,
|
|
|
|
| 21 |
|
| 22 |
def llm_judge_content(prompt_text, file_content):
|
| 23 |
"""
|
| 24 |
+
此函数为检测非结构化文本的统一接口。
|
| 25 |
+
针对 data_persona_aligned_skills_50_0026 任务由于要求生成纯 JSON 结果,代码可以直接完成确定性验证,
|
| 26 |
+
本函数作为规范预留,在有任何自然语言生成时调用。
|
| 27 |
"""
|
| 28 |
try:
|
| 29 |
response = client.chat.completions.create(
|
|
|
|
| 39 |
print(f"LLM API Error: {e}")
|
| 40 |
return False
|
| 41 |
|
| 42 |
+
def verify():
|
| 43 |
+
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 44 |
+
results = []
|
| 45 |
+
total_score = 0
|
| 46 |
+
|
| 47 |
+
# 1. 动态计算 Ground Truth (由于 env_builder 中数据和 hex 值是随机生成的)
|
| 48 |
+
ground_truth = None
|
|
|
|
| 49 |
traces_dir = os.path.join(workspace, "traces")
|
| 50 |
+
if os.path.isdir(traces_dir):
|
| 51 |
+
for file_name in os.listdir(traces_dir):
|
| 52 |
+
if not file_name.endswith(".json"):
|
| 53 |
+
continue
|
| 54 |
+
file_path = os.path.join(traces_dir, file_name)
|
| 55 |
+
try:
|
| 56 |
+
with open(file_path, 'r', encoding='utf-8') as f:
|
| 57 |
+
data = json.load(f)
|
| 58 |
+
for trace in data.get("data", []):
|
| 59 |
+
spans = trace.get("spans", [])
|
| 60 |
+
is_target = False
|
| 61 |
+
|
| 62 |
+
# 找到持续时间 > 5s (5,000,000 微秒) 的目标 Trace
|
| 63 |
+
for span in spans:
|
| 64 |
+
if span.get("duration", 0) > 5000000:
|
| 65 |
+
is_target = True
|
| 66 |
+
break
|
| 67 |
+
|
| 68 |
+
if is_target:
|
| 69 |
+
trace_id = trace.get("traceID")
|
| 70 |
+
operation = None
|
| 71 |
+
payload = None
|
| 72 |
+
# 深度遍历锁定底层报错 Span
|
| 73 |
+
for span in spans:
|
| 74 |
+
if span.get("operationName") == "grpc.inventory.ReserveStock":
|
| 75 |
+
operation = span.get("operationName")
|
| 76 |
+
for log in span.get("logs", []):
|
| 77 |
+
for field in log.get("fields", []):
|
| 78 |
+
if field.get("key") == "corrupted_payload":
|
| 79 |
+
payload = field.get("value")
|
| 80 |
+
|
| 81 |
+
if trace_id and operation and payload:
|
| 82 |
+
ground_truth = {
|
| 83 |
+
"trace_id": trace_id,
|
| 84 |
+
"operation": operation,
|
| 85 |
+
"payload": payload
|
| 86 |
+
}
|
| 87 |
+
break
|
| 88 |
+
except Exception:
|
| 89 |
+
pass
|
| 90 |
+
|
| 91 |
+
if ground_truth:
|
| 92 |
+
break
|
| 93 |
|
| 94 |
+
if not ground_truth:
|
| 95 |
+
results.append({"item": "沙盒异常监控", "score": 0, "max_score": 0, "passed": False, "reason": "无法计算 Ground Truth,Trace 原始文件可能遭到破坏或未生成。"})
|
| 96 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 97 |
+
json.dump({"total_score": 0, "details": results}, f, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
return
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
+
# 2. 检查结果文件是否存在 (权重: 20分)
|
| 101 |
+
target_file = os.path.join(workspace, "ops", "root_cause.json")
|
| 102 |
+
if not os.path.exists(target_file):
|
| 103 |
+
results.append({"item": "检查目标文件是否存在", "score": 0, "max_score": 20, "passed": False, "reason": "文件 ops/root_cause.json 不存在"})
|
| 104 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 105 |
+
json.dump({"total_score": 0, "details": results}, f, indent=2, ensure_ascii=False)
|
| 106 |
+
return
|
| 107 |
|
| 108 |
+
results.append({"item": "检查目标文件是否存在", "score": 20, "max_score": 20, "passed": True, "reason": "文件 ops/root_cause.json 存在"})
|
| 109 |
+
total_score += 20
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
+
# 3. 检查文件是否为合法 JSON 且结构正常 (权重: 20分)
|
| 112 |
+
try:
|
| 113 |
+
with open(target_file, 'r', encoding='utf-8') as f:
|
| 114 |
+
ans_data = json.load(f)
|
| 115 |
+
results.append({"item": "检查文件是否为合法 JSON 解析", "score": 20, "max_score": 20, "passed": True, "reason": "标准 JSON 格式合法"})
|
| 116 |
+
total_score += 20
|
| 117 |
+
except json.JSONDecodeError:
|
| 118 |
+
results.append({"item": "检查文件是否为合法 JSON 解析", "score": 0, "max_score": 20, "passed": False, "reason": "无法被原生 json.load 解析"})
|
| 119 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 120 |
+
json.dump({"total_score": total_score, "details": results}, f, indent=2, ensure_ascii=False)
|
| 121 |
+
return
|
| 122 |
+
except Exception as e:
|
| 123 |
+
results.append({"item": "检查文件是否为合法 JSON 解析", "score": 0, "max_score": 20, "passed": False, "reason": f"文件读取发生未知错误: {str(e)}"})
|
| 124 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 125 |
+
json.dump({"total_score": total_score, "details": results}, f, indent=2, ensure_ascii=False)
|
| 126 |
return
|
| 127 |
|
| 128 |
+
# 4. 提取核心指标:严格比对 (每项 20 分,共 60 分)
|
|
|
|
|
|
|
| 129 |
|
| 130 |
+
# 4.1 Trace ID 校验
|
| 131 |
+
agent_trace_id = ans_data.get("trace_id")
|
| 132 |
+
if agent_trace_id == ground_truth["trace_id"]:
|
| 133 |
+
results.append({"item": "检查 Trace ID 提取是否正确", "score": 20, "max_score": 20, "passed": True, "reason": "Trace ID 精准匹配"})
|
| 134 |
+
total_score += 20
|
| 135 |
+
else:
|
| 136 |
+
results.append({"item": "检查 Trace ID 提取是否正确", "score": 0, "max_score": 20, "passed": False, "reason": f"匹配失败, 期待 {ground_truth['trace_id']}, 实际得到 {agent_trace_id}"})
|
| 137 |
+
|
| 138 |
+
# 4.2 底层 Operation 校验
|
| 139 |
+
agent_operation = ans_data.get("operation")
|
| 140 |
+
if agent_operation == ground_truth["operation"]:
|
| 141 |
+
results.append({"item": "检查底层报错 Operation 提取是否正确", "score": 20, "max_score": 20, "passed": True, "reason": "Operation 提取正确"})
|
| 142 |
total_score += 20
|
| 143 |
else:
|
| 144 |
+
results.append({"item": "检查底层报错 Operation 提取是否正确", "score": 0, "max_score": 20, "passed": False, "reason": f"匹配失败, 实际得到 {agent_operation}"})
|
| 145 |
+
|
| 146 |
+
# 4.3 Corrupted Payload 内存地址校验
|
| 147 |
+
agent_payload = ans_data.get("payload")
|
| 148 |
+
if agent_payload == ground_truth["payload"]:
|
| 149 |
+
results.append({"item": "检查 Corrupted Payload 提取是否正确", "score": 20, "max_score": 20, "passed": True, "reason": "Payload 提取正确"})
|
| 150 |
+
total_score += 20
|
|
|
|
| 151 |
else:
|
| 152 |
+
results.append({"item": "检查 Corrupted Payload 提取是否正确", "score": 0, "max_score": 20, "passed": False, "reason": f"匹配失败, 实际得到 {agent_payload}"})
|
| 153 |
+
|
| 154 |
+
# 5. 扣分项:极其严格地验证废话与多余字段 (题目要求:"其他废话和分析过程一句都别留")
|
| 155 |
+
allowed_keys = {"trace_id", "operation", "payload"}
|
| 156 |
+
actual_keys = set(ans_data.keys())
|
| 157 |
+
extra_keys = actual_keys - allowed_keys
|
| 158 |
+
if extra_keys:
|
| 159 |
+
deduct = 20
|
| 160 |
+
total_score = max(0, total_score - deduct)
|
| 161 |
+
results.append({"item": "多余废话字段检测", "score": -deduct, "max_score": 0, "passed": False, "reason": f"存在不允许的额外字段: {extra_keys},违背强制不罗嗦指令,扣除 {deduct} 分"})
|
| 162 |
else:
|
| 163 |
+
results.append({"item": "多余废话字段检测", "score": 0, "max_score": 0, "passed": True, "reason": "未包含多余字段,严格遵守了输出格式指令"})
|
| 164 |
|
| 165 |
+
# 最终输出 workplace_score.json
|
| 166 |
+
with open(os.path.join(workspace, "workplace_score.json"), "w", encoding='utf-8') as f:
|
| 167 |
+
json.dump({"total_score": total_score, "details": results}, f, indent=2, ensure_ascii=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
if __name__ == "__main__":
|
| 170 |
+
verify()
|
|
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0029/verify_workplace.py
CHANGED
|
@@ -2,15 +2,13 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
| 5 |
-
import re
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
-
# 强制约定的环境变量
|
| 9 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 10 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 11 |
-
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-
|
| 12 |
|
| 13 |
-
# 初始化客户端,
|
| 14 |
http_client = httpx.Client(verify=False)
|
| 15 |
client = OpenAI(
|
| 16 |
api_key=MOCK_API_KEY,
|
|
@@ -19,19 +17,13 @@ client = OpenAI(
|
|
| 19 |
)
|
| 20 |
|
| 21 |
def llm_judge_content(prompt_text, file_content):
|
| 22 |
-
|
| 23 |
try:
|
| 24 |
response = client.chat.completions.create(
|
| 25 |
model=MOCK_MODEL_NAME,
|
| 26 |
messages=[
|
| 27 |
-
{
|
| 28 |
-
|
| 29 |
-
"content": "You are a strict output formatting judge. Answer ONLY with 'YES' or 'NO'."
|
| 30 |
-
},
|
| 31 |
-
{
|
| 32 |
-
"role": "user",
|
| 33 |
-
"content": f"{prompt_text}\n\n[File Content]:\n{file_content}"
|
| 34 |
-
}
|
| 35 |
],
|
| 36 |
temperature=0
|
| 37 |
)
|
|
@@ -40,40 +32,141 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 40 |
print(f"LLM API Error: {e}")
|
| 41 |
return False
|
| 42 |
|
| 43 |
-
def
|
| 44 |
-
"""尝试严格或容错解析 JSON"""
|
| 45 |
-
try:
|
| 46 |
-
return json.loads(text)
|
| 47 |
-
except json.JSONDecodeError:
|
| 48 |
-
# 容错提取,防止 Agent 违规使用 Markdown 导致后续结构化判定全部失效
|
| 49 |
-
match = re.search(r'```
|
| 50 |
-
|
| 51 |
-
```', text, re.DOTALL)
|
| 52 |
-
if match:
|
| 53 |
-
try:
|
| 54 |
-
return json.loads(match.group(1))
|
| 55 |
-
except:
|
| 56 |
-
pass
|
| 57 |
-
return None
|
| 58 |
-
|
| 59 |
-
def verify():
|
| 60 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 61 |
-
target_file = os.path.join(workspace, "action_items", "kill_list.json")
|
| 62 |
-
|
| 63 |
-
score_details = []
|
| 64 |
total_score = 0
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
# 1. 检查文件是否存在 (
|
| 67 |
if os.path.exists(target_file):
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
else:
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
return
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
|
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import httpx
|
|
|
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
|
|
| 7 |
MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
| 8 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 9 |
+
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 10 |
|
| 11 |
+
# 初始化客户端,必须关闭 SSL 验证
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
| 20 |
+
# 此函数为检测非结构化文本的统一接口
|
| 21 |
try:
|
| 22 |
response = client.chat.completions.create(
|
| 23 |
model=MOCK_MODEL_NAME,
|
| 24 |
messages=[
|
| 25 |
+
{"role": "system", "content": "You are a strict data validation assistant. Answer ONLY with 'YES' or 'NO'."},
|
| 26 |
+
{"role": "user", "content": f"{prompt_text}\n\n[File Content]:\n{file_content}"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
],
|
| 28 |
temperature=0
|
| 29 |
)
|
|
|
|
| 32 |
print(f"LLM API Error: {e}")
|
| 33 |
return False
|
| 34 |
|
| 35 |
+
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
|
|
|
|
|
|
|
|
| 37 |
total_score = 0
|
| 38 |
+
details = []
|
| 39 |
+
|
| 40 |
+
target_file = os.path.join(workspace, "action_items", "kill_list.json")
|
| 41 |
|
| 42 |
+
# 1. 检查目标文件是否存在 (10 分)
|
| 43 |
if os.path.exists(target_file):
|
| 44 |
+
details.append({
|
| 45 |
+
"item": "检查结果文件是否存在",
|
| 46 |
+
"score": 10,
|
| 47 |
+
"max_score": 10,
|
| 48 |
+
"passed": True,
|
| 49 |
+
"reason": "目标文件 action_items/kill_list.json 已创建"
|
| 50 |
+
})
|
| 51 |
+
total_score += 10
|
| 52 |
else:
|
| 53 |
+
details.append({
|
| 54 |
+
"item": "检查结果文件是否存在",
|
| 55 |
+
"score": 0,
|
| 56 |
+
"max_score": 10,
|
| 57 |
+
"passed": False,
|
| 58 |
+
"reason": "目标文件 action_items/kill_list.json 未找到"
|
| 59 |
+
})
|
| 60 |
+
# 文件不存在直接输出结果
|
| 61 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 62 |
+
json.dump({"total_score": total_score, "details": details}, f, ensure_ascii=False, indent=2)
|
| 63 |
return
|
| 64 |
|
| 65 |
+
# 2. 检查 JSON 格式合法性与 Schema (20 分)
|
| 66 |
+
# 利用原生的 json.load 严查 Markdown 包裹、废话及格式错误
|
| 67 |
+
data = None
|
| 68 |
+
try:
|
| 69 |
+
with open(target_file, "r", encoding="utf-8") as f:
|
| 70 |
+
data = json.load(f)
|
| 71 |
+
|
| 72 |
+
if isinstance(data, dict) and "idle_ebs" in data and "zombie_gpu" in data:
|
| 73 |
+
if isinstance(data["idle_ebs"], list) and isinstance(data["zombie_gpu"], list):
|
| 74 |
+
details.append({
|
| 75 |
+
"item": "检查 JSON 格式与 Schema 合法性",
|
| 76 |
+
"score": 20,
|
| 77 |
+
"max_score": 20,
|
| 78 |
+
"passed": True,
|
| 79 |
+
"reason": "JSON 文件可以被原生解析器成功加载,没有包含多余的废话和 Markdown 代码块,且 Schema 正确"
|
| 80 |
+
})
|
| 81 |
+
total_score += 20
|
| 82 |
+
else:
|
| 83 |
+
details.append({
|
| 84 |
+
"item": "检查 JSON 格式与 Schema 合法性",
|
| 85 |
+
"score": 0,
|
| 86 |
+
"max_score": 20,
|
| 87 |
+
"passed": False,
|
| 88 |
+
"reason": "JSON 格式有效,但 idle_ebs 或 zombie_gpu 不是列表"
|
| 89 |
+
})
|
| 90 |
+
data = None
|
| 91 |
+
else:
|
| 92 |
+
details.append({
|
| 93 |
+
"item": "检查 JSON 格式与 Schema 合法性",
|
| 94 |
+
"score": 0,
|
| 95 |
+
"max_score": 20,
|
| 96 |
+
"passed": False,
|
| 97 |
+
"reason": "JSON 格式有效,但缺少要求的 idle_ebs 或 zombie_gpu 字段"
|
| 98 |
+
})
|
| 99 |
+
data = None
|
| 100 |
+
except json.JSONDecodeError as e:
|
| 101 |
+
details.append({
|
| 102 |
+
"item": "检查 JSON 格式与 Schema 合法性",
|
| 103 |
+
"score": 0,
|
| 104 |
+
"max_score": 20,
|
| 105 |
+
"passed": False,
|
| 106 |
+
"reason": f"JSON 解析失败(Agent 未遵循要求,可能包裹了 Markdown、包含了废话说明或语法错误):{str(e)}"
|
| 107 |
+
})
|
| 108 |
+
|
| 109 |
+
# 如果无法解析,后续计分均跳过
|
| 110 |
+
if data:
|
| 111 |
+
# 定义期望的答案集
|
| 112 |
+
expected_ebs = {"vol-09a8b7c6d5e4f3a21", "vol-00001111222233334", "vol-0ffeeddccbbaa9988"}
|
| 113 |
+
# 定义一定存在于文件中但不应该被提取的干扰项(用于校验是否存在提取条件过滤错误)
|
| 114 |
+
invalid_ebs = {"vol-01122334455667788", "vol-0a1b2c3d4e5f60708"}
|
| 115 |
+
|
| 116 |
+
expected_gpu = {"i-0987654321abcdef0", "i-55556666777788889", "i-deadbeefdeadbeef0", "i-9876543210fedcba9"}
|
| 117 |
+
invalid_gpu = {"i-11112222333344445", "i-99990000aaaaabbbb", "i-abcdef12345678900"}
|
| 118 |
+
|
| 119 |
+
actual_ebs_set = set(data.get("idle_ebs", []))
|
| 120 |
+
actual_gpu_set = set(data.get("zombie_gpu", []))
|
| 121 |
+
|
| 122 |
+
# 3. 检查 idle_ebs 提取准确度 (满分 35 分)
|
| 123 |
+
ebs_score = 0
|
| 124 |
+
ebs_reason = ""
|
| 125 |
+
|
| 126 |
+
# 严查作弊与逻辑错误:一旦包含了不符合条件的数据或幻觉伪造数据,一票否决
|
| 127 |
+
if any(x in invalid_ebs for x in actual_ebs_set) or not actual_ebs_set.issubset(expected_ebs | invalid_ebs):
|
| 128 |
+
ebs_reason = "在 idle_ebs 结果中混入了 in-use 的 EBS 或无中生有的幻觉 ID,触发强杀脚本报警规则,该项得分清零。"
|
| 129 |
+
else:
|
| 130 |
+
if "vol-09a8b7c6d5e4f3a21" in actual_ebs_set: ebs_score += 10
|
| 131 |
+
if "vol-00001111222233334" in actual_ebs_set: ebs_score += 10
|
| 132 |
+
if "vol-0ffeeddccbbaa9988" in actual_ebs_set: ebs_score += 15 # 提取单引号伪 JSON 数据的难度稍高
|
| 133 |
+
ebs_reason = f"成功提取了 {len(actual_ebs_set)} 个符合要求的可用 EBS 卷。"
|
| 134 |
+
|
| 135 |
+
details.append({
|
| 136 |
+
"item": "检查 idle_ebs 数据准确性",
|
| 137 |
+
"score": ebs_score,
|
| 138 |
+
"max_score": 35,
|
| 139 |
+
"passed": ebs_score == 35,
|
| 140 |
+
"reason": ebs_reason
|
| 141 |
+
})
|
| 142 |
+
total_score += ebs_score
|
| 143 |
+
|
| 144 |
+
# 4. 检查 zombie_gpu 提取准确度 (满分 35 分)
|
| 145 |
+
gpu_score = 0
|
| 146 |
+
gpu_reason = ""
|
| 147 |
+
|
| 148 |
+
# 同样严查:如果提取出利用率大于2%的节点,或者把非GPU实例拿进来,一票否决
|
| 149 |
+
if any(x in invalid_gpu for x in actual_gpu_set) or not actual_gpu_set.issubset(expected_gpu | invalid_gpu):
|
| 150 |
+
gpu_reason = "在 zombie_gpu 中包含了利用率大于2%的实例、非 GPU 实例(如t3)或幻觉 ID,触发报警,该项得分清零。"
|
| 151 |
+
else:
|
| 152 |
+
if "i-0987654321abcdef0" in actual_gpu_set: gpu_score += 8
|
| 153 |
+
if "i-55556666777788889" in actual_gpu_set: gpu_score += 9
|
| 154 |
+
if "i-deadbeefdeadbeef0" in actual_gpu_set: gpu_score += 9
|
| 155 |
+
if "i-9876543210fedcba9" in actual_gpu_set: gpu_score += 9
|
| 156 |
+
gpu_reason = f"成功提取了 {len(actual_gpu_set)} 个符合要求的僵尸 GPU 实例。"
|
| 157 |
+
|
| 158 |
+
details.append({
|
| 159 |
+
"item": "检查 zombie_gpu 数据准确性",
|
| 160 |
+
"score": gpu_score,
|
| 161 |
+
"max_score": 35,
|
| 162 |
+
"passed": gpu_score == 35,
|
| 163 |
+
"reason": gpu_reason
|
| 164 |
+
})
|
| 165 |
+
total_score += gpu_score
|
| 166 |
+
|
| 167 |
+
# 输出结果
|
| 168 |
+
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 169 |
+
json.dump({"total_score": total_score, "details": details}, f, ensure_ascii=False, indent=2)
|
| 170 |
|
| 171 |
+
if __name__ == "__main__":
|
| 172 |
+
main()
|
persona_aligned_mix_200/tasks/data_persona_aligned_skills_50_0033/verify_workplace.py
CHANGED
|
@@ -2,7 +2,6 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import math
|
| 5 |
-
import re
|
| 6 |
import httpx
|
| 7 |
from openai import OpenAI
|
| 8 |
|
|
@@ -10,7 +9,6 @@ MOCK_API_KEY = os.environ.get("MOCK_API_KEY", "dummy_key")
|
|
| 10 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 11 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 12 |
|
| 13 |
-
# 初始化客户端,必须关闭 SSL 验证
|
| 14 |
http_client = httpx.Client(verify=False)
|
| 15 |
client = OpenAI(
|
| 16 |
api_key=MOCK_API_KEY,
|
|
@@ -19,7 +17,6 @@ client = OpenAI(
|
|
| 19 |
)
|
| 20 |
|
| 21 |
def llm_judge_content(prompt_text, file_content):
|
| 22 |
-
# 此函数为检测非结构化文本的统一接口
|
| 23 |
try:
|
| 24 |
response = client.chat.completions.create(
|
| 25 |
model=MOCK_MODEL_NAME,
|
|
@@ -34,130 +31,144 @@ def llm_judge_content(prompt_text, file_content):
|
|
| 34 |
print(f"LLM API Error: {e}")
|
| 35 |
return False
|
| 36 |
|
| 37 |
-
def
|
| 38 |
-
"""
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
def
|
| 47 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 48 |
target_file = os.path.join(workspace, "flight_dynamics", "quaternions.json")
|
| 49 |
|
| 50 |
-
|
| 51 |
total_score = 0
|
| 52 |
|
| 53 |
-
# 物理
|
| 54 |
-
raw_qs = [
|
| 55 |
-
(0.9990, 0.0100, 0.0200, -0.0400),
|
| 56 |
-
(0.9950, 0.0250, 0.0350, -0.0890),
|
| 57 |
-
(0.9800, 0.0500, 0.0700, -0.1790),
|
| 58 |
-
(0.9500, 0.0900, 0.1200, -0.2700),
|
| 59 |
-
(0.9000, 0.1500, 0.1800, -0.3700)
|
| 60 |
-
]
|
| 61 |
-
|
| 62 |
-
expected_norm = []
|
| 63 |
-
for qw, qx, qy, qz in raw_qs:
|
| 64 |
-
mag = math.sqrt(qw**2 + qx**2 + qy**2 + qz**2)
|
| 65 |
-
expected_norm.append({
|
| 66 |
-
"q_w": round(qw / mag, 6),
|
| 67 |
-
"q_x": round(qx / mag, 6),
|
| 68 |
-
"q_y": round(qy / mag, 6),
|
| 69 |
-
"q_z": round(qz / mag, 6)
|
| 70 |
-
})
|
| 71 |
-
|
| 72 |
-
# 1. 检查目标文件及目录是否存在 (10分)
|
| 73 |
if os.path.exists(target_file):
|
|
|
|
| 74 |
total_score += 10
|
| 75 |
-
details.append({"item": "检查目标文件及目录", "score": 10, "max_score": 10, "passed": True, "reason": f"成功找到文件: {target_file}"})
|
| 76 |
else:
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
| 79 |
return
|
| 80 |
|
| 81 |
-
# 2. 检查 JSON
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
try:
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
json_str = extract_json_from_text(content)
|
| 86 |
-
data = json.loads(json_str)
|
| 87 |
total_score += 10
|
| 88 |
-
details.append({"item": "检查 JSON 格式", "score": 10, "max_score": 10, "passed": True, "reason": "JSON 解析成功"})
|
| 89 |
except Exception as e:
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
if
|
|
|
|
| 97 |
total_score += 10
|
| 98 |
-
details.append({"item": "检查数组结构与长度", "score": 10, "max_score": 10, "passed": True, "reason": "精确包含 5 个数据对象,无捏造或遗漏"})
|
| 99 |
else:
|
| 100 |
-
|
| 101 |
else:
|
| 102 |
-
|
| 103 |
-
data = [] # 防止后续崩溃
|
| 104 |
|
| 105 |
-
# 4
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
def is_raw_match(target_dict, raw_tuple, tol=1e-4):
|
| 126 |
-
try:
|
| 127 |
-
return (math.isclose(float(target_dict["q_w"]), float(raw_tuple[0]), abs_tol=tol) and
|
| 128 |
-
math.isclose(float(target_dict["q_x"]), float(raw_tuple[1]), abs_tol=tol) and
|
| 129 |
-
math.isclose(float(target_dict["q_y"]), float(raw_tuple[2]), abs_tol=tol) and
|
| 130 |
-
math.isclose(float(target_dict["q_z"]), float(raw_tuple[3]), abs_tol=tol))
|
| 131 |
-
except (KeyError, ValueError, TypeError):
|
| 132 |
-
return False
|
| 133 |
-
|
| 134 |
-
for i in range(5):
|
| 135 |
-
if i < len(data):
|
| 136 |
-
user_item = data[i]
|
| 137 |
-
gold_norm = expected_norm[i]
|
| 138 |
-
raw_tuple = raw_qs[i]
|
| 139 |
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
else:
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
"total_score": total_score,
|
| 157 |
-
"details": details
|
| 158 |
-
}
|
| 159 |
-
with open("workplace_score.json", "w", encoding="utf-8") as f:
|
| 160 |
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 161 |
|
| 162 |
if __name__ == "__main__":
|
| 163 |
-
|
|
|
|
| 2 |
import sys
|
| 3 |
import json
|
| 4 |
import math
|
|
|
|
| 5 |
import httpx
|
| 6 |
from openai import OpenAI
|
| 7 |
|
|
|
|
| 9 |
MOCK_API_BASE = os.environ.get("MOCK_API_BASE", "http://localhost/v1")
|
| 10 |
MOCK_MODEL_NAME = os.environ.get("MOCK_MODEL_NAME", "gpt-5.4")
|
| 11 |
|
|
|
|
| 12 |
http_client = httpx.Client(verify=False)
|
| 13 |
client = OpenAI(
|
| 14 |
api_key=MOCK_API_KEY,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def llm_judge_content(prompt_text, file_content):
|
|
|
|
| 20 |
try:
|
| 21 |
response = client.chat.completions.create(
|
| 22 |
model=MOCK_MODEL_NAME,
|
|
|
|
| 31 |
print(f"LLM API Error: {e}")
|
| 32 |
return False
|
| 33 |
|
| 34 |
+
def extract_quaternions(json_obj):
|
| 35 |
+
"""
|
| 36 |
+
通过结构遍历,严格从任意层级的嵌套 JSON 中提取出类似 [float, float, float, float] 的记录,
|
| 37 |
+
规避纯正则表达式可能引发的假阳性匹配。
|
| 38 |
+
"""
|
| 39 |
+
extracted = []
|
| 40 |
+
|
| 41 |
+
def traverse(obj):
|
| 42 |
+
if isinstance(obj, dict):
|
| 43 |
+
nums = [v for v in obj.values() if isinstance(v, (int, float))]
|
| 44 |
+
if len(nums) == 4:
|
| 45 |
+
# 优先尝试根据 w, x, y, z 键名提取
|
| 46 |
+
keys = list(obj.keys())
|
| 47 |
+
w_v = next((obj[k] for k in keys if 'w' in k.lower()), None)
|
| 48 |
+
x_v = next((obj[k] for k in keys if 'x' in k.lower()), None)
|
| 49 |
+
y_v = next((obj[k] for k in keys if 'y' in k.lower()), None)
|
| 50 |
+
z_v = next((obj[k] for k in keys if 'z' in k.lower()), None)
|
| 51 |
+
if all(v is not None for v in [w_v, x_v, y_v, z_v]):
|
| 52 |
+
extracted.append((float(w_v), float(x_v), float(y_v), float(z_v)))
|
| 53 |
+
else:
|
| 54 |
+
# 降级:按数值顺序提取
|
| 55 |
+
extracted.append(tuple(float(n) for n in nums[:4]))
|
| 56 |
+
else:
|
| 57 |
+
for v in obj.values():
|
| 58 |
+
traverse(v)
|
| 59 |
+
elif isinstance(obj, list):
|
| 60 |
+
# 检查当前列表是否恰好为一组四元数
|
| 61 |
+
nums = [x for x in obj if isinstance(x, (int, float))]
|
| 62 |
+
if len(nums) == 4 and len(obj) == 4:
|
| 63 |
+
extracted.append(tuple(float(n) for n in nums))
|
| 64 |
+
else:
|
| 65 |
+
for v in obj:
|
| 66 |
+
traverse(v)
|
| 67 |
+
|
| 68 |
+
traverse(json_obj)
|
| 69 |
+
return extracted
|
| 70 |
+
|
| 71 |
+
def match_quaternions(extracted, expected):
|
| 72 |
+
matched_flags = [False] * len(expected)
|
| 73 |
+
score = 0
|
| 74 |
+
for ex in extracted:
|
| 75 |
+
best_match_idx = -1
|
| 76 |
+
for i, exp in enumerate(expected):
|
| 77 |
+
if not matched_flags[i]:
|
| 78 |
+
# 允许极小的浮点数误差
|
| 79 |
+
if all(math.isclose(a, b, abs_tol=1e-3) for a, b in zip(ex, exp)):
|
| 80 |
+
best_match_idx = i
|
| 81 |
+
break
|
| 82 |
+
if best_match_idx != -1:
|
| 83 |
+
matched_flags[best_match_idx] = True
|
| 84 |
+
score += 10
|
| 85 |
+
|
| 86 |
+
return score, matched_flags
|
| 87 |
|
| 88 |
+
def main():
|
| 89 |
workspace = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 90 |
target_file = os.path.join(workspace, "flight_dynamics", "quaternions.json")
|
| 91 |
|
| 92 |
+
score_details = []
|
| 93 |
total_score = 0
|
| 94 |
|
| 95 |
+
# 1. 物理探针:检查文件是否存在
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
if os.path.exists(target_file):
|
| 97 |
+
score_details.append({"item": "检查目标结果文件是否存在", "score": 10, "max_score": 10, "passed": True, "reason": "文件 flight_dynamics/quaternions.json 存在"})
|
| 98 |
total_score += 10
|
|
|
|
| 99 |
else:
|
| 100 |
+
score_details.append({"item": "检查目标结果文件是否存在", "score": 0, "max_score": 10, "passed": False, "reason": "文件 flight_dynamics/quaternions.json 不存在"})
|
| 101 |
+
result = {"total_score": 0, "details": score_details}
|
| 102 |
+
with open("workplace_score.json", "w") as f:
|
| 103 |
+
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 104 |
return
|
| 105 |
|
| 106 |
+
# 2. 结构探针:检查 JSON 合法性
|
| 107 |
+
with open(target_file, "r") as f:
|
| 108 |
+
content = f.read()
|
| 109 |
+
|
| 110 |
+
json_data = None
|
| 111 |
try:
|
| 112 |
+
json_data = json.loads(content)
|
| 113 |
+
score_details.append({"item": "验证 JSON 语法格式", "score": 10, "max_score": 10, "passed": True, "reason": "文件是合法的 JSON"})
|
|
|
|
|
|
|
| 114 |
total_score += 10
|
|
|
|
| 115 |
except Exception as e:
|
| 116 |
+
score_details.append({"item": "验证 JSON 语法格式", "score": 0, "max_score": 10, "passed": False, "reason": f"解析 JSON 失败: {e}"})
|
| 117 |
+
|
| 118 |
+
# 3. LLM 语义探针:判断 Key 命名是否具可读性
|
| 119 |
+
if json_data is not None:
|
| 120 |
+
prompt = "Does the following JSON content clearly express quaternion components using explicit keys like q_w, q_x, q_y, q_z, or have an extremely clear and unambiguous array structure for quaternions?"
|
| 121 |
+
is_clear = llm_judge_content(prompt, content)
|
| 122 |
+
if is_clear:
|
| 123 |
+
score_details.append({"item": "利用大模型检查数据字段表达是否清晰", "score": 10, "max_score": 10, "passed": True, "reason": "大模型判定 JSON 结构中包含清晰的四元数表达或键名"})
|
| 124 |
total_score += 10
|
|
|
|
| 125 |
else:
|
| 126 |
+
score_details.append({"item": "利用大模型检查数据字段表达是否清晰", "score": 0, "max_score": 10, "passed": False, "reason": "大模型认为数据字段不够直观或缺失相关标记"})
|
| 127 |
else:
|
| 128 |
+
score_details.append({"item": "利用大模型检查数据字段表达是否清晰", "score": 0, "max_score": 10, "passed": False, "reason": "JSON无法解析,跳过大模型检测"})
|
|
|
|
| 129 |
|
| 130 |
+
# 4 & 5. 核心计算探针:防幻觉与精度验证
|
| 131 |
+
expected_data = [
|
| 132 |
+
(0.9990, 0.0100, 0.0200, -0.0400),
|
| 133 |
+
(0.9950, 0.0250, 0.0350, -0.0890),
|
| 134 |
+
(0.9800, 0.0500, 0.0700, -0.1790),
|
| 135 |
+
(0.9500, 0.0900, 0.1200, -0.2700),
|
| 136 |
+
(0.9000, 0.1500, 0.1800, -0.3700)
|
| 137 |
+
]
|
| 138 |
+
|
| 139 |
+
if json_data is not None:
|
| 140 |
+
extracted = extract_quaternions(json_data)
|
| 141 |
+
if len(extracted) == 0:
|
| 142 |
+
score_details.append({"item": "防幻觉及数据完整性检测", "score": 0, "max_score": 20, "passed": False, "reason": "未能在 JSON 中找到四元数数据组"})
|
| 143 |
+
score_details.append({"item": "验证四元数数值提取精度", "score": 0, "max_score": 50, "passed": False, "reason": "无数据可校验"})
|
| 144 |
+
else:
|
| 145 |
+
acc_score, matched_flags = match_quaternions(extracted, expected_data)
|
| 146 |
+
|
| 147 |
+
# 计算幻觉与遗漏扣分
|
| 148 |
+
extra_items = len(extracted) - sum(matched_flags) # 找到了但无法匹配上的伪造数据
|
| 149 |
+
missing_items = len(expected_data) - sum(matched_flags) # 漏找的数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
+
penalty = min(extra_items * 5, 20)
|
| 152 |
+
hal_score = 20 - penalty - (missing_items * 4)
|
| 153 |
+
hal_score = max(0, hal_score)
|
| 154 |
+
|
| 155 |
+
if hal_score == 20:
|
| 156 |
+
score_details.append({"item": "防幻觉及数据完整性检测", "score": 20, "max_score": 20, "passed": True, "reason": "精准提取了所有5组数据,且无任何冗余错漏数据"})
|
| 157 |
+
total_score += 20
|
| 158 |
else:
|
| 159 |
+
score_details.append({"item": "防幻觉及数据完整性检测", "score": hal_score, "max_score": 20, "passed": False, "reason": f"提取存在漏掉或冗余: 漏掉 {missing_items} 组,多出 {extra_items} 组无法对齐的数据"})
|
| 160 |
+
total_score += hal_score
|
| 161 |
+
|
| 162 |
+
# 精度分
|
| 163 |
+
score_details.append({"item": "验证四元数数值提取精度", "score": acc_score, "max_score": 50, "passed": acc_score == 50, "reason": f"成功匹配 {sum(matched_flags)}/5 组四元数,每组 10 分"})
|
| 164 |
+
total_score += acc_score
|
| 165 |
+
else:
|
| 166 |
+
score_details.append({"item": "防幻觉及数据完整性检测", "score": 0, "max_score": 20, "passed": False, "reason": "无有效 JSON 供检查"})
|
| 167 |
+
score_details.append({"item": "验证四元数数值提取精度", "score": 0, "max_score": 50, "passed": False, "reason": "无有效 JSON 供检查"})
|
| 168 |
|
| 169 |
+
result = {"total_score": total_score, "details": score_details}
|
| 170 |
+
with open("workplace_score.json", "w") as f:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
json.dump(result, f, indent=2, ensure_ascii=False)
|
| 172 |
|
| 173 |
if __name__ == "__main__":
|
| 174 |
+
main()
|