Skip to content

Query-type semantics: individual-image vs class counts, and image-aware routing#7

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

Query-type semantics: individual-image vs class counts, and image-aware routing#7
Robbie1977 merged 2 commits into
mainfrom
feature/answer-quality-recipes

Conversation

@Robbie1977

Copy link
Copy Markdown
Contributor

Follow-up to PR #6 (which merged the count-question auto-run). This commit was pushed just after #6 merged, so it needs its own PR. Targets v3.3.1.

The "28 images" bug

After #6 auto-runs a query, it ran the wrong one: "how many images of neurons with a part in the medulla are available?" answered 28 — that's PartsOf (28 subparts, a class query) reported as "28 images", when ImagesNeurons = 226,524 is the real images count.

Row id prefixes separate the two kinds:

  • Individual-image queries return VFB_* rows — count = images (ImagesNeurons, ListAllAvailableImages, AllAlignedImages).
  • Class queries return FBbt_* rows whose thumbnails are just examples — count = number of classes (NeuronsPartHere 471, PartsOf 28, SubclassesOf).

Changes

  • lib/queryTypes.mjs (new): per-query_type semantics (kind + countNoun), with querySemantics() / isIndividualImageQuery().
  • Digest (termInfoDigest.mjs): every count renders with its unit ("226,524 images", "471 neuron types", "28 subparts") and a header stating class counts are not image counts and class thumbnails are examples; the uncounted "run this query" line names the unit too.
  • Routing (pickBestQueryForQuestion): for an "images" question, restricts candidates to individual-image queries, so it can never pick a class query like PartsOf.

Tested with the user's exact question including the deliberate medualla misspelling (the term still resolves; matching keys off "images"/"neurons").

Tests / lint

queryTypes 4, termInfoDigest 9, orchestrator 23; whole offline unit suite green (19 files); next lint clean.

After merge

Tag v3.3.1 on main. Code delta: lib/orchestrator.mjs, lib/termInfoDigest.mjs, new lib/queryTypes.mjs + tests (rest is the tracked task-battery snapshots).

The chat conflated individual-image queries with class queries — it answered
"how many images of neurons with a part in the medulla" with 28 (PartsOf, a
class query = 28 subparts) reported as "28 images", when the real images count
is ImagesNeurons = 226,524. Row id prefixes separate them: individual-image
queries return VFB_* rows (count = images), class queries return FBbt_* rows
whose thumbnails are just examples (count = number of classes).

- Add lib/queryTypes.mjs: per-query_type semantics (kind + countNoun), with
  querySemantics()/isIndividualImageQuery().
- Digest (termInfoDigest.mjs): render each count with its unit ("226,524 images",
  "471 neuron types", "28 subparts") and a header explaining that class counts
  are not image counts and that class thumbnails are examples; include the unit
  in the uncounted "run this query" line.
- Routing (orchestrator pickBestQueryForQuestion): for an "images" question,
  restrict candidates to individual-image queries so it can never pick a class
  query like PartsOf. Tested with the user's exact question (deliberate
  "medualla" misspelling).

Tests: queryTypes 4, termInfoDigest 9, orchestrator 23; next lint clean.
@Robbie1977 Robbie1977 merged commit 08bcb35 into main Jul 15, 2026
2 of 3 checks passed
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