Requirements
To follow this guide, you’ll need:- An understanding of Omni modeling concepts
- Familiarity with Omni’s model IDE
- Familiarity with basic AI terminology such as tokens, agents, etc.
Common questions
What is AI context?
What is AI context?
- Descriptions of topics and fields
- Possible field values
- How a field might be used
Why provide context to AI?
Why provide context to AI?
What does Omni AI use for context?
What does Omni AI use for context?
Context and tuning pre-built by the Omni Engineering team
The ai_context parameters in the model, topics and views, if provided
Topic's description, if provided
Topic's name and base_view
Prioritized field properties
fully_qualified_name(view_name.field_name) - For example,order_items.total_sale_pricename- For example,total_sale_pricealiasesai_contextall_values- Used to specify the possible values for the field
Pruned field properties
descriptiongroup_label- The categorization of the fieldlabel- If defined, the value will be used. If not provided, a title-cased field name with underscores removed will be used. For example,Total Sale Pricesemantic_type- The dimension or aggregate type, such asdimension,sum,count, etc. This value is evaluated based on the field definition and can’t be directly modified.data_type- The field’s data type, such asnumber,string, etc.sample_values- Example values for the fieldsynonyms- Other terms used to refer to the field
Where does context apply?
Where does context apply?
- Omni Agent / Embedded chat instances
- Workbook Agent in the workbook
- AI summary visualizations
- AI filter generator
What limitations does context have?
What limitations does context have?
- ~15-25K is reserved for Omni app context, which is used to ensure queries are generated properly
- The remaining ~175K characters are allocated for context from the semantic layer before truncation, starting with field metadata
Topic metadata & prioritized field properties
description, name, base_view, ai_context, and the included fields’ prioritized properties (ex: name), let’s say the total characters used is around 10,000.Topic field metadata
Field-level context
description, sample_values, and ai_context. Let’s add 140 characters to account for the AI-specific metadata, which brings the total characters per field to 300 characters:Remaining fields for inclusion
How is context to the AI processed?
How is context to the AI processed?
Context and agent behavior
As the previous section explained, Omni assemblesai_context from multiple levels — model, topic, view, and field — and passes it to the Omni Agent as part of the query generation prompt. The LLM that powers the Omni Agent makes its own decisions about which context to follow, how to weight it, and how to resolve apparent contradictions.
This means:
- Model-level
ai_contextis not guaranteed to override topic-levelai_context. All context is passed together; the LLM decides what to prioritize. - Context is guidance, not strict instruction. The LLM may partially follow, fully follow, or in some cases not follow a given instruction, especially when instructions are complex or contradictory.
- Behavior can be non-deterministic. Running the same query twice may result in different context being applied, particularly when context is large or contains conflicting signals.
Curate AI outputs across the model
You can use the model parameterai_context to pass context shared across topics. This parameter may also be useful for topic selection in the Omni Agent.
Personalize context with user attributes
Theai_context parameter at the model, topic, and view levels supports user attributes through {{omni_attributes.<attribute_name>}} syntax. At query time, Omni substitutes each placeholder with the current user’s attribute value, allowing you to tailor AI behavior per user or group.
ai_context at the model, topic, and view levels only. Dimension and measure ai_context does not support this syntax — the value is used as-is. Field references and filter conditions are also not supported and will produce a validation warning.Optimize context for different AI models
Theai_context parameter at the model, topic, and view levels supports model-specific customization through the omni_llm namespace. This ensures optimal performance across AI model options by allowing you to tailor AI instructions to the capabilities of different AI model tiers:
smartest- Most capable models suited for complex reasoningstandard- Balanced models for typical queriesfastest- Optimized for speed and simple requests
{{# omni_llm.smartest }}) would apply when the model tier is smartest, and the second ({{^ omni_llm.smartest }}) would apply when the model tier is standard or fastest:
ai_context references for models, topics, and views for more information and examples.
Optimize context for different AI agents
Theai_context parameter at the model, topic, and view levels also supports agent-specific customization through the omni_agent namespace. This lets you scope portions of your context to the AI agent that will read it, preventing bulky agent-specific content from inflating context windows for other agents.
The three agent types correspond to existing AI settings configuration categories:
analyze- Used for search-model tool and query generationbuild- Used for topic metadata generation and learn-from-conversationsimple_summarize- Used for tile/visualization summaries and query metadata
ai_context references for models, topics, and views for more information and examples.
Use constants for reusable AI context
You can define reusable AI instruction blocks asconstants and reference them across multiple ai_context fields using @{constant_name} syntax. This approach helps you maintain shared context (tone, privacy guidance, domain context) in a single location instead of duplicating it across models, topics, views, and sample queries.
ai_context fields, ensuring consistent instruction blocks across your model while keeping maintenance centralized.
See the constants reference for more details and examples.
Implement chain-of-thought reasoning
If you want the Omni Agent to give a more thorough explanation of what is being generated (topic selection, field selection, etc.), you can include the following context within the model’sai_context.
This can be altered and tweaked if needed, but the reference to GenerateQuery is required for proper behavior.
Output summaries in multiple languages
If you’d like the Omni Agent to summarize outputs in multiple languages, you can include the following context:Curate topics
Topics have anai_context parameter, which is useful for providing behavioral prompts and guidance for handling certain questions specific to the topic.
For example:
Limit fields included in the context window
The Omni Agent only uses fields within the context of a topic. Fields withhidden: true are excluded from the context window.
To control which fields are included, use the ai_fields parameter in a topic. For included fields, you can also provide additional context at the field level.
We recommend periodically checking the Analytics > AI usage dashboard to see what questions your users are asking. This helps you identify opportunities to promote commonly used calculations and aggregations to the shared model, improving the self-serve experience over time.
Reuse logic and limit the context window with topic extensions
Topics that you’re already leveraging in Omni can be extended to further curate them for AI. Using theextends parameter, you can reuse the definition of an existing topic without needing to repeat the code. Consider the following Order Transactions topic, which you want to extend to create a curated version dedicated to AI usage:
extends: [ order_items ] to extend the Order Transactions topic. You can then specify what to include in the AI-specific topic, such as limiting fields, filtering the data for specific use cases, adding more AI context, and so on:
Add example queries as context
Along with providing context about the topic itself, you can use the topic’ssample_queries to provide example questions. This approach is useful if you anticipate specific, recurring questions or you find that the Omni Agent struggles with date filters.
To do this, you’ll want to:
- Create a query in a workbook that contains the correct answer to the question.
- In the workbook, click Model > Save as sample query to topic.
- When prompted, fill in the following:
- Label - A user-friendly name for the query
- Description - An optional description
- Display on topic overview - If checked, the query will display as a sample query when the topic is selected in a new query tab
- Include in AI context - If checked, the query will be included in the AI context for the topic
- Prompt - An optional example prompt that could be used to generate this query
- AI context - Optional, additional context for the AI
- When finished, click Save.
Curate views and fields
Views also have anai_context parameter which can be useful for passing context to AI that is specific to the view.
Keeping fields organized and labeled can not only help you create a top-notch self-service experience, it can also make Omni’s AI more efficient. The following parameters can be used to add metadata to fields for the purposes of AI:
ai_context- Adds context useful for AI responsesall_values- All possible values for the field- Note: when the dbt integration is enabled,
accepted_valuestests will be ingested asall_values
- Note: when the dbt integration is enabled,
sample_values- Example values for the fieldsynonyms- Other terms used to refer to the field
In the workbook
In the workbook
- In the field browser, click the (three dots icon) next to the field.
-
Click Modeling > Edit to open the Edit field side panel.

In the IDE
In the IDE

