InMemoryByteStore 中
本指南将帮助您开始使用内存中的键值存储。有关所有InMemoryByteStore功能和配置可参考 API 参考。
概述
这InMemoryByteStore是ByteStore将所有内容存储在 Python 字典中。它适用于演示和不需要在 Python 进程生命周期之后保持持久性的情况。
集成详细信息
| 类 | 包 | 本地化 | JS 支持 | 软件包下载 | 最新包装 |
|---|---|---|---|---|---|
| InMemoryByteStore | langchain_core | ✅ | ✅ |
安装
The LangChainInMemoryByteStore集成位于langchain_core包:
%pip install -qU langchain_core
实例
现在你可以实例化你的字节存储了:
from langchain_core.stores import InMemoryByteStore
kv_store = InMemoryByteStore()
API 参考:InMemoryByteStore
用法
您可以使用mset方法:
kv_store.mset(
[
["key1", b"value1"],
["key2", b"value2"],
]
)
kv_store.mget(
[
"key1",
"key2",
]
)
[b'value1', b'value2']
您可以使用mdelete方法:
kv_store.mdelete(
[
"key1",
"key2",
]
)
kv_store.mget(
[
"key1",
"key2",
]
)
[None, None]
API 参考
有关所有InMemoryByteStore功能和配置,请前往 API 参考:https://python.langchain.com/api_reference/core/stores/langchain_core.stores.InMemoryByteStore.html
相关
- 键值存储概念指南