Repository navigation
Make every chart say where its figures came from - #840
Closed
guidovizoso wants to merge 7 commits into
Closed
guidovizoso wants to merge 7 commits into
guidovizoso wants to merge 7 commits into
Conversation
A chart now carries a basis (read, given, own knowledge), the sources it was read from and an as-of date, and draws them under the plot. Figures the Bot recalled without looking up are marked as unchecked. The model has to give a basis; older conversations without one still render, with no footer.
Separate the unchecked note from the sources list, name a repeated source once, and skip sources or dates that are not the shape the schema asks for instead of breaking the card.
Collaborator
Author
|
Landed in #847. |
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.
What this changes
A chart is the most confident-looking answer a Bot can give, and a figure it recalled from training looks exactly like one it read this morning. Now every chart says which it is.
basis(read,givenorown-knowledge),sources(title and optional address) andasOf. The card draws them as one line under the plot, for example "Sources: World Bank World Development Indicators API — GDP (current US$), 2025 · As of 2025". Onlyhttp(s)addresses become links.basis: own-knowledgethe line starts, in amber, "From the Bot's own knowledge. Not checked against a source."basisis required in the schema the model is given, so it cannot draw a chart without saying where the numbers came from. The renderer treats all three as optional, so charts already in a conversation draw as before, with no line.PROVENANCE_GUIDANCEgains a paragraph: before charting figures that change over time (prices, statistics, rankings, results), look them up with a search tool if you hold one and list what you read as the sources; otherwise say so inbasis.server/src/components/headless.tsmirrors the app's chart schema (a routine's chart is drawn by the app later), andheadless-components.test.tskeeps the two in step.Where it runs
Boundary and audit
readmatches the tool calls in the turn. The line is the Bot's own account, which is whyown-knowledgeis required to be said out loud and drawn as unchecked.Changelog
Unreleased.How it was checked
app/tests/chart-sources.test.tsx(sources named and linked for a chart drawn from what the Bot read, the unchecked note for its own knowledge and kept apart from the sources, wrongly shaped sources skipped, links only for web addresses, no line on a chart from before, andbasisrequired of the model).server/tests/headless-components.test.tsand its integration test cover the mirrored schema.headless-componentslines), and one Mastra test that needs a package not installed locally. The app suite: 1,675 pass.Slack and Teams
A chart drawn natively in Slack or Teams has no caption, so the reply now carries the same line after each chart: "Sources: World Bank · As of 2025", or the own-knowledge warning. Covered in
server/tests/delivery-routes.test.ts.