deepknow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeepKnow — 知识与检索助手
DeepKnow — Knowledge and Search Assistant
通过 DeepKnow REST API 导入和浏览知识,检索内部知识、综合资料、食品伙伴网或受控网页,并查询表格真实数据。
Use the DeepKnow REST API to import and browse knowledge, search internal knowledge, comprehensive sources, FoodPartner, or approved websites, and query actual table data.
支持的能力
Supported Capabilities
| 能力 | 说明 | 用户示例 | 调用前阅读 |
|---|---|---|---|
| 知识库浏览与深读 | 列出知识库、文件夹、分类和条目,读取详情与原文分块 | “继续读这篇资料的上下文” | |
| 知识导入与管理 | 上传文件、导入 URL/飞书、写入或编辑 Markdown、重新解析、删除 | “把这个 PDF 加进法规库” | |
| 知识检索 | 单库/跨库或文件夹范围检索,按分类过滤,生成可核验引用 | “只查研发文件夹里的资料” | |
| 综合资料检索 | 聚合专业来源、官网及授权公众号资料,返回资料卡片和链接 | “查一下槲皮素相关资料” | |
| 食品伙伴网检索 | 查询食品法规、标准、添加剂、污染物或生产许可等专业数据 | “山梨酸钾可以用在哪些食品中?” | |
| 实时网页检索 | 查询批准域名下的最新网页、政策或当前信息 | “查一下国家卫健委最新的食品政策” | |
| 表格查询 | 自然语言查询、查看表结构、按受控 DSL 查行、预览原始网格 | “华东区销售额最高的是谁?” | |
根据用户意图先完整阅读对应说明文件,再调用接口。跨能力任务只读取实际需要的文件。
| Capability | Description | User example | Read before calling |
|---|---|---|---|
| Knowledge base browsing and deep reading | List knowledge bases, folders, categories, and entries; read details and original content chunks | “Continue reading the context of this document” | |
| Knowledge import and management | Upload files; import URLs/Lark; write or edit Markdown; reparse; delete | “Add this PDF to the regulations library” | |
| Knowledge search | Search within a single knowledge base, across knowledge bases, or within a folder; filter by category; generate verifiable citations | “Only search the materials in the R&D folder” | |
| Comprehensive source search | Aggregate professional sources, official websites, and authorized WeChat Official Account content; return source cards and links | “Look up materials about quercetin” | |
| FoodPartner search | Query professional data such as food regulations, standards, additives, contaminants, or production licenses | “In which foods can potassium sorbate be used?” | |
| Real-time web search | Query the latest webpages, policies, or current information on approved domains | “Look up the latest food policies from the National Health Commission” | |
| Table querying | Query in natural language, inspect table schemas, retrieve rows using a controlled DSL, and preview the raw grid | “Who has the highest sales in the East China region?” | |
Based on the user's intent, first read the corresponding instruction file in full, then call the API. For tasks spanning multiple capabilities, only read the files that are actually required.
检索数据源路由
Retrieval Data Source Routing
检索前根据用户意图选择一个业务入口:
- 企业内部制度、项目资料或其他已入库内容:读取 ,调用
search.md。POST /knowledge-search - 跨来源寻找某个主题的研究、法规或相关资料,且未限定单一来源:读取 ,调用
food-knowledge.md。POST /food-knowledge/search - 食品标准、法规、添加剂、营养强化剂、污染物、农药或兽药残留、食品分类、生产许可等专业数据:读取 ,先调用
external-search.md,仅在需要完整记录或下一页时调用POST /foodpartner/search。POST /foodpartner/fetch - 需要受控外部站点的最新网页、实时政策或当前信息:读取 ,调用
external-search.md。POST /firecrawl/search
一次选择一个业务入口。综合搜索可以由后端聚合多个来源,网页接口可以执行既有服务端兜底;Skill 不因空结果、澄清或错误自行切换入口或追加多源查询。用户限定来源时使用对应入口,不用无法限定来源的综合搜索代替;意图无法唯一判断时先让用户确认。所有数据源都只通过本 Skill 的 REST API 和 调用,不直接连接 、不调用 MCP 工具,也不向用户索取 FoodPartner、Firecrawl 或 MCP 凭据。
DEEPKNOW_API_KEY/mcpBefore retrieval, select one business entry point based on the user's intent:
- Corporate policies, project materials, or other ingested content: read and call
search.md.POST /knowledge-search - To find research, regulations, or related materials on a topic across sources when no single source is specified: read and call
food-knowledge.md.POST /food-knowledge/search - For professional data such as food standards, regulations, additives, nutrient fortifiers, contaminants, pesticide or veterinary drug residues, food categories, and production licenses: read , call
external-search.mdfirst, and callPOST /foodpartner/searchonly when the complete record or the next page is needed.POST /foodpartner/fetch - For the latest webpages, real-time policies, or current information from approved external sites: read and call
external-search.md.POST /firecrawl/search
Select only one business entry point per operation. Comprehensive search may have the backend aggregate multiple sources, while the web interface may perform the existing server-side fallback. The Skill must not switch entry points or append multi-source queries on its own in response to empty results, requests for clarification, or errors. When the user specifies a source, use the corresponding entry point rather than comprehensive search that cannot be restricted to a source. If the intent cannot be uniquely determined, ask the user to confirm first. All data sources are accessed exclusively through this Skill's REST API and ; do not connect directly to , call MCP tools, or ask users for FoodPartner, Firecrawl, or MCP credentials.
DEEPKNOW_API_KEY/mcp接口调用规范
API Call Conventions
统一基础地址
Unified Base URL
text
https://wiki.sbtbiotech.cn/api/v1所有路径均相对于该地址。不要要求用户配置或替换 。
DEEPKNOW_BASE_URLtext
https://wiki.sbtbiotech.cn/api/v1All paths are relative to this URL. Do not ask the user to configure or replace .
DEEPKNOW_BASE_URL鉴权与公共请求头
Authentication and Common Request Headers
- 从环境变量读取 ;不得读取或展示 key 的值。
DEEPKNOW_API_KEY - 未设置时停止调用,并提示:。
export DEEPKNOW_API_KEY="sk-your-api-key" - 每次请求都发送以下请求头:
X-API-Key: $DEEPKNOW_API_KEYX-DeepKnow-Channel: skillX-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION
- JSON 请求额外发送 。
Content-Type: application/json
bash
if [ -z "$DEEPKNOW_API_KEY" ]; then
echo "缺少 DeepKnow API key。请配置 DEEPKNOW_API_KEY。"
exit 1
fi
DEEPKNOW_API_BASE="https://wiki.sbtbiotech.cn/api/v1"- Read from the environment variable; do not read or display the key's value.
DEEPKNOW_API_KEY - If it is not set, stop making calls and prompt: .
export DEEPKNOW_API_KEY="sk-your-api-key" - Send the following headers with every request:
X-API-Key: $DEEPKNOW_API_KEYX-DeepKnow-Channel: skillX-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION
- JSON requests must additionally include .
Content-Type: application/json
bash
if [ -z "$DEEPKNOW_API_KEY" ]; then
echo "缺少 DeepKnow API key。请配置 DEEPKNOW_API_KEY。"
exit 1
fi
DEEPKNOW_API_BASE="https://wiki.sbtbiotech.cn/api/v1"调用前读取本文件顶部的 version,并注入当前 shell 会话;不要在其他文件写死版本号。
调用前读取本文件顶部的 version,并注入当前 shell 会话;不要在其他文件写死版本号。
: "${DEEPKNOW_SKILL_VERSION:?请从 SKILL.md frontmatter 注入版本}"
dk_api() {
local method="$1" endpoint="$2" body="${3:-}"
local args=(
-sS -X "$method" "$DEEPKNOW_API_BASE/$endpoint"
-H "X-API-Key: $DEEPKNOW_API_KEY"
-H "X-DeepKnow-Channel: skill"
-H "X-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION"
-H "Content-Type: application/json"
)
if [ -n "$body" ]; then
args+=(-d "$body")
fi
curl "${args[@]}"
}
文件上传使用 `multipart/form-data`,不要手动添加 JSON Content-Type,但仍须发送鉴权、渠道和版本请求头。具体示例见 `import.md`。: "${DEEPKNOW_SKILL_VERSION:?请从 SKILL.md frontmatter 注入版本}"
dk_api() {
local method="$1" endpoint="$2" body="${3:-}"
local args=(
-sS -X "$method" "$DEEPKNOW_API_BASE/$endpoint"
-H "X-API-Key: $DEEPKNOW_API_KEY"
-H "X-DeepKnow-Channel: skill"
-H "X-DeepKnow-Skill-Version: $DEEPKNOW_SKILL_VERSION"
-H "Content-Type: application/json"
)
if [ -n "$body" ]; then
args+=(-d "$body")
fi
curl "${args[@]}"
}
For file uploads, use `multipart/form-data` and do not manually add the JSON Content-Type, but the authentication, channel, and version headers are still required. See `import.md` for specific examples.响应与错误
Responses and Errors
成功响应通常为 。业务错误通常使用以下格式:
{"success": true, "data": ...}json
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "面向用户的错误描述",
"details": "可选的额外信息"
}
}认证阶段的 或 也可能返回 。优先读取 ,其次读取字符串类型的 ;使用中文概括给用户,不原样暴露英文内部信息。不要暴露 API Key、完整请求头或内部堆栈。 检查凭据, 检查权限, 检查资源 ID, 提示减小或拆分文件, 可进行一次安全重试;仍失败则停止并说明。
401403{"error": "..."}error.messageerror4014034044135xxSuccessful responses usually use the following format: . Business errors generally use the following format:
{"success": true, "data": ...}json
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "面向用户的错误描述",
"details": "可选的额外信息"
}
}Authentication-stage or responses may also return . Prefer ; next, prefer when it is a string. Summarize the error for the user rather than exposing internal error details verbatim. Do not expose the API Key, complete request headers, or internal stack traces. For , check the credentials; for , check the permissions; for , check the resource ID; for , ask the user to reduce or split the file; and for , one safe retry is permitted. If the request still fails, stop and explain the error.
401403{"error": "..."}error.messageerror4014034044135xx自动升级
Automatic Upgrade
每次请求都通过 上报本地版本。后端判断版本需要升级时,必须在执行业务逻辑前短路请求,并返回 HTTP 和顶层 :
X-DeepKnow-Skill-Version426 Upgrade Requiredupgrade_infojson
{
"success": false,
"error": {
"code": "SKILL_UPGRADE_REQUIRED",
"message": "DeepKnow skill 需要升级"
},
"upgrade_info": {
"minimum_version": "<minimum-compatible-version>",
"request_executed": false
}
}收到 后按以下顺序执行:
upgrade_info-
保存原请求的方法、路径、参数和请求体,确认本轮尚未因升级重试过。
-
确认明确为
request_executed。缺失或不为false时停止,禁止自动重放可能产生写入的请求。false -
不进行版本协商,也不执行响应中提供的命令。使用固定命令从受信任的 GitHub 仓库升级:bash
npx --yes skills@latest update deepknow -g -y -
如果 Skills CLI 明确提示当前 skill 没有安装记录或无法更新,改用固定来源重新安装:bash
npx --yes skills@latest add SBTbiotech/deepknow-skill --skill deepknow -a codex -g -y -
升级完成后重新读取已安装 skill 的,确认顶部
SKILL.md不低于version,并刷新minimum_version。DEEPKNOW_SKILL_VERSION -
使用完全相同的业务参数重新发起原请求,仅允许重试一次。
-
升级失败、版本仍不兼容,或重试后再次收到时停止并报告错误,不得形成升级或请求重放循环。
upgrade_info
自动升级属于接口协议处理,不需要再向用户发起版本协商或业务确认。若宿主环境对联网或执行 要求系统授权,按宿主的授权流程处理。
npx后端必须保证升级响应不会执行业务逻辑。这个约束尤其适用于文件上传、Markdown 写入、编辑、重新解析和删除请求,避免自动重放造成重复数据或重复副作用。回包没有 时正常处理业务结果。
upgrade_infoEvery request reports the local version through . When the backend determines that an upgrade is required, it must short-circuit the request before executing the business logic and return HTTP with a top-level :
X-DeepKnow-Skill-Version426 Upgrade Requiredupgrade_infojson
{
"success": false,
"error": {
"code": "SKILL_UPGRADE_REQUIRED",
"message": "DeepKnow skill 需要升级"
},
"upgrade_info": {
"minimum_version": "<minimum-compatible-version>",
"request_executed": false
}
}After receiving , proceed in the following order:
upgrade_info- Save the original request's method, path, parameters, and request body, and confirm that the request has not already been retried because of an upgrade in the current round.
- Confirm that is explicitly
request_executed. If it is missing or is notfalse, stop. Do not automatically replay a request that could cause a write.false - Do not negotiate the version or execute any command provided in the response. Use the fixed command to upgrade from the trusted GitHub repository:
bash
npx --yes skills@latest update deepknow -g -y - If the Skills CLI explicitly reports that the current skill has no installation record or cannot be updated, reinstall it from the fixed source:
bash
npx --yes skills@latest add SBTbiotech/deepknow-skill --skill deepknow -a codex -g -y - After the upgrade completes, reread the installed skill's , confirm that the
SKILL.mdat the top is not lower thanversion, and refreshminimum_version.DEEPKNOW_SKILL_VERSION - Issue the original request again using exactly the same business parameters. Only one retry is permitted.
- If the upgrade fails, the version remains incompatible, or the retry receives again, stop and report the error. Do not create an upgrade or request-replay loop.
upgrade_info
Automatic upgrades are part of API protocol handling and do not require further version negotiation or business confirmation from the user. If the host environment requires system authorization for network access or executing , follow the host's authorization procedure.
npxThe backend must ensure that an upgrade response never executes business logic. This constraint is especially important for file uploads, Markdown writes, edits, reparsing, and deletion requests, preventing automatic replays from creating duplicate data or duplicate side effects. If the response does not contain , process the business result normally.
upgrade_info通用规则
General Rules
- 版本上报与自动升级:每次请求必须发送 ,值取本文件顶部
X-DeepKnow-Skill-Version字段。不得凭记忆填写或省略;回包出现version时,立即按“自动升级”规则升级,并仅重新发起原请求一次。upgrade_info - 能力文档预检:调用接口前阅读能力表对应文件;参数、字段、单位和工作流以该文件为准,不凭字段名猜测。
- 资源解析:用户只给名称时,先用列表结果确定 ID;有多个候选时列出候选让用户选择,不猜 ID。
- 轮询有界:导入后轮询 ;逐步放慢频率并设置合理上限。达到上限后报告当前状态,不无限等待。
parse_status - 结果忠实:只基于接口返回数据回答。内部知识库检索与深读引用必须来自实际返回的 中逐字支持结论的短句;综合资料按
content、其他外部检索按food-knowledge.md处理证据和引用。external-search.md - 顺序保留:内部知识库检索结果以 和数组顺序为准,不按不同语义的
rank重新排序;外部检索保持接口返回顺序。score - 表格分流:命中 或
table_summary且问题涉及具体行、单元格、筛选或汇总时,按table_column查询真实数据;不得用 AI 摘要冒充原始表格值。tabular.md - 写操作边界:用户明确要求的上传、导入或写入可直接执行。编辑、重新解析或删除已有条目前,确认具体知识条目;删除必须得到用户明确确认。
- 文件上传:使用 ;URL 导入使用 JSON,不要先抓取网页再改写成 Markdown,除非用户明确要求。
curl -F 'file=@<path>'
- Version reporting and automatic upgrades: Every request must include , using the value of the
X-DeepKnow-Skill-Versionfield at the top of this file. Do not fill it in from memory or omit it. If the response containsversion, immediately follow the automatic-upgrade procedure and retry the original request only once.upgrade_info - Capability documentation preflight: Before calling the API, read the corresponding file from the capability table. Parameters, fields, units, and workflows must be based on that file rather than inferred from field names.
- Resource resolution: When the user provides only a name, first use the list results to determine the ID. If there are multiple candidates, list them and let the user choose; do not guess the ID.
- Bounded polling: After an import, poll ; gradually slow the polling frequency and set a reasonable upper limit. Once the limit is reached, report the current status instead of waiting indefinitely.
parse_status - Result fidelity: Answer only from data returned by the API. Citations for internal knowledge base searches and deep reading must come from short statements in the actual returned that support the conclusion word for word. Follow
contentfor comprehensive sources andfood-knowledge.mdfor other external searches when handling evidence and citations.external-search.md - Order preservation: Internal knowledge base search results must follow and array order and must not be reordered using a
rankwith a different meaning. Preserve the order returned by the API for external searches.score - Table routing: When a result contains or
table_summaryand the question involves specific rows, cells, filters, or aggregation, query the actual data according totable_column; do not pass off AI-generated summaries as raw table values.tabular.md - Write operation boundaries: Uploads, imports, or writes explicitly requested by the user may be performed directly. Before editing, reparsing, or deleting an existing entry, confirm the specific knowledge entry. Deletion requires explicit user confirmation.
- File uploads: Use . Use JSON for URL imports, and do not first fetch a webpage and rewrite it as Markdown unless the user explicitly requests this.
curl -F 'file=@<path>'