{/** * @typedef Props * @property {string} apiBaseUrl */} import { CodeGroup } from '@/app/components/develop/code.tsx' import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx' # 知识库 API
high_quality 高质量:使用
ding 模型进行嵌入,构建为向量数据库索引
- economy 经济:使用 keyword table index 的倒排索引进行构建
text_model text 文档直接 embedding,经济模式默认为该模式
- hierarchical_model parent-child 模式
- qa_model Q&A 模式:为分片文档生成 Q&A 对,然后对问题进行 embedding
English、Chinese
mode (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
- rules (object) 自定义规则(自动模式下,该字段为空)
- pre_processing_rules (array[object]) 预处理规则
- id (string) 预处理规则的唯一标识符
- 枚举:
- remove_extra_spaces 替换连续空格、换行符、制表符
- remove_urls_emails 删除 URL、电子邮件地址
- enabled (bool) 是否选中该规则,不传入文档 ID 时代表默认值
- segmentation (object) 分段规则
- separator 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
- max_tokens 最大长度(token)默认为 1000
- parent_mode 父分段的召回模式 full-doc 全文召回 / paragraph 段落召回
- subchunk_segmentation (object) 子分段规则
- separator 分段标识符,目前仅允许设置一个分隔符。默认为 ***
- max_tokens 最大长度 (token) 需要校验小于父级的长度
- chunk_overlap 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
search_method (string) 检索方法
- hybrid_search 混合检索
- semantic_search 语义检索
- full_text_search 全文检索
- reranking_enable (bool) 是否开启rerank
- reranking_mode (String) 混合检索
- weighted_score 权重设置
- reranking_model Rerank 模型
- reranking_model (object) Rerank 模型配置
- reranking_provider_name (string) Rerank 模型的提供商
- reranking_model_name (string) Rerank 模型的名称
- top_k (int) 召回条数
- score_threshold_enabled (bool)是否开启召回分数限制
- score_threshold (float) 召回分数限制
original_document_id 源文档 ID(选填)
- 用于重新上传文档或修改文档清洗、分段配置,缺失的信息从源文档复制
- 源文档不可为归档的文档
- 当传入 original_document_id 时,代表文档进行更新操作,process_rule 为可填项目,不填默认使用源文档的分段方式
- 未传入 original_document_id 时,代表文档进行新增操作,process_rule 为必填
- indexing_technique 索引方式
- high_quality 高质量:使用 embedding 模型进行嵌入,构建为向量数据库索引
- economy 经济:使用 keyword table index 的倒排索引进行构建
- doc_form 索引内容的形式
- text_model text 文档直接 embedding,经济模式默认为该模式
- hierarchical_model parent-child 模式
- qa_model Q&A 模式:为分片文档生成 Q&A 对,然后对问题进行 embedding
- doc_language 在 Q&A 模式下,指定文档的语言,例如:English、Chinese
- process_rule 处理规则
- mode (string) 清洗、分段模式,automatic 自动 / custom 自定义 / hierarchical 父子
- rules (object) 自定义规则(自动模式下,该字段为空)
- pre_processing_rules (array[object]) 预处理规则
- id (string) 预处理规则的唯一标识符
- 枚举:
- remove_extra_spaces 替换连续空格、换行符、制表符
- remove_urls_emails 删除 URL、电子邮件地址
- enabled (bool) 是否选中该规则,不传入文档 ID 时代表默认值
- segmentation (object) 分段规则
- separator 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
- max_tokens 最大长度(token)默认为 1000
- parent_mode 父分段的召回模式 full-doc 全文召回 / paragraph 段落召回
- subchunk_segmentation (object) 子分段规则
- separator 分段标识符,目前仅允许设置一个分隔符。默认为 ***
- max_tokens 最大长度 (token) 需要校验小于父级的长度
- chunk_overlap 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
search_method (string) 检索方法
- hybrid_search 混合检索
- semantic_search 语义检索
- full_text_search 全文检索
- reranking_enable (bool) 是否开启 rerank
- reranking_model (object) Rerank 模型配置
- reranking_provider_name (string) Rerank 模型的提供商
- reranking_model_name (string) Rerank 模型的名称
- top_k (int) 召回条数
- score_threshold_enabled (bool) 是否开启召回分数限制
- score_threshold (float) 召回分数限制
high_quality 高质量
- economy 经济
only_me 仅自己
- all_team_members 所有团队成员
- partial_members 部分团队成员
vendor 上传文件
- external 外部知识库
search_method (string) 检索方法
- hybrid_search 混合检索
- semantic_search 语义检索
- full_text_search 全文检索
- reranking_enable (bool) 是否开启 rerank
- reranking_model (object) Rerank 模型配置
- reranking_provider_name (string) Rerank 模型的提供商
- reranking_model_name (string) Rerank 模型的名称
- top_k (int) 召回条数
- score_threshold_enabled (bool) 是否开启召回分数限制
- score_threshold (float) 召回分数限制
high_quality 高质量
- economy 经济
only_me 仅自己
- all_team_members 所有团队成员
- partial_members 部分团队成员
search_method (text) 检索方法:以下四个关键字之一,必填
- keyword_search 关键字检索
- semantic_search 语义检索
- full_text_search 全文检索
- hybrid_search 混合检索
- reranking_enable (bool) 是否启用 Reranking,非必填,如果检索模式为 semantic_search 模式或者 hybrid_search 则传值
- reranking_mode (object) Rerank 模型配置,非必填,如果启用了 reranking 则传值
- reranking_provider_name (string) Rerank 模型提供商
- reranking_model_name (string) Rerank 模型名称
- weights (float) 混合检索模式下语意检索的权重设置
- top_k (integer) 返回结果数量,非必填
- score_threshold_enabled (bool) 是否开启 score 阈值
- score_threshold (float) Score 阈值
mode (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
- rules (object) 自定义规则(自动模式下,该字段为空)
- pre_processing_rules (array[object]) 预处理规则
- id (string) 预处理规则的唯一标识符
- 枚举:
- remove_extra_spaces 替换连续空格、换行符、制表符
- remove_urls_emails 删除 URL、电子邮件地址
- enabled (bool) 是否选中该规则,不传入文档 ID 时代表默认值
- segmentation (object) 分段规则
- separator 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
- max_tokens 最大长度(token)默认为 1000
- parent_mode 父分段的召回模式 full-doc 全文召回 / paragraph 段落召回
- subchunk_segmentation (object) 子分段规则
- separator 分段标识符,目前仅允许设置一个分隔符。默认为 ***
- max_tokens 最大长度 (token) 需要校验小于父级的长度
- chunk_overlap 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
mode (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
- rules (object) 自定义规则(自动模式下,该字段为空)
- pre_processing_rules (array[object]) 预处理规则
- id (string) 预处理规则的唯一标识符
- 枚举:
- remove_extra_spaces 替换连续空格、换行符、制表符
- remove_urls_emails 删除 URL、电子邮件地址
- enabled (bool) 是否选中该规则,不传入文档 ID 时代表默认值
- segmentation (object) 分段规则
- separator 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
- max_tokens 最大长度(token)默认为 1000
- parent_mode 父分段的召回模式 full-doc 全文召回 / paragraph 段落召回
- subchunk_segmentation (object) 子分段规则
- separator 分段标识符,目前仅允许设置一个分隔符。默认为 ***
- max_tokens 最大长度 (token) 需要校验小于父级的长度
- chunk_overlap 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
content (text) 文本内容/问题内容,必填
- answer (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
- keywords (list) 关键字,非必填
content (text) 文本内容/问题内容,必填
- answer (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
- keywords (list) 关键字,非必填
- enabled (bool) false/true,非必填
- regenerate_child_chunks (bool) 是否重新生成子分段,非必填
search_method (text) 检索方法:以下四个关键字之一,必填
- keyword_search 关键字检索
- semantic_search 语义检索
- full_text_search 全文检索
- hybrid_search 混合检索
- reranking_enable (bool) 是否启用 Reranking,非必填,如果检索模式为 semantic_search 模式或者 hybrid_search 则传值
- reranking_mode (object) Rerank 模型配置,非必填,如果启用了 reranking 则传值
- reranking_provider_name (string) Rerank 模型提供商
- reranking_model_name (string) Rerank 模型名称
- weights (float) 混合检索模式下语意检索的权重设置
- top_k (integer) 返回结果数量,非必填
- score_threshold_enabled (bool) 是否开启 score 阈值
- score_threshold (float) Score 阈值
- metadata_filtering_conditions (object) 元数据过滤条件
- logical_operator (string) 逻辑运算符: and | or
- conditions (array[object]) 条件列表
- name (string) 元数据字段名
- comparison_operator (string) 比较运算符,可选值:
- 字符串比较:
- contains: 包含
- not contains: 不包含
- start with: 以...开头
- end with: 以...结尾
- is: 等于
- is not: 不等于
- empty: 为空
- not empty: 不为空
- 数值比较:
- =: 等于
- ≠: 不等于
- >: 大于
- < : 小于
- ≥: 大于等于
- ≤: 小于等于
- 时间比较:
- before: 早于
- after: 晚于
- value (string|number|null) 比较值
type (string) 元数据类型,必填
- name (string) 元数据名称,必填
name (string) 元数据名称,必填
document_id (string) 文档 ID
- metadata_list (list) 元数据列表
- id (string) 元数据 ID
- value (string) 元数据值
- name (string) 元数据名称
| code | status | message |
|---|---|---|
| no_file_uploaded | 400 | Please upload your file. |
| too_many_files | 400 | Only one file is allowed. |
| file_too_large | 413 | File size exceeded. |
| unsupported_file_type | 415 | File type not allowed. |
| high_quality_dataset_only | 400 | Current operation only supports 'high-quality' datasets. |
| dataset_not_initialized | 400 | The dataset is still being initialized or indexing. Please wait a moment. |
| archived_document_immutable | 403 | The archived document is not editable. |
| dataset_name_duplicate | 409 | The dataset name already exists. Please modify your dataset name. |
| invalid_action | 400 | Invalid action. |
| document_already_finished | 400 | The document has been processed. Please refresh the page or go to the document details. |
| document_indexing | 400 | The document is being processed and cannot be edited. |
| invalid_metadata | 400 | The metadata content is incorrect. Please check and verify. |