Skip to content

Add Open Science Assistant (OSA) BIDS chat widget#847

Open
neuromechanist wants to merge 2 commits into
bids-standard:mainfrom
neuromechanist:feat/osa-bids-assistant
Open

Add Open Science Assistant (OSA) BIDS chat widget#847
neuromechanist wants to merge 2 commits into
bids-standard:mainfrom
neuromechanist:feat/osa-bids-assistant

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Jun 8, 2026

Copy link
Copy Markdown
Member

Add Open Science Assistant (OSA) BIDS chat widget

Related: bids-standard/bids-specification#2256, bids-standard/bids-specification#2254

Tip

Test the assistant from built PR link, on bottom right:
https://bids-website--847.org.readthedocs.build/en/847/

Summary

This embeds a BIDS assistant on the website, powered by the Open Science Assistant (OSA) and its dedicated BIDS community. It is a single self-contained script (its own floating button, no iframe), configured entirely from a YAML file in the OSA repository. It is the companion to the specification-site change and comes out of the assistant discussion in bids-standard/bids-specification#2256.

What changes

One file. The site already ships a Material theme override (docs/overrides/main.html), so this only appends a scripts block:

<script src="https://demo.osc.earth/osa-chat-widget.js"></script>
<script>
  OSAChatWidget.setConfig({ communityId: 'bids' });
</script>

No CSS, no iframe: the widget renders and manages its own UI. The widget's CORS allow-list already includes bids.neuroimaging.io.

Design notes

  • Self-contained, not an iframe, so chat history persists in localStorage across page navigation (with navigation.instant enabled on this site, the widget initializes once and the config call is idempotent).
  • Page-context aware (opt-in): the widget shares the current page URL/title so answers are scoped to the page the reader is on.
  • Unpinned by design so the BIDS community always gets the latest assistant without merging another PR here. Served from OSA's own domain; push access to the OSA deployment is restricted to the BIDS community maintainer(s) and OSA admins. Security-sensitive deployments can pin a tagged release with Subresource Integrity (hashes published with each OSA release).

What the BIDS assistant does

Defined entirely in one YAML config (src/assistants/bids/config.yaml), editable by the BIDS community without OSA code changes:

  • YAML-only onboarding & tuning — branding, model, system prompt, doc list.
  • Live documentation retrieval — ~40 curated BIDS docs fetched from the spec (master) and website (main) raw sources, so answers track current text.
  • Codebase / GitHub indexing — daily issues + PRs across bids-specification, bids-validator, bids-website, bids-examples.
  • BEP awarenesslookup_bep searches synced BEP content from open PRs and links the PR + HTML preview.
  • Papers citing BIDS — weekly citation sync over the canonical paper and the modality extension papers.
  • Validator & converter guidance, NeuroStars (bids tag) integration, and anti-hallucination guardrails (never fabricate issue/PR numbers, DOIs, URLs), plus per-community budget caps and a CORS embed allow-list.

Sync cadence: GitHub daily, papers weekly, BEPs weekly.

Testing

  • Local mkdocs serve renders the widget across website pages; the floating button opens the BIDS assistant and history survives navigation.
  • Additive, scoped to the theme override; no content changes.

Links

neuromechanist and others added 2 commits June 8, 2026 11:04
Embed the OSA BIDS assistant via the existing Material theme override. The
widget is a single self-contained script served from the OSA project's own
domain; it renders its own floating button, persists chat history in
localStorage across navigation, and is configured entirely from the BIDS
community YAML config in the OSA repository. The only per-site setting is the
community id.

The script is intentionally unpinned so the BIDS community receives assistant
updates without merging a new PR here. See bids-standard/bids-specification#2256
and bids-standard/bids-specification#2254.
neuromechanist added a commit to OpenScience-Collective/osa that referenced this pull request Jun 8, 2026
Allow the BIDS assistant widget to load on the ReadTheDocs PR preview builds
for bids-standard/bids-specification#2442 and bids-standard/bids-website#847 so
reviewers can try the widget before merge. These two origins are temporary and
should be removed once both PRs merge.

@yarikoptic yarikoptic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems needs fixing, also make sure other affected Ci runs are good (bep leads is false positive)

Comment thread docs/overrides/main.html
Integrity; see https://github.com/OpenScience-Collective/osa/releases
#}

{% block scripts %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember this syntax but pre commit fails with

docs/overrides/main.html
───────────────────────────────────────────────────────────────────────────────
T003 95:0 Endblock should have name. Ex: {% endblock body %}. {% endblock %}

Linted 3 files, found 1 error.

So

Suggested change
{% block scripts %}
{% endblock scripts %}

?

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.

2 participants