Create a knowledge base

Updated at:

Select the knowledge base type and use case, then configure parsing and chunking strategies.

A knowledge base is the core entity of the RAG platform, organizing a set of documents, chunks, embeddings, and index configurations to provide retrieval and question-answering capabilities.

Knowledge base types

You must select a knowledge base type during creation. Each type corresponds to different data formats and retrieval methods:

TypeApplicable DataRetrieval MethodDescription
Document SearchPDF / Word / Markdown / HTML / ExcelHybrid Vector + KeywordBuilds a mixed-index for documents, files, images, and Excel sheets
Data QueryCSV / Excel / RDS TablesNatural Language to SQL (NL2SQL)Queries structured tables based on schema; supports NL2SQL for headers and column names
Image Q&AProduct Images / Design MockupsMultimodal EmbeddingPrimarily indexes images; supports image search and multimodal (image + text) Q&A
Audio/Video SearchScreen Recordings / Training VideosTranscription + Segment LocalizationIntegrates understanding and intelligent summarization of audio/video content

Use cases

When selecting Document Search as the knowledge base type, you must further specify a use case. Different use cases determine distinct retrieval and response-generation strategies:

Use CaseDescription
Basic Document Q&ARetrieves document chunks and directly generates answers using the LLM
Rich-Media ResponsesAutomatically formats responses with layout and relevant images, generating rich-media replies
Visual Understanding (Rich Text Documents)No chunking required; the LLM directly interprets visually rich documents and images
Ultra-Fast Q&AOptimized for highly structured or simple documents, delivering ultra-low-latency Q&A

NoteOther knowledge base types—Data Query, Image Q&A, and Audio/Video Search—do not offer use case options.

Console-based creation

  1. Navigate to Knowledge Management: Log on to the console and go to Data Ingestion → Knowledge Management, then click Create Knowledge Base in the top-right corner.

  2. Enter basic information:

    FieldRequiredDescription
    NameYes1–20 characters; unique within the workspace
    DescriptionYesUp to 200 characters; aids filtering
    Knowledge Base TypeYesDocument Search / Data Query / Image Q&A / Audio/Video Search
    Use CaseYesBasic Document Q&A / Rich-Media Responses / Visual Understanding / Ultra-Fast Q&A
  3. Import data: Choose a data source.

    Data SourceDescription
    Upload FilesUpload files directly via the UI; up to 50 files per batch, each ≤ 150 MB
    Select CategoryImport from dataset file categories; supports automatic synchronization
    Select FilesChoose specific files under a dataset category for import

    Supported formats: PDF / DOCX / XLSX / PPTX / TXT / MD / HTML / CSV, etc.

  4. Choose a parsing method: By default, Default Settings are used—the system automatically selects an appropriate parser based on file type, requiring no manual adjustment in most scenarios.

    To customize parsing per format, click Custom Settings. Available parsing methods include:

    Parsing MethodDescriptionApplicable Scenarios
    Electronic Document ParsingStandard text extractionWell-formatted electronic documents
    Intelligent Document ParsingLayout-level OCR + structural recoveryScanned documents, complex layouts
    LLM-based Document ParsingUses large language models to understand document structureNon-standard or irregular document formats
    Qwen-VL ParsingVision-language modelDocuments with mixed text and images
    Audio/Video ParsingSpeech-to-text transcription + timestamped segment localizationAudio/video files
  5. Configure index settings:

    ParameterDefault ValueDescription
    Chunking MethodSmart ChunkingAlternatives: by length / by page / by heading / by regex / by delimiter
    Maximum Chunk Length600Range: 10–6000
    Embedding Modeltext-embedding-v4Semantic vector model supporting both Chinese and English
    Vector StoragePlatform StorageAlternative: self-managed ADB-PG engine

    See Chunking and vectorization for details.

    NoteRetrieval parameters—including ranking model, TopK, and similarity threshold—are configured in the retrieval service. See Knowledge retrieval for details.

  6. Complete the creation: Click Create Knowledge Base. The system automatically performs parsing, chunking, vectorization, and index building. Once the knowledge base status changes to Ready, it becomes available for retrieval. Processing progress can be monitored in the document list.

API-based creation

Use the Create a knowledge base and import data API to create a knowledge base and submit an import task in one step:

curl -X POST https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/indices/rag/index/create_v2 \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-knowledge-base",
    "structureType": "unstructured",
    "sinkType": "BUILT_IN",
    "sourceType": "DATA_CENTER_CATEGORY",
    "embeddingModelName": "text-embedding-v4",
    "chunkSize": 600,
    "source_ids": ["cate_xxx"]
  }'

NoteChunking strategies can be adjusted after creation, but changing the embedding model triggers full index reconstruction. For complete capacity limits, see Capacity and limits.

ImportantAfter creating your knowledge base, proceed to Upload documents.