Knowledge Base type and usage scenario
knowledgeType and knowledgeScene correspond to Knowledge Base Type and Usage Scenario in step 1 of the console creation wizard. They must be supplied together or omitted together — sending only one returns knowledgeType and knowledgeScene cannot be empty. When both are omitted, the system applies defaults based on structureType.
The console only offers a Usage Scenario choice for Document Search. The other three types have a fixed scenario that the console fills in automatically, but you must still send the pair explicitly when creating a Knowledge Base through the API.
| knowledgeType | Console label | structureType | Available knowledgeScene |
|---|---|---|---|
document | Document Search | unstructured | basic_document_qa (basic document Q&A)visual_perception_qa (visual understanding, rich text documents)lite_document_qa (express Q&A) |
table | Data Query | structured | basic_table_qa (fixed) |
image | Image Q&A | unstructured | image_qa (fixed) |
multimedia | Audio and Video Search | unstructured | basic_multimedia_qa (fixed) |
- An incompatible
knowledgeTypeandstructureTypepair returnsknowledgeType and structureType do not match. AknowledgeScenethat does not belong to the selected type returnsknowledgeType and knowledgeScene do not match. lite_document_qa(express Q&A) requiressinkTypeto beBUILT_IN. Using the defaultDEFAULTreturnsLite Rag only supports BUILT_IN sink type.visual_perception_qaandimage_qamust specify a multimodal embedding model throughmultimodalEmbeddingModelName(for exampleqwen3-vl-embedding), otherwise the request returnsinvalid multi embedding model.- The
documenttype also has avisual_document_qa(rich media answers) scenario. The API still accepts this value, but the console no longer exposes it, so avoid it for new Knowledge Bases.
Authorizations
DashScope API Key,在控制台 API Key 页面 获取。
Body
application/json知识库名称,1-20 字符。
知识库描述,1-200 字符。
结构类型:unstructured(非结构化)或 structured(结构化)。
存储类型,默认 DEFAULT。BUILT_IN 表示使用平台内置向量存储,knowledgeScene 为 lite_document_qa(极速问答)时必须为 BUILT_IN。
数据源类型,如 DATA_CENTER_FILE。
数据源配置列表。
知识库类型,对应控制台的知识库类型:document(文档搜索)、table(数据查询)、image(图片问答)、multimedia(音视频搜索)。取值需与 structureType 匹配:document、image 和 multimedia 搭配 unstructured,table 搭配 structured。必须与 knowledgeScene 同时提供或同时省略;同时省略时,系统按 structureType 采用默认配置。
使用场景,对应控制台的使用场景,取值取决于 knowledgeType:document 支持 basic_document_qa(基础文档问答)、visual_perception_qa(视觉理解,富文本文档)、lite_document_qa(极速问答);table 固定为 basic_table_qa;image 固定为 image_qa;multimedia 固定为 basic_multimedia_qa。控制台仅在文档搜索类型下提供场景选项,其余类型自动填入固定值,但通过 API 创建时仍需显式传入。必须与 knowledgeType 同时提供或同时省略。注意:lite_document_qa 要求 sinkType 为 BUILT_IN;visual_perception_qa 和 image_qa 要求通过 multimodalEmbeddingModelName 指定多模态向量模型。此外 document 还接受 visual_document_qa(图文并茂回复),但控制台已不再提供该入口。
向量嵌入模型名称,如 text-embedding-v4。
多模态向量模型名称,如 qwen3-vl-embedding。knowledgeScene 为 image_qa(图片问答)或 visual_perception_qa(视觉理解)时必填,缺失或取值非法会返回 invalid multi embedding model。
文档切片大小(字符数)。建议值 300-800。
创建知识库时可同步导入文件。通过指定类目 ID,可导入对应类目下的所有文件,建议导入不超过 10000 个。