Wemo.Learn

Tutorial · Beginner

AI Customer Support Chatbot

Website support chat that answers from a help center with verified citations and hands everything else to a person. Includes retrieval and answer evals, rate limits and a daily budget.

About 2 hours 11 stepsPythonOpenAISupabaseFastAPI

This guide builds a support chat for a company website. It answers customer questions from the company's help center articles. Every answer must be backed by a quote from an article, checked in code. Questions it cannot answer from the articles, and questions about a specific booking, invoice or complaint, are handed to a person as a ticket.

Each step ends with a checkpoint you can run.

Architecture#

Loading diagram…

Design principle: the model writes the answer, code decides whether it may be shown. The model must quote its sources. Code checks every quote. When in doubt, the question goes to a person instead of getting a guessed answer.

Requirements#

Project structure#

Output
support-desk/
├── .env                  # keys and settings (not committed)
├── pyproject.toml
├── hello_openai.py       # step 1
├── knowledge_base/       # help center articles (Markdown)
├── support_desk/
│   ├── config.py         # settings from .env
│   ├── openai_client.py  # shared OpenAI client
│   ├── schema.sql        # tables and indexes
│   ├── db.py             # connection pool
│   ├── kb.py             # articles → chunks
│   ├── telemetry.py      # request log, token prices
│   ├── embeddings.py     # text → vectors
│   ├── index.py          # keep the index in sync
│   ├── search.py         # keyword, vector, hybrid search
│   ├── answer.py         # answer with verified citations
│   ├── conversations.py  # history, feedback
│   ├── handoff.py        # tickets
│   ├── cache.py          # answer cache
│   ├── service.py        # one chat turn
│   ├── app.py            # HTTP API
│   └── static/           # widget.js, demo page
├── evals/                # retrieval and answer evals, reports
├── .github/workflows/    # index job
└── dockerfile

AI Automations Guild

Join the community

Ask questions, get help with this tutorial and share what you build. Free on Skool.