semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Implement semantic cache

Open Rtoribiog opened this issue 1 year ago • 5 comments

That's a feature that already exists in langchain and will be beneficial to save costs. The idea will be to ported from phyton to c#

https://github.com/zilliztech/GPTCache

https://python.langchain.com/docs/integrations/llms/llm_caching/

https://www.mongodb.com/developer/products/atlas/advanced-rag-langchain-mongodb/

Be able to save all the queries together with llm responses in some database and try to fetch it first from there, if not then call the LLM, and have some parameters to invalidate or update cache from time to time.

Rtoribiog avatar Apr 18 '24 20:04 Rtoribiog

@markwallace-microsoft, going to assign this to @dmytrostruk since this is one of the samples he's working on using filters.

madsbolaris avatar Apr 30 '24 14:04 madsbolaris

Also assigning @eavanvalkenburg since he was working on filters for Python

madsbolaris avatar Apr 30 '24 14:04 madsbolaris

Example for Semantic Caching in .NET is here: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Caching/SemanticCachingWithFilters.cs

dmytrostruk avatar Jul 17 '24 19:07 dmytrostruk

Nice, we are going to take a look. Thanks

Rtoribiog avatar Jul 18 '24 06:07 Rtoribiog

Removing the .Net tag, since the sample exists. Leaving python as we haven't completed this yet.

moonbox3 avatar Jul 18 '24 14:07 moonbox3

Hi! Any news on the Python version?

andresnievessouthworks avatar Oct 17 '24 15:10 andresnievessouthworks

Python version was actually created a bit ago: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/concepts/caching/semantic_caching.py

eavanvalkenburg avatar Jun 16 '25 12:06 eavanvalkenburg