Skip to main content

AI debate engine framework - importable Python library

Project description

Dialectus Engine

Dialectus Engine

A Python library for orchestrating AI-powered debates with multi-provider model support.

Python License Status

Overview

The Dialectus Engine is a standalone Python library that provides core debate orchestration logic, including participant coordination, turn management, AI judge integration, and multi-provider model support. It's designed to be imported and used by other applications to build debate systems.

Components

  • Core Engine (debate_engine/) - Main debate orchestration logic
  • Models (models/) - AI model provider integrations (Ollama, OpenRouter)
  • Configuration (config/) - System configuration management
  • Judges (judges/) - AI judge implementations with ensemble support
  • Formats (formats/) - Debate format definitions (Oxford, Parliamentary, Socratic, Public Forum)

Installation

From PyPI

pip install dialectus-engine

From Source

# Clone the repository
git clone https://github.com/dialectus-ai/dialectus-engine.git
cd dialectus-engine

# Install in development mode
pip install -e .

# Or install with dev dependencies
pip install -e ".[dev]"

As a Dependency

Add to your requirements.txt or pyproject.toml:

dialectus-engine>=0.1.0

Or install directly from git:

pip install git+https://github.com/dialectus-ai/dialectus-engine.git@main

Quick Start

import asyncio
from debate_engine.core import DebateEngine
from models.manager import ModelManager
from config.settings import AppConfig, ModelConfig

async def run_debate():
    # Load configuration
    config = AppConfig.from_json_file("debate_config.json")

    # Set up model manager
    model_manager = ModelManager()

    # Register models
    for model_id, model_config in config.models.items():
        model_manager.register_model(model_id, model_config)

    # Create debate engine
    engine = DebateEngine(
        config=config,
        model_manager=model_manager
    )

    # Run debate
    transcript = await engine.run_debate()
    print(transcript)

asyncio.run(run_debate())

Configuration

The engine uses debate_config.json for system configuration. To get started:

# Copy the example configuration
cp debate_config.example.json debate_config.json

# Edit with your settings and API keys
nano debate_config.json

Key configuration sections:

  • Models: Define debate participants with provider, personality, and parameters
  • Providers: Configure Ollama (local) and OpenRouter (cloud) settings
  • Judging: Set evaluation criteria and judge models
  • Debate: Default topic, format, and word limits

For detailed configuration documentation, see CONFIG_GUIDE.md.

Features

Multi-Provider Model Support

  • Ollama: Local model management with hardware optimization
  • OpenRouter: Cloud model access to 100+ models
  • Async streaming: Chunk-by-chunk response generation
  • Auto-discovery: Dynamic model listing from all configured providers
  • Caching: In-memory cache with TTL for model metadata

Debate Formats

  • Oxford: Classic opening/rebuttal/closing structure
  • Parliamentary: British-style government vs. opposition
  • Socratic: Question-driven dialogue format
  • Public Forum: American high school debate style

AI Judge System

  • LLM-based evaluation: Detailed criterion scoring
  • Ensemble judging: Aggregate decisions from multiple judges
  • Structured decisions: JSON-serializable judge results
  • Configurable criteria: Logic, evidence, persuasiveness, etc.

Architecture

Key architectural principles:

  • Library-first: Designed to be imported by other applications
  • Provider agnostic: Support for multiple AI model sources
  • Async by default: All model interactions are async
  • Type-safe: Strict Pyright configuration with modern type hints
  • Pydantic everywhere: All config and data models use Pydantic v2
  • Configurable: JSON-based configuration with validation

Technology Stack

  • Python 3.13+ with modern type hints (X | None, list[T], dict[K, V])
  • Pydantic v2 for data validation and settings management
  • OpenAI SDK for OpenRouter API integration (streaming support)
  • httpx for async HTTP requests (Ollama provider)
  • asyncio for concurrent debate operations

Usage Examples

Listing Available Models

from models.manager import ModelManager

async def list_models():
    manager = ModelManager()
    models = await manager.get_all_models()
    for model_id, model_info in models.items():
        print(f"{model_id}: {model_info.description}")

Running a Custom Format

from formats.registry import format_registry

# Get available formats
formats = format_registry.list_formats()

# Load a specific format
oxford = format_registry.get_format("oxford")
phases = oxford.phases()

Ensemble Judging

from judges.factory import JudgeFactory

# Create judge with multiple models
config.judging.judge_models = ["openthinker:7b", "llama3.2:3b", "qwen2.5:3b"]
judge = JudgeFactory.create_judge(config.judging, model_manager)

# Get aggregated decision
decision = await judge.judge_debate(context)

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

dialectus_engine-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

dialectus_engine-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dialectus_engine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d8d25f1c0f92c199cb0c78a819aecb552a4095a7f729952bfd06f97a254a061
MD5 cb2ce38e0108776d2001f4dd703d2778
BLAKE2b-256 3f175bf5c5afd6e4bfa74f45bf9fe781d129fcf398e33dbe3fb2777299d837c3

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on Dialectus-AI/dialectus-engine

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

File details

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

File metadata

File hashes

Hashes for dialectus_engine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77e2b97a81f743fdf1ec0a1b36ebc3d8f1eda62ebf6db6e08239848ceec7d731
MD5 a5aed9408923b959cdfd5a6aeff7a91c
BLAKE2b-256 cf5bb5afc04805ca26f54a1d4debcd23fc0b4ca8d9057ea91fd26760403ab5b0

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on Dialectus-AI/dialectus-engine

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