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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 langchain_s3_cached_embeddings-0.8.0.tar.gz.
File metadata
- Download URL: langchain_s3_cached_embeddings-0.8.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4384f1db55316c9ca750eeb7c3be795f9e85b2b0aa5343e75293dedfc7aca0d
|
|
| MD5 |
a0cad23e6c6df61d6f8476fe8cbc2cd5
|
|
| BLAKE2b-256 |
d676df7e4c70f97645aaf3f443eba724511e969414d863db99c53395f5765c13
|
Provenance
The following attestation bundles were made for langchain_s3_cached_embeddings-0.8.0.tar.gz:
Publisher:
python-publish.yml on cdimascio/langchain-s3-cached-embeddings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_s3_cached_embeddings-0.8.0.tar.gz -
Subject digest:
f4384f1db55316c9ca750eeb7c3be795f9e85b2b0aa5343e75293dedfc7aca0d - Sigstore transparency entry: 158149494
- Sigstore integration time:
-
Permalink:
cdimascio/langchain-s3-cached-embeddings@bf96e2343f0e621071ced513dc238253762df863 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/cdimascio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bf96e2343f0e621071ced513dc238253762df863 -
Trigger Event:
release
-
Statement type:
File details
Details for the file langchain_s3_cached_embeddings-0.8.0-py3-none-any.whl.
File metadata
- Download URL: langchain_s3_cached_embeddings-0.8.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecda76a8b38f82a981a48f6d8a17f7ad2d95b2b41d9fbdb310a8548c26964515
|
|
| MD5 |
e2a69c23395719a2c9ce3c8b807d942a
|
|
| BLAKE2b-256 |
2e59a104af7487c7e4365b67ed173c431da4fb1c5424cefaec3b9e6ab6f4a9f3
|
Provenance
The following attestation bundles were made for langchain_s3_cached_embeddings-0.8.0-py3-none-any.whl:
Publisher:
python-publish.yml on cdimascio/langchain-s3-cached-embeddings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_s3_cached_embeddings-0.8.0-py3-none-any.whl -
Subject digest:
ecda76a8b38f82a981a48f6d8a17f7ad2d95b2b41d9fbdb310a8548c26964515 - Sigstore transparency entry: 158149495
- Sigstore integration time:
-
Permalink:
cdimascio/langchain-s3-cached-embeddings@bf96e2343f0e621071ced513dc238253762df863 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/cdimascio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bf96e2343f0e621071ced513dc238253762df863 -
Trigger Event:
release
-
Statement type: