# -*- coding: utf-8 -*- """iAOP-Core · 领域 RAG 知识库(RAG KB)—— 模板化接入。 对应 PRD 5.4「④ LLM 网关 + RAG」与 Issue #46(EPIC #6 子任务): 领域 RAG 知识库改为**按模板配置**(工艺规范 / SOP / 国标 三类知识源), 换行业只改模板资产(`config/kb.template.yaml` + 文档集),内核零改动; 检索返回**命中文档片段 + 来源**(引用溯源,PRD 5.4)。 模块: - templating 知识源分类 + 模板命名推导(collection/索引/namespace) + 轻量 YAML 配置加载(零依赖); - documents 文档模型 + 段落抽取分块(保留 文档/章节/段落 溯源信息); - store 模板化知识库(from_template_config 构建)+ 检索 + 类别过滤。 测试:`python -m unittest discover -s tests -v`(在 core/rag-kb 目录下执行)。 """ __version__ = "0.1.0" from .documents import Chunk, KbDocument, build_document, chunk_document from .store import RagKnowledgeBase, RetrievalHit from .templating import ( KbSourceConfig, KbTemplateConfig, KbTemplateNaming, KnowledgeSourceKind, load_kb_config, sanitize, ) __all__ = [ "KnowledgeSourceKind", "KbTemplateNaming", "KbTemplateConfig", "KbSourceConfig", "load_kb_config", "sanitize", "KbDocument", "Chunk", "build_document", "chunk_document", "RagKnowledgeBase", "RetrievalHit", ]