← 返回基因目录

kb-provenance-formatter

Nativeknowledge.provenance

从知识库 RAG 引用的 enriched citations 构建出处行(KbProvenanceLine)、拼装文本与导出 Markdown。纯字符串处理,无网络调用。

README

暂无文档。

基因作者可在发布时添加 README。

表现型

输入

属性类型描述
askIdstring可选的 ask_id,输出到 responseFields
kbCitationsarray知识库引用列表(kb-rag 输出的 enriched citations)
webCitationsarray网页引用列表
includeMarkdownboolean = true是否生成 Markdown 格式的出处文本
includeResponseFieldsboolean = true是否生成 API 响应字段格式

输出

属性类型必填描述
kbarray格式化后的知识库出处行
webarray格式化后的网页出处行
markdownstring完整 Markdown 格式(含回答、出处、审计附录)
responseFieldsobjectAPI 响应字段格式(含 provenance 对象)
provenanceTextKbstring知识库出处纯文本(一行一条)
provenanceTextWebstring网页出处纯文本(一行一条)
原始 JSON Schema

inputSchema

{
  "type": "object",
  "required": [],
  "properties": {
    "askId": {
      "type": "string",
      "description": "可选的 ask_id,输出到 responseFields"
    },
    "kbCitations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "quote": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "chunk_id": {
            "type": "string"
          },
          "loc_hint": {
            "type": "string"
          },
          "article_id": {
            "type": "string"
          },
          "chunk_index": {
            "type": "number"
          },
          "source_path": {
            "type": "string"
          },
          "source_type": {
            "type": "string"
          },
          "file_display": {
            "type": "string"
          },
          "article_title": {
            "type": "string"
          },
          "kb_library_id": {
            "type": "string"
          },
          "kb_library_label": {
            "type": "string"
          },
          "file_display_kind": {
            "type": "string"
          }
        }
      },
      "description": "知识库引用列表(kb-rag 输出的 enriched citations)"
    },
    "webCitations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "w_index": {
            "type": "number"
          }
        }
      },
      "description": "网页引用列表"
    },
    "includeMarkdown": {
      "type": "boolean",
      "default": true,
      "description": "是否生成 Markdown 格式的出处文本"
    },
    "includeResponseFields": {
      "type": "boolean",
      "default": true,
      "description": "是否生成 API 响应字段格式"
    }
  }
}

outputSchema

{
  "type": "object",
  "required": [
    "kb",
    "web"
  ],
  "properties": {
    "kb": {
      "type": "array",
      "description": "格式化后的知识库出处行"
    },
    "web": {
      "type": "array",
      "description": "格式化后的网页出处行"
    },
    "markdown": {
      "type": "string",
      "description": "完整 Markdown 格式(含回答、出处、审计附录)"
    },
    "responseFields": {
      "type": "object",
      "description": "API 响应字段格式(含 provenance 对象)"
    },
    "provenanceTextKb": {
      "type": "string",
      "description": "知识库出处纯文本(一行一条)"
    },
    "provenanceTextWeb": {
      "type": "string",
      "description": "网页出处纯文本(一行一条)"
    }
  }
}