Skip to main content

Knowledge Retrieval

Multi-index Retrieval across Knowledge Bases with Agentic multi-turn search.

The Knowledge Retrieval service searches one or more Knowledge Bases for relevant content from your private corpus. Create and configure retrieval services in the console, or call them through the API.
After Wiki is enabled in a Flagship Knowledge Base, the system automatically provides two retrieval services: Chunk retrieval (created with the Knowledge Base) and Wiki retrieval (created when Wiki is enabled). Both are published on creation. Wiki retrieval returns topic-oriented Wiki Pages with source information. See Wiki and Ontology Knowledge Graph.

Capabilities

CapabilityDescription
Multi-index RetrievalSearch up to 15 Knowledge Bases in one call — no need to query each separately.
Hybrid retrievalVector search + keyword search + Rerank in a single pipeline.
Fine-grained configPer-Knowledge-Base recall counts, Rerank model, and similarity threshold.
MultimodalText, image, and table search.
Agentic multi-turnModel-driven multi-step planning with automatic query rewrites.

Retrieval pipeline

  1. Query rewriting (optional): rewrite the user input to improve recall.
  2. Vector + keyword retrieval: recall Chunks by semantic similarity and keyword matching in parallel.
  3. Rerank: a ranking model re-sorts the recalled Chunks and filters low-scoring ones.
  4. Return results: after reranking, the original semantic scores are weighted, and Chunks are returned in descending order of weighted score.

Create a retrieval service

1

Open Knowledge Retrieval

Sign in to the console and click Knowledge Retrieval in the left navigation.
2

Create a service

Click Create Retrieval Service in the top right. Enter a Service Name (required, up to 40 characters) and a Description (optional, up to 200 characters), then click Confirm.
3

Bind Knowledge Bases

On the configuration page, click + Add to bind one or more Knowledge Bases (up to 15). Set a weight for each Knowledge Base: a higher weight prioritizes its results in the final ranking.
4

Configure parameters

Set the global retrieval parameters described below. To configure independent parameters for a Knowledge Base, click its Settings icon to expand the configuration panel.
5

Test retrieval

Enter a query in the chat window on the right to view the returned Chunks, including similarity scores, source documents, and retrieval latency.
6

Publish

Click Publish in the top right. After publishing, the retrieval service is callable through the API.
  • At least one Knowledge Base must exist and contain successfully parsed documents.
  • For multi-Knowledge-Base retrieval, all Knowledge Bases must reside in the same workspace.

Global retrieval config

The following parameters apply to all bound Knowledge Bases:
ParameterValid rangeDescription
Knowledge-Base routingOn / OffAutomatically determines which Knowledge Bases to query based on retrieval intent. Routing uses an LLM and incurs model invocation fees.
Rerank modelqwen3-rerank / qwen3-rerank-hybrid / qwen3-vl-rerank / No modelUses a model to rank results across Knowledge Bases. Without a model, each Knowledge Base ranks its results independently. Select the qwen3-rerank series for text-only Knowledge Bases or qwen3-vl-rerank for multimodal Knowledge Bases.
Rerank modeQ&A Mode / Similarity Mode / Custom Advanced ModeQ&A Mode prioritizes Chunks likely to answer the query. Similarity Mode ranks by semantic similarity. Custom Advanced Mode allows custom intervention in the reranking model.
Max results1–20Total number of Chunks returned after reranking.

Per-Knowledge-Base config

Expand a bound Knowledge Base's configuration panel to tune its retrieval parameters independently:
ParameterValid rangeDescription
Query rewritingOn / OffRewrites and optimizes the input query to improve retrieval.
Initial vector retrieval TopK1–100Number of Chunks initially recalled by vector retrieval.
Initial keyword retrieval TopK1–100Number of Chunks initially recalled by keyword retrieval.
Rerank modelqwen3-rerank, etc. / No modelIndependently ranks this Knowledge Base's recalled results.
Rerank modeQ&A Mode / Similarity ModeRanks by Q&A matching score or semantic similarity. Available only when a reranking model is selected.
Similarity threshold0.01–1.0Filters out Chunks scoring below the threshold after reranking. Higher values improve precision but may exclude relevant content.
Max results1–20Number of Chunks returned from this Knowledge Base after reranking.
Tag filtering—Filters retrieval by document tags. Enter a tag and press Enter, or select an existing tag from the dropdown.

Retrieval modes

ModeHow it worksLatencyBest for
Fast ModeSingle-pass retrieval.Lowest.Simple factual questions.
Multi-turn Agentic ModeModel-driven multi-step planning with automatic query rewrites.Higher.Complex questions, multi-step reasoning.

API calls

Use the knowledge search endpoint:
curl -X POST https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/indices/knowledge/search \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "<retrieval-service-id>",
    "query": "How do I configure a chunking strategy?"
  }'
The returned nodes array contains the matched Chunks with text, relevance score, and source metadata.
agent_id is the ID of a published retrieval service (for example, aid-xxxxxxxxxxxxxxxx), not a Knowledge Base ID. Configure and publish result counts, routing, and reranking in the service; this example does not require index_id, top_k, or a reranking model in the request. Calling an unpublished service returns an Agent not published error.
If recall isn't where you want it, follow RAG Optimization for targeted improvements.