本页还没有译文
本页 15 段还没译成Español,下面显示的是英文原文。InMemoryByteStore integration
还没翻译译自英文(docs.langchain.com)本页 15 段都还没译
This guide will help you get started with in-memory key-value stores. For detailed documentation of all InMemoryByteStore features and configurations head to the API reference.
Overview
The InMemoryByteStore is a non-persistent implementation of a ByteStore that stores everything in a Python dictionary. It's intended for demos and cases where you don't need persistence past the lifetime of the Python process.
Integration details
| Class | Package | Local | JS support | Downloads | Version |
|---|---|---|---|---|---|
InMemoryByteStore | langchain-core | ✅ | ✅ |
Installation
The LangChain InMemoryByteStore integration lives in the langchain-core package:
pip install -qU langchain-coreInstantiation
Now you can instantiate your byte store:
from langchain_core.stores import InMemoryByteStore
kv_store = InMemoryByteStore()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']And 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 InMemoryByteStore features and configurations, head to the API reference