β Qualtrics Frontend
When is the registration deadline for the 2026 election?
For the 2026 Maryland general election (Nov 3), the voter registration deadline is Tuesday, Oct 13, 2026.
π elections.maryland.gov
π elections.maryland.gov
Ask about voting in Montgomery Countyβ¦
β€
JS β Backend (HTTPS)
// Send message to FastAPI
fetch("/chat", {
headers: { "X-API-Key": apiKey },
body: JSON.stringify({
user_id, query
})
})
β‘ Python + FastAPI Backend (VIOLETS Engine)
VIOLETS
Voter Information from Official Local Election Trusted Sources
FastAPI + LangChain + OpenAI
/chat Request Pipeline
1
Auth + Rate Limit
X-API-Key check β 20 req/min per user_id
hmac compare Β· sliding window2
PII Guard
Presidio scan β hard block on SSN/card/email/phone/IP/ID
Presidio Β· score β₯ 0.53
Classify Query
8 categories Β· 5 exit early with a hardcoded response
gpt-5-nano Β· structured output4
Retrieve
Embed query β pgvector cosine search β top-k=5 chunks
text-embedding-3-small Β· pgvector5
Generate Response
gpt-5-nano Β· prompt varies by category (QA / Concerns / Conversational)
gpt-5-nano Β· cited answer6
Partisan Check & Respond
Retry up to 2Γ if flagged (fail-open) β log β return response + sources
gpt-5-nano Β· fail-openGuardrails & Operating Limits
X-API-Key auth
20 req/min limit
PII detection
8-way classify
partisan retry Γ2
30min / 20-turn TTL
CORS allowlist
fail-open on guard error
β’ Knowledge Base
Postgres + pgvector
Vector DB
chunk_1
chunk_2
chunk_3
chunk_n
1536
dims/vector
k=5
top retrieved
cos
similarity
Offline KB Construction
1
Discovery (Pass 1)
- Web Crawl β allowlisted BFS over SBE + MoCo, exclusion-filtered, rule-classified into a SQLite manifest
- Box Hub β Playwright + Box API discover & download 2026-folder files, filename-filtered into include / exclude / manual-review
Both run in parallel to build the corpus before extraction
2
Extraction & Chunking (Pass 2)
Type-specific splitting (FAQ pairs, ~300w prose, table rows, ~250w paragraphs, single-chunk pages) for both web and Box content, into one unified schema
3
Embedding & Upload (Pass 3)
text-embedding-3-small β unified Postgres + pgvector table, retrieved by cosine similarity across all sources
β» Incremental & resumable at every stage β reruns only touch what actually changed.
SBE β elections.maryland.gov
MoCo BoE β montgomerycountymd.gov/elections
Box Hub β mdsbe.app.box.com/hubs/263564910