Skip to main content

Semantic caching framework for LLMs

Project description

CacheMind is a lightweight semantic caching layer for LLM applications.
It helps reduce redundant LLM calls to improve response time and save LLM token costs.

📦Installation

pip install cachemind

⚡Quick Start

from cachemind import CacheMind  
cache = CacheMind()  

response = cache.query("What is artificial intelligence?")  
print(response)  

🧩Customization

CacheMind is designed to be flexible. You can plug in your own components for LLM, embedding, vector store, and policy.

Custom Embedding

class MyEmbedding:  
    def encode(self, text):  
        return [0.1] * 384  
cache = CacheMind(embedding=MyEmbedding()) 

📊 Metrics

CacheMind also supports metrics tracking, allowing you to monitor cache performance and effectiveness over time.

stats = cache.metrics.get_stats()  
print(stats)  

Sample output:

{  
  "total_queries": 10,  
  "cache_hits": 6,  
  "cache_misses": 4,  
  "hit_rate": 0.6,  
  "tokens_saved": 120,  
  "tokens_used": 80  
}  

This project is under the MIT License.

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

cachemind-0.1.3.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

cachemind-0.1.3-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file cachemind-0.1.3.tar.gz.

File metadata

  • Download URL: cachemind-0.1.3.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for cachemind-0.1.3.tar.gz
Algorithm Hash digest
SHA256 49c1de5a27c6a26346474d4772637e73bfd3372fcc9b1f4d8e80f65d1ed6e10d
MD5 1b13ebea5050f9b7fc2be941dd937efd
BLAKE2b-256 ad05300327ea0d995ed7419e3f1302f9dbe92fe65e8bdaa535da546e9df04ad0

See more details on using hashes here.

File details

Details for the file cachemind-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cachemind-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for cachemind-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 689acaeb406cb2dfae22a5d783b24206e5636011f4effb87c4150dcfff159515
MD5 44abb1536bff887778e4de7ea84c27b5
BLAKE2b-256 714f033eb0d603c8fa875eac2e0ab035ac86ad52f5a2f2d98660e52bd95bdf1b

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