Parses a JSONL audit log written by llm_log_enable() into its records and a
per-record manifest tibble. Each manifest row carries the call's metadata, a
record_hash over the verbatim log line (tamper evidence), and, where the
request body was logged, a request_hash identifying the call. The
request_hash is computed through llm_request_hash() over the call's
canonical turns and generation parameters, so a call read from a log and the
same call described by a config hash identically.
Value
A list with records (a list of list(raw=, rec=), one per
nonblank line) and manifest (a tibble with idx, ts, kind,
provider, model, model_version, status, schema_version,
has_payload, request_hash, record_hash, and line, the record's
line number in the file).
Details
Reading is strict: a line that is not a JSON object, or a record whose metadata fields are not single values, stops with an error that names the line of the file, the field, and the reason. Blank lines are ignored but still counted, so the line numbers match the file.
Examples
# In practice the log comes from llm_log_enable("study.jsonl"); here one
# record written by hand.
log <- tempfile(fileext = ".jsonl")
writeLines(paste0(
'{"ts":"2026-06-01T10:00:01+0000","schema_version":"1.0","kind":"call",',
'"provider":"openai","model":"gpt-4o-mini","status":200,',
'"request":{"messages":[{"role":"user","content":"Capital of France?"}],',
'"temperature":0},"usage":{"sent":5,"rec":1},',
'"response_id":"r-1","text":"Paris"}'), log)
read <- llm_log_read(log)
read$manifest