You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update admin dashboard for v3 batched AI narration diagnostics
The Narrate tab now correctly shows 'AI narration active (batched)' when
the v3 pipeline runs with batch_ai mode. Handles both v2 (ai_calls count)
and v3 (mode/ai_call_succeeded) diagnostic formats. Updated tooltips to
reflect that observations are now AI-narrated alongside discoveries.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
**Estimated effort:** Medium — the batched prompt design and experiment matching logic are new. The narration infrastructure (imports, compliance, fallback) was built and reverted once already.
1594
+
**Status: DONE (2026-03-19)**
1595
+
- Batched AI narration live: single GPT-4o-mini call per pipeline run
1596
+
- All discoveries and observations get plain-language titles and summaries
1597
+
- OpenAI json_object wrapper format handled (extracts array from `{ "discoveries": [...] }`)
1598
+
- Template fallback on AI failure — 21 vitest passing
1599
+
- Admin dashboard updated to show v3 narration diagnostics (mode, patterns narrated, AI succeeded)
1600
+
- Experiment matching NOT YET IMPLEMENTED — `suggested_experiment_id` still null (deferred to next iteration)
@@ -1265,36 +1271,58 @@ export default function InsightRunDetail() {
1265
1271
<div>
1266
1272
<StepHeader
1267
1273
title="Narrate"
1268
-
description="Generates user-facing titles and summaries. AI narration via GPT-4o-mini for discoveries, templates for observations."
1274
+
description="Generates plain-language titles and summaries via a single batched GPT-4o-mini call for all discoveries and observations. Falls back to templates if AI call fails."
1269
1275
inputLabel={`Input: ${discoveriesCount+observationsCount} classified patterns from Filter`}
1270
1276
outputLabel={`Output: narrated patterns to Persist`}
1271
1277
/>
1272
1278
1273
1279
{/* AI Status Banner */}
1274
1280
{(()=>{
1275
-
constaiCalls=narrateDiag?.ai_calls??0;
1276
-
constisAiDisabled=aiCalls===0;
1281
+
// Support both v2 (ai_calls) and v3 (mode/ai_call_succeeded) diagnostics
Copy file name to clipboardExpand all lines: web/src/app/routes/admin/insights.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -341,7 +341,7 @@ export default function InsightsDashboard() {
341
341
<thtitle="Total rows fetched across all 6 source tables (daily_summary, sleep_sessions, activities, glucose_data, glucose_alarms, intraday_data). Needs >= 14 to proceed.">Data Rows</th>
342
342
<thtitle="Pattern candidates before BH correction → after. The arrow shows how many survived the Benjamini-Hochberg false discovery rate filter (alpha=0.10).">Candidates</th>
343
343
<thtitle="Strong patterns (p < 0.05, |effect size| > 0.3) actually inserted into user_discoveries. Limited to 3 active + 2 per week.">Discoveries</th>
344
-
<thtitle="Weaker patterns inserted as observations. Limited to 5 active + 3 per week. Use template narratives (no AI call).">Observations</th>
344
+
<thtitle="Weaker patterns inserted as observations. Narrated by the same batched AI call as discoveries.">Observations</th>
345
345
<thtitle="Data points outside plausibility bounds (e.g., HR > 220 bpm) that were excluded from analysis and flagged as data quality issues.">Outliers</th>
346
346
<thtitle="Wall-clock time for the entire pipeline (fetch through persist) for this user.">Duration</th>
347
347
<thtitle="Pipeline exit reason: 'success' = produced candidates, 'insufficient_data' = < 14 rows, 'no_candidates' = 0 passed significance test, 'no_bh_survivors' = all removed by BH correction, 'error' = exception thrown.">Status</th>
0 commit comments