Skip to main content

Module audit

Module audit 

Source
Expand description

§Request Replay / Audit Log

An append-only, capacity-bounded audit log for LLM inference requests and responses. Entries can be filtered, queried, and exported as JSONL.

§Example

use tokio_prompt_orchestrator::audit::{AuditEntry, AuditFilter, AuditLog};
use chrono::Utc;

let mut log = AuditLog::new(1000);

let entry = AuditEntry {
    id: 1,
    timestamp: Utc::now(),
    model_id: "claude-3-5-sonnet".to_string(),
    input: "Hello!".to_string(),
    output: vec!["Hi there!".to_string()],
    latency_ms: 320,
    cache_hit: false,
    tags: vec!["prod".to_string()],
};

log.append(entry);

let results = log.query(&AuditFilter::default());
assert_eq!(results.len(), 1);

Structs§

AuditEntry
A single audit log entry recording one inference request/response pair.
AuditFilter
Predicate for AuditLog::query.
AuditLog
Append-only audit log backed by a VecDeque.
AuditQueryResponse
Serialisable response body for GET /api/v1/audit.
AuditStats
Aggregate statistics computed over all entries currently in the log.
AuditStatsResponse
Serialisable response body for GET /api/v1/audit/stats.