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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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