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.

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
How to try it
Open the bot
Click “Open in Telegram” or scan the QR code with your phone. Press “Start”.
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.
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.
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
- All demos by stack:
- Python
- Telegram and Max
- 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.
Book · D. M. Koltsov
Python by Example: Practice, Practice and Only Practice
A support bot on Python and aiogram, one codebase for Telegram and Max.
Book · Fan Wenjie, Li Jianchao, Yan Xiaofan, Zhang Bin
Vibe Coding: Software Development in the Age of AI
Search quality metrics are checked in CI on 40 test questions: a change won’t pass if search got worse.
Book · Alexey Vasiliev
Python Programming in Examples and Exercises
The bot runs in Telegram and Max at the same time in one process.
Book · John Berryman, Albert Ziegler
Prompt Engineering for LLMs
The prompt is built from the knowledge base fragments that were found: only the most relevant go into the context, the answer cites them as [1], [2], and if the base doesn’t cover the question the bot honestly declines.
University course · CMC MSU
Python Development
A support bot on Python 3.14 and aiogram: hybrid search, handover to an operator, one codebase for Telegram and Max.
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- live
Telegram and Max · leads and CRM
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
- live
Telegram Mini App · payment · statuses
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
- live
Telegram and Max · booking, prepayment, reminders
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
- live
Telegram and Max · points, QR at the till, broadcasts
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
- live
Web app · scenario · aiogram 3 code
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
