The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Add async methods to InMemoryCache (#17425)
Christophe Bornetfb7552bfcfa6
diff --git a/libs/community/langchain_community/cache.py b/libs/community/langchain_community/cache.pyindex 54996071f8..4719d661ba 100644--- a/libs/community/langchain_community/cache.py+++ b/libs/community/langchain_community/cache.py@@ -192,6 +192,20 @@ class InMemoryCache(BaseCache):"""Clear cache."""self._cache = {}+ async def alookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]:+ """Look up based on prompt and llm_string."""+ return self.lookup(prompt, llm_string)++ async def aupdate(+ self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE+ ) -> None:+ """Update cache based on prompt and llm_string."""+ self.update(prompt, llm_string, return_val)++ async def aclear(self, **kwargs: Any) -> None:+ """Clear cache."""+ self.clear()+Base = declarative_base()