Skip to main content

Python package for role-based LLM debates over OpenAI-compatible APIs.

Project description

council-debates

Run multiple independent LLM roles against the same prompt, optionally rank their responses, and generate a final answer through a chairman model.

council-debates is a small modular Python 3.11+ package for running debates between independent LLM roles through OpenAI-compatible APIs.

The pipeline is deliberately strict:

  1. Each role is called separately with only its own system_prompt and the original user prompt.
  2. (Optional) A separate ranking LLM receives the original prompt plus all role responses.
  3. A final chairman LLM receives the original prompt, role responses, and the optional ranking result, then writes the final Markdown answer.

You can omit the ranking block entirely. In that case the chairman aggregates role responses without an external ranker, which prevents the ranker from biasing the chairman's decision.

The package supports OpenAI, OpenRouter, LM Studio, Ollama OpenAI-compatible endpoint, vLLM, LocalAI, and any /v1/chat/completions-compatible provider.

Pipeline

User Prompt
     │
     ▼
┌───────────────┐
│ Role: Judge   │
├───────────────┤
│ Role: Skeptic │
├───────────────┤
│ Role: Builder │
└───────────────┘
     │
     ▼
┌────────────────────┐
│ Ranking (optional) │
└────────────────────┘
     │
     ▼
┌────────────────────┐
│ Chairman           │
└────────────────────┘
     │
     ▼
Final Markdown Answer

Project layout

council_debates/
├── CHANGELOG.md
├── pyproject.toml
├── README.md
├── config.example.yaml
├── .env.example
├── requirements-dev.txt
├── tests/
└── src/
    └── council_debates/
        ├── __init__.py
        ├── __main__.py
        ├── cli.py
        ├── core/
        ├── pipeline/
        ├── presentation/
        ├── providers/
        └── templates.py

Install

Install the latest released version from PyPI:

pip install council-debates

Upgrade an existing installation:

pip install --upgrade council-debates

PyPI package:

Install the latest code directly from GitHub:

pip install "git+https://github.com/ssh-den/council-debates.git"

Install a specific branch, tag, or commit:

pip install "git+https://github.com/ssh-den/council-debates.git@main"

For local development and tests from the repository:

python -m venv .venv
. .venv/bin/activate
pip install -r requirements-dev.txt

Quality checks:

black --check .
ruff check .
mypy src tests
pylint src tests
pytest

Create a config

council-debates init-config
council-debates init-env
cp .env.example .env

Edit config.example.yaml or save it as config.yaml. Set the environment variables referenced by api_key_env.

Run

Prompt from the command line:

council-debates run "Suppose that a judge or magistrate..." --config config.yaml

Prompt from a file:

council-debates run --file prompt.txt --config config.yaml

Save Markdown output:

council-debates run "test prompt" --config config.yaml --output result.md

Show provider/model logging:

council-debates run "test prompt" --config config.yaml --verbose

Configuration

All behavior is configured in YAML:

  • providers: OpenAI-compatible base URLs and API keys or api_key_env references.
  • defaults: default temperature and max_tokens.
  • roles: independent debate roles; each role has its own provider, model, and system prompt.
  • ranking: (optional) separate ranking model config. Omit it if you want the chairman to aggregate responses without external ranking.
  • chairman: final aggregation model config.
  • output: Markdown output options.

Example provider entries:

providers:
  openai:
    base_url: "https://api.openai.com/v1"
    api_key_env: "OPENAI_API_KEY"
  openrouter:
    base_url: "https://openrouter.ai/api/v1"
    api_key_env: "OPENROUTER_API_KEY"
  local:
    base_url: "http://localhost:11434/v1"
    api_key: "ollama"

Local OpenAI-compatible servers usually accept any non-empty API key.

Design Principle

Roles never see each other's responses.

Each role receives only:

  • its own system prompt
  • the original user prompt

This prevents early consensus, role contamination, and chain-of-thought leakage between participants.

Contributions / Acknowledgments

The original idea of using multiple LLM roles in a council/debate setup comes from Andrej Karpathy's llm-council.

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

council_debates-0.1.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

council_debates-0.1.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: council_debates-0.1.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for council_debates-0.1.0.tar.gz
Algorithm Hash digest
SHA256 40fb897cc18b61f9721188383350c0f0cf237163d375cf280154ba69b764dded
MD5 5aa6256573d2d5db61a5c84a9e81ea74
BLAKE2b-256 3c868cd34d2b0a1aa4fb802ba307d91f90d779479c1fa2d574a6456ee8906e5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for council_debates-0.1.0.tar.gz:

Publisher: publish-pypi.yml on ssh-den/council-debates

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: council_debates-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for council_debates-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 902e1ad5974bb29d7a1edabe6a39045e74ac2a72a655f558a366b649dadc6dd4
MD5 58013bd3012b6affd1cb7947c40f9216
BLAKE2b-256 421a8825df6578096126161eebba52fafd6d6101ed818cbd2442ea5288e2f9a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for council_debates-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on ssh-den/council-debates

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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