mcpField
V
vector-embed

vector-embed

github.com/ruvnet数据与数据库80.0k731 次安装今天更新
代码仓库

关于 vector-embed

Vector Embed 使用 ruvector npm 包将文本、代码和文档转换为 384 维向量。该技能涵盖单项及逐文件嵌入、可选的自适应 LoRA 模式,以及在 AgentDB 中保存元数据。

主要功能

  1. 01生成 384 维嵌入向量
  2. 02嵌入文本、代码和文档
  3. 03按领域使用自适应 LoRA 嵌入
  4. 04在 AgentDB 中保存元数据

适用场景

  1. 01为语义搜索准备文本
  2. 02比较或聚类嵌入内容
  3. 03逐个嵌入文件内容

MCP 相关

可按文档中的命令注册 MCP 服务;其工具包括语义上下文、搜索、AST 分析和路由。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/ruvnet/ruflo --skill vector-embed

安装后在 Claude Code 中输入/vector-embed确认已加载。

详细介绍

Vector Embed

使用 ruvector npm 包生成并存储向量嵌入。

适用场景

使用此技能将文本、代码或文档嵌入为 384 维向量,用于语义搜索、相似度比较或聚类。ruvector 使用 ONNX all-MiniLM-L6-v2 和 HNSW 索引(每秒插入 52,000 次以上,搜索约需 0.045 毫秒)。

步骤

  1. 确保已安装 [email protected]:
    npm ls ruvector 2>/dev/null | grep '0.2.25' || npm install [email protected]
    
    如果之后运行 embed text 时提示 ONNX WASM files not bundled,也请运行:
    npm install ruvector-onnx-embeddings-wasm
    
  2. 嵌入输入内容(使用 text 子命令,将文本作为位置参数传入):
    • 单个字符串:npx -y [email protected] embed text "your text here"
    • 输出到文件:npx -y [email protected] embed text "your text here" -o vec.json
    • 文件:使用 Read 工具读取文件内容,然后将其作为位置参数传入。
    • 批量处理:在 shell 中循环处理文件——[email protected] 没有内置的 --batch/--glob 标志。
  3. 自适应(LoRA)变体:npx -y [email protected] embed text "..." --adaptive --domain code
  4. 确认——报告向量维度(384)、范数以及写入的任何输出路径。
  5. 必要时在 AgentDB 中存储元数据: mcp__plugin_ruflo-core_ruflo__memory_store({ key: "embed-SOURCE", value: "VECTOR_METADATA", namespace: "vector-patterns" })

MCP 替代方案

使用固定版本注册一次 MCP 服务:

claude mcp add ruvector -- npx -y [email protected] mcp start

然后直接调用 MCP 工具:hooks_rag_context(语义上下文)、brain_search(集体知识库)、hooks_ast_analyze、hooks_route。

注意事项

  • [email protected] 中不存在 embed --batch --glob 和 embed --file 标志;只支持 embed text <text>。请自行读取文件,并对每个文件调用一次 embed text。
  • 默认不包含 ONNX runtime。如果嵌入失败,请安装 ruvector-onnx-embeddings-wasm,或运行 npx -y [email protected] doctor 进行诊断。

评论

支持 Markdown