Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dramatically simpler and more reliable cache #775

Open
prescod opened this issue May 18, 2024 · 0 comments
Open

Dramatically simpler and more reliable cache #775

prescod opened this issue May 18, 2024 · 0 comments

Comments

@prescod
Copy link

prescod commented May 18, 2024

It's my belief that the cache can be dramatically simplified, and made more reliable, by using the Python "diskcache" library.

DiskCache handles so much:

  • locking
  • reliability in the face of Ctrl-C/Keyboard Interrupr and other signals
  • easy clearing

I think that hundreds of lines of code could be replaced with diskcache.

JSON is a poor format for a cache because it is hard to update it transactionally and incrementally. If you Ctrl-C in the middle of a write, you'll end up with corrupted data.

Furthermore, I think that the right unit of Cache is the LLM response.

This will solve the problem where some kinds of tests are cached and others are not.

I will attach two files that show how I monkey-patched to add a much more reliable caching system with few lines of code.

caching.zip

It might be cleaner to add caching to the DeepEvalBaseLLM but then I'd need to change every place it is called, so this monkeypatching hack worked better for me. I turned off the DeepEval cache because I was frustrated with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant