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

Ability to customise cache TTL #259

Open
Maxim-Filimonov opened this issue Nov 4, 2023 · 0 comments
Open

Ability to customise cache TTL #259

Maxim-Filimonov opened this issue Nov 4, 2023 · 0 comments

Comments

@Maxim-Filimonov
Copy link
Contributor

Proposal

Ability to customise cache expiration age.
Suggested api:
On specific prompt - cache: {ttl: {days: 30}}
Allowed values: {ttl: {hours, days, minutes}}
Sdk sums up and converts them to ms.

To keep it backwards compatible I’m thinking if cache: true it defaults to {ttl: {days: 3}} when true is specified.

Not sure if there is invalidation api already if one doesn’t exists it might be required.

Use-Case

We have certain queries that are used to generate content in our system. There is no need to run them again every time user requests the same content. Moreover, unless model has been changed or the prompt itself there should be no need to run them again at all.
As mentioned in our discussion current cache implementation resets age every time content is accessed which is perfect for our use case. We don’t necessarily want to store years of content only accessed once

Is this a feature you are interested in implementing yourself?

Maybe

@arielweinberger arielweinberger changed the title Ability to customise cache age Ability to customise cache TTL Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant