本页还没有译文
本页 16 段还没译成Español,下面显示的是英文原文。LocalFileStore integration
还没翻译译自英文(docs.langchain.com)本页 16 段都还没译
This will help you get started with local filesystem key-value stores. For detailed documentation of all LocalFileStore features and configurations head to the API reference.
Overview
The LocalFileStore is a persistent implementation of ByteStore that stores everything in a folder of your choosing. It's useful if you're using a single machine and are tolerant of files being added or deleted.
Integration details
| Class | Package | Local | JS support | Downloads | Version |
|---|---|---|---|---|---|
LocalFileStore | langchain | ✅ | ✅ |
Installation
The LangChain LocalFileStore integration lives in the langchain package:
pip install -qU langchain-classicInstantiation
Now we can instantiate our byte store:
from pathlib import Path
from langchain_classic.storage import LocalFileStore
root_path = Path.cwd() / "data" # can also be a path set by a string
kv_store = LocalFileStore(root_path)Usage
You can set data under keys like this using the mset method:
kv_store.mset(
[
["key1", b"value1"],
["key2", b"value2"],
]
)
kv_store.mget(
[
"key1",
"key2",
]
)[b'value1', b'value2']You can see the created files in your data folder:
!ls {root_path}key1 key2And you can delete data using the mdelete method:
kv_store.mdelete(
[
"key1",
"key2",
]
)
kv_store.mget(
[
"key1",
"key2",
]
)[None, None]API reference
For detailed documentation of all LocalFileStore features and configurations, head to the API reference