Skip to main content

Compositional semantic caching for LLM APIs and RAG pipelines

Project description

ComposeCache Python Package

Python package for compositional semantic caching over LLM requests.

Quick Start

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
from composecache import ComposeCache

cache = ComposeCache(
    database_url="postgresql://dev:dev@localhost:5432/composecache",
    openai_api_key="YOUR_OPENAI_KEY",
)

response = cache.complete(
    {
        "model": "gpt-4o-mini",
        "messages": [{"role": "user", "content": "Compare GDP of France and Germany"}],
    }
)

print(response["content"])
print(response["cache_type"])

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

composecache-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

composecache-0.1.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file composecache-0.1.0.tar.gz.

File metadata

  • Download URL: composecache-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for composecache-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e09f1b6b634c3f92bb36a2af988c866aaae3a79882f004bf0bbbc5be7eadd3a
MD5 6924ccdb351fecf68157b4803fda4a9e
BLAKE2b-256 36fbc73c940459b7adc0d3ceaaab1ab7a52870a1999cd44b6ba1a5cb886ca437

See more details on using hashes here.

File details

Details for the file composecache-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: composecache-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for composecache-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f9c007ff4fb7feb54a531d258bc9a8b270634e5f77c782ba7f17568653601cf
MD5 a920633bbeeb3d677128ad11c07b1521
BLAKE2b-256 0b3ae656403aaedf4e063674e9cf9970d33459256aaa8545d4497c968999f17f

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