Skip to content

Telegram Bot v.3 - Multi-Persona LLM Debate System #50

Description

@kimpro82

PRD: Telegram Bot v.3 - Multi-Persona LLM Debate System

1. Overview

The goal of version 3 is to evolve the existing Ollama-powered Telegram bot into an autonomous debate system. A single LLM engine will cycle through distinct personas to discuss complex topics. This version prioritizes system stability (thermal management) and performance transparency (token metrics).

2. Core Objectives

  • Autonomous Debate: Enable a "Self-Debate" mode where one model acts as multiple participants.
  • Resource Management: Implement a configurable "Cooldown" period between responses to prevent CPU overheating.
  • Performance Tracking: Display real-time inference statistics (TPS, token counts).
  • System Monitoring: Provide direct visibility into the host machine's hardware status via Telegram commands.

3. Key Features

A. Multi-Persona Debate Engine

  • Context Switching: The bot will use a single Ollama model but swap System Prompts dynamically to simulate different experts/personas.
  • Iterative Loop: 1. Persona A generates a statement.
    2. The system pauses for a defined duration.
    3. Persona B reads the statement and generates a rebuttal.
    4. Repeat for $N$ iterations.

B. Thermal & Duty Cycle Control

  • Rest Period: A mandatory pause between LLM calls to allow CPU temperatures to normalize.
  • Configuration: The duration is controlled via .env (Variable: DEBATE_COOLDOWN_SECONDS, Default: 300).

C. Verbose Metadata (The "Harness")

Every LLM response sent to Telegram must include a performance footer containing:

  • Total Duration: Time taken for the generation.
  • Token Count: Prompt and response tokens.
  • Inference Speed: Tokens per second (TPS).
  • Note: This will leverage Ollama’s verbose output or internal timing logic.

D. New Telegram Commands

Command Description
/introduce Returns a bio of the current model and the active debate personas.
/temperature Fetches and displays the current host CPU temperature.
/start_debate Initiates the multi-persona discussion on a given topic.

4. Technical Requirements

  • Library: aiogram (consistent with v.1 and v.2).
  • Backend: Ollama API.
  • Monitoring: psutil or similar library for CPU temperature retrieval.
  • State Management: Tracking the "current speaker" in the debate loop to prevent context contamination.

5. Environment Variables (.env)

TELEGRAM_BOT_TOKEN=your_token_here
OLLAMA_MODEL=llama3
DEBATE_COOLDOWN_SECONDS=300
MAX_DEBATE_ROUNDS=5

6. Success Metrics

  • Stability: The bot operates for 10+ debate rounds without triggering thermal throttling.
  • Context Retention: Persona B accurately addresses the points made by Persona A.
  • Transparency: All messages include accurate hardware and LLM performance metrics.

Pro-Tip for Implementation:

  • For the CPU Temperature command, if you are running this on Linux (like a Raspberry Pi or a home server), you can usually find the data in /sys/class/thermal/thermal_zone0/temp. If you are on Windows, you might need specific WMI permissions.
  • When you're ready to dive into the aiogram logic for the debate loop, let me know! I can help you structure the asynchronous tasks so the bot doesn't "freeze" during that 5-minute wait.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions