Add ai_hint to Orders explore and referrer dimension for agent routing - #123
Open
lightdash[bot] wants to merge 1 commit into
Open
lightdash[bot] wants to merge 1 commit into
lightdash[bot] wants to merge 1 commit into
Conversation
## Review finding **"Empty response despite successful query execution on dbt_orders with referrer breakdown"** An AI agent successfully queried the Orders explore with `order_date_month`, `referrer`, and an order-count metric, but the response path suggested `dbt_orders_referrer` may not be reliably routed. Investigation confirmed the `referrer` dimension is already exposed as a plain `string` dimension — no field declaration or join was missing. ## Root cause The `referrer` field name exists in three explores (`dbt_orders`, `dbt_orders_no_preagg`, and `dbt_support_requests`), with no `ai_hint` on either the explore or the field to disambiguate. Agents lacked guidance on which explore to target for order-level referrer breakdowns, causing unreliable routing. ## Change made Two targeted `ai_hint` additions in `models/dbt_orders.yml` — no SQL changes: 1. **Explore-level `ai_hint`** (under `models[dbt_orders].meta`) — tells agents that Orders is the primary explore for order trends broken down by referrer, and distinguishes it from `dbt_support_requests` which has a referrer field in a different context. 2. **Dimension-level `ai_hint`** (on the `referrer` column's `meta.dimension`) — clarifies that this field is for order-level traffic-source attribution and directs agents to use `dbt_orders` (not `dbt_support_requests`) when the question is about order volume or revenue by referrer. Descriptions were not changed; routing guidance is placed exclusively in `ai_hint` per project conventions. Co-authored-by: lightdash[bot] <183517231+lightdash[bot]@users.noreply.github.com> Co-authored-by: Oliver Ramsay <oliver.ramsay@lightdash.com>
Contributor
Author
|
🔍 Lightdash preview environment ready: https://analytics.lightdash.cloud/projects/46a6c261-d7be-4b46-95b7-c3983a639ca3/home Compiled from branch |
Lightdash Validation Results
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review finding
"Empty response despite successful query execution on dbt_orders with referrer breakdown"
An AI agent successfully queried the Orders explore with
order_date_month,referrer, and an order-count metric, but the response path suggesteddbt_orders_referrermay not be reliably routed. Investigation confirmed thereferrerdimension is already exposed as a plainstringdimension — no field declaration or join was missing.Root cause
The
referrerfield name exists in three explores (dbt_orders,dbt_orders_no_preagg, anddbt_support_requests), with noai_hinton either the explore or the field to disambiguate. Agents lacked guidance on which explore to target for order-level referrer breakdowns, causing unreliable routing.Change made
Two targeted
ai_hintadditions inmodels/dbt_orders.yml— no SQL changes:Explore-level
ai_hint(undermodels[dbt_orders].meta) — tells agents that Orders is the primary explore for order trends broken down by referrer, and distinguishes it fromdbt_support_requestswhich has a referrer field in a different context.Dimension-level
ai_hint(on thereferrercolumn'smeta.dimension) — clarifies that this field is for order-level traffic-source attribution and directs agents to usedbt_orders(notdbt_support_requests) when the question is about order volume or revenue by referrer.Descriptions were not changed; routing guidance is placed exclusively in
ai_hintper project conventions.