rag_search
Performs hybrid semantic and keyword search across one or multiple knowledge bases, returning ranked text chunks with metadata and optional filters or context expansion.
Instructions
在指定知识库或跨多个知识库中执行向量语义检索与原生 FTS 倒排混合检索(RRF 融合)。
Args:
kb_name: 目标知识库名称,支持单库名称、知识库列表(如 ["docs", "code"])或 "*" 跨全库召回
query: 检索查询文本
top_k: 返回相似切片的最大数量(默认为 5)
threshold: 相似度截断阈值,过滤掉低于此分数的切片(范围 0.0 ~ 1.0)
keyword: 可选的精准关键词,切片正文必须包含此词(大小写无关)
metadata_filter: 可选的元数据字典过滤条件(如 {"category": "tech"})
expand_context: 邻近上下文窗口扩展步数(默认 0 不展开,允许安全范围 0 ~ 5)
Returns:
list[dict[str, Any]]: 排序后的相似切片列表,
每个切片包含 chunk_id, text, score, metadata(含结构化 images 列表), kb_name
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"kb_name": "<kb_name>",
"query": "<query>"
},
"name": "rag_search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| top_k | No | ||
| kb_name | Yes | ||
| keyword | No | ||
| threshold | No | ||
| expand_context | No | ||
| metadata_filter | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |