How WebChat AI transforms visitor questions into grounded, source-backed answers without fabricating unverified information.
What is Retrieval-Augmented Generation (RAG)?
The 8-stage pipeline executed per user message.
Input Validation & Safety Screening
Incoming questions are trimmed, sanitized, and evaluated against common prompt injection patterns. The system rejects abusive payloads before any embedding or generation compute is spent.
Context-Aware Disambiguation
If the user asks a follow-up question (e.g. "How much does it cost?"), the query rewriter uses prior conversation memory to expand pronouns and implicit references into a self-contained search query.
Dual-Path Vector + Lexical Search
WebChat AI retrieves passages using two complementary strategies:
Merging and Reordering Candidate Chunks
Results from vector search and lexical search are merged using Reciprocal Rank Fusion (RRF) and scored with embedding-based reranking with lexical awareness. A maximum chunk limit per source prevents a single document from crowding out others.
The Hallucination Guard
Before calling the language model, the system evaluates chunk relevance scores. If the knowledge base contains no sufficiently relevant material, the assistant returns a graceful fallback message immediately without invoking the LLM, ensuring ungrounded facts are not fabricated.
Deduplication & Character Budgets
Retrieved chunks are stripped of near-duplicates and compressed to fit within a strict context character budget. This reduces latency and ensures only high-signal information reaches the model.
Server-Sent Events (SSE) Output
The model synthesizes the answer strictly based on the provided context passages. Tokens stream back to the widget UI in real time over Server-Sent Events (SSE).
Traceable Document Attribution
Every factual response includes structured source cards linking visitors directly to the crawled web URL or uploaded document that supplied the evidence.
Preventing vector space corruption across re-crawls.
When an assistant first indexes content, WebChat AI permanently records the embedding provider, model, and vector dimensions on the website record. All subsequent document uploads, retries, and visitor search queries are locked to that identical model. This ensures vector search spaces never suffer dimensionality or semantic drift.
Related documentation
Ready to build?
Register a website and get a live assistant in minutes.