codefuse-ai / ModelCache

A LLM semantic caching system aiming to enhance user experience by reducing response time via cached query-result pairs.
Other
780 stars 40 forks source link

Fix: Correct an issue related to clearing the Faiss index in Flask4ModelCache_demo #35

Closed powerli2002 closed 4 months ago

powerli2002 commented 4 months ago

Fixed an issue where clearing faiss database was invalid when using flask4modelcache_demo.py

When I run flask4modelcache_demo.py, I found that the Cache-Clearing method mentioned in the documentation cannot clear the Faiss index and returns an error message. Upon inspecting the code, I discovered that this logic was not implemented. Therefore, this pull request adds a method to reset the index.

Additionally, I noticed that rebuild_col() only works properly when it has no return value. I'm unsure if this is intended behavior, so I made minimal changes to achieve the desired functionality without altering it.

I'm honored to be involved in your open-source project. Please feel free to contact me if there are any issues with my changes. I'm very eager to join the open-source initiative of CodeFuse AI!

peng3307165 commented 4 months ago

We've merged your commit that fixes the faiss database clearing issue in flask4modelcache_demo.py. Thank you for your keen observation and subsequent fix. Additionally, we find sqlite does not correctly return the number of rows deleted. we have made some adjustments and fixes. Welcome to join CodeFuse AI open-source initiative.