Skip to main content

Documentation Index

Fetch the complete documentation index at: https://langchain-zh.cn/llms.txt

Use this file to discover all available pages before exploring further.

概述

LangChain 提供了一个键值存储接口用于通过键存储和检索数据。LangChain 中的键值存储接口主要用于缓存 嵌入

接口

所有 BaseStores 支持以下接口:
  • mget(key: Sequence[str]) -> List[Optional[bytes]]: 获取多个键的内容,如果键不存在则返回 None
  • mset(key_value_pairs: Sequence[Tuple[str, bytes]]) -> None: 设置多个键的内容
  • mdelete(key: Sequence[str]) -> None: 删除多个键
  • yield_keys(prefix: Optional[str] = None) -> Iterator[str]: 生成存储中的所有键,可选地按前缀过滤
基础存储旨在同时处理多个键值对以提高效率。这节省了网络往返时间,并可能允许在底层存储中进行更高效的批处理操作。

本地开发内置存储

InMemoryByteStore

LocalFileStore

自定义存储

您也可以通过扩展 BaseStore 类来实现自己的自定义存储。有关更多详细信息,请参阅 存储接口文档

所有键值存储

AstraDBByteStore

CassandraByteStore

ElasticsearchEmbeddingsCache

RedisStore

UpstashRedisByteStore

BigtableByteStore