Semantic and exact caching for LLM calls — cut costs by catching duplicate and similar prompts.
Project description
🪷 स्मृति
smriti
Vedic Smriti tradition
Sacred Memory — the 18 Smritis
Multi-backend caching for LLM agents: memory, disk, Redis-compatible interface. TTL, LRU, semantic cache.
Formerly agent-cache — Part of the Vedic Arsenal: 100 production-grade Python libraries for LLM agents, each named from the Vedas, Puranas, and Mahakavyas.
The Vedic Principle
The eighteen Smritis — sacred texts of remembered law and tradition — preserved the Vedic wisdom across millennia without digital storage. Pure memory, encoded in verse, passed from guru to shishya.
smriti brings this sacred memory architecture to LLM agents. Semantic cache, exact cache, TTL-aware LRU — the agent remembers what it has learned. The TF-IDF similarity matching finds the memory that feels like the current question, even if the words differ.
Smriti means "that which is remembered." Every cached response is a memory. Every cache hit is the agent drawing on its accumulated wisdom rather than asking the universe the same question twice.
How It Works
flowchart LR
A[Input] --> B[smriti]
B --> C{Process}
C -- Success --> D[Output]
C -- Error --> E[Handle]
E --> B
style B fill:#6b21a8,color:#fff
Installation
pip install smriti
Or from source:
git clone https://github.com/darshjme/smriti.git
cd smriti && pip install -e .
Quick Start
from smriti import *
# See examples/ for full usage
The Vedic Arsenal
smriti is one of 100 libraries in darshjme/arsenal — each named from sacred Indian literature:
| Sanskrit Name | Source | Technical Function |
|---|---|---|
smriti |
Vedic Smriti tradition | Sacred Memory — the 18 Smritis |
Each library solves one problem. Zero external dependencies. Pure Python 3.8+.
Contributing
- Fork the repo
- Create feature branch (
git checkout -b fix/your-fix) - Add tests — zero dependencies only
- Open a PR
🪷 Built by Darshankumar Joshi · @thedarshanjoshi
"कर्मण्येवाधिकारस्ते मा फलेषु कदाचन" Your right is to action alone, never to its fruits. — Bhagavad Gita 2.47
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smriti_cache-0.1.0.tar.gz.
File metadata
- Download URL: smriti_cache-0.1.0.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff65b653c57e678fc5bc3f2a1ba5bacc5786133ad18869f869c32dd97dd93c6e
|
|
| MD5 |
19fcd8def49d238a660a7827e1a8f5c3
|
|
| BLAKE2b-256 |
f452afc0af17ec03d75cb6ac7069d6f9dec56f77e187546f8934cb648d840924
|
File details
Details for the file smriti_cache-0.1.0-py3-none-any.whl.
File metadata
- Download URL: smriti_cache-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84782fc0831eebf4c63b0863e3bc1c8a73c27e3c29de9a008c1925deca172a08
|
|
| MD5 |
9c469da20920a0b0eef6ce2c57017798
|
|
| BLAKE2b-256 |
b543e5ee4a67d784f94a130ed839309ab12b7d98c95e48a692fe56e5cf66c39e
|