Skip to content

Commit 6e13d7a

Browse files
committed
feat: add VFB query link skill and short names for enhanced query functionality
1 parent cf6e3a6 commit 6e13d7a

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

app/api/chat/route.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,71 @@ function replaceTermsWithLinks(text) {
851851
return result
852852
}
853853

854+
const VFB_QUERY_LINK_BASE = 'https://v2.virtualflybrain.org/org.geppetto.frontend/geppetto?q='
855+
856+
const VFB_QUERY_SHORT_NAMES = [
857+
{ name: 'ListAllAvailableImages', description: 'List all available images of $NAME' },
858+
{ name: 'TransgeneExpressionHere', description: 'Reports of transgene expression in $NAME' },
859+
{ name: 'ExpressionOverlapsHere', description: 'Anatomy $NAME is expressed in' },
860+
{ name: 'NeuronClassesFasciculatingHere', description: 'Neurons fasciculating in $NAME' },
861+
{ name: 'ImagesNeurons', description: 'Images of neurons with some part in $NAME' },
862+
{ name: 'NeuronsPartHere', description: 'Neurons with some part in $NAME' },
863+
{ name: 'epFrag', description: 'Images of fragments of $NAME' },
864+
{ name: 'NeuronsSynaptic', description: 'Neurons with synaptic terminals in $NAME' },
865+
{ name: 'NeuronsPresynapticHere', description: 'Neurons with presynaptic terminals in $NAME' },
866+
{ name: 'NeuronsPostsynapticHere', description: 'Neurons with postsynaptic terminals in $NAME' },
867+
{ name: 'PaintedDomains', description: 'List all painted anatomy available for $NAME' },
868+
{ name: 'DatasetImages', description: 'List all images included in $NAME' },
869+
{ name: 'TractsNervesInnervatingHere', description: 'Tracts/nerves innervating $NAME' },
870+
{ name: 'ComponentsOf', description: 'Components of $NAME' },
871+
{ name: 'LineageClonesIn', description: 'Lineage clones found in $NAME' },
872+
{ name: 'AllAlignedImages', description: 'List all images aligned to $NAME' },
873+
{ name: 'PartsOf', description: 'Parts of $NAME' },
874+
{ name: 'SubclassesOf', description: 'Subclasses of $NAME' },
875+
{ name: 'AlignedDatasets', description: 'List all datasets aligned to $NAME' },
876+
{ name: 'AllDatasets', description: 'List all datasets' },
877+
{ name: 'ref_neuron_region_connectivity_query', description: 'Show connectivity per region for $NAME' },
878+
{ name: 'ref_neuron_neuron_connectivity_query', description: 'Show neurons connected to $NAME' },
879+
{ name: 'ref_downstream_class_connectivity_query', description: 'Show downstream connectivity by class for $NAME' },
880+
{ name: 'ref_upstream_class_connectivity_query', description: 'Show upstream connectivity by class for $NAME' },
881+
{ name: 'SimilarMorphologyTo', description: 'Neurons with similar morphology to $NAME [NBLAST mean score]' },
882+
{ name: 'SimilarMorphologyToPartOf', description: 'Expression patterns with some similar morphology to $NAME [NBLAST mean score]' },
883+
{ name: 'TermsForPub', description: 'List all terms that reference $NAME' },
884+
{ name: 'SimilarMorphologyToPartOfexp', description: 'Neurons with similar morphology to part of $NAME [NBLAST mean score]' },
885+
{ name: 'SimilarMorphologyToNB', description: 'Neurons that overlap with $NAME [NeuronBridge]' },
886+
{ name: 'SimilarMorphologyToNBexp', description: 'Expression patterns that overlap with $NAME [NeuronBridge]' },
887+
{ name: 'anatScRNAseqQuery', description: 'Single cell transcriptomics data for $NAME' },
888+
{ name: 'clusterExpression', description: 'Genes expressed in $NAME' },
889+
{ name: 'scRNAdatasetData', description: 'List all Clusters for $NAME' },
890+
{ name: 'expressionCluster', description: 'scRNAseq clusters expressing $NAME' },
891+
{ name: 'SimilarMorphologyToUserData', description: 'Neurons with similar morphology to your upload $NAME [NBLAST mean score]' },
892+
{ name: 'ImagesThatDevelopFrom', description: 'List images of neurons that develop from $NAME' }
893+
]
894+
895+
function buildVfbQueryLinkSkill() {
896+
const queryLines = VFB_QUERY_SHORT_NAMES
897+
.map(({ name, description }) => `- ${name}: ${description}`)
898+
.join('\n')
899+
900+
return `VFB QUERY LINK SKILL:
901+
- Build direct VFB query-result links so users can open the full results list.
902+
- Link format: ${VFB_QUERY_LINK_BASE}<TERM_ID>,<QUERY_SHORT_NAME>
903+
- Construct links from the exact pair: term_id + query_name.
904+
- URL-encode TERM_ID and QUERY_SHORT_NAME independently before concatenating.
905+
- Only use query names returned by vfb_get_term_info for that specific term.
906+
- In term-info JSON, read short names from Queries[].query and user-facing descriptions from Queries[].label.
907+
- Treat Queries[] from vfb_get_term_info as authoritative for the current term; use the static list below as a fallback reference.
908+
- When you answer with query findings, include matching query-result links when useful.
909+
- Examples:
910+
- ${VFB_QUERY_LINK_BASE}FBbt_00100482,ListAllAvailableImages
911+
- ${VFB_QUERY_LINK_BASE}FBbt_00100482,SubclassesOf
912+
- ${VFB_QUERY_LINK_BASE}FBbt_00100482,ref_upstream_class_connectivity_query
913+
- Query short names and descriptions (from geppetto-vfb/model):
914+
${queryLines}`
915+
}
916+
917+
const VFB_QUERY_LINK_SKILL = buildVfbQueryLinkSkill()
918+
854919
const systemPrompt = `You are a Virtual Fly Brain (VFB) assistant specialising in Drosophila melanogaster neuroanatomy, neuroscience, and related research.
855920
856921
SCOPE:
@@ -888,6 +953,8 @@ TOOLS:
888953
- search_pubmed / get_pubmed_article: search and fetch peer-reviewed publications
889954
- biorxiv_search_preprints / biorxiv_get_preprint / biorxiv_search_published_preprints / biorxiv_get_categories: preprint discovery
890955
956+
${VFB_QUERY_LINK_SKILL}
957+
891958
TOOL SELECTION:
892959
- Questions about VFB terms, anatomy, neurons, genes, or datasets: use VFB tools
893960
- Questions about published papers or recent literature: use PubMed first, optionally bioRxiv/medRxiv for preprints

0 commit comments

Comments
 (0)