tkhersoft's picture
temp build/analysis scripts (54 py files) backup before prune
94da461 verified
Raw
History Blame Contribute Delete
1.34 kB
"""Dump the exact CONV_A / CONV_B text the C3 judge sees for a given tail eid."""
from __future__ import annotations
import json, sys, os
from pathlib import Path
import yaml
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[2]
sys.path.insert(0, str(ROOT))
from datasetreview import pipelines as P
from datasetreview import judge_prompts as J
eid = sys.argv[1] if len(sys.argv) > 1 else "confuser-get_order_invoice-782-t2"
fakes = {e["example_id"]: e for e in
(json.loads(l) for l in open(HERE / "out" / (os.environ.get("V4FILE") or "trajectories_all_v3.jsonl"), encoding="utf-8") if l.strip())}
base = {}
for line in open(ROOT / "datasetreview" / "results" / "new" / "C3.jsonl", encoding="utf-8"):
if line.strip():
d = json.loads(line); base[d["item_id"]] = d
fake = fakes[eid]
reals = P.real_trajectories()
pairer = P.make_pairer(reals)
real = pairer(fake)
orig = fake.get("metadata", {}).get("orig_eid")
swap = (base.get(eid) or base.get(orig) or {}).get("answer_key") == "B"
msgs = J.build_c3(fake, real, swap=swap)
print(f"eid={eid} swap={swap} answer_key={msgs['answer_key']}")
print(f"history turns in fake: {len(fake.get('history', []))}")
print("#" * 80)
# extract just the two convs from the user message
u = msgs["user"]
print(u[u.index("---Conversation A---"):])