Skip to content

Commit

Permalink
FIX: GPTCache cache_obj creation loop (#4827)
Browse files Browse the repository at this point in the history
_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 <[email protected]>
  • Loading branch information
elBarkey and dev2049 authored May 18, 2023
1 parent c9e2a01 commit a8ded21
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions langchain/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ def _new_gptcache(self, llm_string: str) -> Any:
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:
Expand Down

0 comments on commit a8ded21

Please sign in to comment.