@carbide/l6-vector-store
v1.0.0
Published
VectorStore 组件,向量存储与检索 - Day 2 核心组件 L6
Downloads
140
Maintainers
Readme
L6 VectorStore 组件
向量存储与检索组件,支持文档嵌入和相似度搜索。
功能
- 文档向量化存储
- 相似度搜索
- 最大边际相关性搜索 (MMR)
- Retriever 接口
使用
import { VectorStoreService } from '@carbide/l6-vector-store';
const store = new VectorStoreService({ apiKey: 'your-api-key' });
await store.initialize();
// 添加文档
await store.addDocuments([
"LangChain 是一个用于开发 LLM 应用的框架",
"向量数据库用于存储和检索向量数据"
], [{ source: "doc1" }, { source: "doc2" }]);
// 搜索
const results = await store.similaritySearch("什么是 LangChain?", 2);
console.log(results);