Spaces:
Sleeping
Sleeping
Commit History
-
fix(link-rot): validate PDF candidates + untrack llm_health.jsonβ
THE INCIDENT Overnight 2026-05-27/28 the nightly link-rot LaunchAgent (com.rohit.insurancebot.linkrot β tools/check_link_rot.py) applied seven bad auto-patches to 40-data/corpus_urls.md and one to tools/.pdf_etag_state.json: - HDFC ERGO Γ3 + Bajaj Allianz Γ2 + New India Γ1: rewrote httpsβhttp via try_canonicalise β both work but the downgrade is gratuitous. - Niva Bupa Health Companion (a core indemnity product): rewrote the live URL to a 2-year-old Wayback wrapper that serves HTML, not PDF. Would have silently broken corpus rebuild for that policy. ROOT CAUSE head_check() did HEAD only; the affected origins (HDFC ERGO, Bajaj, New India, Niva Bupa) return text/html interstitials or transient errors for HEAD while serving the real PDF on GET. When HEAD failed transiently, the tool fell into auto_fix and both strategies (try_ canonicalise + try_wayback) accepted any candidate whose HEAD returned status 2xx β without verifying it ACTUALLY served a PDF. The Wayback 'availβ¦f9437bb
-
chore(cleanup): purge stale narrative/tombstones/dead code β codebase reads as the current standardβ
Comprehensive stale-content purge so code/docs read as if written correctly from the start; history of record stays only in ADRs (70-docs/60-decisions), KIs (80-audit), and the README. Code (.py): removed mistake/removal/incident narration and tombstone comments ("REMOVED/VESTIGIAL", dated fix-narration, "Z2 fix/W1 Turn/Priya/ Vikram", "the bug was", "used to ... β loop", "do NOT reintroduce"), rewrote them as clean current-behavior comments; deleted the dead SessionState._recall_sniff_done field (zero readers; in-memory-only, verified safe); cleaned stale references to removed systems (sales_brain/qa_brain/orchestrator) in comments, docstrings and a log string. NO logic changed: 29/31 modified .py are AST-equal modulo docstrings (provably comment-only); the other 2 are the verified-safe field deletion + log/docstring string text only. Docs: 70-docs/** + ARCHITECTURE.md rewritten to the current single-LLM-with-tools standard (gemini-2.5-flash + save_profile_field/ retrieve_policies/mβ¦23b8fad -
fix(de-stale): remove deleted get_fast_brain_llm (broke rag.extract import)β
The audit framework's Tier-2 surfaced this real defect: get_fast_brain_llm was deleted in the 2026-05-15 three-chain collapse but still imported/called by rag/extract.py (raised ImportError on import), tools/reextract_all.py, and imported-unused by tools/extract_all_corpus.py. Collapsed to the surviving get_brain_llm() (its NimChainLLM already does internal fallback); fixed the now-false primary/fallback comments + rag/README. rag.extract now imports clean. Local only β not pushed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>ec44444
-
feat(audit): core contract + runner + CLI
a519e2c -
recovery: integrate stalled-session work + de-stale/cleanup (pytest 215 green) [build-fix]β
Resumes the session whose 3 background agents stalled on the 600s watchdog; captures the prior session's uncommitted #42β#110 work + data exercise plus this session's verified recovery changes. (Rebuilt from the first attempt to store frontend/public/insurer-logos/*.png via Git LFS β HF Spaces' pre-receive hook requires it; .gitattributes updated, tools/.pdf_text_cache gitignored.) Prior-session work captured (was uncommitted, behaviourally live-tested): - single_brain rewrite, full frontend rebuild, compare/scorecard/premium UI, ~77 40-data/policy_facts sourced-data edits, new tests/tools, render.yaml drop. This session's recovery (surgical, verified, behaviour-preserving): - Fix app-wide HTTP 500: a `*/` inside a CSS comment killed the stylesheet. - Remove dead get_judge_llm everywhere (judge retired in single-brain rewrite). - eval/run.py: repair imports + hard-guard against stale results.json. - Centralize ~13 hardcoded "40-data" literals to one settings.DATA_DIR (resolves idβ¦b87bd2d -
data+scoring: verbatim-source all policy_facts, recalibrate scorecard, fix recommendationβ
- Re-sourced ~2900 cells to verbatim PDF clauses (v1/v2/v3 fleets); 0 fabrication, 0 legacy-provenance, ~250 wrong values corrected; image-only Acko cells dropped. - Removed max_renewal_age from scoring (IRDAI lifelong is universal); root-caused 999. - Recalibrated 6 sub-scores + thresholds: real A/B/C/D/F spread (was ~90% B); fixed-benefit N/A reweight. - #9 citations = exactly the prose-named policies (no slice cap). - #10 eligibility gates (no top-up for first-timers, zero-copay, SI floor) + profile-fit rank. - Voice TTS silent-failure surfaced + codec fix; 14 dead source URLs replaced. - scorecard/compare/bulk now merge corrected policy_facts (divergence fix). - 62/62 tests; two-part verify: 4113 verbatim-verified, 66 documented residual, 0 fabrication. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>7081aaa
-
feat(llm+docs): KI-177 + KI-179 + KI-183 + ADR-040 docs cascadeβ
THREE-TIER LLM CHAIN β Google Gemini PRIMARY, NIM Tier 1, OR Tier 2. Live audit (KI-178) of OpenRouter's free-tier catalog killed my earlier recommendation: gemini-2.0-flash isn't in OR's catalog, llama-3.3-70b- :free and hermes-3-405b:free don't expose response_format. So OR's free-with-JSON pool is only nemotron-3-super-120b / qwen3-next-80b / gemma-4-31b. User obtained a Google AI Studio key, set up billing ($0 historical spend, $10 cap, free 1500/day quota active), confirmed working live on gemini-2.5-flash + gemini-2.5-flash-lite. NEW MODEL TIERS: Brain Fast (sales_brain): Tier 0 Google gemini-2.5-flash-lite (KI-183 β 2.0-flash retired) Tier 1 NIM qwen3-next-80b β mistral-large-3 β llama-4-maverick Tier 2 OR nemotron-3-super-120b:free β qwen3-next-80b:free β gemma-4-31b:free Last NIM nemotron-super-49b (only when all else dies) Brain Main (orchestrator): Tier 0 Google gemini-2.5-flash Tier 1+ same NIM/OR cascade Judgβ¦132a829 -
feat(deploy): KI-152 β upload_to_hf.py syncs deletions, not just addsβ
After upload_folder, walk local tree + list_repo_files, then issue a second commit that deletes orphan remote files. Prevents ghost brochures lingering on the Space after KI-126/143/144-style renames. Adds --dry-run + --no-upload flags. HF_PROTECTED guards .gitattributes / .gitignore / README.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>38c937d -
fix(rag+voice): KI-137 + KI-138 + KI-139 β ingest 21 curated policies into Chroma, canonicalize 84 policy names, fix voice VAD thresholds
9c01288 -
fix(deploy): KI-128 β exclude _hf_dataset_backup + LFS pointers from Space pushβ
Two prior pushes (KI-126, KI-127) silently failed with: 403 Forbidden: Repository storage limit reached (Max: 1 GB) on POST /InsuranceBot.git/info/lfs/objects/batch. Root cause: tools/upload_to_hf.py walks the entire ROOT directory and respects ignore_patterns relative to walked paths. The previous IGNORE list excluded rag/corpus/**, rag/vectors/**, rag/extracted/**, but NOT: β’ rag/_hf_dataset_backup/** β which the new rag/corpus and rag/extracted symlinks (created in the 2026-05-15 session) resolve into. The walker followed those symlinks and re-enumerated 206 PDF blobs at paths the rag/corpus/** rule no longer matched. β’ rag/policies.duckdb β an LFS pointer file at project root that tries to push its LFS object on every upload. The HF Space's 1 GB LFS quota is reserved for ACTUAL Space-only artefacts; all corpus / vectors / extracted data lives in the companion HF Dataset (D-019). Adding rag/_hf_dataset_backup/**, **/_hf_dataset_backup/**, rag/policies.duckdb,β¦c20e471 -
fix(corpus): KI-126 β drop 2 image-only PDFs + cascade docs across 3 reposβ
The 2 deleted PDFs are scanned-image PDFs that pdfplumber extracts as 0 chars, so they were never queryable through the RAG pipeline. OCR is explicitly out of scope. Removing them brings every surface back into agreement: β’ royal-sundaram/family-plus__brochure.pdf β Family Plus product is still covered via royal-sundaram__family-plus__wordings (text-extractable). β’ aditya-birla/activ-one__brochure.pdf β Activ One coverage is provided via aditya-birla__activ-health-individual__wordings (already in Chroma, 120 chunks). The separate aditya-birla__activ-one KB entry was independent and remains intact. Cascade across all surfaces (per the no-stale-content prime directive): β’ Deleted: 2 PDFs (HF dataset + local symlink target) β’ Deleted: 2 kb/policies/__brochure.md files β’ Deleted: 2 40-data/policy_facts/__brochure.json files β’ Deleted: 2 _hf_dataset_backup/rag/extracted/__brochure.json + 1 _raw.txt β’ kb/INDEX.md: rows removed; "Policies (255)" -> "Policies (2β¦f9adc25
-
docs: KI-071 β reconcile docs with code reality (Qwen 80B / Nemotron 30B / Mistral 675B as current primaries)β
Source-of-truth audit found the production code on `main` runs Qwen 3-Next 80B (brain primary) + Nemotron Nano 30B (fast brain primary) + Mistral Large 3 675B (judge primary) per the D-022 inline brain swap on 2026-05-14 (NIM DeepSeek + Llama-4 Maverick pools were timing out for hours). The ADR-019 decision text + multiple docs still referenced DeepSeek V4-Pro / V4-Flash + Llama-4 Maverick as primaries. This commit aligns 12 files with the actual chain definitions in `backend/providers/nvidia_nim_llm.py`. DeepSeek V4-Pro / V4-Flash + Llama-4 Maverick are correctly documented now as **fallback chain entries** that re-enter rotation when NIM's pools recover. Files reconciled (+64 / -45): - `README.md` β Β§1.2 "Honest model picks" paragraph + Β§4.3 Model stack table rewritten. Heavy brain row now: "Qwen 3-Next 80B *or* Groq Llama-3.3-70B (50/50 rotation)". Fast brain: "Nemotron Nano 30B". Judge: "Mistral Large 3 675B". Full fallback chains documented. - `70-docs/60-decisioβ¦2e60476 -
refactor: KI-050 β complete data/ β 40-data/ rename across all Python refsβ
The data/ β 40-data/ git mv landed in the previous commit (c8bf1a1) but the corresponding string-path updates in Python code did not β Python was still resolving _DATA_ROOT, _PROFILES_DIR, PREMIUM_DATA, HEALTH_FILE, etc. to the now-non-existent data/ path. The HF Space rebuild would have shipped a broken backend. This commit sweeps the 23 files that referenced data/ as a string path: β’ `"data/*` β `"40-data/*` β’ `/data/*` β `/40-data/*` β’ `(data/` β `(40-data/` β’ `Path("data" ...)` β `Path("40-data" ...)` β’ `ROOT / "data"` β `ROOT / "40-data"` Touched: backend/{session_state, profile_store, premium_calculator, llm_health, admin, main, scorecard, providers/nvidia_nim_llm}, rag/build_kb, tools/{check_link_rot, info_source_map, refresh_premiums, generate_policy_facts, curate_*, ingest_reviews, ingest_kb_summaries}, backend's per-folder docs, etc. Dockerfile: `COPY data ./data` β `COPY 40-data ./40-data` β container path mirrors host. Verified by: β’ Python smoke: _DATA_ROOβ¦52c6351 -
refactor: KI-047 β bucket reorg (Option A safe subset)β
User picked numbered-bucket layout. Executing the SAFE subset that does NOT touch Python imports or string path refs: β’ docs/ β 70-docs/ β’ audit_results/ β 80-audit/ Kept as-is (renaming would need ~25 Python files of string-path updates β deferred to follow-up): β’ data/ β code-referenced (backend/{premium_calculator, session_state, profile_store, scorecard, admin, llm_health, main}, rag/build_kb, tools/{check_link_rot, info_source_map, curate_*, refresh_premiums, generate_policy_facts}). β’ backend/, frontend/, rag/, tools/, eval/, tests/, kb/ β Python directly forbids leading-digit / hyphen package names. All references to the moved folders updated in one sed pass across *.md, *.py, *.sh, *.ts, *.tsx, *.json, Dockerfile. Verified by: β’ tests/test_routing_regression.py β 15/15 still pass. β’ No residual (docs/ or [docs/ or /docs/ or ^docs/ refs. β’ Same for audit_results/. Docβ¦e2d09f9 -
feat: KI-044 PCM pre-roll via AudioWorklet + 11 folder READMEsβ
KI-044 β Proper first-word capture in Live mode. Previous MediaRecorder approach started recording only AFTER VAD declared speech-start, missing the first 50-100 ms of the opening word. User report: "ensure that the first word uttered is also captured, especially in live." New approach (frontend/src/lib/useLiveConversation.ts): β’ Inline AudioWorkletProcessor (Blob-URL registered, no static asset routing) taps the raw PCM from the mic source. Every render quantum (128 samples) is posted to the main thread as Float32. β’ Main thread maintains a circular preroll buffer (~300 ms at the AudioContext sample rate) while no utterance is in progress. β’ When VAD fires speech-start: snapshot the preroll into the active utterance buffer; continue accumulating subsequent samples. β’ When VAD fires silence-end: encode utterance as 16-bit PCM WAV (Sarvam Saarika native format) and post to onUtterance. β’ Worklet stays running via source β workletNode β silentSink (zeroβ¦86fcc31 -
fix: KI-018..022 β routing, profile telemetry, NIM timeouts, judge JSON, chat clearβ
Five interlocking enterprise-readiness fixes plus a master audit report. KI-018 β orchestrator.py: stop force-routing QA intent to fact-find when the session profile is empty. The KI-013 guard was over-correcting: every QA question ("What's the waiting period for PED in Activ Assure?") was being answered with "Happy to help. First, your age?". Restrict the empty-profile guard to {recommendation, comparison} intents only. 5-Q post-fix smoke: factual accuracy 0% β 60%; nim-chain serving 100% of QA (was 0%). Full re-eval owed. KI-019 β orchestrator.py: populate TurnResult.profile_updates from the fact-find branch (previously only the free-form branch populated it). The 100-persona audit appeared to show age captured for only 12/100 personas when the slot-filler was actually working β confirmed by the fact_find_complete readback "42 years old; covering self+spouse+kids+ parents; income 25L+". This was a telemetry bug, not a slot-filler bug. KI-020 β main.py / session_state.py / frontendβ¦bcb7079 -
feat(rag): tools/ingest_kb_summaries.py β embed kb/policies/*.md (KI-019)β
224 hand-written policy summaries in kb/policies/<id>.md were never embedded. Retrieval matched against raw PDF prose instead of clean natural-language section text. Bad for "what does X cover?" queries. New ingester: - Parses YAML frontmatter for canonical policy_id, insurer_slug, policy_name, uin_code. - Splits body at H2 boundaries (Identity, Eligibility, Waiting periods, Coverage, Sub-limits, Exclusions, etc.) β one section per schema-field family. - SKIPS sections where every H3 field is "_not specified_" (no information content). - Embeds each surviving section via BGE-small. - Inserts to same Chroma `policies` collection with doc_type="summary" and kb_section=<H2 title> for facet filtering. Expected impact: retrieve.py now has summary chunks alongside raw wordings β better recall for natural-language Q&A, cleaner citations (one summary section vs 3-4 raw chunks per topic). Ingestion currently running locally; once complete, will re-upload Chroma β¦244fa54 -
feat(reviews): KI-017 β enriched per-facet review chunks (10 β 60)β
Was: 1 generic paragraph per insurer (β500 chars) β bad recall for review queries because the LLM had to disambiguate metrics from sentiment from news from inside one blob. Now: 4-6 semantically distinct chunks per insurer: - claim_metrics (IRDAI numbers) - aggregator_ratings (Policybazaar / InsuranceDekho / MouthShut / Trustpilot) - reddit_sentiment (themes + sample URLs) - youtube_coverage (creator + video links) - recent_news (one line per item) - overall_score (aggregate trust + letter grade) Each carries a `review_facet` metadata field so retrieve.py can filter or boost when intent is clear. Live counts (verified against rag/_hf_dataset_backup/rag/vectors): - 10 insurers Γ 6 facets = 60 review chunks total - was 10 chunks β 6Γ richer recall surface Also: backwards-compat shim β old `review_to_paragraph()` still works (returns concat of all facets) so any external caller doesn't break. After this commit, push to HF Dataset (`rohitsar567/insurance-bot-data`) viaβ¦85a34b0 -
feat(audit): 100-persona multi-scenario simulation frameworkβ
Three-stage audit harness for the non-speech parts of the bot: tools/audit/personas.py 100 personas (10 archetypes Γ 10 demographics). Cross-product engineered so each persona is a unique (archetype, demo, style) triple. tools/audit/flows.py 30-turn flow per persona: opening + 9 fact-find answers + 10 free-form policy Qs (anchored on persona concerns) + 5 edge cases (retries, view-shift, mid-profile-update, view-aware) + 5 adversarial (OOC, multi-policy, regulatory, closing-resistance, summary). tools/audit/run_audit.py Concurrent async runner with NIM rate-limit guard (1.8s/dispatch Γ 4 workers = 35 req/min, under NIM's 40/min cap). Resumable: completed persona transcripts land in β¦3dab53c -
chore: print absolute output path (PDF is outside the repo now)
6f3c920 -
chore: build_readme_pdf.py outputs to ~/Desktop, not the repoβ
The PDF is a sharable artifact (email / Slack / AirDrop), not a repo asset. Repo holds README.md (the source of truth, present on HF Space + GitHub); the PDF gets regenerated to the Desktop where it's easy to grab and share. Output path: ~/Desktop/Insurance-Sales-Bot-README.pdf Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>db1ecc9 -
docs: add tools/build_readme_pdf.py (PDF gitignored β HF rejects binaries)β
The HF Space pre-receive hook rejects binary files in the Space repo (use Xet/LFS or releases instead). Putting README.pdf in the gitignore keeps both remotes in sync at the same tree. To regenerate the PDF locally for sharing: uv pip install --python ~/.cache/uv-venvs/insurance-sales-bot/bin/python markdown-pdf python tools/build_readme_pdf.py # β README.pdf (~730 KB, ready to email / Slack) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>a2a4ece -
Deploy: Stack A (NIM brain + Maverick judge + Sarvam voice). D-019.
Verified signatured7ac696 -
Deploy: Stack A (NIM brain + Maverick judge + Sarvam voice). D-019.
Verified signaturecd72f85 -
Deploy: Stack A (NIM brain + Maverick judge + Sarvam voice). D-019.
Verified signature13779e8
-
Clean Space: delete 263 legacy files (4 retired providers + corpus/vectors/extracted moved to dataset). D-019 Stack A.
Verified signature35cff13 -
Stack A: NIM brain + Maverick judge + Sarvam voice/Indic (D-019). Data moved to insurance-bot-data dataset; Space is now code-only.
Verified signaturec32bddc -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signature881b2f5 -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signature54e6ba9 -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signature54ae55a -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signature64d5deb -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signature9559143 -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signatured1c5011 -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signaturebd7ade9 -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signature9c879c3 -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signatured2e3503 -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signaturef0adc52
-
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signaturea21896f -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signature3e6b7ee -
Deploy v1 β single-Docker FastAPI + Next.js + RAG + voice + faithfulness
Verified signature5dbdf6e