conversation-codec 0.1.0

JSONL save/load for LLM conversation messages with optional per-message redaction. Zero deps beyond serde_json.
Documentation
  • Coverage
  • 71.43%
    10 out of 14 items documented1 out of 10 items with examples
  • Size
  • Source code size: 28.12 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 434.53 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • MukundaKatta/conversation-codec-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MukundaKatta

conversation-codec

JSONL save/load for LLM conversation messages. One JSON object per line — appends are cheap and partial files are recoverable.

Usage

use conversation_codec::Codec;
use serde_json::json;

let messages = vec![
    json!({"role": "user", "content": "hello"}),
    json!({"role": "assistant", "content": "hi"}),
];

let codec = Codec::new();
codec.save(&messages, "conv.jsonl").unwrap();
let loaded = codec.load("conv.jsonl").unwrap();
assert_eq!(loaded.len(), 2);

// Optional per-message redaction
let c = Codec::with_redact(|mut msg| {
    if let Some(obj) = msg.as_object_mut() {
        obj.remove("api_key");
    }
    msg
});

License

MIT OR Apache-2.0