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。
创建知识库时同步导入的文件 ID 列表,值来自 addFile 注册文件后返回的 fileId,或通过 listFile 查询已有文件获取。建议导入不超过 10000 个。注意参数名为 docIds(非 file_ids/fileIds),但校验失败时错误信息中的参数名为 file_ids
数据源配置列表。
知识库类型,取值与 structureType/knowledgeScene 的匹配见知识库类型与使用场景
使用场景,取值取决于 knowledgeType,见知识库类型与使用场景
向量嵌入模型名称,如 text-embedding-v4。
多模态向量模型名称,如 qwen3-vl-embedding。knowledgeScene 为 image_qa(图片问答)或 visual_perception_qa(视觉理解)时必填,缺失或取值非法会返回 invalid multi embedding model。
文档切片大小(字符数)。建议值 300-800。
创建知识库时可同步导入文件。通过指定类目 ID,可导入对应类目下的所有文件,建议导入不超过 10000 个。