Skip to main content

langchain embeddings wrapper to persist embeddings for re-use later

Project description

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",
        filenaming_function=lamdba x: f"{x[0]}-{x[1].embedding.txt"}, # optional function to name your embedding file
        cache_behavior=CacheBehavior.NO_CACHE, # set to #CacheBehavior.ONLY_CACHE to use previously cached embeddings
    )

License

MIT

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

langchain_s3_cached_embeddings-0.8.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file langchain_s3_cached_embeddings-0.8.1.tar.gz.

File metadata

File hashes

Hashes for langchain_s3_cached_embeddings-0.8.1.tar.gz
Algorithm Hash digest
SHA256 bd81bb3145446089ddc88cd77a50cd7cf130fad77ba166dcb55cadb7548af3b4
MD5 727485a37111518884aeb03664a9803b
BLAKE2b-256 ae6ef565ba1e02736345fa1b6b8ee7f86b5727534f0cbdb8feb71b032841795a

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_s3_cached_embeddings-0.8.1.tar.gz:

Publisher: python-publish.yml on cdimascio/langchain-s3-cached-embeddings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_s3_cached_embeddings-0.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_s3_cached_embeddings-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6fac63ca65acd535209186f123a01889c0fa1ca99188eb6e2dc97db718d23c88
MD5 72921c1da9f18ca4ee3e8c8a087a2f88
BLAKE2b-256 1d1508f2aa3eff1c8e09a7842ce23f3756008c50cb1a1386ee54b0ccf9d3e254

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_s3_cached_embeddings-0.8.1-py3-none-any.whl:

Publisher: python-publish.yml on cdimascio/langchain-s3-cached-embeddings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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