Cached Sentence Transformer
PostgreSQL-backed embedding cache for SentenceTransformers.
This package provides a small wrapper that caches computed sentence embeddings in a Postgres
table keyed by a stable hash of (model, normalize flag, text), so repeated runs can reuse
stored vectors instead of recomputing them.
Installation
pip install cached-sentence-transformer
Quickstart
from cached_sentence_transformer import CachedSentenceTransformer
st = CachedSentenceTransformer(
model_name_or_path="sentence-transformers/all-MiniLM-L6-v2",
pg_dsn="host=localhost port=5432 dbname=mydb user=myuser password=mypassword",
)
emb = st.encode(["hello", "world"], normalize_embeddings=True)
st.close()
Environment-based DSN
If you do not pass pg_dsn, the wrapper will attempt to build it from environment variables
(auto loads environment variables in the .env file in the current working directory) and
will fail fast if any are missing:
PSQL_HOST_NAMEPSQL_PORTPSQL_DBNAMEPSQL_USERPSQL_PASSWORD
Metadata
Release files for cached-sentence-transformer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cached_sentence_transformer-0.1.0.tar.gz | 15.2 kB | Without provenance | Details for cached_sentence_transformer-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cached_sentence_transformer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cached_sentence_transformer-0.1.0-py3-none-any.whl |
Total release size: 27.0 kB
Release files / cached_sentence_transformer-0.1.0.tar.gz
| Download URL | cached_sentence_transformer-0.1.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbd742fb1a4dc3d13df30c1267580d5f29b4ccb861ea018666fdc1eddff24962
|
|
BLAKE2b-256 checksum How to use checksums |
52e8d622bbe4eac5d126418036d45cadde60f59e253483cf4acf6f2dd59f91cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|
Release files / cached_sentence_transformer-0.1.0-py3-none-any.whl
| Download URL | cached_sentence_transformer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9aeb67dadc5aecd8432cb5903f7ff84bb26161ae6c20c97c7109807b48e9e80c
|
|
BLAKE2b-256 checksum How to use checksums |
8dec9f88a46f551c2f56e3b22026bfab60304afd8bfeac6b981bea187f86eb40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|
Security for cached-sentence-transformer 0.1.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.