Skip to main content

Build a Q&A Application Without Code

This guide walks you through quickly building a private-knowledge Q&A application using Alibaba Cloud Bailian’s agent application development capabilities.

Large language models (LLMs) cannot directly answer questions about proprietary or domain-specific knowledge. However, with Alibaba Cloud Bailian’s agent application development capabilities and your own private knowledge documents, you can build an LLM-powered Q&A application that answers domain-specific questions—no coding required.

Why Can’t LLMs Answer Private Knowledge Questions?

Core Concept

An LLM’s knowledge comes solely from its training data and does not include any private, domain-specific, or up-to-date information. As a result, asking it directly about specific products or internal knowledge often yields inaccurate or hallucinated responses.

Solution: RAG (Retrieval-Augmented Generation)

Retrieval-Augmented Generation (RAG) is a technique that integrates external knowledge bases with large language models. It retrieves relevant information and feeds it to the model, enabling answers grounded in your proprietary knowledge. Its core workflow is as follows:
  1. Data Processing & Vectorization: Uploaded documents are automatically split into chunks. An embedding model converts each chunk into a mathematical vector, which is stored in a dedicated vector database.
  2. Retrieval: When a question arrives, the system vectorizes it and retrieves the Top-k most semantically similar document chunks from the vector database.
  3. Generation: The original question and retrieved document snippets are combined into a prompt and submitted to the LLM, which then generates the final answer.

Building a Private-Knowledge Q&A Application

This tutorial uses the new Agent application (Agent 2.0). In the current console, clicking Create Agent creates an Agent 2.0 application by default; to create a legacy (Agent 1.0) application, click the Legacy Agent creation link at the bottom of the creation dialog — the page will redirect to the legacy Bailian console.

Creating an Agent

1

Create the Application

Go to the Application Management page. Click Create Agent, fill in the Application Name (this tutorial uses “Alibaba Cloud Bailian Phone Shopping Assistant”), and click Create Now. You will be taken to the application configuration page automatically.
2

Select a Model

In the Planning section of the configuration page, open the model selector:
  • Smart Mode: the platform automatically balances cost and quality—no manual model selection required. Recommended for beginners. The AUTO tier routes each request to an appropriate performance tier based on task complexity.
  • Specific Model: choose a concrete model. For better multi-step planning, we recommend models with strong tool-calling capabilities, such as the Qwen-Max series; click More Models for additional options.
Using LLMs incurs charges. Alibaba Cloud Bailian offers limited-time free quotas. To check your remaining free quota, go to the Model Marketplace and click View Details on any model card.
3

Design the Prompt

In the prompt input box of the Planning section, define the agent’s role and task. We recommend setting the prompt to:“You are an Alibaba Cloud Bailian phone shopping assistant. Your task is to help customers compare phone specifications, analyze their needs, and provide personalized recommendations.”Variables are supported in the system prompt: click Create Variable above the prompt box to define them, and type / to insert a configured variable.
4

Test the Application

Enter a question in the chat panel on the right (for example, “What phone models does Alibaba Cloud Bailian offer?”).
Because no “Alibaba Cloud Bailian phones” knowledge has been added yet, the application’s responses will be generic—or even fabricated. Next, we’ll attach a knowledge base.

Creating a Knowledge Base

1

Open the Knowledge Management Page

Go to the Data Ingestion > Knowledge Management page and click Create Knowledge Base.
2

Enter Basic Information

Fill in the Name and Description, set the knowledge base type to Document Search, choose the Basic Document Q&A use case, and click Next.
3

Upload Knowledge Documents

Choose Upload Files as the data source, then drag and drop or click to upload a document about “Alibaba Cloud Bailian phones” — you can download the sample file 阿里云百炼系列手机产品介绍.docx (PDF, Word, and Markdown formats are also supported).
4

Finish Creation

Keep the default index settings and click Create Knowledge Base.
The system automatically parses, chunks, vectorizes, and indexes the documents. The knowledge base becomes available for retrieval once its status changes to Ready. For the full set of configuration options (knowledge base type, use case, chunking strategy), see Creating a Knowledge Base.

Creating and Publishing a Knowledge Retrieval Service

The new Agent uses knowledge bases through a knowledge retrieval service. One retrieval service can contain one or more knowledge bases; it must be created and published before an application can reference it.
1

Create the Retrieval Service

Go to the Knowledge Service > Knowledge Retrieval page, click Create Retrieval Service in the top-right corner, fill in the Service Name (this tutorial reuses “Alibaba Cloud Bailian Phones”), and click Confirm.
2

Bind Knowledge Bases

After creation, the configuration page opens automatically. Click + Add and bind the “Alibaba Cloud Bailian Phones” knowledge base created in the previous step. When binding multiple knowledge bases, you can set a weight for each—the higher the weight, the higher the priority of its retrieval results in the final ranking.
3

Test and Publish

Enter a query in the chat window on the right (for example, “Which phone has the best camera?”) and confirm the returned chunks meet your expectations. Then click Publish in the top-right corner. The retrieval service can only be attached to an application after it is published.
Retrieval service settings (knowledge base routing, re-ranking model, recall count) can remain at their defaults in this tutorial. See Knowledge Retrieval Service for the full description.

Attaching the Retrieval Service to Your Agent

1

Enter Application Configuration

Go to the Application Management page. Locate your “Alibaba Cloud Bailian Phone Shopping Assistant” application and click Configure to open the configuration page.
2

Attach the Service

Find the Retrieval Strategy area under Knowledge Base: on first configuration, the page indicates that no retrieval service is configured—click Configure Now to open the service selection panel, or click Configure in the top-right corner of the area.In the Configure Retrieval Service panel, use the search box to locate the published “Alibaba Cloud Bailian Phones” service, verify it by service name, version, and the included knowledge bases, then click Link on the right side of the target service to attach it to the current application.

Testing and Publishing

1

Test Q&A Performance

Return to the application configuration page and ask again in the right-hand chat panel, for example: “Help me pick the best camera phone from Alibaba Cloud Bailian under ¥3,000.”With retrieval-augmented generation enabled, the application now answers your shopping questions accurately based on the knowledge base.
2

Publish the Application

Click Publish in the top-right corner, review the version information in the Publish Version window, and click Confirm Publish.
Version IDs start from V1.0 and increment automatically; each application keeps up to 10 versions. Publishing is required before the application can be invoked via API/SDK.

Best Practices

You’ve now mastered the fundamentals of building a basic RAG application. Next steps include:
  1. Optimize RAG Performance: Learn how to fine-tune RAG at every stage—query rewriting, retrieval, recall, and re-ranking. See Knowledge Base Optimization for details.
  2. Add External Tools: Extend your agent’s capabilities by integrating plugins, MCP tools, and more. See Agent applications (Agent 2.0).
  3. Build Advanced Applications: Use Workflow Applications for complex process orchestration, with conditional branches, loops, and parallel execution for multi-step business scenarios.
  4. External Integration: Integrate your application into business systems via the DashScope SDK or HTTP APIs.

Frequently Asked Questions

This may stem from multiple points in the RAG pipeline:
  1. Document chunking breaks semantic coherence.
  2. The embedding model fails to capture core meaning accurately.
  3. Retrieval misses the most relevant document chunks.
Try these optimizations:
  1. Use well-structured documents (e.g., Markdown, JSON).
  2. In knowledge base configuration, switch to Custom Mode, experiment with different embedding models and ranking settings to improve response quality.
Enable the Intervene Agent Responses feature and configure a fallback reply for cases where no knowledge base results are found.