Token导航 LogoToken导航TokenDH.com
研究检索需要联网clawhub未标认证来源可访问clear审计通过

hybrid-retrieval混合检索

Agent Skill

用于搭建或维护带检索增强的 RAG 工作流,适合让 Agent 处理知识库问答、向量检索、来源引用和事实核查。它可以辅助整理数据接入、Embedding、向量库、召回参数和回答生成流程。使用时需要确认数据来源、更新频率、召回阈值和引用展示方式,避免把未命中的资料或过期内容包装成确定事实。

总安装

3,034

周安装

129

GitHub Stars

1

下载量

1,063
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:hybrid-retrieval(混合检索)
来源仓库:https://github.com/vnesin-sarai/hybrid-retrieval
安装命令:
openclaw skills install hybrid-retrieval
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install hybrid-retrieval

简介

构建融合 BM25、向量嵌入与知识图遍历的混合检索系统。

  • 增强 AI 代理的记忆与事实核查能力,提升问答准确性。
  • 通过 clawhub 安装,适用于知识库问答与数据接入场景。
  • 需准备结构化数据源并配置 Embedding 模型。
  • 注意设置合理的召回阈值以避免误判或信息遗漏。hybrid-retrieval 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

name
hybrid-retrieval
description
Design and build a hybrid retrieval system combining BM25 keyword search, vector embeddings, and knowledge graph traversal for AI agent memory. Use when building agent memory, designing RAG systems, or improving recall quality. Triggers on "hybrid search", "RAG architecture", "agent memory design", "build memory system", "BM25 + vector", "knowledge graph search".

You are an expert in information retrieval systems, specifically hybrid approaches that combine multiple search paradigms. Help the user design and build a retrieval system inspired by the BlackRock/NVIDIA HybridRAG paper.

Core Insight

No single retrieval method works for everything:

MethodStrengthWeakness
BM25 (keyword)Exact matches, names, IDs, codesMisses synonyms and semantic meaning
Vector (embedding)Semantic similarity, paraphrasesStruggles with exact terms, numbers, names
Graph (knowledge graph)Relationships, multi-hop reasoningRequires structured extraction, maintenance

The hybrid approach: Run all three in parallel, then fuse results with weighted scoring. Each method catches what the others miss.

Architecture Pattern

User Query
    │
    ├──→ BM25 Keyword Search (fastest, sub-ms)
    │         SQLite FTS5 or Elasticsearch
    │
    ├──→ Vector Search (fast, ~100ms)
    │         Embedding model → ANN index (Qdrant, Milvus, FAISS, sqlite-vec)
    │
    └──→ Graph Search (medium, ~200ms)
              Entity extraction → Graph DB traversal (Neo4j, etc.)
    │
    └──→ Fusion Layer
              Weighted merge → Deduplication → Reranking → Top-K results

Step-by-Step Design

Step 1: Choose Your Document Store

Your chunks need to live somewhere. Options:

  • SQLite + FTS5 + vec0 — Single file, zero infrastructure, good up to ~100K chunks
  • PostgreSQL + pgvector — Production-ready, handles millions
  • Qdrant / Milvus — Purpose-built vector DBs, best for scale
  • Elasticsearch — If you already use it, it does BM25 + vector natively

Recommendation for most projects: Start with SQLite (FTS5 for keywords, vec0 for vectors). Migrate when you hit performance limits.

Step 2: Choose Your Embedding Model

ModelDimensionsQualitySpeedCost
OpenAI text-embedding-3-small1536GoodFast$0.02/1M tokens
Voyage AI voyage-31024Very goodFast$0.06/1M tokens
NV-Embed-v2 (self-hosted)4096ExcellentMediumFree (GPU needed)
nomic-embed-text (Ollama)768GoodFastFree (CPU ok)

Key decision: Self-hosted = free but needs GPU. Cloud = easy but recurring cost. For production agent memory, self-hosted pays for itself quickly.

Step 3: Chunking Strategy

Bad chunking ruins everything. Rules:

  1. Chunk by semantic unit — sections, paragraphs, conversations. NOT fixed-size windows.
  2. Include metadata — file path, date, source type. You'll filter on this later.
  3. Overlap sparingly — 10-20% overlap prevents losing context at boundaries.
  4. Keep chunks 200-600 tokens — too small = no context, too large = noise.

Step 4: BM25 Layer

-- SQLite FTS5 example
CREATE VIRTUAL TABLE chunks_fts USING fts5(path, text, source);

-- Search
SELECT path, text, rank
FROM chunks_fts
WHERE chunks_fts MATCH 'query terms'
ORDER BY rank
LIMIT 20;

BM25 handles: exact names, error codes, file paths, dates, IDs — anything where the exact string matters.

Step 5: Vector Layer

# Embed query
query_vec = embed("What is the deployment status?")

# ANN search (sqlite-vec example)
results = db.execute(
    "SELECT id, distance FROM chunks_vec "
    "WHERE embedding MATCH ? AND k = ? ORDER BY distance",
    (query_vec_blob, 20)
)

Vector handles: semantic questions, paraphrases, "find things related to X" — meaning over matching.

Step 6: Graph Layer (Optional but Powerful)

// Neo4j: Find entity and its connections
MATCH (n) WHERE n.name CONTAINS $entity
OPTIONAL MATCH (n)-[r]-(connected)
RETURN n, r, connected
ORDER BY coalesce(r.weight, 1.0) DESC
LIMIT 10

Graph handles: "Who works with X?", "What's related to Y?", multi-hop reasoning — relationships that flat search can't find.

Step 7: Fusion

The critical part — merging results from all three methods:

def fuse_results(bm25_results, vector_results, graph_results,
                 bm25_weight=0.3, vector_weight=0.5, graph_weight=0.8):
    all_results = {}

    for r in bm25_results:
        key = r["path"] + ":" + r["text"][:100]
        all_results[key] = {**r, "score": r["score"] * bm25_weight}

    for r in vector_results:
        key = r["path"] + ":" + r["text"][:100]
        if key in all_results:
            all_results[key]["score"] += r["score"] * vector_weight
        else:
            all_results[key] = {**r, "score": r["score"] * vector_weight}

    for r in graph_results:
        key = r["path"] + ":" + r["text"][:100]
        if key in all_results:
            all_results[key]["score"] += r["score"] * graph_weight
        else:
            all_results[key] = {**r, "score": r["score"] * graph_weight}

    return sorted(all_results.values(), key=lambda x: x["score"], reverse=True)

Weight tuning:

  • Graph results get highest weight — if the KG found a relevant entity, it's almost certainly right
  • Vector gets medium weight — good general recall
  • BM25 gets lowest weight — precise but narrow

Step 8: Deduplication and Reranking

After fusion:

  1. Deduplicate by text content (not path — same file can have multiple relevant chunks)
  2. MMR reranking (optional) — Maximal Marginal Relevance reduces redundancy by penalising results too similar to already-selected ones
  3. Score threshold — drop anything below 0.3 (tune this for your data)

Common Mistakes

  1. Using only vector search — Misses exact matches. "Port 8034" won't match semantically.
  2. Fixed-size chunking — Splitting mid-sentence destroys context.
  3. No graph layer — You'll hit a ceiling where flat retrieval can't answer relationship questions.
  4. Reranking with the same model — If you rerank with the same embeddings you searched with, you're just re-sorting the same biases.
  5. Ignoring BM25 — It's the fastest layer and catches what vectors miss. Always include it.

When to Add Complexity

If you have...You need...
< 1K chunksBM25 only (SQLite FTS5)
1K - 50K chunksBM25 + Vector
50K+ chunksBM25 + Vector + Graph
Multiple data sources (chats, emails, docs)Separate collections with routing
Real-time requirementsParallel search with timeouts

Output

Help the user:

  1. Assess their data volume and types
  2. Choose appropriate layers (BM25, vector, graph)
  3. Select embedding model and storage backend
  4. Design their chunking strategy
  5. Implement fusion with appropriate weights
  6. Set up a simple evaluation (test queries → expected results)

Further Reading

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

83.43%
按下载量换算887

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills