"""C4 workload: import headroom and compress all 4 payloads (default config), as in c1b. Run under strace to see network syscalls."""
import json
from headroom import compress
for f in ("gh_issues.json", "pypi_info.json", "synthetic_logs.json", "wiki_search.json"):
    raw = open("payloads/" + f).read()
    m = [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Here is the tool output."},
         {"role": "assistant", "content": None, "tool_calls": [{"id": "call_1", "type": "function", "function": {"name": "fetch", "arguments": "{}"}}]},
         {"role": "tool", "tool_call_id": "call_1", "content": raw}]
    r = compress(m, model="gpt-4o")
    print(f, r.tokens_before, r.tokens_after)
