Skip to main content

LocalFileStore

The LocalFileStore is a persistent implementation of ByteStore that stores everything in a folder of your choosing.

from pathlib import Path

from langchain.storage import LocalFileStore

root_path = Path.cwd() / "data" # can also be a path set by a string
store = LocalFileStore(root_path)

store.mset([("k1", b"v1"), ("k2", b"v2")])
print(store.mget(["k1", "k2"]))
API Reference:LocalFileStore
[b'v1', b'v2']

Now let's see which files exist in our data folder:

!ls {root_path}
k1 k2

Was this page helpful?


You can leave detailed feedback on GitHub.