Skip to main content

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 implementing langchain_core.embeddings.Embeddings
  • bucket - (required) the s3 bucket name
  • prefix - (required) the s3 key name
  • filenaming_function - (optional) redeives two arguments, 1. the file contents (str), 2. the index (int) e.g. 9 for the 10the document and returns the filename ()str)
  • cache_behavior - (optional)
    • CacheBehavior.NO_CACHE - do not use cached embeddings, instead embed using the embeddings class' standard embed_documents(...) method
    • CacheBehavior.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)

Source distribution for langchain-s3-cached-embeddings 0.8.3
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)

Table of built distributions (wheels) for langchain-s3-cached-embeddings 0.8.3
File Interpreter ABI Platform Actions
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 log

Release 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 log

Security 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.

Select from 2 files

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 log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page