Skip to content

Add interactive UK Chat answer walkthrough - #10

Open
anth-volk wants to merge 8 commits into
mainfrom
feat/interactive-answer-walkthrough
Open

Add interactive UK Chat answer walkthrough#10
anth-volk wants to merge 8 commits into
mainfrom
feat/interactive-answer-walkthrough

Conversation

@anth-volk

Copy link
Copy Markdown
Contributor

Summary

  • replace the remaining static request walkthrough with a stage-navigable reproduction of the UK Chat interface
  • animate the opening request, submission, loading state, gateway stages, public tool activity, and final answer
  • pair each of the six stages with concise explanatory and technical panels
  • update the article source to remove the redundant end-to-end walkthrough and align the surrounding copy

Why

The article benefits from showing readers how one request moves through UK Chat rather than describing the same lifecycle twice in static prose. The interactive keeps the user prompt and response recognizable while exposing the gateway and deterministic calculation boundaries alongside it.

Validation

  • bun run check
    • ESLint
    • Prettier
    • Vite production build
  • git diff --check

Review request

@vahid-ahmadi, could you review the technical accuracy of the six-stage flow, especially the gateway resolution and verification stages and the public tool sequence in Calculate/Stream?

@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-uk-chat-article Ready Ready Preview Aug 17, 2026 5:23pm

Request Review

@vahid-ahmadi vahid-ahmadi 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.

Reviewed the six-stage flow against PolicyEngine/policyengine-uk-chat at 6ade3b1, since that's what you asked for. The short version: the stage data is accurate, and there's a base problem that matters more than anything in the diff.

Technical accuracy — verified against source

Every stage checks out:

  • GroundgroundProposedPlan matches _EMIT_PLAN_TOOL exactly (gateway/runtime.py:143-278): domain_status, capability_status, tool, catalogue_queries[{kind, query}].
  • ResolveresolveCatalogueMatch matches CatalogueMatch (gateway/catalogue.py:16-20, 45-50), and authoritative: true is right for strong_phrase, since authoritative is match_type != "fuzzy_suggestion".
  • Gategate(in_domain=…, tool=…, unmodellable_outputs=[]) uses real parameter names (gateway/policy.py:337-346), and {outcome, gating_reasons} is exactly GateResult (:87-89). Eliding slots and prompt is the right call for an illustration.
  • Verifyemit_reform_assessment and require_approved_reform: true match gateway/assessment.py:97-118 and tools/context.py:47-52.
  • Calculatecompute_budgetary_impact(simulation_id=<result_id from run_society_simulation>) gets the naming subtlety right, which is easy to miss: the store returns result_id, the derivatives take it as simulation_id.
  • Stream — every event in streamEventSequence is real (chat/events.py, chat/public_service.py:67-119), including thinking_done, which our version omits.
  • Method lineEnhanced FRS 2024–25, release 1.56.13 matches engine/constants.py:28-33.

Two notes rather than corrections:

  1. Reform shape. You use flat {path: 30.0}; the version on main uses a date-keyed map. REFORM_SCHEMA accepts both ("scalar values or date-to-value maps", tools/definitions.py:23-27), and yours is the schema's own example — arguably the better choice, since passing year=2026 and a 2026-01-01.2026-12-31 key reads as redundant. Worth settling on one; I'd take yours.
  2. confidence: 95 and score: 0.9 are plausible illustrations rather than observed values. Only the ≥80 confidence threshold is in source (assessment.py:18). Fine as illustration, just flagging that they aren't reproducible.

The blocker: this branch is based on 18cb354, before #8

main moved this morning. Merging as-is would revert, silently:

  • The £0.9bn computed result box and its tableworked-result appears 9× on your base and 0× here. That's the article's only real, sourced number, and the interactive's answer panel paraphrases it in prose rather than showing it.
  • Beta framing throughout — hero tag, introduction, Limitations, CTA. That came out of Max and Vahid's 1:1 and is a launch decision, not a preference.
  • "How policy analysis is done today" — the narrative leg agreed in the same 1:1.
  • Call/return examples on all 21 tools — Pavel's feedback, derived from tools/definitions.py and the handlers.
  • Three factual corrections verified against the chat repo. The most important: this branch restores "the language model receives the calculation tools plus a machine-readable description of what the deployed engine can compute: its capabilities and parameter schema". That is not true — the system prompt (prompts/system.py) and all 21 tool schemas are hand-written, and engine-derived truth only reaches the model when it calls discovery tools. main now says the model has to ask.
  • Two of David's fixes from #7 — the AI model segment label and "these models".

A rebase on main would surface all of this as conflicts rather than losing it quietly.

What I'd suggest keeping from #9 when you rebase

Your interactive is better than what it replaces, and I'd drop three things from our side in its favour: the static screenshot in the introduction (yours shows the interface properly), the CallTrace component, and the six-stage scrollytelling — the interactive does both jobs in one place, and a structural review had already flagged that section as roughly a quarter of the article by scroll for a diagram that only highlights one of six boxes.

Three things I'd argue to keep, though:

  1. The computed result box, after the interactive's answer. The answer panel says "about £0.9 billion a year"; the box states the year, the comparator, the dataset release, and the three-line table. For a piece arguing that figures should be checkable, showing the number with its provenance is the payoff, and prose alone gives that up.
  2. The per-tool examples. They answer Pavel's ask directly and they're independent of the walkthrough — one tool each, in isolation, whereas the interactive shows one path through five.
  3. The corrected boundary paragraph, for accuracy rather than preference.

Happy to do the rebase and resolve it if that's easier than untangling it — say the word. The other thing worth deciding together: whether the article keeps a static six-stage view at all once the interactive is in, or whether the interactive is the only place those stages appear.

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