SuperAPI AI 工具集

vector-search

智能体与模型

查看项目

更新于 10-16 06:38

技能介绍

Vector Search Skill 是 agent-memory 系统中的语义相似度搜索技能,使用向量嵌入进行检索。

一、用途与检索类型选择 根据不同查询意图选择合适的检索方式:

  • 精确关键词匹配:使用 BM25(teleport search)。
  • 概念相似度:使用向量检索(teleport vector-search)。
  • 两者兼顾:使用混合检索(teleport hybrid-search)。
  • 拼写错误/同义词:使用向量或混合检索。
  • 技术术语:使用 BM25 或混合检索。

以下情况不适合使用本技能:

  • 当前会话上下文(已在 memory 中)。
  • 基于时间的查询(应改用 TOC 导航)。
  • 计数或聚合(不支持)。

二、快速开始 命令与用途对照:

  • teleport vector-search:语义搜索,示例 teleport vector-search -q "authentication patterns"。
  • teleport hybrid-search:BM25 + 向量,示例 teleport hybrid-search -q "JWT token handling"。
  • teleport vector-stats:索引状态,示例 teleport vector-stats。

前置条件(检查并启动守护进程): memory-daemon status # Check daemon memory-daemon start # Start if needed

三、向量搜索基本用法 简单语义搜索: memory-daemon teleport vector-search -q "authentication patterns"

带过滤条件: memory-daemon teleport vector-search -q "debugging strategies"
--top-k 5
--min-score 0.6
--target toc

四、混合搜索 混合搜索使用 Reciprocal Rank Fusion(RRF)将 BM25 关键词匹配与向量语义相似度结合。

基本用法: 默认混合模式(50/50 权重): memory-daemon teleport hybrid-search -q "JWT authentication"

偏向向量语义: memory-daemon teleport hybrid-search -q "similar topics"
--bm25-weight 0.3
--vector-weight 0.7

偏向关键词匹配: memory-daemon teleport hybrid-search -q "exact_function_name"
--bm25-weight 0.8
--vector-weight 0.2

五、搜索策略决策流程 用户查询 | v +-- 是否包含精确术语/函数名? --> BM25 搜索 | +-- 是否为概念/语义查询? --> 向量搜索 | +-- 混合或不确定? --> 混合搜索(默认)

六、错误处理

  • Connection refused:执行 memory-daemon start。
  • Vector index unavailable:等待索引构建完成,或检查磁盘空间。
  • No results:降低 --min-score,尝试混合模式,放宽查询。
  • Slow response:减少 --top-k,检查索引大小。

更多完整 CLI 选项见 Command Reference。