Skip to content
Anton GoncharovAI systems developer

Telegram and Max · knowledge base search

AI support from a knowledge base

A support bot for a fictional coworking space: it answers only from a knowledge base of 18 documents, attaches sources to every answer, and when a question is off-topic it doesn’t make things up but offers an operator. The operator replies from their own Telegram, and the customer gets the answer in the same chat.

Scenario: Kvadrat Coworking, Yekaterinburg — fictional: plans, meeting rooms, parking, rules.

Conversation with the bot: AI support from a knowledge base
The replies are real — captured from the bot’s code and styled like Telegram. The bot speaks Russian.

Open the demo

The bot replies in Russian: it was built for Russian-speaking customers. Example phrases come with translations.

Don’t enter real personal data: this is a demo, and everything is deleted after 24 hours.

What the demo shows

  • Hybrid search: BM25 over word stems plus vectors, results merged by rank

  • Answers with [1], [2] links to knowledge base fragments — any of them opens with a button

  • Refusal instead of invention: if the base doesn’t cover the question, the bot says so

  • Handover to an operator with the conversation history, and back to the bot

  • Search quality metrics in CI: hitting the right document on 40 control questions

  • One codebase for Telegram and Max

How to try it

  1. Open the bot

    Click “Open in Telegram” or scan the QR code with your phone. Press “Start”.

  2. Ask a question

    In your own words or with an example button. Sources appear under the answer — tap a number to see the original fragment.

  3. Ask something off-topic

    For example, ask for a poem. The bot will decline and offer an operator — that’s how a bot you can trust with customers behaves.

  4. Call an operator

    The /operator command or the button under an answer. If an operator is online, they reply right in this chat; /bot returns you to the bot.

What to write

  • Сколько стоит переговорная на 8 человек?How much is a meeting room for 8 people?
  • Можно прийти с собакой?Can I bring my dog?
  • Есть ли парковка?Is there parking?
  • Как вернуть деньги за абонемент?How do I get a refund for a membership?
  • Можно ли зарегистрировать ООО по вашему адресу?Can I register a company at your address?
  • Работаете в субботу?Are you open on Saturday?

Commands

/start
start over
/operator
call an operator
/bot
back to the bot
/about
how the demo works

No paid neural networks

In a production project, a language model writes the answer from the retrieved fragments. In the demo it is replaced by a local stub that assembles the answer from the best-matching sentences of the knowledge base. Search, sources, refusals and operator handover work just as in production.

The demo runs without OpenAI, YandexGPT or GigaChat API keys. Wherever a production system calls a model, there’s a local stub with the same interface — so the demo is free, always available and never makes things up.

What a production project adds

  • A knowledge base built from your documents, website, Notion or Confluence, updated on a schedule
  • Model answers (OpenAI, YandexGPT or GigaChat) strictly based on retrieved fragments
  • Operators in a Telegram group, Bitrix24 or amoCRM rather than in private messages
  • Conversation logs, the share of requests closed without an operator, and review of failed answers

Stack

  • Python 3.14
  • aiogram
  • Max Bot API
  • BM25 + vectors
  • SQLAlchemy
  • SQLite

Based on

Books and university courses whose ideas are at work in this demo.

Developer’s comment

Anton Goncharov

AI systems developer · Python

For business

  • The first line answers at night and on weekends, and the operator gets only what the bot honestly doesn’t know — along with the conversation history.
  • Every answer links to a document: the customer sees where the information came from, and you see which sections of the base are outdated.
  • The most valuable thing is the list of questions the bot answered with “I don’t know”. It’s a ready plan of what to add to the knowledge base.

For developers

  • Search is hybrid: BM25 over word stems plus vectors, with the lists merged by rank (RRF). The model gets only the retrieved fragments.
  • Refusal isn’t a “don’t make things up” prompt but a threshold: if the fragments cover the question poorly, the model is never called.
  • One codebase for Telegram and Max: transport is separated from logic, and search quality is checked in CI on 40 questions with an expected document.

Tips

  • Tip 01

    Start with a set of control questions, not with choosing a model: without it, any “it got better” is just a feeling.

  • Tip 02

    Split the base by headed sections, not by fixed length: a fragment should answer a question in full.

Want the same for your business?

Tell me about your task — I’ll tell you what from the demo fits, how long it will take and what I’ll need from you.

Other demos in this section

All demos
  • Telegram and Max · leads and CRM

    live

    Lead qualification

    The bot takes a request in free-form text, pulls out the task, budget, timeline and contact, rates how “hot” the lead is and puts a card on the deal board.

    • Python
    • Telegram and Max
  • Telegram Mini App · payment · statuses

    live

    A store in Telegram

    A catalog as an app inside Telegram, a cart, test payment and order status notifications — from “packing” to “delivered”.

    • Python
    • Telegram and Max
    • React
  • Telegram and Max · booking, prepayment, reminders

    live

    Service booking in Telegram and Max

    The bot books barbershop appointments: service, barber and free time via buttons or in a single phrase, prepayment, a reminder with “I’ll come” and “Reschedule” buttons, rescheduling, cancellation and the schedule as the administrator sees it.

    • Python
    • Telegram and Max
  • Telegram and Max · points, QR at the till, broadcasts

    live

    Loyalty program in Telegram and Max

    A bakery guest card right in the messenger: a QR code for the till that changes every minute, points and tiers, every sixth coffee free, points exchanged for coupons, bonuses for friends and segmented broadcasts with marketing consent.

    • Python
    • Telegram and Max
  • Web app · scenario · aiogram 3 code

    live

    Bot scenario builder

    A booking or lead-collection bot is assembled from steps: messages, buttons, questions with phone or date validation, conditions. The scenario can be walked through right away in a Telegram-style preview, and the output is ready-to-run Python bot code.

    • React
    • TypeScript
    • Python