Skip to content

Commit 1ffba63

Browse files
authored
Merge pull request #5 from VirtualFlyBrain/feature/answer-quality-recipes
Release v3.3.1 — surface uncounted (count -1) term-info queries
2 parents 6f0a31c + 07dd6d9 commit 1ffba63

5 files changed

Lines changed: 6278 additions & 492 deletions

File tree

lib/orchestrator.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ async function synthesise(ledger, deps, models) {
434434
// "no information" — when specific evidence is thin.
435435
const availableData = Object.values(ledger.terms)
436436
.filter(t => t.id && t.digest?.queries?.length)
437-
.map(t => `${t.digest.name || t.label}: ${t.digest.queries.slice(0, 10).map(q => `${q.label} (${q.count})`).join('; ')}`)
437+
.map(t => `${t.digest.name || t.label}: ${t.digest.queries.slice(0, 10).map(q => `${q.label} (${q.count < 0 ? 'available — run this query for the count' : q.count})`).join('; ')}`)
438438
const availableBlock = availableData.length
439439
? `\n\nAVAILABLE VFB DATA for the resolved terms (counts of records VFB holds — use to say what IS available, never claim "no information" when this lists relevant data):\n${availableData.join('\n')}`
440440
: ''

lib/termInfoDigest.mjs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,13 @@ export function buildTermInfoDigest(info = {}) {
183183
// full parsed preview rows (name, id, thumbnail, tags) for result tables
184184
previewRows: parsed.slice(0, 5)
185185
}
186-
}).filter(q => q.label && (q.count > 0 || q.examples.length > 0))
186+
// Keep a query if it has data (count > 0), preview examples, OR an uncounted
187+
// count (-1). get_term_info returns count -1 for query types it did not
188+
// pre-count (common for large ones like ImagesNeurons on a big region) — that
189+
// means the data IS available and the query must be RUN to get it, NOT that
190+
// there is no data. Only drop a query that was actually counted as empty
191+
// (count === 0) with no preview rows.
192+
}).filter(q => q.label && (q.count !== 0 || q.examples.length > 0))
187193

188194
const publications = (Array.isArray(info.Publications) ? info.Publications : [])
189195
.map(p => {
@@ -214,10 +220,16 @@ export function digestToText(digest, { maxQueries = 16, maxExamples = 5 } = {})
214220
if (digest.relationships) lines.push(`Relationships: ${digest.relationships}`)
215221
if (digest.synonyms?.length) lines.push(`Synonyms: ${digest.synonyms.join(', ')}`)
216222
if (digest.queries?.length) {
217-
lines.push('Available VFB data for this term (query result: total count — examples):')
223+
lines.push('Available VFB data for this term (query result: total count — examples). "run this query" means the total was not precomputed but the data exists — call vfb_run_query with that query_type to get the count/results:')
218224
for (const q of digest.queries.slice(0, maxQueries)) {
219225
const ex = q.examples.slice(0, maxExamples).join(', ')
220-
lines.push(`- ${q.label}: ${q.count}${ex ? ` (e.g. ${ex})` : ''}`)
226+
if (q.count < 0) {
227+
// Count not precomputed by get_term_info — the data is available; the
228+
// query must be run to get the count/results (do NOT read this as "no data").
229+
lines.push(`- ${q.label}: run this query — call vfb_run_query with query_type ${q.query_type} to get the count/results`)
230+
} else {
231+
lines.push(`- ${q.label}: ${q.count}${ex ? ` (e.g. ${ex})` : ''}`)
232+
}
221233
}
222234
}
223235
if (digest.publications?.length) {

0 commit comments

Comments
 (0)