Enrich Context for AI
Introduction
Context is the information that guides Holistics AI to understand your specific business and analytics needs, such as business rules, goals, terms, possible values, and common analysis patterns.
What does Holistics AI use for context?
From the modeling layer
-
Datasets:
- Metadata:
name
,label
anddescription
relationships
between data modelscontext > analysis
including underlying views for View Underlying Data and breakdown groups for Drill Down & Break Downtags
- Metadata:
-
Data models:
- Metadata:
name
,label
anddescription
tags
- Metadata:
-
Fields (dimensions, measures, and metrics):
- Metadata:
name
,label
,type
anddescription
definition
- Metadata:
From the reporting layer
-
Dashboards:
- Metadata:
name
andlabel
blocks
: visualization blocks, text blocks, controls and filterstags
- Metadata:
-
Visualizations:
- Metadata:
label
- Fields and filters used in the visualization
- Result data (if shared with Holistics AI)
- Metadata:
Other context sources
- Prebuilt context by the Holistics Engineering team: Role and scope of the AI, product knowledge, feature guidelines, AQL foundations, and documentation knowledge.
- User's current chat: Questions asked within the ongoing conversation.
- Auto-learning context: User preferences (for example: concise responses, more suggestions)
Where can you enrich context for AI?
You can enhance AI context by adding details to:
description
of any object: dataset, data model, field, tagdefinition
(i.e. formula) of a metric or dimensioncontext > analysis
tags
Object's description
Descriptions give you the most space and flexibility to add business context, goals, synonyms, and AI instructions.
Below are examples of before & after enriching the context for AI:
Example #1: Adding a business goal
You can create a separate metric for the goal, or add it to the metric's description, to help your business executives get answers faster.
metric net_sales {
label: "Net Sales"
description: '''
Business Goal: Average monthly Net Sales of this year should be
at least 20% more than that of last year
'''
}

Example #2: Adding operational context
Add operational context to let both your users and the AI know what isn't always reflected in the data.
metric return_ratio {
label: "Return Ratio"
description: '''
Product quality issue: If the return ratio of a particular product_id is
higher than 30%, it means the product has quality issues
'''
definition: @aql safe_divide(return_amount, gross_sales)
}

Example #3: Add common breakdown
With more declarative context for "Locations," "Continent" was added to the result.
dataset dataset ecommerce_sales {
label: "Ecommerce - Sales"
description: '''
Common breakdowns: Locations (continent, country, city),
Category (category name, product name),
Demographics (gender, age group)
'''
}

Example #4: Add an instruction for the AI response's language
The AI responded in Vietnamese - the language used in the user's question.
For general instructions, please use "IMPORTANT INSTRUCTION" (all caps) to get more accurate answers.
dataset ecommerce_sales {
label: "Ecommerce - Sales"
description: '''
IMPORTANT INSTRUCTION: ALWAYS RESPOND IN THE LANGUAGE USED IN THE USER'S QUESTION
'''
}

Metric and dimension definitions
For accuracy and consistency, encapsulate logic in metric and dimension formulas - especially for ambiguous terms or complex business rules.
Example of “Active User” with both description and formula:
metric active_user_count {
label: 'Active user count'
description: '''
Active users are those who placed at least one order in the previous month
'''
definition: @aql
ecommerce_orders
| where(ecommerce_orders.created_at is @(last month))
| count_distinct(ecommerce_orders.user_id)
}
Analysis context
When you customize underlying views for View Underlying Data or breakdown groups for Drill Down, you not only improve the end-user experience, you also give AI more signal.
For example, if Revenue has predefined underlying views of Orders, Users and Products, AI can surface top canceled orders, churned users, or least-selling products when investigating a Revenue drop.
Object's tags
Tags help organize and categorize models, datasets, and dashboards, benefiting both users and AI.
For example, a “verified” or “trusted” tag signals reliable content to prefer; a “deprecated” tag signals content to avoid.
How to enrich context faster?
Holistics AI includes built-in features that help you enrich data context quickly and at scale.
Create field descriptions with AI
Holistics AI helps automatically generate clear, contextual descriptions for your data fields. This helps business users to understand data fields better, as well as improve the quality of AI queries by providing better context.
Create tag descriptions with AI
Holistics AI quickly generates meaningful descriptions for your tags based on the tag name, user-provided keywords, or conventions from existing tags in your workspace. This improves documentation consistency and enhances context for other AI features.
Create metrics and dimensions with AI
As noted earlier, the most reliable way to encode context is to translate business rules into actual metrics or dimensions. Our AI Explore Data helps you quickly create these. You can always review its analysis and AQL formula before adding the field back to the dataset.