-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Problem
dspy-rs caches LM responses keyed on Vec<(String, Value)> derived from the Example struct. This is semantically wrong:
- Same logical request through different
Exampleshapes = cache miss - The cache should key on the actual formatted request (messages + params), not the pre-formatting input
DSPy Python keys on SHA256(json(request_params)) with ignored args stripped (api_key, api_base, etc.), which correctly caches at the LM request boundary.
What's needed
- Cache key = hash of (model, messages, temperature, max_tokens, tools, ...) — the actual
CompletionRequest - Strip non-deterministic fields (api_key, timestamps) from key
- Consider
rollout_idsemantics for cache-busting during optimization (DSPy uses this whentemperature > 0) CacheEntryshould store raw response + metadata, notPrediction
Related
- data storage #55 (data storage)
- History decoupling (history should be separate from cache)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels