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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e09f1b6b634c3f92bb36a2af988c866aaae3a79882f004bf0bbbc5be7eadd3a
|
|
| MD5 |
6924ccdb351fecf68157b4803fda4a9e
|
|
| BLAKE2b-256 |
36fbc73c940459b7adc0d3ceaaab1ab7a52870a1999cd44b6ba1a5cb886ca437
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f9c007ff4fb7feb54a531d258bc9a8b270634e5f77c782ba7f17568653601cf
|
|
| MD5 |
a920633bbeeb3d677128ad11c07b1521
|
|
| BLAKE2b-256 |
0b3ae656403aaedf4e063674e9cf9970d33459256aaa8545d4497c968999f17f
|