Smart Cache Package
Intelligent LLM Caching & Routing
About the Project
Smart Cache Package is a pip-installable Python library designed to drastically reduce redundant LLM API calls without losing answer quality.
It uses Mem0AI to store every query-answer pair with semantic embeddings. On each new query it performs near-duplicate detection: if a semantically similar query was answered before (above a configurable threshold), the cached response is returned instantly.
If no duplicate is found, it retrieves related context from the store to enrich the LLM prompt before calling the API — improving coherence without extra cost.
Every answer is tagged with its source — Local Cache, Mem0 Near-Duplicate, or LLM Call — so developers always know what happened under the hood.
Export / Import support enables teams to share cache state across instances for collaborative workflows.
5,300+ downloads on PyPI.