The Knowledge Q&A service combines large language models with knowledge retrieval capabilities to automatically find relevant content from multiple knowledge bases and generate natural language answers. You can configure models, retrieval parameters, and generation strategies in the console, or integrate the service into your applications using an API.
Create a Q&A Service
- Log on to the console and go to Knowledge Services → Knowledge Q&A.
- Click Create in the upper-right corner. In the dialog box that appears, enter a Service Name (required, up to 40 characters) and a Description (optional, up to 200 characters), then click Confirm.
-
After the service is created, you are redirected to its configuration page. Select the Model used to generate answers, such as qwen3.6-plus. Click the Settings icon to the right of the model to configure the
temperatureandenable_thinkingparameters. The Prompt (optional, up to 500 characters) guides the model's response style and behavior. - Select a retrieval strategy. For details, see Retrieval Modes below.
- Click + Add to associate one or more knowledge bases (up to 15). After you turn on the Priority switch, each knowledge base displays a priority option. You can select High / Medium / Low to set its retrieval priority. To configure independent parameters for a single knowledge base, click the expand icon to the right of the knowledge base to expand its configuration panel. For details, see Independent Knowledge Base Configuration below.
- Enable generation control parameters, such as file pre-parsing, answer refusal, and leakage prevention, as needed. For details, see Generation Control Parameters below.
- Enter a question in the debugging window on the right to view the answer generated by the model, including citations and the retrieval process. You can upload attachments after file pre-parsing is enabled.
- After you complete the configuration, click Publish in the upper-right corner. After publishing, you can call the Q&A service through the API.
- At least one knowledge base must exist, and it must contain successfully parsed documents.
- For multi-knowledge-base joint Q&A, all knowledge bases must reside in the same workspace.
Retrieval Modes
| Mode | How It Works | Use Cases |
|---|---|---|
| Ultra-Fast | Generates an answer directly after a single round of retrieval, with a switch for query rewriting | Simple and clear questions, and scenarios that are sensitive to response speed |
| Multi-Round Intelligent Retrieval | Performs multi-round planning searches (Agentic) based on a large model, which automatically performs intent recognition, query rewriting, and knowledge base routing. You can configure the maximum number of ReAct rounds | Complex or ambiguous questions, and scenarios that require answers synthesized across knowledge bases |
Independent Knowledge Base Configuration
Click the expand icon to the right of a knowledge base to configure its independent retrieval parameters:
| Parameter | Valid Range | Description |
|---|---|---|
| Query Rewriting | On/Off | Rewrites and optimizes the user input to improve retrieval performance. In Ultra-Fast mode, this feature is controlled by this switch. In Multi-Round Intelligent Retrieval mode, the agent automatically rewrites queries |
| Initial Vector Retrieval TopK | 1~100 | The number of chunks initially retrieved in the vector search phase |
| Initial Keyword Retrieval TopK | 1~100 | The number of chunks initially retrieved in the keyword search phase |
| Re-ranking Model | qwen3-rerank, etc. / No model | Independently sorts the results retrieved from this knowledge base. For text-only knowledge bases, select the qwen3-rerank series. For multimodal knowledge bases, select qwen3-vl-rerank |
| Re-ranking Mode | Q&A Mode / Similarity Mode | Q&A Mode ranks chunks by Q&A matching score. Similarity Mode ranks chunks by semantic similarity. Available only when a re-ranking model is selected |
| Similarity Threshold | 0.01~1.0 | Filters out chunks whose scores fall below the threshold after re-ranking. A higher value yields more precise results but may exclude relevant content |
| Max Recall Count | 1~20 | The number of chunks returned from this knowledge base after re-ranking |
| Tag Filtering | — | Filters the retrieval scope based on document tags. Enter a tag and press Enter, or select an existing tag from the drop-down list |
The displayed parameters vary by knowledge base type. Document search knowledge bases display all parameters. Multimodal types, such as image Q&A, do not display the Query Rewriting and TopK parameters.
Generation Control Parameters
| Parameter | Description |
|---|---|
| File Pre-parsing | When enabled, you can upload files (including images and documents) by clicking the attachment button in the debugging window for Q&A. Two parsing modes are available: Full-text Reference, which parses the complete content as context, and Chunk-based Retrieval, which splits the file into chunks and combines them with knowledge base retrieval |
| Answer Refusal | When enabled, the model refuses to answer and returns a custom refusal message if the retrieval results are insufficient to answer the question |
| Leakage Prevention | When enabled, prevents the original text of the knowledge base from being directly leaked in answers. If a potential leak is detected, a custom protection response is returned |
| Multimodal Response | When enabled, the model's answers include multimodal content from the knowledge base, such as images |
| Citation | When enabled, the model's answers display citation sources, indicating which document the answer content comes from |
API Invocation
The Knowledge Q&A service is called through the chat API and returns SSE streaming responses:
SSE Event Types
Q&A responses return events in the following order:
| Event | Description |
|---|---|
plan_start → planning → plan_end | Planning phase: the model plans retrieval and response strategies |
tool_calling → tool_return | Tool calling phase: tool_calling issues a retrieval request, and tool_return returns the matched chunks |
generation_start → generating → generation_end | Generation phase: the final answer is streamed. In generation_end, finish_reason is stop |
In Multi-Round Intelligent Retrieval mode, the entire
plan → tool_calling → tool_return cycle can repeat multiple times. For a complete description of the events, see the chat API.Multi-Turn Conversations
The platform does not retain conversation state. Each request must include the complete messages history. We recommend that you:
- Limit the history length (for example, to the last 10 turns) to avoid exceeding the model's context window.
- Retrieve content based only on the most recent user message to reduce noise.