Can GPTcache to refer the previous cache record? #384
-
Hi , I have a script contains 4 questions and loop those 4 questions 4 times. I run this script several times, so the cache database have the questions record. But as the time record it looks there is no hit cache record. here is the script result ( local answer means result from LLM model directly, and cache answer means go through GPTcache First Loop Question: can you explain what function of TV is ? Question: can you tell me more about TV ? Question: what is the function of money ? Second Round in the same session Question: what is TV ? Question: can you explain what function of TV is ? Question: can you tell me more about TV ? Question: what is the function of money ? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
@terryweijian can you show me your code snippet for the cache initialization? if possible, you can give me a demo code. |
Beta Was this translation helpful? Give feedback.
-
@terryweijian yes, we don't check the existed data when inserting the data to cache, which is a good idea. I will improve about this part in a few days. For better solving your problem, I simply adjusted the program, but I don't seem to have encountered the problem you mentioned. I used the
|
Beta Was this translation helpful? Give feedback.
-
@SimFG , Thanks a lot for your checking! And I tried to use the Onnx() and SQLite in my program, but the problem is still there Do you mind share all your program? I didn't see the CacheBase, VectorBase and get_data_manager functions setting. Not sure if have relationship with the current program. Thanks |
Beta Was this translation helpful? Give feedback.
-
I have actually given my test code above, you can try it locally, pay attention to changing the cache data directory. The initialization of the cache is wrapped in the |
Beta Was this translation helpful? Give feedback.
@terryweijian yes, we don't check the existed data when inserting the data to cache, which is a good idea. I will improve about this part in a few days.
For better solving your problem, I simply adjusted the program, but I don't seem to have encountered the problem you mentioned. I used the
openai
model, the defaultonnx
embedding model and the traditional database usessqlite
. I guess the problem is caused by the unstable embedding model. And you can remove all history data and retry it. Below is my sample code: