Skip to contents

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.

Usage

llm_log_read(log)

Arguments

log

Path to a JSONL audit log.

Value

A list with records (a list of list(raw=, rec=), one per line) and manifest (a tibble with idx, ts, kind, provider, model, model_version, status, schema_version, has_payload, request_hash, record_hash).

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