-
Notifications
You must be signed in to change notification settings - Fork 333
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
Cache completions #389
Comments
Workaround: incorporate a hash of the function’s source code (including the prompt) into the cache key.
Now, modifying the prompt will avoid re-using the stale API result. |
cross-linking: #200 |
I wonder if something has changed in ell since this, when I use the above method I get an error. |
Is there some mechanism to avoid hitting the API if the prompt hasn't changed at all?
For example:
If we run this script twice, there is no need for the API to be called on the second time if we simply persist the result of the function call to disk.
Normally we can accomplish this with
joblib.memory
:Now if we run this script twice, the API will not be hit on the second call.
This behaves as we expect if we modify the parameters to the function, e.g. if we call
hello("Sam")
, the API will be hit, since the arguments changed.However, if we change the prompt literal inside the function, unfortunately joblib is not able to pick up on it, and the stale result is returned.
Any suggestions for avoiding unnecessary API calls would be appreciated!
The text was updated successfully, but these errors were encountered: