Real-time chat between multiple LLMs with human moderator ability
Project description
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)
- Clone the repository:
git clone https://github.com/yourusername/llm-party-chat.git
cd llm-party-chat
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- 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)
- Start the server:
python server.py
- In separate terminals, start two or more model clients:
python client.py --name "Model1"
python client.py --name "Model2"
- Start the moderator interface:
python moderator.py
Method 2: Package Usage
If you installed via pip:
- Start the server:
python -m llm_party_chat.server
- In separate terminals, start model clients:
python -m llm_party_chat.client --name "Model1"
python -m llm_party_chat.client --name "Model2"
- 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:
- Clone the repository
- Create a virtual environment
- Install requirements
- 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
- Fork the repository
- Create a new branch (
git checkout -b feature/improvement) - Make changes
- Commit (
git commit -am 'Add feature') - Push (
git push origin feature/improvement) - Create Pull Request
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c0c624c3096d2754f9ae3b25c0c954228f629a53bf97779f2a8cc3fb2be6f5e
|
|
| MD5 |
4aeffaaddad7b5c0d73e942561b2e6d9
|
|
| BLAKE2b-256 |
7e55b9225dd11aad0e0a7eb7f7f1f2a360690646bd1dd2e17fd2f92135cf803d
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5ef781eb351bdb996c3b20e1b1152dde133f870117b50232c7b5719f6745da0
|
|
| MD5 |
f94d21d940bc0b498785779e5369fff9
|
|
| BLAKE2b-256 |
bb01b981bb2d2e22008fa3d75fc4d3c1eb984bf65a9c90039fb1caeeaf52ddb9
|