dialectus-engine 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dialectus_engine-0.1.0/LICENSE +9 -0
- dialectus_engine-0.1.0/PKG-INFO +216 -0
- dialectus_engine-0.1.0/README.md +189 -0
- dialectus_engine-0.1.0/dialectus/__init__.py +3 -0
- dialectus_engine-0.1.0/dialectus/engine/__init__.py +6 -0
- dialectus_engine-0.1.0/dialectus_engine.egg-info/PKG-INFO +216 -0
- dialectus_engine-0.1.0/dialectus_engine.egg-info/SOURCES.txt +10 -0
- dialectus_engine-0.1.0/dialectus_engine.egg-info/dependency_links.txt +1 -0
- dialectus_engine-0.1.0/dialectus_engine.egg-info/requires.txt +6 -0
- dialectus_engine-0.1.0/dialectus_engine.egg-info/top_level.txt +1 -0
- dialectus_engine-0.1.0/pyproject.toml +42 -0
- dialectus_engine-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dialectus AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dialectus-engine
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI debate engine framework - importable Python library
|
|
5
|
+
Author: Dialectus AI
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/dialectus-ai/dialectus-engine
|
|
8
|
+
Project-URL: Repository, https://github.com/dialectus-ai/dialectus-engine
|
|
9
|
+
Project-URL: Issues, https://github.com/dialectus-ai/dialectus-engine/issues
|
|
10
|
+
Keywords: ai,debate,llm,argumentation,ollama,openrouter,artificial-intelligence
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.13
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: httpx>=0.28.1
|
|
22
|
+
Requires-Dist: openai>=1.105.0
|
|
23
|
+
Requires-Dist: pydantic>=2.11.7
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pip-tools; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
<img src="./assets/logo.png" alt="Dialectus Engine" width="500">
|
|
29
|
+
|
|
30
|
+
<br />
|
|
31
|
+
|
|
32
|
+
# Dialectus Engine
|
|
33
|
+
|
|
34
|
+
A Python library for orchestrating AI-powered debates with multi-provider model support.
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+

|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
## Overview
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
## Components
|
|
45
|
+
|
|
46
|
+
- **Core Engine** (`debate_engine/`) - Main debate orchestration logic
|
|
47
|
+
- **Models** (`models/`) - AI model provider integrations (Ollama, OpenRouter)
|
|
48
|
+
- **Configuration** (`config/`) - System configuration management
|
|
49
|
+
- **Judges** (`judges/`) - AI judge implementations with ensemble support
|
|
50
|
+
- **Formats** (`formats/`) - Debate format definitions (Oxford, Parliamentary, Socratic, Public Forum)
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
### From PyPI
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install dialectus-engine
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### From Source
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Clone the repository
|
|
64
|
+
git clone https://github.com/dialectus-ai/dialectus-engine.git
|
|
65
|
+
cd dialectus-engine
|
|
66
|
+
|
|
67
|
+
# Install in development mode
|
|
68
|
+
pip install -e .
|
|
69
|
+
|
|
70
|
+
# Or install with dev dependencies
|
|
71
|
+
pip install -e ".[dev]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### As a Dependency
|
|
75
|
+
|
|
76
|
+
Add to your `requirements.txt` or `pyproject.toml`:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
dialectus-engine>=0.1.0
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or install directly from git:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install git+https://github.com/dialectus-ai/dialectus-engine.git@main
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Quick Start
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import asyncio
|
|
92
|
+
from debate_engine.core import DebateEngine
|
|
93
|
+
from models.manager import ModelManager
|
|
94
|
+
from config.settings import AppConfig, ModelConfig
|
|
95
|
+
|
|
96
|
+
async def run_debate():
|
|
97
|
+
# Load configuration
|
|
98
|
+
config = AppConfig.from_json_file("debate_config.json")
|
|
99
|
+
|
|
100
|
+
# Set up model manager
|
|
101
|
+
model_manager = ModelManager()
|
|
102
|
+
|
|
103
|
+
# Register models
|
|
104
|
+
for model_id, model_config in config.models.items():
|
|
105
|
+
model_manager.register_model(model_id, model_config)
|
|
106
|
+
|
|
107
|
+
# Create debate engine
|
|
108
|
+
engine = DebateEngine(
|
|
109
|
+
config=config,
|
|
110
|
+
model_manager=model_manager
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# Run debate
|
|
114
|
+
transcript = await engine.run_debate()
|
|
115
|
+
print(transcript)
|
|
116
|
+
|
|
117
|
+
asyncio.run(run_debate())
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
The engine uses `debate_config.json` for system configuration. To get started:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Copy the example configuration
|
|
126
|
+
cp debate_config.example.json debate_config.json
|
|
127
|
+
|
|
128
|
+
# Edit with your settings and API keys
|
|
129
|
+
nano debate_config.json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Key configuration sections:
|
|
133
|
+
- **Models**: Define debate participants with provider, personality, and parameters
|
|
134
|
+
- **Providers**: Configure Ollama (local) and OpenRouter (cloud) settings
|
|
135
|
+
- **Judging**: Set evaluation criteria and judge models
|
|
136
|
+
- **Debate**: Default topic, format, and word limits
|
|
137
|
+
|
|
138
|
+
For detailed configuration documentation, see [CONFIG_GUIDE.md](CONFIG_GUIDE.md).
|
|
139
|
+
|
|
140
|
+
## Features
|
|
141
|
+
|
|
142
|
+
### Multi-Provider Model Support
|
|
143
|
+
- **Ollama**: Local model management with hardware optimization
|
|
144
|
+
- **OpenRouter**: Cloud model access to 100+ models
|
|
145
|
+
- **Async streaming**: Chunk-by-chunk response generation
|
|
146
|
+
- **Auto-discovery**: Dynamic model listing from all configured providers
|
|
147
|
+
- **Caching**: In-memory cache with TTL for model metadata
|
|
148
|
+
|
|
149
|
+
### Debate Formats
|
|
150
|
+
- **Oxford**: Classic opening/rebuttal/closing structure
|
|
151
|
+
- **Parliamentary**: British-style government vs. opposition
|
|
152
|
+
- **Socratic**: Question-driven dialogue format
|
|
153
|
+
- **Public Forum**: American high school debate style
|
|
154
|
+
|
|
155
|
+
### AI Judge System
|
|
156
|
+
- **LLM-based evaluation**: Detailed criterion scoring
|
|
157
|
+
- **Ensemble judging**: Aggregate decisions from multiple judges
|
|
158
|
+
- **Structured decisions**: JSON-serializable judge results
|
|
159
|
+
- **Configurable criteria**: Logic, evidence, persuasiveness, etc.
|
|
160
|
+
|
|
161
|
+
## Architecture
|
|
162
|
+
|
|
163
|
+
Key architectural principles:
|
|
164
|
+
- **Library-first**: Designed to be imported by other applications
|
|
165
|
+
- **Provider agnostic**: Support for multiple AI model sources
|
|
166
|
+
- **Async by default**: All model interactions are async
|
|
167
|
+
- **Type-safe**: Strict Pyright configuration with modern type hints
|
|
168
|
+
- **Pydantic everywhere**: All config and data models use Pydantic v2
|
|
169
|
+
- **Configurable**: JSON-based configuration with validation
|
|
170
|
+
|
|
171
|
+
### Technology Stack
|
|
172
|
+
- **Python 3.13+** with modern type hints (`X | None`, `list[T]`, `dict[K, V]`)
|
|
173
|
+
- **Pydantic v2** for data validation and settings management
|
|
174
|
+
- **OpenAI SDK** for OpenRouter API integration (streaming support)
|
|
175
|
+
- **httpx** for async HTTP requests (Ollama provider)
|
|
176
|
+
- **asyncio** for concurrent debate operations
|
|
177
|
+
|
|
178
|
+
## Usage Examples
|
|
179
|
+
|
|
180
|
+
### Listing Available Models
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
from models.manager import ModelManager
|
|
184
|
+
|
|
185
|
+
async def list_models():
|
|
186
|
+
manager = ModelManager()
|
|
187
|
+
models = await manager.get_all_models()
|
|
188
|
+
for model_id, model_info in models.items():
|
|
189
|
+
print(f"{model_id}: {model_info.description}")
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Running a Custom Format
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from formats.registry import format_registry
|
|
196
|
+
|
|
197
|
+
# Get available formats
|
|
198
|
+
formats = format_registry.list_formats()
|
|
199
|
+
|
|
200
|
+
# Load a specific format
|
|
201
|
+
oxford = format_registry.get_format("oxford")
|
|
202
|
+
phases = oxford.phases()
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Ensemble Judging
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
from judges.factory import JudgeFactory
|
|
209
|
+
|
|
210
|
+
# Create judge with multiple models
|
|
211
|
+
config.judging.judge_models = ["openthinker:7b", "llama3.2:3b", "qwen2.5:3b"]
|
|
212
|
+
judge = JudgeFactory.create_judge(config.judging, model_manager)
|
|
213
|
+
|
|
214
|
+
# Get aggregated decision
|
|
215
|
+
decision = await judge.judge_debate(context)
|
|
216
|
+
```
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<img src="./assets/logo.png" alt="Dialectus Engine" width="500">
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
# Dialectus Engine
|
|
6
|
+
|
|
7
|
+
A Python library for orchestrating AI-powered debates with multi-provider model support.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
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.
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
- **Core Engine** (`debate_engine/`) - Main debate orchestration logic
|
|
20
|
+
- **Models** (`models/`) - AI model provider integrations (Ollama, OpenRouter)
|
|
21
|
+
- **Configuration** (`config/`) - System configuration management
|
|
22
|
+
- **Judges** (`judges/`) - AI judge implementations with ensemble support
|
|
23
|
+
- **Formats** (`formats/`) - Debate format definitions (Oxford, Parliamentary, Socratic, Public Forum)
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
### From PyPI
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install dialectus-engine
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### From Source
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Clone the repository
|
|
37
|
+
git clone https://github.com/dialectus-ai/dialectus-engine.git
|
|
38
|
+
cd dialectus-engine
|
|
39
|
+
|
|
40
|
+
# Install in development mode
|
|
41
|
+
pip install -e .
|
|
42
|
+
|
|
43
|
+
# Or install with dev dependencies
|
|
44
|
+
pip install -e ".[dev]"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### As a Dependency
|
|
48
|
+
|
|
49
|
+
Add to your `requirements.txt` or `pyproject.toml`:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
dialectus-engine>=0.1.0
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or install directly from git:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install git+https://github.com/dialectus-ai/dialectus-engine.git@main
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Quick Start
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import asyncio
|
|
65
|
+
from debate_engine.core import DebateEngine
|
|
66
|
+
from models.manager import ModelManager
|
|
67
|
+
from config.settings import AppConfig, ModelConfig
|
|
68
|
+
|
|
69
|
+
async def run_debate():
|
|
70
|
+
# Load configuration
|
|
71
|
+
config = AppConfig.from_json_file("debate_config.json")
|
|
72
|
+
|
|
73
|
+
# Set up model manager
|
|
74
|
+
model_manager = ModelManager()
|
|
75
|
+
|
|
76
|
+
# Register models
|
|
77
|
+
for model_id, model_config in config.models.items():
|
|
78
|
+
model_manager.register_model(model_id, model_config)
|
|
79
|
+
|
|
80
|
+
# Create debate engine
|
|
81
|
+
engine = DebateEngine(
|
|
82
|
+
config=config,
|
|
83
|
+
model_manager=model_manager
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Run debate
|
|
87
|
+
transcript = await engine.run_debate()
|
|
88
|
+
print(transcript)
|
|
89
|
+
|
|
90
|
+
asyncio.run(run_debate())
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
The engine uses `debate_config.json` for system configuration. To get started:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Copy the example configuration
|
|
99
|
+
cp debate_config.example.json debate_config.json
|
|
100
|
+
|
|
101
|
+
# Edit with your settings and API keys
|
|
102
|
+
nano debate_config.json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Key configuration sections:
|
|
106
|
+
- **Models**: Define debate participants with provider, personality, and parameters
|
|
107
|
+
- **Providers**: Configure Ollama (local) and OpenRouter (cloud) settings
|
|
108
|
+
- **Judging**: Set evaluation criteria and judge models
|
|
109
|
+
- **Debate**: Default topic, format, and word limits
|
|
110
|
+
|
|
111
|
+
For detailed configuration documentation, see [CONFIG_GUIDE.md](CONFIG_GUIDE.md).
|
|
112
|
+
|
|
113
|
+
## Features
|
|
114
|
+
|
|
115
|
+
### Multi-Provider Model Support
|
|
116
|
+
- **Ollama**: Local model management with hardware optimization
|
|
117
|
+
- **OpenRouter**: Cloud model access to 100+ models
|
|
118
|
+
- **Async streaming**: Chunk-by-chunk response generation
|
|
119
|
+
- **Auto-discovery**: Dynamic model listing from all configured providers
|
|
120
|
+
- **Caching**: In-memory cache with TTL for model metadata
|
|
121
|
+
|
|
122
|
+
### Debate Formats
|
|
123
|
+
- **Oxford**: Classic opening/rebuttal/closing structure
|
|
124
|
+
- **Parliamentary**: British-style government vs. opposition
|
|
125
|
+
- **Socratic**: Question-driven dialogue format
|
|
126
|
+
- **Public Forum**: American high school debate style
|
|
127
|
+
|
|
128
|
+
### AI Judge System
|
|
129
|
+
- **LLM-based evaluation**: Detailed criterion scoring
|
|
130
|
+
- **Ensemble judging**: Aggregate decisions from multiple judges
|
|
131
|
+
- **Structured decisions**: JSON-serializable judge results
|
|
132
|
+
- **Configurable criteria**: Logic, evidence, persuasiveness, etc.
|
|
133
|
+
|
|
134
|
+
## Architecture
|
|
135
|
+
|
|
136
|
+
Key architectural principles:
|
|
137
|
+
- **Library-first**: Designed to be imported by other applications
|
|
138
|
+
- **Provider agnostic**: Support for multiple AI model sources
|
|
139
|
+
- **Async by default**: All model interactions are async
|
|
140
|
+
- **Type-safe**: Strict Pyright configuration with modern type hints
|
|
141
|
+
- **Pydantic everywhere**: All config and data models use Pydantic v2
|
|
142
|
+
- **Configurable**: JSON-based configuration with validation
|
|
143
|
+
|
|
144
|
+
### Technology Stack
|
|
145
|
+
- **Python 3.13+** with modern type hints (`X | None`, `list[T]`, `dict[K, V]`)
|
|
146
|
+
- **Pydantic v2** for data validation and settings management
|
|
147
|
+
- **OpenAI SDK** for OpenRouter API integration (streaming support)
|
|
148
|
+
- **httpx** for async HTTP requests (Ollama provider)
|
|
149
|
+
- **asyncio** for concurrent debate operations
|
|
150
|
+
|
|
151
|
+
## Usage Examples
|
|
152
|
+
|
|
153
|
+
### Listing Available Models
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from models.manager import ModelManager
|
|
157
|
+
|
|
158
|
+
async def list_models():
|
|
159
|
+
manager = ModelManager()
|
|
160
|
+
models = await manager.get_all_models()
|
|
161
|
+
for model_id, model_info in models.items():
|
|
162
|
+
print(f"{model_id}: {model_info.description}")
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Running a Custom Format
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from formats.registry import format_registry
|
|
169
|
+
|
|
170
|
+
# Get available formats
|
|
171
|
+
formats = format_registry.list_formats()
|
|
172
|
+
|
|
173
|
+
# Load a specific format
|
|
174
|
+
oxford = format_registry.get_format("oxford")
|
|
175
|
+
phases = oxford.phases()
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Ensemble Judging
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from judges.factory import JudgeFactory
|
|
182
|
+
|
|
183
|
+
# Create judge with multiple models
|
|
184
|
+
config.judging.judge_models = ["openthinker:7b", "llama3.2:3b", "qwen2.5:3b"]
|
|
185
|
+
judge = JudgeFactory.create_judge(config.judging, model_manager)
|
|
186
|
+
|
|
187
|
+
# Get aggregated decision
|
|
188
|
+
decision = await judge.judge_debate(context)
|
|
189
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"""Dialectus Engine - Core debate orchestration library"""
|
|
2
|
+
|
|
3
|
+
from dialectus.engine.debate_engine.engine import DebateEngine
|
|
4
|
+
from dialectus.engine.debate_engine.models import DebateContext, DebateMessage
|
|
5
|
+
|
|
6
|
+
__all__ = ["DebateEngine", "DebateContext", "DebateMessage"]
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dialectus-engine
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI debate engine framework - importable Python library
|
|
5
|
+
Author: Dialectus AI
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/dialectus-ai/dialectus-engine
|
|
8
|
+
Project-URL: Repository, https://github.com/dialectus-ai/dialectus-engine
|
|
9
|
+
Project-URL: Issues, https://github.com/dialectus-ai/dialectus-engine/issues
|
|
10
|
+
Keywords: ai,debate,llm,argumentation,ollama,openrouter,artificial-intelligence
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.13
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: httpx>=0.28.1
|
|
22
|
+
Requires-Dist: openai>=1.105.0
|
|
23
|
+
Requires-Dist: pydantic>=2.11.7
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pip-tools; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
<img src="./assets/logo.png" alt="Dialectus Engine" width="500">
|
|
29
|
+
|
|
30
|
+
<br />
|
|
31
|
+
|
|
32
|
+
# Dialectus Engine
|
|
33
|
+
|
|
34
|
+
A Python library for orchestrating AI-powered debates with multi-provider model support.
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+

|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
## Overview
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
## Components
|
|
45
|
+
|
|
46
|
+
- **Core Engine** (`debate_engine/`) - Main debate orchestration logic
|
|
47
|
+
- **Models** (`models/`) - AI model provider integrations (Ollama, OpenRouter)
|
|
48
|
+
- **Configuration** (`config/`) - System configuration management
|
|
49
|
+
- **Judges** (`judges/`) - AI judge implementations with ensemble support
|
|
50
|
+
- **Formats** (`formats/`) - Debate format definitions (Oxford, Parliamentary, Socratic, Public Forum)
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
### From PyPI
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install dialectus-engine
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### From Source
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Clone the repository
|
|
64
|
+
git clone https://github.com/dialectus-ai/dialectus-engine.git
|
|
65
|
+
cd dialectus-engine
|
|
66
|
+
|
|
67
|
+
# Install in development mode
|
|
68
|
+
pip install -e .
|
|
69
|
+
|
|
70
|
+
# Or install with dev dependencies
|
|
71
|
+
pip install -e ".[dev]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### As a Dependency
|
|
75
|
+
|
|
76
|
+
Add to your `requirements.txt` or `pyproject.toml`:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
dialectus-engine>=0.1.0
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or install directly from git:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install git+https://github.com/dialectus-ai/dialectus-engine.git@main
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Quick Start
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import asyncio
|
|
92
|
+
from debate_engine.core import DebateEngine
|
|
93
|
+
from models.manager import ModelManager
|
|
94
|
+
from config.settings import AppConfig, ModelConfig
|
|
95
|
+
|
|
96
|
+
async def run_debate():
|
|
97
|
+
# Load configuration
|
|
98
|
+
config = AppConfig.from_json_file("debate_config.json")
|
|
99
|
+
|
|
100
|
+
# Set up model manager
|
|
101
|
+
model_manager = ModelManager()
|
|
102
|
+
|
|
103
|
+
# Register models
|
|
104
|
+
for model_id, model_config in config.models.items():
|
|
105
|
+
model_manager.register_model(model_id, model_config)
|
|
106
|
+
|
|
107
|
+
# Create debate engine
|
|
108
|
+
engine = DebateEngine(
|
|
109
|
+
config=config,
|
|
110
|
+
model_manager=model_manager
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# Run debate
|
|
114
|
+
transcript = await engine.run_debate()
|
|
115
|
+
print(transcript)
|
|
116
|
+
|
|
117
|
+
asyncio.run(run_debate())
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
The engine uses `debate_config.json` for system configuration. To get started:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Copy the example configuration
|
|
126
|
+
cp debate_config.example.json debate_config.json
|
|
127
|
+
|
|
128
|
+
# Edit with your settings and API keys
|
|
129
|
+
nano debate_config.json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Key configuration sections:
|
|
133
|
+
- **Models**: Define debate participants with provider, personality, and parameters
|
|
134
|
+
- **Providers**: Configure Ollama (local) and OpenRouter (cloud) settings
|
|
135
|
+
- **Judging**: Set evaluation criteria and judge models
|
|
136
|
+
- **Debate**: Default topic, format, and word limits
|
|
137
|
+
|
|
138
|
+
For detailed configuration documentation, see [CONFIG_GUIDE.md](CONFIG_GUIDE.md).
|
|
139
|
+
|
|
140
|
+
## Features
|
|
141
|
+
|
|
142
|
+
### Multi-Provider Model Support
|
|
143
|
+
- **Ollama**: Local model management with hardware optimization
|
|
144
|
+
- **OpenRouter**: Cloud model access to 100+ models
|
|
145
|
+
- **Async streaming**: Chunk-by-chunk response generation
|
|
146
|
+
- **Auto-discovery**: Dynamic model listing from all configured providers
|
|
147
|
+
- **Caching**: In-memory cache with TTL for model metadata
|
|
148
|
+
|
|
149
|
+
### Debate Formats
|
|
150
|
+
- **Oxford**: Classic opening/rebuttal/closing structure
|
|
151
|
+
- **Parliamentary**: British-style government vs. opposition
|
|
152
|
+
- **Socratic**: Question-driven dialogue format
|
|
153
|
+
- **Public Forum**: American high school debate style
|
|
154
|
+
|
|
155
|
+
### AI Judge System
|
|
156
|
+
- **LLM-based evaluation**: Detailed criterion scoring
|
|
157
|
+
- **Ensemble judging**: Aggregate decisions from multiple judges
|
|
158
|
+
- **Structured decisions**: JSON-serializable judge results
|
|
159
|
+
- **Configurable criteria**: Logic, evidence, persuasiveness, etc.
|
|
160
|
+
|
|
161
|
+
## Architecture
|
|
162
|
+
|
|
163
|
+
Key architectural principles:
|
|
164
|
+
- **Library-first**: Designed to be imported by other applications
|
|
165
|
+
- **Provider agnostic**: Support for multiple AI model sources
|
|
166
|
+
- **Async by default**: All model interactions are async
|
|
167
|
+
- **Type-safe**: Strict Pyright configuration with modern type hints
|
|
168
|
+
- **Pydantic everywhere**: All config and data models use Pydantic v2
|
|
169
|
+
- **Configurable**: JSON-based configuration with validation
|
|
170
|
+
|
|
171
|
+
### Technology Stack
|
|
172
|
+
- **Python 3.13+** with modern type hints (`X | None`, `list[T]`, `dict[K, V]`)
|
|
173
|
+
- **Pydantic v2** for data validation and settings management
|
|
174
|
+
- **OpenAI SDK** for OpenRouter API integration (streaming support)
|
|
175
|
+
- **httpx** for async HTTP requests (Ollama provider)
|
|
176
|
+
- **asyncio** for concurrent debate operations
|
|
177
|
+
|
|
178
|
+
## Usage Examples
|
|
179
|
+
|
|
180
|
+
### Listing Available Models
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
from models.manager import ModelManager
|
|
184
|
+
|
|
185
|
+
async def list_models():
|
|
186
|
+
manager = ModelManager()
|
|
187
|
+
models = await manager.get_all_models()
|
|
188
|
+
for model_id, model_info in models.items():
|
|
189
|
+
print(f"{model_id}: {model_info.description}")
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Running a Custom Format
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from formats.registry import format_registry
|
|
196
|
+
|
|
197
|
+
# Get available formats
|
|
198
|
+
formats = format_registry.list_formats()
|
|
199
|
+
|
|
200
|
+
# Load a specific format
|
|
201
|
+
oxford = format_registry.get_format("oxford")
|
|
202
|
+
phases = oxford.phases()
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Ensemble Judging
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
from judges.factory import JudgeFactory
|
|
209
|
+
|
|
210
|
+
# Create judge with multiple models
|
|
211
|
+
config.judging.judge_models = ["openthinker:7b", "llama3.2:3b", "qwen2.5:3b"]
|
|
212
|
+
judge = JudgeFactory.create_judge(config.judging, model_manager)
|
|
213
|
+
|
|
214
|
+
# Get aggregated decision
|
|
215
|
+
decision = await judge.judge_debate(context)
|
|
216
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
dialectus/__init__.py
|
|
5
|
+
dialectus/engine/__init__.py
|
|
6
|
+
dialectus_engine.egg-info/PKG-INFO
|
|
7
|
+
dialectus_engine.egg-info/SOURCES.txt
|
|
8
|
+
dialectus_engine.egg-info/dependency_links.txt
|
|
9
|
+
dialectus_engine.egg-info/requires.txt
|
|
10
|
+
dialectus_engine.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dialectus
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dialectus-engine"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "AI debate engine framework - importable Python library"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.13"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Dialectus AI"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ai", "debate", "llm", "argumentation", "ollama", "openrouter", "artificial-intelligence"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Education",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"httpx>=0.28.1",
|
|
27
|
+
"openai>=1.105.0",
|
|
28
|
+
"pydantic>=2.11.7",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/dialectus-ai/dialectus-engine"
|
|
33
|
+
Repository = "https://github.com/dialectus-ai/dialectus-engine"
|
|
34
|
+
Issues = "https://github.com/dialectus-ai/dialectus-engine/issues"
|
|
35
|
+
|
|
36
|
+
[project.optional-dependencies]
|
|
37
|
+
dev = [
|
|
38
|
+
"pip-tools",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools]
|
|
42
|
+
packages = ["dialectus", "dialectus.engine"]
|