Repository navigation
Cite userguide answers by url, so they stop having no sources at all - #246
Merged
Merged
Conversation
Adam's call, 2026-09-18. A userguide-routed question returned zero citations -- "How do I use the pathway browser?" gave 0 citations and 452 tokens -- because a citation carries `st_id` and the userguide collection indexes documentation pages whose identity is a URL. It is also the fastest class of answer, so the gap was common rather than exotic. A citation now carries exactly one identifier: `st_id` for Reactome and disease-variant sources, `url` for userguide pages, with the other key absent rather than empty so a consumer that understands only `st_id` keeps working by skipping what it does not recognise. No fabricated stable ids. A made-up `R-` would resolve to nothing or to a real but wrong entity, and a reader cannot tell from the link text. Deduplicated by page rather than chunk: the bundle is 98 chunks across 10 pages, so chunk-level citations would repeat one page up to 27 times. The page title is the label. **Only http(s) sources are cited, and that guard was not in the first version.** `source` is a generic LangChain field the CSV loaders set to the file they read, so a Reactome document lacking an `st_id` cited "/home/awright/git/reactome_chatbot/embeddings/openai/..." -- a server path, to a public website. The unit tests used fixtures too clean to contain one; it showed up the first time a real question ran. Measured after: pathway-browser 0 -> 4 citations, GSEA 0 -> 2, and Reactome questions unchanged at 12 with no paths among them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adam's decision. A userguide-routed question returned zero citations — "How do I use the pathway browser?" gave 0 citations and 452 tokens — because a citation carries
st_id, and the userguide collection indexes documentation pages whose identity is a URL. It is also the fastest class of answer, so the gap was common rather than exotic.The shape
Exactly one identifier per citation, the other key absent rather than empty:
A consumer that understands only
st_idkeeps working by skipping what it does not recognise.No fabricated stable ids. A made-up
R-would resolve to nothing or — worse — to a real but wrong entity, and a reader cannot tell from the link text.Deduplicated by page, not chunk: the bundle is 98 chunks across 10 pages, so chunk-level citations would repeat one page up to 27 times.
The bug the unit tests could not have caught
The first version leaked a server filesystem path as a citation url:
sourceis a generic LangChain metadata field, and the CSV loaders set it to the file they read — so a Reactome document lacking anst_idcited a local path, to a public website. Onlyhttps://andhttp://sources are cited now.It showed up the first time a real question ran. My fixtures were too clean to contain a filesystem path, which is precisely why they passed.
Measured after
CI-equivalent locally: ruff, format, mypy (129 files), full suite with no API keys set.
🤖 Generated with Claude Code