dspy/cache-disabled-in-module
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| DSPy | warning | none, edit by hand | All versions |
Disabling DSPy's response cache inside a dspy.Module defeats disk and memory caching across repeated evaluations and optimizer trials.
class AnswerModule(dspy.Module): def forward(self, question: str) -> dspy.Prediction: with dspy.context(cache=False): return self.predict(question=question) return self.predict(question=question)What the rule reports
Section titled “What the rule reports”Calls to dspy.configure_cache(...) or dspy.context(..., cache=False) inside a dspy.Module subclass.
How to fix it
Section titled “How to fix it”Remove cache overrides from the module and pass --no-cache or with dspy.context(cache=False): in the evaluation runner when uncached repeats are needed.
Diagnostic message
Section titled “Diagnostic message”Disabling cache inside a dspy.Module prevents evaluation and optimization reuse. Control cache policy in the runner instead.See all rules in the DSPy pack.