All Products
Search
Document Center

DataWorks:Knowledge base

Last Updated:Mar 26, 2026

Configure the ChatBI knowledge base to help the LLM (Large Language Model) understand your business terminology and generate more accurate SQL queries. By adding question templates, glossary terms, and business logic, you reduce the gap between how users phrase questions and how your data is structured.

Important

Only ChatBI administrators can view and edit the knowledge base.

Knowledge base objects

The knowledge base contains three types of objects, each targeting a different kind of semantic gap:

Object What it does When to use it
Question template Pairs a common question with a verified SQL statement. ChatBI runs the SQL directly when the question matches. Use for recurring, well-defined questions where you want exact, predictable results—for example, "Monthly sales trend of Product B in Outlet A."
Term Defines business vocabulary and synonyms. Use when users phrase questions with terms that differ from column names, or when domain-specific words (such as "month-over-month") need disambiguation.
Business logic Captures business concepts and their definitions in natural language. Use when a concept requires a formula or condition to interpret correctly—for example, ` ord_cnt_1d>0 ` defines a valid order.
Question templates and business logic both relate to business semantics but serve different purposes. Question templates answer specific, predictable questions with verified SQL. Business logic teaches ChatBI how to interpret a concept—it informs query generation rather than replacing it.

How the knowledge base works

When ChatBI receives a question, it checks the knowledge base for relevant templates, terms, and business logic associated with the associated datasets. Matching entries inform how ChatBI interprets the question and constructs the execution plan. This improves Q&A accuracy for sessions that use the associated datasets.

Add question templates

A question template pairs a natural-language question with an exact SQL statement. When a session question matches a template, ChatBI runs the predefined SQL directly, producing consistent and verified results.

Write effective questions: Be specific. Include the entities, metrics, and time scope your users typically ask about. Use variables in the ${parameter_name} format to make templates reusable across different values.

To add a question template:

  1. Log on to Alibaba Cloud and open the ChatBI intelligent data insight page. Select the region where your DataWorks resource group and datasets are located. <table> <thead> <tr> <td><p><a href="https://dataworks.data.aliyun.com/cn-hangzhou/chat-bi/">China (Hangzhou)</a></p></td> <td><p><a href="https://dataworks.data.aliyun.com/cn-shanghai/chat-bi/">China (Shanghai)</a></p></td> <td><p><a href="https://dataworks.data.aliyun.com/cn-shenzhen/chat-bi/">China (Shenzhen)</a></p></td> <td><p><a href="https://dataworks.data.aliyun.com/cn-hongkong/chat-bi/chat">China (Hong Kong)</a></p></td> </tr> </thead> <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup> <tbody> <tr> <td><p><a href="https://dataworks.data.aliyun.com/cn-chengdu/chat-bi/">China (Chengdu)</a></p></td> <td><p><a href="https://dataworks.data.aliyun.com/cn-beijing/chat-bi/">China (Beijing)</a></p></td> <td><p><a href="https://dataworks.data.aliyun.com/cn-zhangjiakou/chat-bi/">China (Zhangjiakou)</a></p></td> <td><p><a href="https://dataworks.data.aliyun.com/ap-southeast-5/chat-bi/chat">Indonesia (Jakarta)</a></p></td> </tr> </tbody> </table>

  2. In the left navigation pane, click Knowledge base, then click the Question Template tab.

Add templates in either of two ways:

Configure on the page

  1. Click Add.

  2. On the Create Question Template page, set the following parameters:

    Parameter Description
    Question A common question in a session. Can contain variables in the ${parameter_name} format. Example: Monthly sales trend of ${commodityName} in ${shopName}.
    SQL A data query SQL statement that returns accurate results for the question. If the question contains a variable, the SQL must include a parameter with the same name. Example: SELECT shop_name, commodity_name, sales, month FROM ads_order_table WHERE shop_Name = ${shopName} AND commodity_Name = ${commodityName} ORDER BY month;
    Parameters If the question and SQL contain variables, provide enumeration or sample values. Format: ${parameter_name}: ["value1", "value2", "value3"]
    Dataset The datasets this template applies to. If left blank, the template applies globally.
  3. Click Save.

Import from a local file

  1. Click Import and Add.

  2. In the dialog box, click Download Template. Fill in the Question, Script, Params, and Dataset columns.

  3. Drag the file into the dialog box, or click + to select the file.

  4. Click Confirm.

Add terms

Terms define the business vocabulary ChatBI uses to interpret user questions. Add synonyms, abbreviations, and translations so ChatBI can map informal or domain-specific phrasing to the correct data.

On the Knowledge base page, click the Term Management tab. Add terms in either of two ways:

Configure on the page

  1. Click Add.

  2. On the Create Term Management page, set the following parameters:

    Parameter Description
    Term A business term used in communication and analysis. Example: month-over-month.
    Alias Synonyms, abbreviations, full names, or translations of the term. Press Enter after each alias to add multiple values.
    Dataset The datasets this term applies to. If left blank, the term applies globally.
  3. Click Save.

Import from a local file

  1. Click Import and Add.

  2. In the dialog box, click Download Template. Fill in the Business Term, Alias Names, Description, and Dataset columns.

  3. Drag the file into the dialog box, or click + to select the file.

  4. Click Confirm.

Add business logic

Business logic captures how your organization defines key concepts. Use it to teach ChatBI what a term means in practice—especially when the definition involves a calculation, a condition, or domain-specific rules.

Write effective definitions: State the definition as a clear, direct rule. For example, ` ord_cnt_1d>0 indicates a valid order ` is more useful than a vague description.

On the Knowledge base page, click the Business Logic tab. Add business logic in either of two ways:

Configure on the page

  1. Click Add.

  2. On the Create Business Logic page, set the following parameters:

    Parameter Description
    Business Concept The name of a business concept. Example: valid order.
    Logic Explanation The definition of the concept. Example: ` ord_cnt_1d>0 indicates a valid order `.
    Dataset The datasets this business logic applies to. If left blank, the logic applies globally.
    Field After selecting a dataset, select fields from the dataset tables to associate the concept with a specific table or field.
  3. Click Save.

Import from a local file

  1. Click Import and Add.

  2. In the dialog box, click Download Template. Fill in the Business Concept, Business Description, Tables And Columns, and Dataset columns.

  3. Drag the file into the dialog box, or click + to select the file.

  4. Click Confirm.

Manage knowledge base objects

Edit an object

  1. In the left navigation pane, click Knowledge base.

  2. On the tab for the object type, click Edit in the Action column.

Search for an object

On the object tab, enter a keyword in the search box and press Enter.

Click an object to view its details.

Delete an object

On the object tab, find the object and click Delete in the Action column.

Next steps

  • To improve coverage over time, review questions that ChatBI could not answer and add corresponding question templates or business logic.

  • To apply knowledge base entries to specific datasets only, set the Dataset field when creating each object.