Skip to contents

Parses a JSONL log written by LLMR::llm_log_enable() into a content-addressed archive: one entry per call, each carrying a record hash (over the verbatim line) and, where the request body was logged, a canonical request hash. Environment metadata (R, LLMR, and log schema versions) is captured alongside.

Usage

archive_build(log, name = NULL)

Arguments

log

Path to the JSONL audit log.

name

Optional label for the archive (defaults to the file name).

Value

An archive (unsealed).

Examples

# In a real study the log comes from LLMR::llm_log_enable("study.jsonl"),
# left on for the whole project. 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":"groq","model":"openai/gpt-oss-20b",',
  '"request":{"messages":[{"role":"user","content":"Label: positive?"}]},',
  '"usage":{"sent":5,"rec":2},"response_id":"r-1","text":"positive"}'), log)
a <- archive_build(log)
a <- archive_seal(a)
archive_check(a)