Skip to main content

Библиотека для создания умных чат-ботов

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.

Быстрый старт

  1. Проверьте точку входа CLI:
sbf --help
  1. Создайте каркас бота:
sbf create clinic-bot

Команда создаст bots/clinic-bot/ с каркасом для prompt, message, test, file и .env.

  1. Заполните обязательные значения в bots/clinic-bot/.env, особенно TELEGRAM_BOT_TOKEN и OPENAI_API_KEY.

  2. Запустите бота:

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

smart_bot_factory-2.0.1.tar.gz (804.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smart_bot_factory-2.0.1-py3-none-any.whl (393.6 kB view details)

Uploaded Python 3

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

Hashes for smart_bot_factory-2.0.1.tar.gz
Algorithm Hash digest
SHA256 d47b9dca06cfa4089dfbb34b02af4442f75b9a3bbd933f8b9ce821615e282487
MD5 28e865d2b67f4d5a222a871782228f8b
BLAKE2b-256 6376724e42762548e04b31a88ad336b3fd64d5907e2935b531a3db102ed59ec5

See more details on using hashes here.

Provenance

The following attestation bundles were made for smart_bot_factory-2.0.1.tar.gz:

Publisher: publish.yml on zetam1320/Smart_bot_factory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smart_bot_factory-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for smart_bot_factory-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3306875c873830cde8cfba70f29e1f18dce7f262437d4fe3d12ef61ce9b33959
MD5 b442763ba326ad3f2413cba394e9143c
BLAKE2b-256 93dcdf48c515bfc4c485010316a7401a3e5ea10b91124b93513b7aa0268c5548

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page