可选
options: { 可选
index?: IndexConfig在单个批处理中执行多个操作。这比单独执行操作更有效。
要执行的操作数组
解析为与操作匹配的结果的 Promise
列出和筛选存储中的命名空间。用于探索数据组织和导航命名空间层次结构。
可选
options: { 列出命名空间的选项
可选
limit?: number可选
max可选
offset?: number可选
prefix?: string[]可选
suffix?: string[]解析为命名空间路径列表的 Promise
// List all namespaces under "documents"
await store.listNamespaces({
prefix: ["documents"],
maxDepth: 2
});
// List namespaces ending with "v1"
await store.listNamespaces({
suffix: ["v1"],
limit: 50
});
存储或更新一个项目。
项目的分层路径
命名空间内的唯一标识符
包含项目数据的对象
可选
index: false | string[]可选的索引配置
// Simple storage
await store.put(["docs"], "report", { title: "Annual Report" });
// With specific field indexing
await store.put(
["docs"],
"report",
{
title: "Q4 Report",
chapters: [{ content: "..." }, { content: "..." }]
},
["title", "chapters[*].content"]
);
在命名空间前缀内搜索项目。支持元数据过滤和向量相似度搜索。
要在其中搜索的分层路径前缀
可选
options: { 用于过滤和分页的搜索选项
可选
filter?: Record<string, any>可选
limit?: number可选
offset?: number可选
query?: string解析为带有相关性分数的匹配项目列表的 Promise
// Search with filters
await store.search(["documents"], {
filter: { type: "report", status: "active" },
limit: 5,
offset: 10
});
// Vector similarity search
await store.search(["users", "content"], {
query: "technical documentation about APIs",
limit: 20
});
带可选向量搜索的内存键值存储。
一个使用 JavaScript Maps 的轻量级存储实现。在配置嵌入后,支持基本的键值操作和向量搜索。
示例
警告
此存储将所有数据保存在内存中。当进程退出时,数据将丢失。为了持久性,请使用数据库支持的存储。