Summary
Most website chatbots will confidently make things up. Lumen crawls a site's pages and documents, answers only from what it retrieves, cites each source and declines when it does not know.
test questions handled correctly
By the confidence check, on a labelled set. Not a production measure.
unit tests
In the retrieval and answering service.
The problem
A business cannot put a chatbot on its website if it might invent a price or a promise. The assistant has to answer from real content, and has to know when it should not answer at all.
Constraints
- Many customers on one system, with private content that must never leak across them.
- Source material in many formats, including PDF and Office files.
- Refusing a fair question was judged far more costly than a slightly eager answer.
The approach
A crawler extracts text from pages and documents and sends it for indexing. When a question arrives, search runs, a confidence check decides whether to proceed, and the answer streams back with citations.
Architecture flow
- pages and documentsCrawler
- text and vectorsIndex
- Search, then confidence check
- Streamed answer with citations
Key decisions
Decision 01
Combine keyword and vector search
Why: Vector search handles rephrased questions, and keyword search finds rare exact terms like product codes. Their failures barely overlap.
Trade-off: Two indexes to maintain, and results have to be merged by rank because their scores are not comparable.
Decision 02
Base the confidence check on similarity, not the merged rank
Why: The merged rank shows that two searches agree, not that the result is relevant. Thresholds were set against a labelled test set.
Trade-off: Thresholds have to be measured again whenever the embedding model changes.
Decision 03
Layer the guardrails, and make some of them plain rules
Why: A prompt can eventually be talked around, so some checks run as fixed patterns, before the model and on its output.
Trade-off: The patterns are deliberately broad, so some harmless questions are redirected to a person.
Decision 04
Filter private content before results are limited
Why: If the filter ran afterwards, restricted content could use up result slots or leak. The default is public content only.
Trade-off: Queries are more complex to write and to test.
What is next
The test set measures the confidence check, not how much relevant content search finds. A measure for that would come next, followed by a reranker if the numbers call for one.
Building something similar?
Tell me what you are working on, and we can look at it together.