You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dspy-rs caches LM responses keyed on Vec<(String, Value)> derived from the Example struct. This is semantically wrong:
Same logical request through different Example shapes = 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_id semantics for cache-busting during optimization (DSPy uses this when temperature > 0)
CacheEntry should store raw response + metadata, not Prediction
Problem
dspy-rs caches LM responses keyed on
Vec<(String, Value)>derived from theExamplestruct. This is semantically wrong:Exampleshapes = cache missDSPy 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
CompletionRequestrollout_idsemantics for cache-busting during optimization (DSPy uses this whentemperature > 0)CacheEntryshould store raw response + metadata, notPredictionRelated