fixed the bug #8343 (#8345)

- Issue: #8343

Signed-off-by: Pranay Chandekar <pranayc6@gmail.com>
This commit is contained in:
Pranay Chandekar
2023-07-27 19:03:15 +05:30
committed by GitHub
parent 934ea80780
commit 41bb3a6f9b

View File

@@ -445,8 +445,10 @@ class GPTCache(BaseCache):
"""Get a cache object.
When the corresponding llm model cache does not exist, it will be created."""
return self.gptcache_dict.get(llm_string, self._new_gptcache(llm_string))
_gptcache = self.gptcache_dict.get(llm_string, None)
if not _gptcache:
_gptcache = self._new_gptcache(llm_string)
return _gptcache
def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]:
"""Look up the cache data.