Skip to main content

Semantic and exact caching for LLM calls — cut costs by catching duplicate and similar prompts.

Project description

स्मृति — smriti by Darshankumar Joshi

🪷 स्मृति

smriti

Vedic Smriti tradition

Sacred Memory — the 18 Smritis

Multi-backend caching for LLM agents: memory, disk, Redis-compatible interface. TTL, LRU, semantic cache.

Python Zero Dependencies Vedic Arsenal License

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

  1. Fork the repo
  2. Create feature branch (git checkout -b fix/your-fix)
  3. Add tests — zero dependencies only
  4. Open a PR

🪷 Built by Darshankumar Joshi · @thedarshanjoshi

"कर्मण्येवाधिकारस्ते मा फलेषु कदाचन" Your right is to action alone, never to its fruits. — Bhagavad Gita 2.47

Vedic Arsenal · GitHub · Twitter

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smriti_cache-0.1.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smriti_cache-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

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

Hashes for smriti_cache-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff65b653c57e678fc5bc3f2a1ba5bacc5786133ad18869f869c32dd97dd93c6e
MD5 19fcd8def49d238a660a7827e1a8f5c3
BLAKE2b-256 f452afc0af17ec03d75cb6ac7069d6f9dec56f77e187546f8934cb648d840924

See more details on using hashes here.

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

Hashes for smriti_cache-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84782fc0831eebf4c63b0863e3bc1c8a73c27e3c29de9a008c1925deca172a08
MD5 9c469da20920a0b0eef6ce2c57017798
BLAKE2b-256 b543e5ee4a67d784f94a130ed839309ab12b7d98c95e48a692fe56e5cf66c39e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page