VIOLETS System Architecture — Treatment Condition (Chat)
① Qualtrics Frontend
VIOLETS — Election Info Chat
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
Ask about voting in Montgomery County…
JS → Backend (HTTPS)
// Send message to Flask API
fetch("/chat", {
  body: JSON.stringify({
    msg, pid, condition
  })
})
② Python + Flask Backend (VIOLETS Engine)
🤖
VIOLETS
Voter Information from Official Local Election Trusted Sources
LangChain + OpenAI Enterprise
Retrieval-Augmented Generation Pipeline
1
Embed Query
User input → high-dimensional vector
text-embedding-3-small
2
Retrieve Chunks
Cosine similarity search → top-k=7 official chunks
Pinecone · allow-list only
3
Generate Response
System prompt + context chunks + user query → cited answer
GPT-5-nano · OpenAI Enterprise
4
Safety Guards
Citation guard · hallucination guard · no PII · candidate neutral
middleware · post-processing
Post-Processing Safety Guards
citation guard
hallucination guard
allow-list filter
no PII to LLM
candidate neutral
interaction log
③ Knowledge Base
🗄️ Pinecone Vector DB
chunk_1
chunk_2
chunk_3
chunk_n
512
tokens/chunk
k=7
top retrieved
cos
similarity
Offline KB Construction
1
Collect
Crawl allow-listed official sources
2
Chunk + Metadata
Split into ~512-token windows; attach source URL, title
3
Embed & Index
Encode → store vectors + text in Pinecone
SBE — elections.maryland.gov
County BoE — montgomerycountymd.gov/elections