适用版本:ChengOS v0.1.0+ | 最后核对:2026-08-13 | 来源:crates/cheng-nodes/src/nodes/builtin/rag、crates/cheng-nodes/src/nodes/builtin/ai
检索管线按顺序拼装:rag/chunker 切分文档,rag/document_indexer 做向量化并写入存储, rag/retriever 在查询时召回候选,rag/formatter 把候选整理成 LLM 节点可直接使用的提示词。 rag/kb_manager 管的是知识库本身而不是其中的内容。ai/embedding_config 与 ai/qdrant_config 是整条管线共享的配置端口。请优先使用 *_artifact 端口而不是内联数组:内联形式只是有上限的预览, 完整集合在工件里。
文档分块器 — rag/chunker
将文档拆分为父子块
输入
| 字段 |
类型 |
必填 |
默认值 |
说明 |
content |
string |
— |
"" |
要分块的文档文本内容 |
content_artifact |
object |
— |
null |
存放待分块文档正文的工件(大文档优先使用) |
content_artifact_uri |
string |
— |
null |
待分块文档正文的 artifact:// URI |
legacy_inline_chunks |
boolean |
— |
false |
已废弃的兼容开关:同时内联输出完整的 parent_chunks / child_chunks 数组。默认关闭 —— 正常执行只返回 chunks_artifact 和有限的预览。 |
document_id |
string |
— |
null |
文档标识符(可选,不提供则自动生成) |
mode |
string |
— |
null |
选择文档分块方法. 控件:select |
parent_chunk_chars |
integer |
— |
null |
输入 – 父级 Chunk Chars. 控件:select |
child_chunk_chars |
integer |
— |
null |
输入 – Child Chunk Chars. 控件:select |
max_embedding_chars |
integer |
— |
null |
输入 – Max Embedding Chars. 控件:select |
输出
| 字段 |
类型 |
说明 |
document_id |
string |
已处理的文档 ID |
chunks_artifact |
object |
存放完整父块 + 子块集合的工件 |
parent_preview |
array<object> |
有数量上限的父块预览 |
child_preview |
array<object> |
有数量上限的子块预览 |
preview_truncated |
boolean |
预览省略了分块或截断了文本时为 true |
parent_chunks |
array<object> |
父块列表 |
child_chunks |
array<object> |
子块列表 |
parent_count |
integer |
父块总数 |
child_count |
integer |
子块总数 |
mode |
string |
使用的分块模式 |
文档索引器 — rag/document_indexer
将文档索引到向量数据库
输入
| 字段 |
类型 |
必填 |
默认值 |
说明 |
kb_id |
string |
✅ |
— |
目标知识库(从数据库解析的集合,经过工作区验证). 控件:dynamic-select |
qdrant_config |
object (端口) |
✅ |
— |
来自配置节点的 Qdrant 配置对象. 连接端口,不是表单字段。 控件:text |
content |
string |
— |
null |
要索引的文档文本内容(如果提供了分块器的块则可选) |
document_id |
string |
— |
null |
文档标识符(可选,不提供则自动生成) |
document_title |
string |
— |
null |
文档的可读标题/来源标签(可选,默认使用工作区名称) |
version |
integer |
— |
null |
文档版本号(可选,用于幂等性检查) |
parent_chunks |
array |
— |
null |
来自分块节点的父块(可选,提供时跳过内部分块) |
child_chunks |
array |
— |
null |
来自分块节点的子块(可选) |
chunks_artifact |
object |
— |
null |
来自 rag/chunker 的工件,存放完整分块集合(推荐输入) |
chunks_artifact_uri |
string |
— |
null |
分块集合的 artifact:// URI |
index_mode |
string |
— |
null |
标准或增强模式. 控件:select |
embedding_config |
object (端口) |
✅ |
— |
来自配置节点的嵌入配置对象. 连接端口,不是表单字段。 控件:text |
generate_context |
boolean |
— |
null |
使用 LLM 为每个块生成上下文描述(增强模式) |
llm_config |
object (端口) |
— |
null |
来自配置节点的 LLM 配置对象(可选,用于上下文生成). 连接端口,不是表单字段。 控件:text |
输出
| 字段 |
类型 |
说明 |
document_id |
string |
已索引的文档 ID |
parent_chunks |
integer |
创建的父块数量 |
child_chunks |
integer |
创建的子块数量 |
vectors_stored |
integer |
已存储的向量总数 |
context_generated |
boolean |
是否已生成上下文描述 |
index_mode |
string |
使用的索引模式 |
collection_name |
string |
目标集合名称 |
skipped |
boolean |
是否因幂等性检查而跳过 |
success |
boolean |
索引是否成功 |
summary |
string |
执行结果摘要 |
error |
string |
错误信息(如有) |
知识检索 — rag/retriever
从向量数据库检索相关文档
输入
| 字段 |
类型 |
必填 |
默认值 |
说明 |
workspace_scope |
enum |
— |
ambient |
使用运行时工作区,或将此检索器固定到配置的工作区. 控件:select. 取值:ambient, pinned |
workspace_id |
string (端口) |
— |
null |
固定时使用的工作区标识符,或接线时提供显式覆盖. 连接端口,不是表单字段。 控件:text |
kb_id |
string |
✅ |
— |
目标知识库(从数据库解析的集合,经过工作区验证). 控件:dynamic-select |
qdrant_config |
object (端口) |
✅ |
— |
来自配置节点的 Qdrant 配置对象. 连接端口,不是表单字段。 控件:text |
query |
string |
✅ |
— |
检索查询文本(接受字符串或 ChatContext) |
retrieval_mode |
string |
— |
null |
选择检索策略. 控件:select |
limit |
integer |
— |
null |
返回的最大结果数量 |
embedding_config |
object (端口) |
✅ |
— |
来自配置节点的嵌入配置对象. 连接端口,不是表单字段。 控件:text |
llm_config |
object (端口) |
— |
null |
来自配置节点的 LLM 配置对象(可选,用于 HyDE). 连接端口,不是表单字段。 控件:text |
document_filter |
array |
— |
null |
限制检索范围的文档 ID 列表(可选) |
输出
| 字段 |
类型 |
说明 |
documents |
array<object> |
检索到的文档列表 |
documents_artifact |
object |
存放完整检索文档集合的工件 |
documents_preview |
string |
有数量上限的检索文档预览 |
documents_truncated |
boolean |
内联文档列表省略了部分结果时为 true |
count |
integer |
返回的结果数量 |
retrieval_mode |
string |
使用的检索模式 |
query |
string |
用于检索的查询文本 |
latency_ms |
integer |
检索延迟(毫秒) |
collection_name |
string |
检索的集合名称 |
token_usage |
object |
预估 token 用量 |
has_results |
boolean |
当至少检索到一个文档时为真 |
summary_input |
object |
用于下游 LLM 摘要的轻量 AgentContext(无检索结果时不存在) |
RAG 格式化器 — rag/formatter
将检索结果和用户查询格式化为 LLM 提示
输入
| 字段 |
类型 |
必填 |
默认值 |
说明 |
query |
string |
✅ |
— |
来自检索节点查询输出的用户问题 |
documents |
array<object> |
— |
[] |
来自检索节点输出的检索文档列表 |
documents_artifact |
object |
— |
null |
来自 rag/retriever 的工件,存放完整文档集合(推荐输入) |
documents_artifact_uri |
string |
— |
null |
检索所得文档集合的 artifact:// URI |
template |
string |
— |
null |
选择提示词模板类型. 控件:select |
custom_template |
string |
— |
null |
自定义提示词模板.可用占位符:{query},{documents},{count}. 控件:textarea |
include_scores |
boolean |
— |
null |
在格式化输出中包含文档相关性分数 |
include_sources |
boolean |
— |
null |
在格式化输出中包含文档 ID 和来源信息 |
max_doc_chars |
integer |
— |
null |
每个文档块的最大字符数(0 = 不限制) |
输出
| 字段 |
类型 |
说明 |
prompt |
string |
格式化后的提示词,可直接作为 LLM 输入 |
prompt_artifact |
object |
提示词过大时,存放完整格式化提示词的工件 |
prompt_truncated |
boolean |
内联提示词受长度限制、完整文本位于 prompt_artifact 时为 true |
query |
string |
原始查询文本 |
document_count |
integer |
包含的文档数量 |
total_chars |
integer |
格式化输出的总字符数 |
知识库管理器 — rag/kb_manager
管理知识库(列表,删除,查看详情)
输入
| 字段 |
类型 |
必填 |
默认值 |
说明 |
qdrant_config |
object (端口) |
✅ |
— |
来自配置节点的 Qdrant 配置对象. 连接端口,不是表单字段。 控件:text |
operation |
string |
— |
list |
要执行的操作. 控件:select |
kb_id |
string |
— |
null |
目标知识库(删除和信息操作所需). 控件:dynamic-select |
输出
| 字段 |
类型 |
说明 |
operation |
string |
已执行的操作 |
success |
boolean |
操作是否成功 |
collections |
array |
知识库列表 |
collection_info |
object |
知识库详情 |
message |
string |
操作信息 |
error |
string |
错误信息(如有) |
data |
any |
通用结果数据 |
Embedding 配置 — ai/embedding_config
选择已连接的嵌入模型并输出其完整配置
输入
| 字段 |
类型 |
必填 |
默认值 |
说明 |
embedding_model |
string |
✅ |
— |
选择已连接的嵌入模型.支持 credential_id::model 格式. 控件:llm-model-select |
dimension |
integer |
— |
1024 |
嵌入向量维度. 控件:select |
batch_size |
integer |
— |
null |
批量处理大小. 控件:select |
reranker_model |
string |
— |
null |
选择重排序模型(可选,用于后处理优化). 控件:llm-model-select |
reranker_top_k |
integer |
— |
null |
重排序返回的最大结果数. 控件:select |
输出
| 字段 |
类型 |
说明 |
embedding_config |
object (端口) |
完整的嵌入配置. 连接端口,不是表单字段。 |
reranker_config |
object (端口) |
重排序配置(如已配置重排序模型). 连接端口,不是表单字段。 |
Qdrant 配置 — ai/qdrant_config
配置 Qdrant 向量数据库连接(本地/云/自托管)
输入
| 字段 |
类型 |
必填 |
默认值 |
说明 |
mode |
string |
— |
local |
选择 Qdrant 的部署方式. 控件:select |
url |
string |
— |
null |
Qdrant gRPC 端点 URL(本地模式默认:http://localhost:6334) |
credential_id |
string |
— |
null |
Qdrant Cloud 或认证自建服务器的凭证. 控件:credential-select |
collection_name |
string |
— |
null |
Qdrant 集合名称(向量存储集) |
enable_fulltext |
boolean |
— |
null |
是否在集合上启用 BM25 全文搜索索引 |
输出
| 字段 |
类型 |
说明 |
mode |
string |
Qdrant 部署模式 |
url |
string |
Qdrant gRPC 端点 URL |
api_key |
string |
API 密钥(用于云端/认证模式) |
collection_name |
string |
Qdrant 集合名称 |
enable_fulltext |
boolean |
是否启用了全文搜索 |
credential_id |
string |
使用的凭证 ID(如有) |
qdrant_config |
object (端口) |
完整的 Qdrant 配置(JSON 对象). 连接端口,不是表单字段。 |
下一步
暂无评论内容