@betterdb/semantic-cache

3 cookbooks for the first Valkey-native semantic cache. Standalone, framework-agnostic, with built-in OpenTelemetry and Prometheus metrics at the cache-operation level.

01

Getting Started

Install, connect to Valkey, write an embed function, and serve semantically similar prompts from cache - no LLM call needed.

Beginner~15 minTypeScript
02

LangChain & Vercel AI Adapters

Drop-in caching for LangChain ChatModels via BetterDBSemanticCache, and for Vercel AI SDK models via createSemanticCacheMiddleware.

Intermediate~20 minTypeScript
03

Production Patterns

Threshold tuning, uncertain hit strategies, per-category overrides, TTL management, invalidation, and Prometheus metrics dashboards.

Advanced~20 minTypeScript

Package

Valkey-native semantic cache. Standalone - works with any LLM client. Built-in OTel tracing and Prometheus metrics.

npm install @betterdb/semantic-cache
📦 View on npm 📂 valkeyforai Repo