Rifqi Hafizuddin commited on
Commit ·
839e32c
1
Parent(s): db6db73
/fix planner can now plan quarter comparison
Browse files
src/config/prompts/planner.md
CHANGED
|
@@ -85,12 +85,20 @@ only a `TaskList` object that conforms to the provided schema.
|
|
| 85 |
is still the ELEMENT type — a list of names is `"string"`, a date range is
|
| 86 |
`"date"`. It is **never** `"list"`.
|
| 87 |
- **Filters are ANDed — never stack two disjoint ranges on one column.** Every
|
| 88 |
-
`filters[]` entry combines with AND, so two non-overlapping `between` ranges on
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
- **Use only the `args` a tool lists** — e.g. `analyze_aggregate` takes only
|
| 95 |
`data`/`aggregations`/`group_by`, so never add `order_by`/`limit` to it.
|
| 96 |
- **Top-N ("top/most/least N by <metric>") is a single `retrieve_data` query**,
|
|
|
|
| 85 |
is still the ELEMENT type — a list of names is `"string"`, a date range is
|
| 86 |
`"date"`. It is **never** `"list"`.
|
| 87 |
- **Filters are ANDed — never stack two disjoint ranges on one column.** Every
|
| 88 |
+
`filters[]` entry combines with AND, so two non-overlapping `between` ranges on the
|
| 89 |
+
SAME column (e.g. a date in Q1 2025 AND in Q1 2026) match **zero rows**. Never AND
|
| 90 |
+
two ranges on one column expecting an OR.
|
| 91 |
+
- **Period-over-period comparison = one query per period.** To compare two time
|
| 92 |
+
windows (e.g. Q1 2025 vs Q1 2026), emit a SEPARATE `retrieve_data` (+ its own
|
| 93 |
+
`analyze_*`) task for EACH period, each carrying its own `between` filter for that
|
| 94 |
+
window; the final answer compares the per-period results. Do NOT attempt it in one
|
| 95 |
+
query — there is no way to bucket a date into a quarter/month (no derived columns;
|
| 96 |
+
`group_by` is over EXISTING columns only), so a single spanning range collapses the
|
| 97 |
+
periods into one number and the comparison is lost.
|
| 98 |
+
- **Time-bound a metric by the event's OWN date.** Filter a measure by the column
|
| 99 |
+
that dates the event you are measuring — revenue/sales by the order/transaction
|
| 100 |
+
date, NOT by an entity-creation date like `products.created_at` or
|
| 101 |
+
`customers.registered_at`. Join to the table that holds that date if needed.
|
| 102 |
- **Use only the `args` a tool lists** — e.g. `analyze_aggregate` takes only
|
| 103 |
`data`/`aggregations`/`group_by`, so never add `order_by`/`limit` to it.
|
| 104 |
- **Top-N ("top/most/least N by <metric>") is a single `retrieve_data` query**,
|