LLM replies caching #8521
Replies: 1 comment
-
You're absolutely right! Haystack doesn't currently have a built-in feature to cache LLM responses directly. It primarily focuses on caching documents within its document store. However, you can implement LLM response caching manually using a variety of approaches:
Use Python's built-in dict or a more sophisticated caching library like cachetools to store LLM responses. Serialize LLM responses to disk (e.g., JSON, Pickle) and read them from the file system when needed. Utilize cloud-based caching services like Redis or Memcached for scalable and distributed caching. Cache Expiration: Implement a strategy to expire old or irrelevant cache entries. Would you like to explore any of these approaches in more detail or discuss specific use cases? |
Beta Was this translation helpful? Give feedback.
-
Hi folks, in langchain and autogen there's a feature to cache to llm replies. I tried to find the same thing for haystack but could only find caching for documents. Am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions