-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Context
DSPy Python has 3-level history tracking (global, per-LM, per-module), fully independent of caching. Each history entry includes: messages, kwargs, response, outputs, usage, cost, timestamp, uuid, model. inspect_history(n) works at all three levels.
dspy-rs currently couples history entirely to the cache layer:
inspect_history(n)reads fromResponseCache.history_window(a fixed-sizeVec<CacheEntry>)- If
cache: false, there's no history at all CacheEntrystores{ prompt: String, prediction: Prediction }— minimal info
Meanwhile, the trace/ module (task-local DAG recorder) was an earlier attempt at runtime execution recording, but it uses Prediction/Example types and is currently unwired (see #68).
What's needed
Separate history from cache
- History should record every LM call regardless of cache settings
- Rich entries: messages sent, LM params, raw response, parsed output, usage, timestamp
Per-LM history
lm.history: Vec<HistoryEntry>with configurable max sizelm.inspect_history(n)returns last n entries
Per-module history
- When a module calls an LM, the entry is also appended to
module.history - Requires knowing which module is the caller (DSPy uses
settings.caller_modulesstack)
Global history
dspy_rs::inspect_history(n)for all LM calls across the process
Modernize trace/ module
- The task-local
CURRENT_TRACEpattern intrace/context.rsis the right shape - Migrate from
Prediction/ExampletoBamlValue/typed values - Unify with or complement
ProgramGraph(make sure program graph has the same semantics as old trace/ module #68)
Related
- make sure program graph has the same semantics as old trace/ module #68 (trace/ → ProgramGraph semantics)
- data storage #55 (data storage)
- chore: add tracing #56 (tracing)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels