Skip to content

Type each query in the digest (image vs class) so counts can't be misread#9

Merged
Robbie1977 merged 2 commits into
mainfrom
feature/answer-quality-recipes
Jul 15, 2026
Merged

Type each query in the digest (image vs class) so counts can't be misread#9
Robbie1977 merged 2 commits into
mainfrom
feature/answer-quality-recipes

Conversation

@Robbie1977

Copy link
Copy Markdown
Contributor

Applies the query-type spec at the stage where it bites — the term-info digest the model reads to interpret counts and pick a query. (The planner step schema has no query_type field, so the planner never names the query; the digest is where selection/interpretation actually happens.)

What changed

Every query line in the digest now ends with a compact typing tag and the header states the rule:

- Images of neurons with some part in medulla: not pre-counted — run this query to get its count of images of neurons [ImagesNeurons — individual images; count = images of neurons; use for how many/which images of neurons have a part in a region]
- Parts of medulla: 28 subparts [PartsOf — ontology classes; thumbnails are examples; count = subparts; use for parts/sub-regions/subdivisions of the term]
- Neurons with some part in medulla: 471 neuron types [NeuronsPartHere — ontology classes; thumbnails are examples; count = neuron types; use for which/how many neuron types have a part in a region]

Header rule: "individual images" ⇒ the count is IMAGES; "ontology classes" ⇒ the count is types/subparts/subclasses and any thumbnail is just one example — never report a class count as an image count; answer an "images" question only from an individual-image query.

This is the root-cause fix for the "28 images" answer: PartsOf's concrete 28 is now explicitly typed as subparts, and the image query (ImagesNeurons, uncounted) is typed as individual images — so the model can't grab the class number and call it images.

Files

  • lib/queryTypes.mjs — per-query_type use phrases + queryTypeTag() (kind phrase + count meaning + use).
  • lib/termInfoDigest.mjs — render the tag per line; header explains image-vs-class.

Tests / lint

queryTypes 6, termInfoDigest 11 (incl. an image-vs-class-on-same-term typing check); whole offline unit suite green; next lint clean.

After merge

Tag v3.3.3. Pairs with the authoritative/deterministic count injector already in v3.3.2 — that runs the right query; this stops any competing digest number from being misread.

Robbie1977 and others added 2 commits July 15, 2026 11:26
Apply the query-type spec at the stage where the model actually reads counts and
picks a query: the term-info digest. Every query line now ends with a compact
typing tag [query_type — kind; count = unit; use for …], and the header states
the rule: "individual images" means the count is images; "ontology classes"
means the count is types/subparts/subclasses (thumbnails are just examples) and
is never an image count; answer an "images" question only from an individual-
image query.

This is what stops the model reading PartsOf's concrete "28 subparts" as the
answer to "how many images of neurons …" — the class count is now explicitly
typed as subparts, and the image query (ImagesNeurons, uncounted) is typed as
individual images.

- queryTypes.mjs: add `use` phrases per query_type and queryTypeTag() (kind
  phrase + count meaning + use).
- termInfoDigest.mjs: render the tag on each query line; header explains the
  image-vs-class rule.

Tests: queryTypes 6, termInfoDigest 11 (incl. an image-vs-class-on-same-term
typing check); whole offline suite green; next lint clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant