Библиотека для создания умных чат-ботов
Project description
Smart Bot Factory
Smart Bot Factory — это Python CLI и библиотека для создания Telegram AI-ботов с OpenAI, aiogram, персистентностью через Supabase, CRM-интеграциями и опциональными RAG-бэкендами.
Установка
Установите пакет из PyPI:
pip install smart-bot-factory
Опционально: для изоляции окружения сначала создайте и активируйте виртуальное окружение (python -m venv .venv и source .venv/bin/activate), затем выполните pip install.
Проект требует Python >= 3.10.
Быстрый старт
- Проверьте точку входа CLI:
sbf --help
- Создайте каркас бота:
sbf create clinic-bot
Команда создаст bots/clinic-bot/ с каркасом для prompt, message, test, file и .env.
-
Заполните обязательные значения в
bots/clinic-bot/.env, особенноTELEGRAM_BOT_TOKENиOPENAI_API_KEY. -
Запустите бота:
sbf run clinic-bot
Примеры использования
Управление проектами ботов
С помощью sbf CLI можно просматривать, копировать, диагностировать, тестировать и удалять проекты ботов:
sbf list
sbf copy clinic-bot clinic-bot-staging
sbf doctor clinic-bot
sbf test clinic-bot
sbf update
sbf env-sync clinic-bot
sbf rm clinic-bot-staging
Обновление CLI (sbf update)
Команда sbf update работает только в локальном проекте с существующим .venv и завершится с явной ошибкой, если .venv отсутствует.
sbf update
Регистрация бизнес-событий
Сгенерированные лаунчеры ботов используют BotBuilder и EventRouter, чтобы подключать пользовательские бизнес-действия, которые ассистент может вызывать из структурированных AI-метаданных:
from smart_bot_factory.creation import BotBuilder
from smart_bot_factory.message import send_message_by_human
from smart_bot_factory.router import EventRouter
event_router = EventRouter()
bot_builder = BotBuilder()
@event_router.event_handler(once_only=True)
async def collect_contact(user_id: int, contact_data: str) -> dict[str, str]:
await send_message_by_human(
user_id=user_id,
message_text=f"Thanks, your contact is saved: {contact_data}",
)
return {"status": "success", "contact": contact_data}
bot_builder.register_routers(event_router)
Документация
- Начало работы:
docs/GETTING-STARTED.md - Архитектура:
docs/ARCHITECTURE.md - Конфигурация:
docs/CONFIGURATION.md - Тестирование:
docs/TESTING.md - Процесс разработки:
docs/DEVELOPMENT.md - Деплой:
docs/DEPLOYMENT.md - Устранение неполадок:
docs/troubleshooting.md
Лицензия
Проект распространяется по лицензии MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smart_bot_factory-2.0.1.tar.gz.
File metadata
- Download URL: smart_bot_factory-2.0.1.tar.gz
- Upload date:
- Size: 804.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d47b9dca06cfa4089dfbb34b02af4442f75b9a3bbd933f8b9ce821615e282487
|
|
| MD5 |
28e865d2b67f4d5a222a871782228f8b
|
|
| BLAKE2b-256 |
6376724e42762548e04b31a88ad336b3fd64d5907e2935b531a3db102ed59ec5
|
Provenance
The following attestation bundles were made for smart_bot_factory-2.0.1.tar.gz:
Publisher:
publish.yml on zetam1320/Smart_bot_factory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smart_bot_factory-2.0.1.tar.gz -
Subject digest:
d47b9dca06cfa4089dfbb34b02af4442f75b9a3bbd933f8b9ce821615e282487 - Sigstore transparency entry: 1523459743
- Sigstore integration time:
-
Permalink:
zetam1320/Smart_bot_factory@fd94c06eff64a3c90cf7c59724eb78900538e7a9 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/zetam1320
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd94c06eff64a3c90cf7c59724eb78900538e7a9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file smart_bot_factory-2.0.1-py3-none-any.whl.
File metadata
- Download URL: smart_bot_factory-2.0.1-py3-none-any.whl
- Upload date:
- Size: 393.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3306875c873830cde8cfba70f29e1f18dce7f262437d4fe3d12ef61ce9b33959
|
|
| MD5 |
b442763ba326ad3f2413cba394e9143c
|
|
| BLAKE2b-256 |
93dcdf48c515bfc4c485010316a7401a3e5ea10b91124b93513b7aa0268c5548
|
Provenance
The following attestation bundles were made for smart_bot_factory-2.0.1-py3-none-any.whl:
Publisher:
publish.yml on zetam1320/Smart_bot_factory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smart_bot_factory-2.0.1-py3-none-any.whl -
Subject digest:
3306875c873830cde8cfba70f29e1f18dce7f262437d4fe3d12ef61ce9b33959 - Sigstore transparency entry: 1523459747
- Sigstore integration time:
-
Permalink:
zetam1320/Smart_bot_factory@fd94c06eff64a3c90cf7c59724eb78900538e7a9 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/zetam1320
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd94c06eff64a3c90cf7c59724eb78900538e7a9 -
Trigger Event:
push
-
Statement type: