BerriAI / reliableGPT

Get 100% uptime, reliability from OpenAI. Handle Rate Limit, Timeout, API, Keys Errors
MIT License
624 stars 33 forks source link

Add custom redis cache #33

Closed grski closed 11 months ago

grski commented 1 year ago

For now, we do the simplest approach possible, meaning we cache the results in Redis. Using exact match strategy. In the future this should be extended to other stores and similarity based matching to enable true semantic caching. For that vector store handling needs to be added. Proper exception handling.

Validations and defaults for environment variables were added using pydantic and python-dotenv for local setup. In the future this should be used to load and validate all the env variables as it's currently the preferred go-to approach in Python world. Tests need to be added, but for that to happen I think we should refactor the whole testing approach.

Pipelines will fail coz of some lints that are still left out there to be fixed and some tests that were broken since the beginning. We also need to work on that.

Documentation to follow if this implementation is deemed merge-worthy.

grski commented 1 year ago

Did a small refactor and encapsualted the default cache that you've used. it probably still needs some work to achieve full integration though.

grski commented 1 year ago

@ishaan-jaff @krrishdholakia any opinions so far guys? This needs some love & testing, will gladly help, but I need the intial approval to push things forward.

grski commented 1 year ago

any feedback here...?

ishaan-jaff commented 1 year ago

Sorry for the delay @grski will take a look and respond by EOD

grski commented 1 year ago

thank you very much, no need to hurry if you have other priorities, the information is enough that you have this on the todo list, no worries :)

grski commented 1 year ago

@ishaan-jaff @krrishdholakia It's finally done. The tests pass. Linting applied. No conflicts with main (it's merged into this branch).