Skip to main content

SemCache (Python SDK)

Zero-cost, low-latency tiered semantic caching SDK for LLMs running local embeddings.

Installation

pip install semcache

Quick Start

from semcache import SemCache, FileStore

# Initialize cache with local file storage
cache = SemCache(
    store=FileStore(".semcache/db.json"),
    fuzzy_threshold=0.95,
    semantic_threshold=0.85
)

# Set an entry (simulate LLM response time of 1500ms)
cache.set(
    query="What is the capital of France?",
    response="The capital of France is Paris.",
    latency_ms=1500,
    token_usage={"prompt_tokens": 7, "completion_tokens": 7}
)

# Query semantic matching (instant hit in ~20ms, $0 API cost)
result = cache.get("tell me the capital city of France")
if result:
    entry, tier, similarity = result
    print(f"Hit Tier: {tier} (Similarity: {similarity:.4f})")
    print(f"Response: {entry.response}")

Metadata

Release files for vanshulgoyal101-semcache 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vanshulgoyal101-semcache 1.0.0
File Size Uploaded Provenance Actions
vanshulgoyal101_semcache-1.0.0.tar.gz 5.9 kB Without provenance Details for vanshulgoyal101_semcache-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vanshulgoyal101-semcache 1.0.0
File Interpreter ABI Platform Actions
vanshulgoyal101_semcache-1.0.0-py3-none-any.whl Python 3 none any Details for vanshulgoyal101_semcache-1.0.0-py3-none-any.whl

Total release size: 11.9 kB

Release files / vanshulgoyal101_semcache-1.0.0.tar.gz

Download URL vanshulgoyal101_semcache-1.0.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1014d7ede2cb9166c67abc2bc09cdd229e07b1f72a9affca7f083eda807e3617
BLAKE2b-256 checksum
How to use checksums
1a75a4b35e5854a55fa2202e6f85bf2915216b361c9b44d1dead8067983e8a9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.1

Release files / vanshulgoyal101_semcache-1.0.0-py3-none-any.whl

Download URL vanshulgoyal101_semcache-1.0.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51523191c4b93b27b44ace4c0d4d94420aa35f565bf0f4412f27f51dd0389c6b
BLAKE2b-256 checksum
How to use checksums
1bdf24bc98dc054916ad8436540f4b8757648ceb03793db517f5d6d6913d063e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.1

Security for vanshulgoyal101-semcache 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page