Optional
options: { Optional
index?: IndexConfig在单个批次中执行多个操作。这比单独执行操作更有效。
要执行的操作数组
解析为与操作匹配的结果的 Promise
列出和过滤存储中的命名空间。用于探索数据组织和导航命名空间层次结构。
Optional
options: { 列出命名空间的选项
Optional
limit?: numberOptional
maxOptional
offset?: numberOptional
prefix?: string[]Optional
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
});
存储或更新一个项目。
项目的层级路径
命名空间内的唯一标识符
包含项目数据的对象
Optional
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"]
);
在命名空间前缀内搜索项目。支持元数据过滤和向量相似度搜索。
要在其中搜索的层级路径前缀
Optional
options: { 用于过滤和分页的搜索选项
Optional
filter?: Record<string, any>Optional
limit?: numberOptional
offset?: numberOptional
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
});
已弃用
InMemoryStore 的别名