You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add sql_snippets, join_specs, and benchmark accuracy improvements
- Add genie_sql_filters, genie_sql_measures, genie_sql_expressions, and
genie_join_specs to serialized_space for better Genie SQL generation
- Update ABAC_PROMPT.md with unambiguous benchmark rules, business default
instructions, and domain-adaptive generation guidance
- Use two-step create-then-patch for Genie Space (CREATE endpoint doesn't
support sql_snippets/join_specs)
- Restructure TUNING.md to prioritize Genie accuracy review checklist
- Increase Databricks FMAPI timeout to 600s for larger prompt responses
- Remove abac.auto.tfvars from make setup (generated by make generate)
Made-with: Cursor
Copy file name to clipboardExpand all lines: uc-quickstart/utils/genie/aws/ABAC_PROMPT.md
+83-12Lines changed: 83 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -228,40 +228,111 @@ Violating any of these causes validation failures. Double-check consistency acro
228
228
6. Select masking functions from the library above (or create new ones)
229
229
7. Generate both output files. For entity names in tag_assignments, always use **fully qualified** names (`catalog.schema.table` or `catalog.schema.table.column`). For function_name in fgac_policies, use relative names only (e.g. `mask_pii`). Every fgac_policy MUST include `catalog`, `function_catalog`, and `function_schema`. **CRITICAL**: set `function_schema` to the schema where the tagged columns actually live — do NOT default all policies to the first schema. In `masking_functions.sql`, group the `CREATE FUNCTION` statements by schema with separate `USE SCHEMA` blocks. Only create each function in the schema where it is needed
230
230
8. Every `match_condition` and `when_condition` MUST only use `hasTagValue()` and/or `hasTag()` — no other functions or operators
231
-
9. Generate Genie Space config — all five fields below. Tailor everything to the user's actual tables, domain, and business context:
232
-
-`genie_space_title` — a concise, descriptive title (e.g., "Financial Compliance Analytics", "Clinical Data Explorer")
231
+
9. Generate Genie Space config — all nine fields below. **Derive everything from the user's actual tables, columns, and domain** — do NOT copy the finance/healthcare examples below if the user's data is from a different industry. Adapt terminology, metrics, filters, and joins to whatever vertical the tables belong to (retail, manufacturing, telecom, education, logistics, etc.):
232
+
-`genie_space_title` — a concise, descriptive title reflecting the user's domain (e.g., finance → "Financial Compliance Analytics", retail → "Retail Sales & Inventory Explorer", telecom → "Network Performance Dashboard")
233
233
-`genie_space_description` — 1–2 sentence summary of what the space covers and who it's for
234
-
-`genie_sample_questions` — 5–10 natural-language questions a business user would ask (shown as conversation starters in the UI)
235
-
-`genie_instructions` — domain-specific guidance for the Genie LLM (e.g., how to calculate metrics, date conventions, terminology, masking behaviour awareness)
236
-
-`genie_benchmarks` — 3–5 benchmark questions with ground-truth SQL for evaluating accuracy
234
+
-`genie_sample_questions` — 5–10 natural-language questions a business user in that domain would ask (shown as conversation starters in the UI). Must reference the user's actual table/column names.
235
+
-`genie_instructions` — domain-specific guidance for the Genie LLM. **Must include business defaults** — look at status/state columns in the user's tables and define which values are the default filter (e.g., if a table has `OrderStatus` with values like 'Fulfilled'/'Cancelled'/'Pending', instruct: "default to fulfilled orders"). Also cover date conventions, metric calculations, terminology, and masking awareness relevant to the user's domain.
236
+
-`genie_benchmarks` — 3–5 benchmark questions with ground-truth SQL. **Each question must be unambiguous and self-contained** — include explicit qualifiers so the question and SQL agree on scope (e.g., "What is the average risk score for active customers?" not "What is the average customer risk score?"). Avoid questions that could reasonably be interpreted with different WHERE clauses.
237
+
-`genie_sql_filters` — default WHERE clauses derived from the user's status/state columns (e.g., active records, completed transactions, open orders). Each filter has `sql`, `display_name`, `comment`, and `instruction`.
238
+
-`genie_sql_measures` — standard aggregate metrics derived from the user's numeric columns (e.g., sums, averages, counts that are meaningful in the domain). Each measure has `alias`, `sql`, `display_name`, `comment`, and `instruction`.
239
+
-`genie_sql_expressions` — computed dimensions derived from the user's date/category columns (e.g., year extraction, bucketing, status grouping). Each expression has `alias`, `sql`, `display_name`, `comment`, and `instruction`.
240
+
-`genie_join_specs` — relationships between the user's tables based on foreign key columns (look for matching ID columns like `CustomerID`, `OrderID`, `ProductID`). Each join has `left_table`, `left_alias`, `right_table`, `right_alias`, `sql`, `comment`, and `instruction`.
237
241
238
242
### Output Format — Genie Space Config (in `abac.auto.tfvars`)
239
243
240
-
Include these variables alongside groups, tag_policies, etc.:
244
+
Include these variables alongside groups, tag_policies, etc. The example below shows a **finance/healthcare** scenario — adapt all values to match the user's actual tables and industry:
genie_space_description = "Explore transaction data, patient encounters, and compliance metrics. Designed for analysts, compliance officers, and clinical staff."
245
249
246
250
genie_sample_questions = [
247
251
"What is the total revenue by region for last quarter?",
248
-
"Show the top 10 customers by transaction volume",
252
+
"Show the top 10 active customers by transaction volume",
249
253
"Which accounts have been flagged for AML review?",
250
254
"How many patient encounters occurred last month?",
251
-
"What is the average transaction amount by account type?",
255
+
"What is the average completed transaction amount by account type?",
252
256
]
253
257
254
-
genie_instructions = "When calculating revenue, sum the Amount column. 'Last month' means the previous calendar month (not last 30 days). Round monetary values to 2 decimal places. Patient names are masked for non-clinical roles — queries about patient counts or encounter dates are always allowed."
258
+
genie_instructions = "When asked about 'customers' without a status qualifier, default to active customers (CustomerStatus = 'Active'). When asked about 'transactions' without specifying status, default to completed transactions (TransactionStatus = 'Completed'). 'Last month' means the previous calendar month (not last 30 days). Round monetary values to 2 decimal places. Patient names are masked for non-clinical roles — queries about patient counts or encounter dates are always allowed."
255
259
256
260
genie_benchmarks = [
257
261
{
258
-
question = "What is the total transaction amount?"
259
-
sql = "SELECT SUM(Amount) as total_amount FROM catalog.schema.transactions"
262
+
question = "What is the total amount of completed transactions?"
263
+
sql = "SELECT SUM(Amount) as total_amount FROM catalog.schema.transactions WHERE TransactionStatus = 'Completed'"
260
264
},
261
265
{
262
-
question = "How many patients were seen last month?"
266
+
question = "How many patient encounters occurred last month?"
263
267
sql = "SELECT COUNT(*) FROM catalog.schema.encounters WHERE EncounterDate >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL 1 MONTH) AND EncounterDate < DATE_TRUNC('month', CURRENT_DATE)"
264
268
},
269
+
{
270
+
question = "What is the average risk score for active customers?"
271
+
sql = "SELECT AVG(RiskScore) as avg_risk_score FROM catalog.schema.customers WHERE CustomerStatus = 'Active'"
272
+
},
273
+
]
274
+
275
+
genie_sql_filters = [
276
+
{
277
+
sql = "customers.CustomerStatus = 'Active'"
278
+
display_name = "active customers"
279
+
comment = "Only include customers with Active status"
280
+
instruction = "Apply when the user asks about customers without specifying a status"
Copy file name to clipboardExpand all lines: uc-quickstart/utils/genie/aws/README.md
+26-14Lines changed: 26 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# OneReady — Genie Onboarding Quickstart
2
2
3
-
Get your workspace **OneReady** for Genie in Databricks One. An AI-powered Terraform quickstart that automates business-user onboarding — from ABAC governance and masking functions to a fully configured Genie Space with AI-generated sample questions, instructions, and benchmarks — all from three config files, no `.tf` editing required.
3
+
Get your workspace **OneReady** for Genie in Databricks One. An AI-powered Terraform quickstart that automates business-user onboarding — from ABAC governance and masking functions to a fully configured Genie Space with AI-generated sample questions, instructions, benchmarks, SQL filters, measures, and join specs — all from three config files, no `.tf` editing required.
4
4
5
5
## What This Quickstart Automates
6
6
@@ -12,8 +12,11 @@ Get your workspace **OneReady** for Genie in Databricks One. An AI-powered Terra
12
12
-**Masking functions** — Auto-deploy SQL UDFs to enforce column-level data masking (e.g., mask SSN, redact PII, hash emails).
13
13
-**Genie Space** — Auto-create a new Genie Space from your tables, or bring an existing one. New spaces include AI-generated config:
14
14
-**Sample questions** — Conversation starters tailored to your data domain
15
-
-**Instructions** — Domain-specific LLM guidance (metric definitions, date conventions, terminology)
make apply # Validates → promotes → terraform apply
114
122
```
115
123
116
-
That's it. `make apply` creates groups, tags, masking functions, FGAC policies, UC grants, and a Genie Space (with AI-generated sample questions, instructions, and benchmarks) — all in one command.
124
+
That's it. `make apply` creates groups, tags, masking functions, FGAC policies, UC grants, and a Genie Space (with AI-generated sample questions, instructions, benchmarks, SQL filters/measures/expressions, and join specs) — all in one command.
117
125
118
126
To tear everything down: `make destroy`.
119
127
@@ -166,16 +174,20 @@ Managed automatically based on `genie_space_id` in `env.auto.tfvars`:
166
174
When `make generate` creates the ABAC config, it also generates Genie Space config in `abac.auto.tfvars`:
|`genie_sql_filters`| Default WHERE clauses (e.g., active customers, completed transactions) that guide Genie's SQL generation |
185
+
|`genie_sql_measures`| Standard aggregate metrics (e.g., total revenue, average risk score) |
186
+
|`genie_sql_expressions`| Computed dimensions (e.g., transaction year, age bucket) |
187
+
|`genie_join_specs`| Table relationships with join conditions (e.g., accounts to customers on CustomerID) |
176
188
177
189
178
-
All five fields are included in the `serialized_space` when a new Genie Space is created. Review and tune them in `generated/abac.auto.tfvars` alongside the ABAC policies before applying.
190
+
All nine fields are included in the `serialized_space` when a new Genie Space is created. Review and tune them in `generated/abac.auto.tfvars` alongside the ABAC policies before applying.
0 commit comments