Build your first Knowledge Base in five steps, then run a retrieval and a Q&A call.
Follow these steps to create a Knowledge Base from scratch, upload documents, and try retrieval and Q&A.
Prerequisites
- An Alibaba Cloud account.
- An API key — create one in the Console API Key page.
The first time you sign in to the console, the RAG Knowledge Base service is activated automatically and you get a 720-hour free trial.
Steps
1
Create a Knowledge Base
In the console, click Index Management in the left navigation, then click New Knowledge Base.Enter a name (for example, "Product Manual"), pick Unstructured Documents as the type, and leave the rest at their defaults.
| Parameter | Default | Notes |
|---|---|---|
| Embedding model | General Embedding | Supports Chinese and English |
| Chunking method | Smart Chunking | Splits along the document layout |
| Chunk size | 1024 tokens | Choose from 256 / 512 / 1024 / 2048 / 4096 |
2
Import data
Open the Knowledge Base, click Upload Documents, and select a local PDF or Word file.Supported formats: PDF, DOCX, DOC, XLSX, XLS, PPTX, TXT, MD, HTML, CSV.Upload up to 100 files per call. Each file must be under 100 MB.
3
Wait for indexing
Once a document is uploaded, the platform parses it, splits it into Chunks, embeds them, and builds the Index. When the status flips to Ready, the document is searchable.Track progress in the document list. Indexing takes about 1 minute per MB on average.
4
Try it in the Playground
Click Playground in the left navigation, select your new Knowledge Base, and type a question.The platform first retrieves the relevant Chunks, then asks the LLM to generate an answer with citations. Switch between models (Qwen, DeepSeek) to compare output.
5
Call the API from your app
Run this command in your terminal to make a retrieval call:The
nodes array in the response contains the matched Chunks, sorted by relevance score in descending order.What's next
- Learn how RAG works: Core Concepts.
- Connect external data sources: Data Connectors.
- Set up Multi-index Retrieval through a Knowledge Search service: Knowledge Retrieval.
- Get streaming RAG answers through a Knowledge Q&A service: Knowledge Q&A.
- Browse the full endpoint list: API Reference.