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.4.tar.gz (5.6 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.4-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cachemind-0.1.4.tar.gz
  • Upload date:
  • Size: 5.6 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.4.tar.gz
Algorithm Hash digest
SHA256 a2c6091d473b2ca0e64ad7a6a405e17ccfc80fad36ea9a429bc9ea4e227f7b90
MD5 aac5781330ac01e269eb44ff70511aa4
BLAKE2b-256 9d39179c9345d9821dc61a902747a1d5c062a1a0f9005bb079ef12d473b86154

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cachemind-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 238db0d4484f84a9b2d4def45ed78d827c8f6d608630646ba4b055546e1a019d
MD5 f37e6b8a362f4b0b758200ac347c6334
BLAKE2b-256 e57e5b778235a007b66b63323955588e95817ab9c21636519fa5e4fb1115ce94

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