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.1.tar.gz (12.4 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.1-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: composecache-0.1.1.tar.gz
  • Upload date:
  • Size: 12.4 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.1.tar.gz
Algorithm Hash digest
SHA256 81de6415589f555d0cf44a6e43d986a0bd75ac0ece048b3483bbb5be0d1af5fd
MD5 0a7a61f2c063a274df305653edee5e33
BLAKE2b-256 af05bfaad1d0d85e765ac4d7e70393283238b13b08cae33eeb24c14d7661a894

See more details on using hashes here.

File details

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

File metadata

  • Download URL: composecache-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d06d0ce65cfddbcd1f1111890731fbd91710faac401d90d253c1a23d8272449
MD5 6d990b179dfbb64774adecec0ba1b639
BLAKE2b-256 896b4f6114230a3a12b7080d410cd81f5cbdd48be48b5b64f324d888897c0bfb

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