Create a knowledge base in 5 steps and perform one retrieval and Q&A
After completing this guide, you’ll have created a document-based knowledge base, uploaded documents, experienced retrieval and Q&A in the Playground, and made a retrieval request via API.
Prerequisites
- Alibaba Cloud account
- API Key (created on the Console API Key page, starting with
sk-)
Procedure
1
Create a knowledge base and upload documents
Go to the console’s Data Ingestion → Knowledge Management and click Create Knowledge Base.
- Enter a name and description. Select Document Search as the knowledge base type and Basic Document Q&A as the use case, then click Next.
- Choose Upload Files as the data source, and drag & drop or click to upload a PDF / Word / Markdown file.
- Keep the indexing settings at their defaults and click Create Knowledge Base.
2
Try Q&A in the Playground
Click Playground on the left sidebar, select the knowledge base you just created, switch to Knowledge Q&A at the top, and enter a question.The system first retrieves relevant chunks, then invokes a large language model to generate an answer with citations. You can switch between different models (e.g., Qwen / DeepSeek) to compare results.
3
Integrate via API into your application
First, configure your API Key as an environment variable:Then make a retrieval request:You can copy the
index_id by clicking the corresponding knowledge base on the Knowledge Management page. The returned nodes array contains matched chunks, sorted in descending order by relevance score.Next Steps
- Understand how RAG works: Core Concepts
- Connect external data sources: Data Connectors
- Build a retrieval service for cross-knowledge-base search: Knowledge Retrieval
- Build a Q&A service for streaming responses: Knowledge Q&A
- View the full API reference: API Reference