Skip to main content

Developer-first kit for LLM chatbots with streaming, memory, and personas (Discord-first)

Project description

LLM Chatbot Kit

Developer‑first kit for LLM chatbots
Streaming • Memory • Personas (Discord‑first)

LLM Chatbot Kit

Build Docs Build Package Python

Install (pipx recommended)

  • pipx: pipx install . (from repo root) or pipx install git+https://github.com/maiko/llm-chatbot-kit@main
  • Run (Discord): llm-chatbot discord run --personality personalities/aelita.yml
    • Default behavior streams replies as natural message bursts (no edits), with typing indicator.
    • Disable streaming: llm-chatbot discord run --no-stream (or --stream=false).

Demo personalities (Code Lyoko)

  • Aelita (ally): llm-chatbot discord run --personality personalities/aelita.yml
  • XANA (antagonist): llm-chatbot discord run --personality personalities/xana.yml

Configuration (env)

  • DISCORD_TOKEN: Discord bot token
  • OPENAI_API_KEY: OpenAI key
  • OPENAI_MODEL (optional): defaults to gpt-5-mini.
  • OPENAI_VERBOSITY (optional): low (default), medium, or high (GPT‑5 only; not for gpt-5-chat-latest).
  • DISCORD_OWNER_ID (optional): User ID for reboot
  • COMMAND_PREFIX (default ~), MAX_TURNS (default 20)
  • CONTEXT_STORE_PATH (optional): override default JSON context path.

Run multiple personas

  • Use one process per bot (each with its own DISCORD_TOKEN).
  • Aelita: llm-chatbot discord run --personality personalities/aelita.yml (prefix !)
  • XANA: llm-chatbot discord run --personality personalities/xana.yml (prefix ^)

Models & generation

  • Generation model: GPT‑5 mini by default (OPENAI_MODEL=gpt-5-mini).
  • Judge/classifier (listening): GPT‑5 nano.
  • GPT‑5 features used (except gpt-5-chat-latest):
    • reasoning: { effort: "minimal" } for faster time-to-first-token.
    • text: { format: { type: "text" }, verbosity: <OPENAI_VERBOSITY> } (default low).
  • Requests use the Responses API with typed items (developer/user/assistant). Chat Completions is kept only as a fallback.

Create a new personality

  • Duplicate personalities/aelita.yml, adjust name, developer_prompt, system_prompt.
  • Optional pacing in YAML:
    streaming:
      rate_hz: 1.0
      min_first: 80
      min_next: 120
    
  • Optional environment & listening:
    command_prefix: "!"
    environment:
      include_emojis: true
      emojis_limit: 50
      include_online_members: true
      online_limit: 50
    listen:
      enabled: false
      judge_enabled: true
      judge_model: gpt-5-nano
    truncation: auto  # hide meta and let API auto-truncate context
    
  • Run with --personality path/to/your.yml.

Notes

  • Messages are stored in a JSON file under ~/.cache/llm-chatbot-kit/context.json (or CONTEXT_STORE_PATH). On first run, the kit migrates an existing ~/.cache/discord-llm-bot/context.json automatically.
  • Keep replies under Discord’s 2000-char limit; bot auto-chunks.
  • Streaming is default; on failure it falls back to non-streaming.
  • Enable intents in the Developer Portal: Message Content (required) and Presence (for online members).
  • Mentions: The bot allows user mentions but blocks roles/everyone. It adds a reminder to the developer prompt not to mention itself and strips leading self-mentions.
  • Environment context in guilds includes a “Membres visibles” list with member names and IDs for correct mentions, and an optional online members list by name only.

Commands (per persona prefix)

  • Memory: <prefix>context, <prefix>reset, <prefix>reboot (owner)
  • Listening: <prefix>listen on|off|status|ban|unban
  • Costs: <prefix>cost status|budget daily|budget monthly|hardstop on|off
  • Emojis: <prefix>emoji list
  • Truncation: <prefix>truncation status|set <auto|disabled>

Planned

  • Multi-platform supervisor: run the same persona across Discord and other platforms concurrently via llm-chatbot multi run --platforms discord,slack. See issue #3.
  • Slack integration: first-class adapter and slack run subcommand. See issue #2.
  • Logging improvements: phased verbosity, JSON logs, redaction, usage summaries. See issue #4.
  • Docker packaging: official image and compose example. See issue #5.

Documentation

  • Overview: docs/Overview.md
  • Installation: docs/Installation.md
  • Configuration: docs/Configuration.md
  • Personalities: docs/Personality.md
  • Streaming details: docs/Streaming.md
  • Listening (Experimental): docs/Listening.md
  • Costs: docs/Costs.md
  • Commands: docs/Commands.md
  • Packaging (CI builds): docs/Packaging.md
  • Development: docs/Development.md
  • Security: docs/Security.md
  • Troubleshooting: docs/Troubleshooting.md

Quick tips

  • Set DISCORD_OWNER_ID to receive DM alerts on spend thresholds and to unlock owner-only commands.
  • If running via pipx, use pipx upgrade llm-chatbot-kit (or reinstall) after pulling updates.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_chatbot_kit-0.1.0.tar.gz (30.0 kB view details)

Uploaded Source

Built Distribution

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

llm_chatbot_kit-0.1.0-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file llm_chatbot_kit-0.1.0.tar.gz.

File metadata

  • Download URL: llm_chatbot_kit-0.1.0.tar.gz
  • Upload date:
  • Size: 30.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_chatbot_kit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3a955b613269aef63fa567aff5ddc548b9b1a8e6177e687e76c1a47ac8eb333e
MD5 74f4f6d9df8e29c0ff844148eef50239
BLAKE2b-256 6680a51999f438bbc2d3f8c3d23c3fa94cd6ce47150713048f9d1f315e8d7c03

See more details on using hashes here.

File details

Details for the file llm_chatbot_kit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_chatbot_kit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24dbf0732bca9525a797a3bd6476986cca82392f87c59af4f65b1b99e87fab77
MD5 2880af70d8874d566aae24591c0b2976
BLAKE2b-256 a100c8ba2e7edbbb67eedb36ea7e06c127064a5dea82f74065a0df0e575c1f92

See more details on using hashes here.

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