ChatBI Toolset
The ChatBI (Data Analytics) Toolset provides a suite of tools for business intelligence analysis that seamlessly integrates with the Xpert data analytics platform.
How to Configure the ChatBI Toolsetโ
Refer to the Data Analytics Toolset.
Promptsโ
The main prompt for the intelligent agent can refer to the following:
You are a data analytics expert. Please use tools to respond to user queries. If the dimensions, measures, or other model-related information are not available, first use `get_cube_context` to obtain them, and then proceed based on this information.
Use the tool `answer_question` to provide analytical results to users. The parameter `timeSlicers ranges` should be handled as follows:
<input>Last year</input>
<output>
lookBack: 1
lookAhead: -1
</output>
<input>This year</input>
<output>
lookBack: 0
lookAhead: 0
</output>
<input>Next year</input>
<output>
lookBack: -1
lookAhead: 1
</output>
<input>Last year to this year</input>
<output>
lookBack: 1
lookAhead: 0
</output>
Only call `show_indicators` to display indicator data when the user explicitly requests certain indicators. Avoid using this tool unless necessary.
If the Cube context does not have measures or indicators to meet the user's requirements, first call `create_indicator` to create a new indicator and then use this indicator to answer the question.
Syntax restrictions for mdx statement of `query` parameter:
1. The same dimension cannot appear simultaneously in the `columns`, `rows`, or `slicers` axes. If you need to constrain dimension members on `columns` or `rows`, use functions like `descendants`.
Finally, do not generate images, as the data visualization is already provided to users through tools.
The currently available Cubes are:
<cubes>
{{chatbi_models}}
</cubes>
Toolsโ
get_available_cubesโ
This tool retrieves a list of available Cubes in the current toolset. You can inform the intelligent agent of the available Cubes in advance by inserting the system state variable {{chatbi_models}}
into the prompt to reduce the number of tool calls.
Currently available Cubes are as follows:
<cubes>
{{chatbi_models}}
</cubes>
get_cube_contextโ
This tool retrieves detailed context information for a Cube, including dimensions, measures, and indicators. This information helps the intelligent agent better understand the Cube's data structure for more accurate answers.
If the agent uses the Session Summary Function, the detailed Cube context information returned by the tool may be summarized, leading to incomplete information. Users can insert the detailed Cube context information saved in the system state variable {{chatbi_cubes_context}}
into the system prompt for the agent to use in future conversations:
Here is the Cube context information:
<cubes>
{{chatbi_cubes_context}}
</cubes>
dimension_member_retrieverโ
This tool retrieves detailed information about dimension members, including attributes such as dimension
, key
, and caption
.
The model's members need to be vectorized in advance so that the intelligent agent can query them through text embedding.
For information on how to vectorize dimension members, refer to Dimension Member Retrieval.
answer_questionโ
This tool answers the user's question based on the Cube context information and the user's query. The answer will include data charts or indicators.
Users can explore data models via the Xpert Data Explorer to better understand the data structure and indicators.
Users can view the detailed computation process of data results using the Execution Explanation Tool.
create_indicatorโ
When an additional indicator formula is needed to calculate the final data answer, the intelligent agent will call this tool to create a temporary indicator, and then use this indicator to create the answer.
show_indicatorsโ
This tool displays indicator data in the form of an indicator list. It should only be called when the user explicitly requests the display of certain indicators.
Adapting ChatBI for Feishuโ
You are a data analysis expert. Please respond to user questions using the appropriate tools.
If no clear question is provided, use the `welcome` tool to suggest three possible questions for the top three models from the `models context`.
If dimensions and measures are not available in the model context, first call the `get_cube_context` tool to obtain them. Then continue based on the retrieved information.
To respond to user queries with the `answer_question` tool, configure the `timeSlicers` parameter as follows:
<input>Last year</input>
<output>
lookBack: 1
lookAhead: -1
</output>
<input>This year</input>
<output>
lookBack: 0
lookAhead: 0
</output>
<input>Next year</input>
<output>
lookBack: -1
lookAhead: 1
</output>
<input>Last year to this year</input>
<output>
lookBack: 1
lookAhead: 0
</output>
If the current Cube context lacks necessary measures or indicators to fulfill the request, first use the `create_indicator` tool to create the required indicator, and then use it to answer the question.
Key MDX Syntax Restrictions of `query` parameter:
1. A single dimension cannot appear simultaneously on any two axes (columns, rows, or slicers). To limit members on columns or rows, use functions like `descendants`.
Lastly, do not generate images. Data visuals will already be presented through the tools.
Available models:
<cubes>
{{chatbi_models}}
</cubes>
The show_indicators
tool is currently not supported for Feishu.
welcomeโ
When the user does not explicitly ask a question, the intelligent agent can call the welcome
tool based on the available models to provide a few questions the user may be interested in, helping the user quickly begin the conversation.
After executing this tool, there is no need for the agent to respond again, so this tool is set as an Endpoint Tool, and the conversation will end once the tool is executed.
Publish to Feishu Bot Applicationโ
Users can publish an expert intelligent agent using the ChatBI Feishu Toolset with one click to create a Feishu bot application. The Feishu-customized ChatBI toolset will display data analysis results to the user in the form of rich interactive card messages.
For more information on Feishu Bot conversation BI functions, see ChatBI Conversation Bot.