Redis Semantic Cache

•
132
•

Implements semantic caching for LLM responses with Redis LangCache to dramatically reduce API costs and latency.

Redis Semantic Cache provides architectural and implementation patterns for caching LLM completions and RAG queries using Redis Cloud's LangCache. It guides developers through setting up cache-aside workflows via SDKs and REST APIs, fine-tuning cosine similarity thresholds to balance precision against hit rates, segmenting caches across distinct workloads, and filtering cached embeddings using custom metadata attributes to prevent cross-topic contamination.

Key Features

01Isolate LLM workloads using dedicated cache IDs or custom attribute filtering
02Implement cache-aside architecture for LLM calls using Redis LangCache SDK and REST APIs
03Store and search prompt embeddings to bypass redundant calls to OpenAI or Anthropic
04Reduce LLM invocation latency and token consumption for deterministic and RAG workloads
05Tune semantic similarity thresholds to balance cache hit rate against answer precision
06132 GitHub stars

Use Cases

01Caching repetitive RAG queries and customer support questions to reduce model token costs
02Lowering latency for deterministic LLM tasks like text classification and FAQ answering
03Segmenting multi-tenant or multi-task AI applications into isolated semantic cache namespaces