langchain-s3-cached-embeddings
Proxies any langchain Embeddings class such as OpenAIEmbeddings, GoogleGenerativeAIEmbeddings, persisting all generated embeddings to S3. This allows subsequent calls to optionally leverage the cached embeddings, avoiding additional and unecessary cost of re-embedding.
Install
pip install langchain-s3-cached-embeddings
Usage
from langchain_s3_text_loaders import S3DirectoryLoader
embeddings = S3EmbeddingsConduit(
embeddings=OpenAIEmbeddings(model=model), # required
bucket="my-embeddings-bucket", # required
prefix="my-optional-prefix"
)
Advanced Usage
embeddings = S3EmbeddingsConduit(
embeddings=OpenAIEmbeddings(model=model), # required
bucket="my-embeddings-bucket", # required
prefix="my-optional-prefix"
filenaming_function: Optional[Callable[[str, int], str]] = None,
cache_behavior = CacheBehavior.NO_CACHE):
Usage Options
embeddings- (required) any class implementinglangchain_core.embeddings.Embeddingsbucket- (required) the s3 bucket nameprefix- (required) the s3 key namefilenaming_function- (optional) redeives two arguments, 1. the file contents (str), 2. the index (int) e.g.9for the10the document and returns the filename ()str)cache_behavior- (optional)CacheBehavior.NO_CACHE- do not use cached embeddings, instead embed using theembeddingsclass' standardembed_documents(...)methodCacheBehavior.ONLY_CACHE- use cached embeddings. if the embeddings are no present, it raises an exception
License
MIT
Metadata
Release files for langchain-s3-cached-embeddings 0.8.3
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 |
|---|---|---|---|---|
| langchain_s3_cached_embeddings-0.8.3.tar.gz | 5.4 kB | With provenance | Details for langchain_s3_cached_embeddings-0.8.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_s3_cached_embeddings-0.8.3-py3-none-any.whl | Python 3 | none | any | Details for langchain_s3_cached_embeddings-0.8.3-py3-none-any.whl |
Total release size: 10.9 kB
Release files / langchain_s3_cached_embeddings-0.8.3.tar.gz
| Download URL | langchain_s3_cached_embeddings-0.8.3.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f32dfedcbfd8e22ab77e1a507ba46abf3c154a7df4baae68e836c2e262e71bf5
|
|
BLAKE2b-256 checksum How to use checksums |
ba994843654aad95876efdd7ee41a7478dccc807573e11d1caa3ca5ddf7b39aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 30, 2024.
Transparency logRelease files / langchain_s3_cached_embeddings-0.8.3-py3-none-any.whl
| Download URL | langchain_s3_cached_embeddings-0.8.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e829b91dfa95cd01af3b6f4a246dd43c5496ae0646e7a750b6a55301a802382c
|
|
BLAKE2b-256 checksum How to use checksums |
2c396d648c10e89e0c8849352e962ce02c725f7b75210f4a321ae0f48621bfe8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 30, 2024.
Transparency logSecurity for langchain-s3-cached-embeddings 0.8.3
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for langchain_s3_cached_embeddings-0.8.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 30, 2024.
Transparency logA 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.