From a8ded21b6963b0041e9931f6e397573cb498cbaf Mon Sep 17 00:00:00 2001 From: elBarkey Date: Thu, 18 May 2023 23:42:35 +0700 Subject: [PATCH] FIX: GPTCache cache_obj creation loop (#4827) _get_gptcache method keep creating new gptcache instance, here's the fix # Fix GPTCache cache_obj creation loop Fixes #4830 Co-authored-by: Dev 2049 --- langchain/cache.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/langchain/cache.py b/langchain/cache.py index 3d89233d..c8e021c1 100644 --- a/langchain/cache.py +++ b/langchain/cache.py @@ -341,6 +341,8 @@ class GPTCache(BaseCache): pre_embedding_func=get_prompt, data_manager=get_data_manager(data_path=llm_string), ) + + self.gptcache_dict[llm_string] = _gptcache return _gptcache def _get_gptcache(self, llm_string: str) -> Any: