Skip to content

Commit d56aa34

Browse files
committed
fix(scenarios): read the dataset citation off the answer's provenance, not the tool name
Keying on the query_dataset tool name pulled @objectstack/spec/ai into the narrow ./score entry's import graph, which narrow-score-graph.test.ts pins. The answer's top-level provenance of kind dataset is the query_dataset answer's own block, so the reader keys on it instead. Claude-Session: https://claude.ai/code/session_016WV4cypybwgoxE3ZMZy8kt Co-authored-by: Claude <noreply@anthropic.com>
1 parent ff94b68 commit d56aa34

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎packages/qa/scenarios/src/score/scenario-run-grade.ts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
* out an LLM judge, so every axis is decided by code.
3434
*/
3535

36-
import { QUERY_DATASET_TOOL_NAME } from '@objectstack/spec/ai';
3736
import type { ErrorCode } from '@objectstack/spec/api';
3837

3938
import type { Truth } from '../truth.js';
@@ -552,14 +551,17 @@ interface DatasetCitation {
552551
* from the dataset it resolved, and its `nextStep` tells the client to cite
553552
* that `sourceLine` — which names the dataset and its measures, never the
554553
* object. So a source line naming the dataset, or the `sourceLine` itself,
555-
* cites the figures of that object. Read off the outputs only: an answer
556-
* without an `object` or a dataset `provenance` (a refusal, an older door)
557-
* hands no citation, and the arguments the model sent decide nothing.
554+
* cites the figures of that object. Read off the outputs only, by the
555+
* answer's shape rather than the tool's name: a top-level `provenance` of
556+
* kind `dataset` (`DatasetProvenanceSchema`) is the `query_dataset` answer's
557+
* own block, and keying on it keeps the narrow `./score` entry off the spec's
558+
* `ai` subpath. An answer without an `object` or a dataset `provenance` (a
559+
* refusal, an older door) hands no citation, and the arguments the model
560+
* sent decide nothing.
558561
*/
559562
function datasetCitations(calls: readonly RunToolCall[]): Map<string, DatasetCitation> {
560563
const out = new Map<string, DatasetCitation>();
561564
for (const c of calls) {
562-
if (c.name !== QUERY_DATASET_TOOL_NAME) continue;
563565
const v = outputJson(c.output);
564566
if (!isBag(v) || typeof v.object !== 'string' || v.object.length === 0) continue;
565567
const p = v.provenance;

0 commit comments

Comments
 (0)