stanfordnlp / dspy

DSPy: The framework for programming—not prompting—foundation models
https://dspy-docs.vercel.app/
MIT License
13.82k stars 1.06k forks source link

Cannot disable Caching #1203

Open maziyarpanahi opened 6 days ago

maziyarpanahi commented 6 days ago

Hi,

I am setting os.environ['DSP_CACHEBOOL'] = 'false' as the docs suggest, removing directory here DSP_NOTEBOOK_CACHEDIR, but I still get caching and see new stuff appearing under DSP_NOTEBOOK_CACHEDIR.

I am using the 2.4.10 release, is there anyway to completely disable caching?

arnavsinghvi11 commented 5 days ago

Hi @maziyarpanahi , does your code configure DSP_NOTEBOOK_CACHEDIR before setting os.environ['DSP_CACHEBOOL'] = 'false'? The intro.ipynb notebook does this, so if this was previously set, you might have to delete the folder manually, remove the line with DSP_NOTEBOOK_CACHEDIR and rerun your code to disable caching.

maziyarpanahi commented 5 days ago

Hi @arnavsinghvi11

Thanks for your response. I am using DSPy inside a FastAPI application. This is how I set the ENV in the main.py:

os.environ['DSP_CACHEBOOL'] = 'false'
os.environ["DSP_NOTEBOOK_CACHEDIR"] = os.path.join(os.getcwd(), 'cache')

Not only the cache is not disabled, but I don't have the cache in side ./cache directory. I can see that the path ~/cachedir_joblib is keep getting re-created even when I remove it and still responses are coming from the cache.

Thanks again for your help, the caching is a very useful feature but for rapid development it causes some confusion.