Skip to content

Commit 49ffbca

Browse files
committed
docs(spec): the candidates description scopes the clarifying question, and two ask eval cases
ListDatasetsOutputSchema.candidates and the DatasetTermCandidateSchema docblock said every candidate is offered for a clarifying question. Both now say what the list_datasets description says: a term with a measure among its candidates is asked about, and a word whose candidates are all dimensions is at most a possible grouping. No shape changes. skills/objectstack-ask/evals gains two cases: a matched measure beside a word whose candidates are all dimensions (computed, grouped, no question back), and a bare near word with a measure candidate (still asked about). Claude-Session: https://claude.ai/code/session_016WV4d1Dv2AVwokgRqfdKp2 Co-authored-by: Claude <noreply@anthropic.com>
1 parent c08785a commit 49ffbca

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

‎packages/spec/src/ai/dataset-tools.zod.ts‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,16 @@ export const LIST_DATASETS_MAX_CANDIDATES_PER_TERM = 5;
117117
* A candidate is NOT a match. A match ({@link DatasetTermMatchSchema}) says
118118
* the term equals one of the member's words after normalization, and D3 rule
119119
* 2 lets one match win. A candidate says only that the platform offers the
120-
* member for a clarifying question; what counts as a match is unchanged, and
121-
* a term has candidates only when it has no match anywhere in the answer.
120+
* member as a possible reading; what counts as a match is unchanged, and a
121+
* term has candidates only when it has no match anywhere in the answer.
122+
*
123+
* What a term's candidates are offered for is read from all of them together
124+
* (ADR-0149 D3, the second amendment note under its rules). A term with a
125+
* measure among its candidates is offered them for a clarifying question. A
126+
* word whose candidates are all dimensions is at most a possible grouping:
127+
* never ask about it, and it never stops a matched measure. Both are the
128+
* same shape: the kind is the `measures.` or `dimensions.` prefix of
129+
* `member`.
122130
*
123131
* The entry is a pointer, `{ term, dataset, member }`, and carries no
124132
* `matchedOn`: that key states an equality a candidate does not have. It
@@ -307,8 +315,10 @@ export const ListDatasetsOutputSchema = lazySchema(() => z.object({
307315
),
308316
warning: z.string().optional().describe('Why the answer is partial; present exactly when `partial` is'),
309317
candidates: z.array(DatasetTermCandidateSchema).min(1).optional().describe(
310-
'Members offered as possible readings of a term that matched no member of any listed dataset, for a '
311-
+ 'clarifying question. A candidate is not a match: its term has no entry in any dataset\'s `matches`. The '
318+
'Members offered as possible readings of a term that matched no member of any listed dataset: for a '
319+
+ 'clarifying question when a measure is among the term\'s candidates. A word whose candidates are all '
320+
+ 'dimensions is at most a possible grouping: never ask about it, and it never stops a matched measure. '
321+
+ 'A candidate is not a match: its term has no entry in any dataset\'s `matches`. The '
312322
+ 'platform selects none: the list carries no score, and its order is the listing order stated here, not a '
313323
+ 'ranking. Every candidate is a member this caller may read, listed in `datasets`. Terms in the order sent; '
314324
+ 'for one term, datasets in the order listed, and each dataset\'s measures before its dimensions, as its '

‎skills/objectstack-ask/evals/metric-selection-fallback.json‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,26 @@
150150
"must_contain": ["240", "partial"],
151151
"must_not_contain": ["unknown"]
152152
}
153+
},
154+
{
155+
"id": 16,
156+
"prompt": "用户说:「按行业看销售额」 You called `list_datasets({ terms: ['销售额', '按行业'] })`. The answer lists one dataset, `sales_analysis` (label 销售分析), with `matches: [{ term: '销售额', member: 'measures.sales_amount', matchedOn: 'label' }]`; its dimensions include `industry`, labelled 行业. 「按行业」 matched nothing, and the answer carries `candidates: [{ term: '按行业', dataset: 'sales_analysis', member: 'dimensions.industry' }]`. What do you do next, and how do you write the answer?",
157+
"expected_output": "销售额 matches exactly one measure, so the governed metric answers. 「按行业」 matched nothing and its one candidate is a dimension, so its candidates are all dimensions: it is at most a possible grouping. The user is not asked about it, and it does not stop the matched measure. The question asks for the figure by industry, so the next step is one `query_dataset` call with `datasetName: 'sales_analysis'` and a `selection` whose `measures` is `['sales_amount']` and whose `dimensions` is `['industry']`. The reply carries no question back: it is the answer, written in Chinese, with the figures shown by 行业 label and the source cited from the tool's answer (as in 「指标:销售额(数据集:销售分析)」). The candidate is not treated as a match for any measure, and nothing is computed from the object tools.",
158+
"files": [],
159+
"assertions": {
160+
"must_contain": ["query_dataset", "销售额", "行业"],
161+
"must_not_contain": ["aggregate_records", "非指标口径", "?", "?"]
162+
}
163+
},
164+
{
165+
"id": 17,
166+
"prompt": "The user asks: \"What are our sales?\" `list_datasets({ terms: ['sales'] })` answers one dataset, `sales_analysis` (label Sales Analysis), with `matches: []`. Its one measure is `sales_amount`, labelled Sales Amount and described as \"Amount of opportunities closed as won\"; its dimensions are `industry`, labelled Industry, and `close_quarter`, labelled Close Quarter. The answer also carries `candidates: [{ term: 'sales', dataset: 'sales_analysis', member: 'measures.sales_amount' }]`. What is your reply?",
167+
"expected_output": "The word matches nothing and a measure is among its candidates, so it is asked about: a near word is still not a match, and only a word whose candidates are all dimensions is spared the question. The reply is a question and nothing else, asking whether that candidate is the one meant, such as \"Do you mean Sales Amount (in Sales Analysis: amount of opportunities closed as won)?\", naming the candidate's label, its dataset's label and its description, not its machine name. It does not pick the candidate, gives no figure, makes no tool call until the user answers, and does not fall back to the object tools either: the fallback is for a word with no candidates.",
168+
"files": [],
169+
"assertions": {
170+
"must_contain": ["Sales Amount", "Sales Analysis", "?"],
171+
"must_not_contain": ["query_dataset", "aggregate_records", "sales_amount"]
172+
}
153173
}
154174
]
155175
}

0 commit comments

Comments
 (0)