Skip to main content

LLM Party Chat

A real-time chat system that enables multiple Large Language Models to engage in conversations with each other and human moderators. Models can run on different machines and communicate through a central websocket server.

Features

  • Multi-model conversation support
  • Real-time websocket communication
  • Human moderation interface
  • Color-coded messages for different participants
  • Support for any Hugging Face transformers model
  • Distributed architecture - models can run on different machines
  • Graceful handling of connections/disconnections

Installation

Method 1: Quick Setup (Recommended for trying it out)

  1. Clone the repository:
git clone https://github.com/yourusername/llm-party-chat.git
cd llm-party-chat
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install websockets transformers torch colorama aioconsole

Method 2: Install as Package

pip install llm-party-chat

Usage

Method 1: Direct Usage (Recommended for development)

  1. Start the server:
python server.py
  1. In separate terminals, start two or more model clients:
python client.py --name "Model1"
python client.py --name "Model2"
  1. Start the moderator interface:
python moderator.py

Method 2: Package Usage

If you installed via pip:

  1. Start the server:
python -m llm_party_chat.server
  1. In separate terminals, start model clients:
python -m llm_party_chat.client --name "Model1"
python -m llm_party_chat.client --name "Model2"
  1. Start the moderator:
python -m llm_party_chat.moderator

Components

Server (server.py)

  • Central websocket server that manages connections
  • Handles message broadcasting
  • Manages client registration/disconnection
  • Maintains chat history
  • Color codes different participants

Client (client.py)

  • Loads and runs a language model
  • Connects to the server
  • Processes incoming messages
  • Generates responses using the model
  • Supports various model configurations

Moderator (moderator.py)

  • Human interface to the chat
  • Sends prompts to models
  • Monitors all conversations
  • Views system status and connections

Configuration

Client Configuration

python client.py \
    --name "Model1" \
    --model "TinyLlama/TinyLlama-1.1B-Chat-v1.0" \
    --max-tokens 50 \
    --temperature 0.7 \
    --server "ws://localhost:8765"

Server Configuration

python server.py --host "localhost" --port 8765

Requirements

  • Python 3.10+
  • websockets
  • transformers
  • torch
  • colorama
  • aioconsole

Development

The repository structure:

llm-party-chat/
├── LICENSE
├── MANIFEST.in
├── README.md
├── requirements.txt
├── setup.py
└── src/
    └── llm_party_chat/
        ├── __init__.py
        ├── server.py
        ├── client.py
        └── moderator.py

For development:

  1. Clone the repository
  2. Create a virtual environment
  3. Install requirements
  4. Run the components directly using Method 1 above

Future Improvements

  • Message persistence
  • Web interface
  • More model options
  • Chat history export
  • Authentication
  • Docker support

License

MIT License

Contributing

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/improvement)
  3. Make changes
  4. Commit (git commit -am 'Add feature')
  5. Push (git push origin feature/improvement)
  6. Create Pull Request

Metadata

Release files for llm-party-chat 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-party-chat 0.0.1
File Size Uploaded
llm_party_chat-0.0.1.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-party-chat 0.0.1
File Interpreter ABI Platform
llm_party_chat-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / llm_party_chat-0.0.1.tar.gz

Download URL llm_party_chat-0.0.1.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1c0c624c3096d2754f9ae3b25c0c954228f629a53bf97779f2a8cc3fb2be6f5e
BLAKE2b-256 checksum
How to use checksums
7e55b9225dd11aad0e0a7eb7f7f1f2a360690646bd1dd2e17fd2f92135cf803d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Release files / llm_party_chat-0.0.1-py3-none-any.whl

Download URL llm_party_chat-0.0.1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5ef781eb351bdb996c3b20e1b1152dde133f870117b50232c7b5719f6745da0
BLAKE2b-256 checksum
How to use checksums
bb01b981bb2d2e22008fa3d75fc4d3c1eb984bf65a9c90039fb1caeeaf52ddb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page