Skip to content

data storage #55

Open
Open

Description

@darinkishore

data should be stored, should ship a first class store integration, and should cache properly on hyperparams, return IDs from calls, make every interaction thru the whole system easily traced

Activity

  1. darinkishore commented on Feb 12, 2026

    @darinkishore
    CollaboratorAuthor

    Codebase audit — what exists today

    Cache layer (utils/cache.rs):

    • ResponseCache uses foyer (hybrid mem+disk) keyed on Vec<(String, Value)> from Example
    • CacheEntry stores { prompt: String, prediction: Prediction } — minimal
    • History is coupled to cache: inspect_history(n) reads from history_window: Vec<CacheEntry> (last 100)
    • If cache: false on LM, there's no history at all

    What's missing for "first class data storage":

    1. Call log / audit trail — every LM call should be persisted regardless of cache settings. Schema should include:

      • call_id: Uuid
      • timestamp: DateTime
      • model: String
      • messages: Vec<Message> (what was sent)
      • raw_response: String
      • parsed_output: BamlValue
      • usage: LmUsage (prompt/completion tokens, cost)
      • module_path: String (which Predict leaf made this call)
      • signature_name: String
      • latency_ms: u64
    2. Storage backend — options:

      • SQLite via rusqlite (simple, zero-config, good for local dev)
      • Append-only JSONL (simplest, grep-friendly)
      • Pluggable trait so users can bring their own (Postgres, S3, etc.)
    3. Optimizer artifact storage — COPRO/GEPA/MIPRO produce optimized instructions and demos. Currently these live in-memory only. Should persist:

      • Best instructions per predictor
      • Selected demos per predictor
      • Score history across trials
      • The optimizer config that produced them
    4. Dataset storage — DataLoader loads from files/HF but doesn't cache or version datasets locally.

    Concrete proposal: Start with SQLite for the call log (solves the most immediate pain), make it opt-in via a feature gate. The call log naturally subsumes the history feature (#70) and provides the data #56 (tracing) needs to emit.

    Related: #70 (history), #71 (cache keys), #56 (tracing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions