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

Download files

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

Source Distribution

llm_party_chat-0.0.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

llm_party_chat-0.0.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file llm_party_chat-0.0.1.tar.gz.

File metadata

  • Download URL: llm_party_chat-0.0.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for llm_party_chat-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1c0c624c3096d2754f9ae3b25c0c954228f629a53bf97779f2a8cc3fb2be6f5e
MD5 4aeffaaddad7b5c0d73e942561b2e6d9
BLAKE2b-256 7e55b9225dd11aad0e0a7eb7f7f1f2a360690646bd1dd2e17fd2f92135cf803d

See more details on using hashes here.

File details

Details for the file llm_party_chat-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: llm_party_chat-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for llm_party_chat-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5ef781eb351bdb996c3b20e1b1152dde133f870117b50232c7b5719f6745da0
MD5 f94d21d940bc0b498785779e5369fff9
BLAKE2b-256 bb01b981bb2d2e22008fa3d75fc4d3c1eb984bf65a9c90039fb1caeeaf52ddb9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 files

Supported by

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