Generic AI chatbots confidently make things up. A chatbot that answers from your own documentation, with guardrails that prevent off-topic answers and a clean escalation path to a human, is an entirely different product — one that earns trust instead of destroying it. This is how we build them.
Retrieval-Augmented Generation (RAG) — the foundation
RAG is the pattern that makes AI chatbots trustworthy: instead of letting the LLM answer from its training data (which may be wrong, outdated, or hallucinated), you retrieve relevant chunks from your own knowledge base and inject them into the prompt. The model can only answer from what you gave it.
export async function POST(req: Request) { const { question } = await req.json(); // 1. Embed the question const embedding = await openai.embeddings.create({ model: "text-embedding-3-small", input: question, }); // 2. Search your knowledge base const context = await searchKnowledgeBase(embedding.data[0].embedding); // 3. Answer ONLY from the context const stream = await openai.chat.completions.create({ model: "gpt-4o-mini", stream: true, messages: [ { role: "system", content: `Answer ONLY from the context below. If the answer is not in the context, say "I don't have that information — let me connect you with a team member."\n\nCONTEXT:\n${context}` }, { role: "user", content: question }, ], }); return new Response(stream.toReadableStream());}Guardrails — keeping it on topic
Without guardrails, users will jailbreak your support bot into writing code, telling stories, or giving legal advice. A strict system prompt is the first layer; a classifier that detects off-topic questions before they reach the LLM is the second.
Human handoff — the trust signal
The chatbot should proactively offer human escalation when: confidence is low, the user has asked the same question twice, the question contains keywords like 'urgent', 'refund', 'legal', or 'cancel'. A visible 'Talk to a person' button at all times is not an admission of failure — it's a trust signal.
Building and maintaining the knowledge base
The chatbot is only as good as its knowledge base. We build a sync pipeline that re-indexes your docs, FAQs and help articles whenever content changes — so the chatbot always reflects the current version.
62%
Tickets deflected
< 2s
Response time
0
Hallucinated policies
24/7
Coverage
Need this built? Explore our AI Integrations service.
View service →Written by Zahid Ghotia · Published 15 June 2026 · 8 min read



