Why AI context matters
While Omni automatically understands your schema,ai_context allows you to codify company-specific knowledge that isn’t captured in table names or column labels.
Think of this as training your AI analyst on your company’s specific playbook. In a retail environment, this means:
- Defining terminology: Does Revenue refer to gross ad billings, net publisher payout, or recurring subscription MRR?
- Handling personas: Automatically filtering by a brand manager’s specific publication or a sales rep’s assigned advertiser categories when they ask about
my performance. - Calculating yield: Defining industry-standard formulas like CPM (Cost Per Mille) or ARPU (Average Revenue Per User) so the AI can track monetization efficiency without manual intervention.
The AI context hierarchy
To help the AI return accurate, business-aligned answers, you can add context to the underlying data model. For this example, think of the context in three layers: model, topic, and view. Omni applies this logic from the top down - starting at the model level - allowing you to set universal rules that get more specific as you move toward individual fields.| Layer | Purpose | Example |
|---|---|---|
| Model | Universal truths. Global business logic and formatting rules that apply to all queries in the model. | Setting the revenue_by_brand table as the source of truth for all Total Revenue queries. |
| Topic | The persona. The topic level defines more specific details scoped to your pre-defined datasets. | Instructing the AI to use minutes_on_site as the primary metric when a user asks about “stickiness.” |
| View/Field | Field precision. Specific definitions, synonyms, and allowed values for columns. | Mapping Publication or Property as synonyms for the brand_name dimension. |
Requirements
To implement this example in your own Omni instance, you’ll need:- Familiarity with Omni’s modeling layer
- Permissions in Omni that allow you to edit a shared model
- A connected data source that contains media or AdTech data
Setting universal rules in the model file
The model file defines your universal rules that will exist across the entire model. These rules act as permanent guardrails, ensuring the AI adheres to your core business standards regardless of which topic in the model a user is exploring.
Model-level context
Setting dataset logic in the topic
Topic-level context defines more specific details scoped to your pre-defined datasets. This tells the AI how to navigate things like your campaign spend, traffic, and customer data.
Topic-level context
Adding precision at the view level
View-level context ensures the AI understands technical identifiers, distinguishes between different types of spend and delivery, and maps editorial jargon like Properties or Verticals to the correct dimensions.
View-level context: Brands view
View-level context: Campaign Spend view
Iterating on AI context
Improving AI quality is an iterative process. Use this workflow to refine your context:- Monitor: Use the AI usage dashboard in the Analytics section to find queries with negative (👎) feedback.
- Identify: Did the AI fail due to a missing synonym or lack of business logic?
- Tune: Update the YAML at the appropriate level (model, topic, or view).
- Verify: Re-run the prompt in the Query Helper to ensure the fix worked.
Next steps
- Model-level ai_context — Reference for model-level
ai_contextsyntax - Topic-level ai_context — Reference for topic-level
ai_contextsyntax - View-level ai_context — Reference for view-level
ai_contextsyntax - Optimize models for Omni AI — Broader guidance on optimizing your model for AI