Back to Portfolio

AI Docs Chatbot

RAG-Powered Support Automation

n8nOpenAI GPT-4o-minitext-embedding-3-small Supabase / pgvectorLangChainMicrosoft Teams (Graph API)

Overview

A retrieval-augmented generation (RAG) chatbot that turns a product's own documentation into an AI support engine — answering customer questions instantly, in whichever language they asked in, with a direct link back to the source article on every answer.

In Action

The assistant lives as an embedded chat widget directly on the website, ready to answer visitor questions the moment they land.

The Challenge

Long-form documentation articles, often 3,000+ words, were hard to search with plain keyword matching — customers had to read entire pages to find one answer. A general-purpose LLM would happily generate a plausible-sounding but wrong answer instead of admitting it didn't know, which wasn't acceptable for product support. And technical questions arriving outside business hours had no path to a human: nothing captured, logged, or routed them for follow-up.

Engineering Solution & Architecture

The system runs as two automated n8n pipelines — one for ingesting documentation into a searchable knowledge base, one for answering questions and escalating what it can't:

  • Automated ingestion pipeline: extracts documentation articles from the database, cleans and chunks each one, generates embeddings via OpenAI, and stores the vectors alongside structured metadata in a Supabase/pgvector store — a scheduled n8n workflow, with no manual re-indexing.
  • Overlap-based chunking: articles are split into 800–1,000 character chunks with a 100–150 character overlap, so an answer spanning a paragraph boundary in the source article is never truncated or lost.
  • Structured metadata per chunk: every chunk carries its article ID, title, source URL, category, and last-updated date — letting the agent filter searches by category, cite the exact source, and avoid duplicate content.
  • Grounded retrieval-augmented generation: a user's question is embedded, matched against the top 3–5 most relevant chunks by vector similarity, and injected as context into GPT-4o-mini through a LangChain retrieval chain — the model is instructed to answer strictly from that context, not its general training data.
  • Source-linked, bilingual answers: every response replies in whichever language the user asked in (Arabic or English) and includes a direct link to the source article, turning the chatbot into a navigation aid rather than a black box.
  • Automated human escalation: when no relevant chunk exists for a query, the agent switches into a short conversational intake, collects the customer's contact details, logs the request to a spreadsheet, and pushes a formatted alert to a Microsoft Teams channel so a person picks it up.

Key Results

Delivered a documentation-grounded support chatbot with zero-hallucination, source-cited answers, always-on coverage for technical questions, and an automated escalation path that logs and routes every unresolved query to a human — backed by an HNSW-indexed vector store built to scale to hundreds of thousands of documentation chunks without losing retrieval speed.