dialectus-engine 0.1.1__tar.gz → 0.2.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.
Files changed (74) hide show
  1. {dialectus_engine-0.1.1/dialectus_engine.egg-info → dialectus_engine-0.2.0}/PKG-INFO +164 -9
  2. {dialectus_engine-0.1.1 → dialectus_engine-0.2.0}/README.md +160 -5
  3. dialectus_engine-0.2.0/dialectus/__init__.py +7 -0
  4. dialectus_engine-0.2.0/dialectus/engine/config/__init__.py +1 -0
  5. dialectus_engine-0.2.0/dialectus/engine/config/openrouter_filters.json +153 -0
  6. dialectus_engine-0.2.0/dialectus/engine/config/settings.py +308 -0
  7. dialectus_engine-0.2.0/dialectus/engine/debate_engine/__init__.py +24 -0
  8. dialectus_engine-0.2.0/dialectus/engine/debate_engine/context_builder.py +163 -0
  9. dialectus_engine-0.2.0/dialectus/engine/debate_engine/engine.py +223 -0
  10. dialectus_engine-0.2.0/dialectus/engine/debate_engine/judge_coordinator.py +108 -0
  11. dialectus_engine-0.2.0/dialectus/engine/debate_engine/models.py +39 -0
  12. dialectus_engine-0.2.0/dialectus/engine/debate_engine/prompt_builder.py +204 -0
  13. dialectus_engine-0.2.0/dialectus/engine/debate_engine/response_handler.py +367 -0
  14. dialectus_engine-0.2.0/dialectus/engine/debate_engine/round_manager.py +201 -0
  15. dialectus_engine-0.2.0/dialectus/engine/debate_engine/types.py +23 -0
  16. dialectus_engine-0.2.0/dialectus/engine/debate_engine/utils.py +103 -0
  17. dialectus_engine-0.2.0/dialectus/engine/formats/__init__.py +34 -0
  18. dialectus_engine-0.2.0/dialectus/engine/formats/base.py +148 -0
  19. dialectus_engine-0.2.0/dialectus/engine/formats/oxford.py +192 -0
  20. dialectus_engine-0.2.0/dialectus/engine/formats/parliamentary.py +173 -0
  21. dialectus_engine-0.2.0/dialectus/engine/formats/public_forum.py +212 -0
  22. dialectus_engine-0.2.0/dialectus/engine/formats/registry.py +68 -0
  23. dialectus_engine-0.2.0/dialectus/engine/formats/socratic.py +204 -0
  24. dialectus_engine-0.2.0/dialectus/engine/formats/topic_themes.py +357 -0
  25. dialectus_engine-0.2.0/dialectus/engine/judges/__init__.py +15 -0
  26. dialectus_engine-0.2.0/dialectus/engine/judges/ai_judge.py +606 -0
  27. dialectus_engine-0.2.0/dialectus/engine/judges/base.py +146 -0
  28. dialectus_engine-0.2.0/dialectus/engine/judges/ensemble_utils.py +186 -0
  29. dialectus_engine-0.2.0/dialectus/engine/judges/factory.py +70 -0
  30. dialectus_engine-0.2.0/dialectus/engine/models/__init__.py +1 -0
  31. dialectus_engine-0.2.0/dialectus/engine/models/base_types.py +87 -0
  32. dialectus_engine-0.2.0/dialectus/engine/models/cache_manager.py +316 -0
  33. dialectus_engine-0.2.0/dialectus/engine/models/manager.py +270 -0
  34. dialectus_engine-0.2.0/dialectus/engine/models/openrouter/openrouter_architecture.py +8 -0
  35. dialectus_engine-0.2.0/dialectus/engine/models/openrouter/openrouter_capability_extractor.py +247 -0
  36. dialectus_engine-0.2.0/dialectus/engine/models/openrouter/openrouter_enhanced_model_info.py +99 -0
  37. dialectus_engine-0.2.0/dialectus/engine/models/openrouter/openrouter_filter_config.py +237 -0
  38. dialectus_engine-0.2.0/dialectus/engine/models/openrouter/openrouter_model.py +27 -0
  39. dialectus_engine-0.2.0/dialectus/engine/models/openrouter/openrouter_model_filter.py +365 -0
  40. dialectus_engine-0.2.0/dialectus/engine/models/openrouter/openrouter_models_response.py +6 -0
  41. dialectus_engine-0.2.0/dialectus/engine/models/openrouter/openrouter_pricing.py +32 -0
  42. dialectus_engine-0.2.0/dialectus/engine/models/openrouter/openrouter_top_provider.py +7 -0
  43. dialectus_engine-0.2.0/dialectus/engine/models/providers/__init__.py +15 -0
  44. dialectus_engine-0.2.0/dialectus/engine/models/providers/base_model_provider.py +106 -0
  45. dialectus_engine-0.2.0/dialectus/engine/models/providers/exceptions.py +32 -0
  46. dialectus_engine-0.2.0/dialectus/engine/models/providers/ollama_provider.py +370 -0
  47. dialectus_engine-0.2.0/dialectus/engine/models/providers/open_router_provider.py +755 -0
  48. dialectus_engine-0.2.0/dialectus/engine/models/providers/openrouter_generation_types.py +64 -0
  49. dialectus_engine-0.2.0/dialectus/engine/models/providers/providers.py +36 -0
  50. dialectus_engine-0.2.0/dialectus/engine/moderation/__init__.py +6 -0
  51. dialectus_engine-0.2.0/dialectus/engine/moderation/base_moderator.py +52 -0
  52. dialectus_engine-0.2.0/dialectus/engine/moderation/exceptions.py +55 -0
  53. dialectus_engine-0.2.0/dialectus/engine/moderation/llm_moderator.py +209 -0
  54. dialectus_engine-0.2.0/dialectus/engine/moderation/manager.py +194 -0
  55. dialectus_engine-0.2.0/dialectus/engine/moderation/openai_moderator.py +152 -0
  56. {dialectus_engine-0.1.1 → dialectus_engine-0.2.0/dialectus_engine.egg-info}/PKG-INFO +164 -9
  57. dialectus_engine-0.2.0/dialectus_engine.egg-info/SOURCES.txt +123 -0
  58. {dialectus_engine-0.1.1 → dialectus_engine-0.2.0}/dialectus_engine.egg-info/requires.txt +1 -1
  59. dialectus_engine-0.2.0/pyproject.toml +78 -0
  60. dialectus_engine-0.2.0/tests/test_cache_manager.py +189 -0
  61. dialectus_engine-0.2.0/tests/test_config_settings.py +117 -0
  62. dialectus_engine-0.2.0/tests/test_debate_models.py +88 -0
  63. dialectus_engine-0.2.0/tests/test_format_registry.py +576 -0
  64. dialectus_engine-0.2.0/tests/test_formats_base.py +119 -0
  65. dialectus_engine-0.2.0/tests/test_judges_factory.py +146 -0
  66. dialectus_engine-0.2.0/tests/test_moderation_openai.py +230 -0
  67. dialectus_engine-0.1.1/dialectus/__init__.py +0 -3
  68. dialectus_engine-0.1.1/dialectus_engine.egg-info/SOURCES.txt +0 -10
  69. dialectus_engine-0.1.1/pyproject.toml +0 -46
  70. {dialectus_engine-0.1.1 → dialectus_engine-0.2.0}/LICENSE +0 -0
  71. {dialectus_engine-0.1.1 → dialectus_engine-0.2.0}/dialectus/engine/__init__.py +0 -0
  72. {dialectus_engine-0.1.1 → dialectus_engine-0.2.0}/dialectus_engine.egg-info/dependency_links.txt +0 -0
  73. {dialectus_engine-0.1.1 → dialectus_engine-0.2.0}/dialectus_engine.egg-info/top_level.txt +0 -0
  74. {dialectus_engine-0.1.1 → dialectus_engine-0.2.0}/setup.cfg +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dialectus-engine
3
- Version: 0.1.1
4
- Summary: AI debate engine framework - importable Python library
3
+ Version: 0.2.0
4
+ Summary: Dialectus AI debate engine framework
5
5
  Author: Dialectus AI
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/dialectus-ai/dialectus-engine
8
8
  Project-URL: Repository, https://github.com/dialectus-ai/dialectus-engine
9
9
  Project-URL: Issues, https://github.com/dialectus-ai/dialectus-engine/issues
10
- Keywords: ai,debate,llm,argumentation,ollama,openrouter,artificial-intelligence
10
+ Keywords: ai,debate,llm,ollama,openrouter,artificial-intelligence
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: Intended Audience :: Education
@@ -22,11 +22,11 @@ Requires-Dist: httpx>=0.28.1
22
22
  Requires-Dist: openai>=1.105.0
23
23
  Requires-Dist: pydantic>=2.11.7
24
24
  Provides-Extra: dev
25
- Requires-Dist: pip-tools; extra == "dev"
26
25
  Requires-Dist: ruff>=0.5.0; extra == "dev"
27
26
  Requires-Dist: pytest>=7.0; extra == "dev"
28
27
  Requires-Dist: twine; extra == "dev"
29
28
  Requires-Dist: build; extra == "dev"
29
+ Requires-Dist: pyright>=1.1.377; extra == "dev"
30
30
  Dynamic: license-file
31
31
 
32
32
  <img src="https://raw.githubusercontent.com/dialectus-ai/dialectus-engine/main/assets/logo.png" alt="Dialectus Engine" width="350">
@@ -52,17 +52,38 @@ The Dialectus Engine is a standalone Python library that provides core debate or
52
52
  - **Configuration** (`config/`) - System configuration management
53
53
  - **Judges** (`judges/`) - AI judge implementations with ensemble support
54
54
  - **Formats** (`formats/`) - Debate format definitions (Oxford, Parliamentary, Socratic, Public Forum)
55
+ - **Moderation** (`moderation/`) - Optional content safety system for debate topics
55
56
 
56
57
  ## Installation
57
58
 
58
59
  ### From PyPI
59
60
 
61
+ **Using uv (recommended):**
62
+ ```bash
63
+ uv pip install dialectus-engine
64
+ ```
65
+
66
+ **Using pip:**
60
67
  ```bash
61
68
  pip install dialectus-engine
62
69
  ```
63
70
 
64
71
  ### From Source
65
72
 
73
+ **Using uv (recommended, faster):**
74
+ ```bash
75
+ # Clone the repository
76
+ git clone https://github.com/dialectus-ai/dialectus-engine.git
77
+ cd dialectus-engine
78
+
79
+ # Install in development mode with all dev dependencies
80
+ uv sync
81
+
82
+ # Or install without dev dependencies
83
+ uv pip install -e .
84
+ ```
85
+
86
+ **Using pip:**
66
87
  ```bash
67
88
  # Clone the repository
68
89
  git clone https://github.com/dialectus-ai/dialectus-engine.git
@@ -77,15 +98,22 @@ pip install -e ".[dev]"
77
98
 
78
99
  ### As a Dependency
79
100
 
80
- Add to your `requirements.txt` or `pyproject.toml`:
101
+ Add to your `pyproject.toml`:
81
102
 
82
- ```
83
- dialectus-engine>=0.1.0
103
+ ```toml
104
+ [project]
105
+ dependencies = [
106
+ "dialectus-engine>=0.1.0",
107
+ ]
84
108
  ```
85
109
 
86
110
  Or install directly from git:
87
111
 
88
112
  ```bash
113
+ # Using uv
114
+ uv pip install git+https://github.com/dialectus-ai/dialectus-engine.git@main
115
+
116
+ # Using pip
89
117
  pip install git+https://github.com/dialectus-ai/dialectus-engine.git@main
90
118
  ```
91
119
 
@@ -126,11 +154,16 @@ asyncio.run(run_debate())
126
154
  The engine uses `debate_config.json` for system configuration. To get started:
127
155
 
128
156
  ```bash
129
- # Copy the example configuration
157
+ # Linux/Mac: Copy the example configuration
130
158
  cp debate_config.example.json debate_config.json
131
159
 
160
+ # Windows (PowerShell):
161
+ # copy debate_config.example.json debate_config.json
162
+
132
163
  # Edit with your settings and API keys
133
- nano debate_config.json
164
+ # Linux/Mac: nano debate_config.json
165
+ # Windows: notepad debate_config.json
166
+ # Or use your preferred editor (VS Code, vim, etc.)
134
167
  ```
135
168
 
136
169
  Key configuration sections:
@@ -138,9 +171,102 @@ Key configuration sections:
138
171
  - **Providers**: Configure Ollama (local) and OpenRouter (cloud) settings
139
172
  - **Judging**: Set evaluation criteria and judge models
140
173
  - **Debate**: Default topic, format, and word limits
174
+ - **Moderation** (optional): Content safety for user-provided topics
141
175
 
142
176
  For detailed configuration documentation, see [CONFIG_GUIDE.md](CONFIG_GUIDE.md).
143
177
 
178
+ ## Development Workflows
179
+
180
+ ### Running Tests and Type Checking
181
+
182
+ **Using uv (recommended):**
183
+ ```bash
184
+ # Run tests
185
+ uv run pytest
186
+
187
+ # Type check with Pyright
188
+ uv run pyright
189
+
190
+ # Lint with ruff
191
+ uv run ruff check .
192
+
193
+ # Format with ruff
194
+ uv run ruff format .
195
+ ```
196
+
197
+ **Using pip:**
198
+ ```bash
199
+ # Ensure dev dependencies are installed
200
+ pip install -e ".[dev]"
201
+
202
+ # Run tests
203
+ pytest
204
+
205
+ # Type check with Pyright
206
+ pyright
207
+
208
+ # Lint and format
209
+ ruff check .
210
+ ruff format .
211
+ ```
212
+
213
+ ### Building Distribution
214
+
215
+ **Using uv:**
216
+ ```bash
217
+ # Build wheel and sdist
218
+ uv build
219
+
220
+ # Install locally from wheel
221
+ uv pip install dist/dialectus_engine-*.whl
222
+ ```
223
+
224
+ **Using pip:**
225
+ ```bash
226
+ # Build wheel and sdist
227
+ python -m build
228
+
229
+ # Install locally
230
+ pip install dist/dialectus_engine-*.whl
231
+ ```
232
+
233
+ ### Managing Dependencies
234
+
235
+ **Using uv:**
236
+ ```bash
237
+ # Add a new dependency
238
+ # 1. Edit pyproject.toml [project.dependencies] section
239
+ # 2. Update lock file and sync environment:
240
+ uv lock && uv sync
241
+
242
+ # Upgrade all dependencies (within version constraints)
243
+ uv lock --upgrade
244
+
245
+ # Upgrade specific package
246
+ uv lock --upgrade-package httpx
247
+
248
+ # Add dev dependency
249
+ # 1. Edit pyproject.toml [project.optional-dependencies.dev]
250
+ # 2. Run:
251
+ uv sync
252
+ ```
253
+
254
+ **Using pip:**
255
+ ```bash
256
+ # Add a new dependency
257
+ # 1. Edit pyproject.toml dependencies
258
+ # 2. Reinstall:
259
+ pip install -e ".[dev]"
260
+ ```
261
+
262
+ ### Why uv?
263
+
264
+ - **10-100x faster** than pip for installs and resolution
265
+ - **Reproducible builds** via `uv.lock` (cross-platform, includes hashes)
266
+ - **Python 3.14 ready** - Takes advantage of free-threading for even better performance
267
+ - **Single source of truth** - Dependencies in `pyproject.toml`, lock file auto-generated
268
+ - **Compatible** - `pip` still works perfectly with `pyproject.toml`
269
+
144
270
  ## Features
145
271
 
146
272
  ### Multi-Provider Model Support
@@ -162,6 +288,12 @@ For detailed configuration documentation, see [CONFIG_GUIDE.md](CONFIG_GUIDE.md)
162
288
  - **Structured decisions**: JSON-serializable judge results
163
289
  - **Configurable criteria**: Logic, evidence, persuasiveness, etc.
164
290
 
291
+ ### Content Moderation (Optional)
292
+ - **Multi-provider support**: Ollama (local), OpenRouter, OpenAI moderation API
293
+ - **Safety categories**: Harassment, hate speech, violence, sexual content, dangerous activities
294
+ - **Flexible deployment**: Enable for production APIs, disable for trusted environments
295
+ - **Graceful error handling**: Provider-specific rate limit handling and retry logic
296
+
165
297
  ## Architecture
166
298
 
167
299
  Key architectural principles:
@@ -218,3 +350,26 @@ judge = JudgeFactory.create_judge(config.judging, model_manager)
218
350
  # Get aggregated decision
219
351
  decision = await judge.judge_debate(context)
220
352
  ```
353
+
354
+ ### Content Moderation
355
+
356
+ ```python
357
+ from dialectus.engine.moderation import ModerationManager, TopicRejectedError
358
+
359
+ # Create moderation manager
360
+ manager = ModerationManager(config.moderation, config.system)
361
+
362
+ # Validate user-provided topic
363
+ user_topic = "Should AI be regulated?"
364
+
365
+ try:
366
+ result = await manager.moderate_topic(user_topic)
367
+ # Topic is safe, proceed with debate
368
+ print(f"Topic approved with confidence: {result.confidence}")
369
+ except TopicRejectedError as e:
370
+ # Topic violates content policy
371
+ print(f"Topic rejected: {e.reason}")
372
+ print(f"Violated categories: {', '.join(e.categories)}")
373
+ ```
374
+
375
+ For comprehensive moderation testing and setup instructions, see [MODERATION_TESTING.md](MODERATION_TESTING.md).
@@ -21,17 +21,38 @@ The Dialectus Engine is a standalone Python library that provides core debate or
21
21
  - **Configuration** (`config/`) - System configuration management
22
22
  - **Judges** (`judges/`) - AI judge implementations with ensemble support
23
23
  - **Formats** (`formats/`) - Debate format definitions (Oxford, Parliamentary, Socratic, Public Forum)
24
+ - **Moderation** (`moderation/`) - Optional content safety system for debate topics
24
25
 
25
26
  ## Installation
26
27
 
27
28
  ### From PyPI
28
29
 
30
+ **Using uv (recommended):**
31
+ ```bash
32
+ uv pip install dialectus-engine
33
+ ```
34
+
35
+ **Using pip:**
29
36
  ```bash
30
37
  pip install dialectus-engine
31
38
  ```
32
39
 
33
40
  ### From Source
34
41
 
42
+ **Using uv (recommended, faster):**
43
+ ```bash
44
+ # Clone the repository
45
+ git clone https://github.com/dialectus-ai/dialectus-engine.git
46
+ cd dialectus-engine
47
+
48
+ # Install in development mode with all dev dependencies
49
+ uv sync
50
+
51
+ # Or install without dev dependencies
52
+ uv pip install -e .
53
+ ```
54
+
55
+ **Using pip:**
35
56
  ```bash
36
57
  # Clone the repository
37
58
  git clone https://github.com/dialectus-ai/dialectus-engine.git
@@ -46,15 +67,22 @@ pip install -e ".[dev]"
46
67
 
47
68
  ### As a Dependency
48
69
 
49
- Add to your `requirements.txt` or `pyproject.toml`:
70
+ Add to your `pyproject.toml`:
50
71
 
51
- ```
52
- dialectus-engine>=0.1.0
72
+ ```toml
73
+ [project]
74
+ dependencies = [
75
+ "dialectus-engine>=0.1.0",
76
+ ]
53
77
  ```
54
78
 
55
79
  Or install directly from git:
56
80
 
57
81
  ```bash
82
+ # Using uv
83
+ uv pip install git+https://github.com/dialectus-ai/dialectus-engine.git@main
84
+
85
+ # Using pip
58
86
  pip install git+https://github.com/dialectus-ai/dialectus-engine.git@main
59
87
  ```
60
88
 
@@ -95,11 +123,16 @@ asyncio.run(run_debate())
95
123
  The engine uses `debate_config.json` for system configuration. To get started:
96
124
 
97
125
  ```bash
98
- # Copy the example configuration
126
+ # Linux/Mac: Copy the example configuration
99
127
  cp debate_config.example.json debate_config.json
100
128
 
129
+ # Windows (PowerShell):
130
+ # copy debate_config.example.json debate_config.json
131
+
101
132
  # Edit with your settings and API keys
102
- nano debate_config.json
133
+ # Linux/Mac: nano debate_config.json
134
+ # Windows: notepad debate_config.json
135
+ # Or use your preferred editor (VS Code, vim, etc.)
103
136
  ```
104
137
 
105
138
  Key configuration sections:
@@ -107,9 +140,102 @@ Key configuration sections:
107
140
  - **Providers**: Configure Ollama (local) and OpenRouter (cloud) settings
108
141
  - **Judging**: Set evaluation criteria and judge models
109
142
  - **Debate**: Default topic, format, and word limits
143
+ - **Moderation** (optional): Content safety for user-provided topics
110
144
 
111
145
  For detailed configuration documentation, see [CONFIG_GUIDE.md](CONFIG_GUIDE.md).
112
146
 
147
+ ## Development Workflows
148
+
149
+ ### Running Tests and Type Checking
150
+
151
+ **Using uv (recommended):**
152
+ ```bash
153
+ # Run tests
154
+ uv run pytest
155
+
156
+ # Type check with Pyright
157
+ uv run pyright
158
+
159
+ # Lint with ruff
160
+ uv run ruff check .
161
+
162
+ # Format with ruff
163
+ uv run ruff format .
164
+ ```
165
+
166
+ **Using pip:**
167
+ ```bash
168
+ # Ensure dev dependencies are installed
169
+ pip install -e ".[dev]"
170
+
171
+ # Run tests
172
+ pytest
173
+
174
+ # Type check with Pyright
175
+ pyright
176
+
177
+ # Lint and format
178
+ ruff check .
179
+ ruff format .
180
+ ```
181
+
182
+ ### Building Distribution
183
+
184
+ **Using uv:**
185
+ ```bash
186
+ # Build wheel and sdist
187
+ uv build
188
+
189
+ # Install locally from wheel
190
+ uv pip install dist/dialectus_engine-*.whl
191
+ ```
192
+
193
+ **Using pip:**
194
+ ```bash
195
+ # Build wheel and sdist
196
+ python -m build
197
+
198
+ # Install locally
199
+ pip install dist/dialectus_engine-*.whl
200
+ ```
201
+
202
+ ### Managing Dependencies
203
+
204
+ **Using uv:**
205
+ ```bash
206
+ # Add a new dependency
207
+ # 1. Edit pyproject.toml [project.dependencies] section
208
+ # 2. Update lock file and sync environment:
209
+ uv lock && uv sync
210
+
211
+ # Upgrade all dependencies (within version constraints)
212
+ uv lock --upgrade
213
+
214
+ # Upgrade specific package
215
+ uv lock --upgrade-package httpx
216
+
217
+ # Add dev dependency
218
+ # 1. Edit pyproject.toml [project.optional-dependencies.dev]
219
+ # 2. Run:
220
+ uv sync
221
+ ```
222
+
223
+ **Using pip:**
224
+ ```bash
225
+ # Add a new dependency
226
+ # 1. Edit pyproject.toml dependencies
227
+ # 2. Reinstall:
228
+ pip install -e ".[dev]"
229
+ ```
230
+
231
+ ### Why uv?
232
+
233
+ - **10-100x faster** than pip for installs and resolution
234
+ - **Reproducible builds** via `uv.lock` (cross-platform, includes hashes)
235
+ - **Python 3.14 ready** - Takes advantage of free-threading for even better performance
236
+ - **Single source of truth** - Dependencies in `pyproject.toml`, lock file auto-generated
237
+ - **Compatible** - `pip` still works perfectly with `pyproject.toml`
238
+
113
239
  ## Features
114
240
 
115
241
  ### Multi-Provider Model Support
@@ -131,6 +257,12 @@ For detailed configuration documentation, see [CONFIG_GUIDE.md](CONFIG_GUIDE.md)
131
257
  - **Structured decisions**: JSON-serializable judge results
132
258
  - **Configurable criteria**: Logic, evidence, persuasiveness, etc.
133
259
 
260
+ ### Content Moderation (Optional)
261
+ - **Multi-provider support**: Ollama (local), OpenRouter, OpenAI moderation API
262
+ - **Safety categories**: Harassment, hate speech, violence, sexual content, dangerous activities
263
+ - **Flexible deployment**: Enable for production APIs, disable for trusted environments
264
+ - **Graceful error handling**: Provider-specific rate limit handling and retry logic
265
+
134
266
  ## Architecture
135
267
 
136
268
  Key architectural principles:
@@ -187,3 +319,26 @@ judge = JudgeFactory.create_judge(config.judging, model_manager)
187
319
  # Get aggregated decision
188
320
  decision = await judge.judge_debate(context)
189
321
  ```
322
+
323
+ ### Content Moderation
324
+
325
+ ```python
326
+ from dialectus.engine.moderation import ModerationManager, TopicRejectedError
327
+
328
+ # Create moderation manager
329
+ manager = ModerationManager(config.moderation, config.system)
330
+
331
+ # Validate user-provided topic
332
+ user_topic = "Should AI be regulated?"
333
+
334
+ try:
335
+ result = await manager.moderate_topic(user_topic)
336
+ # Topic is safe, proceed with debate
337
+ print(f"Topic approved with confidence: {result.confidence}")
338
+ except TopicRejectedError as e:
339
+ # Topic violates content policy
340
+ print(f"Topic rejected: {e.reason}")
341
+ print(f"Violated categories: {', '.join(e.categories)}")
342
+ ```
343
+
344
+ For comprehensive moderation testing and setup instructions, see [MODERATION_TESTING.md](MODERATION_TESTING.md).
@@ -0,0 +1,7 @@
1
+ """Dialectus - AI Debate System"""
2
+
3
+ from pkgutil import extend_path
4
+
5
+ __path__ = extend_path(__path__, __name__)
6
+ __all__: list[str] = []
7
+ __version__ = "0.2.0"
@@ -0,0 +1 @@
1
+ """Configuration management for the AI debate system."""
@@ -0,0 +1,153 @@
1
+ {
2
+ "version": "1.0",
3
+ "description": "OpenRouter model filtering configuration for Dialectus AI debate system",
4
+ "last_updated": "2025-01-13",
5
+ "filters": {
6
+ "exclude_patterns": [
7
+ {
8
+ "category": "meta_routing_models",
9
+ "description": "Meta/Router models that automatically select underlying models",
10
+ "patterns": [
11
+ "auto.*router",
12
+ "router",
13
+ "meta.*llama.*auto",
14
+ "mixture.*expert",
15
+ "moe",
16
+ "auto.*select",
17
+ "smart.*router",
18
+ "dynamic.*router"
19
+ ]
20
+ },
21
+ {
22
+ "category": "audio_speech_models",
23
+ "description": "Audio and speech processing models",
24
+ "patterns": [
25
+ "whisper",
26
+ "tts-",
27
+ "stt-",
28
+ "bark",
29
+ "speech",
30
+ "audio"
31
+ ]
32
+ },
33
+ {
34
+ "category": "image_generation_models",
35
+ "description": "Image/vision generation models (multimodal input models like GPT-4V are allowed)",
36
+ "patterns": [
37
+ "dall-e",
38
+ "stable-diffusion",
39
+ "midjourney",
40
+ "flux",
41
+ "sdxl",
42
+ "imagen",
43
+ "firefly"
44
+ ]
45
+ },
46
+ {
47
+ "category": "video_models",
48
+ "description": "Video processing and generation models",
49
+ "patterns": [
50
+ "video",
51
+ "runway",
52
+ "luma",
53
+ "pika",
54
+ "kling"
55
+ ]
56
+ },
57
+ {
58
+ "category": "code_specialized_models",
59
+ "description": "Code-specific models (too specialized for general debate)",
60
+ "patterns": [
61
+ "code-",
62
+ "-code",
63
+ "-coder",
64
+ "codestral",
65
+ "codegeex",
66
+ "codegen",
67
+ "starcoder",
68
+ "deepseek-coder",
69
+ "wizardcoder",
70
+ "phind-code"
71
+ ]
72
+ },
73
+ {
74
+ "category": "embedding_vector_models",
75
+ "description": "Embedding and vector similarity models",
76
+ "patterns": [
77
+ "embed",
78
+ "embedding",
79
+ "vector",
80
+ "similarity"
81
+ ]
82
+ },
83
+ {
84
+ "category": "moderation_safety_models",
85
+ "description": "Content moderation and safety models",
86
+ "patterns": [
87
+ "moderation",
88
+ "safety",
89
+ "guardrail"
90
+ ]
91
+ },
92
+ {
93
+ "category": "search_rag_models",
94
+ "description": "Search and RAG-specific models",
95
+ "patterns": [
96
+ "search",
97
+ "retrieval",
98
+ "rag-"
99
+ ]
100
+ },
101
+ {
102
+ "category": "math_science_specialized",
103
+ "description": "Math/Science specialized models (too narrow for general debate)",
104
+ "patterns": [
105
+ "math-",
106
+ "scientific-",
107
+ "theorem",
108
+ "proof-"
109
+ ]
110
+ },
111
+ {
112
+ "category": "translation_only_models",
113
+ "description": "Translation-only models (too specific for debate)",
114
+ "patterns": [
115
+ "translate-",
116
+ "translation-",
117
+ "-translator"
118
+ ]
119
+ },
120
+ {
121
+ "category": "jailbreak_variants",
122
+ "description": "Problematic jailbreak model variants",
123
+ "patterns": [
124
+ "jailbreak"
125
+ ]
126
+ }
127
+ ],
128
+ "preview_patterns": [
129
+ {
130
+ "category": "preview_anonymous_models",
131
+ "description": "Preview, anonymous, and experimental models",
132
+ "patterns": [
133
+ "^sonoma-",
134
+ "^preview-",
135
+ "^anonymous-",
136
+ "^beta-",
137
+ "^test-",
138
+ "-preview$",
139
+ "-beta$",
140
+ "-alpha$",
141
+ "experimental"
142
+ ]
143
+ }
144
+ ]
145
+ },
146
+ "settings": {
147
+ "allow_preview_models": false,
148
+ "exclude_free_tier_models": false,
149
+ "max_cost_per_1k_tokens": 0.02,
150
+ "min_context_length": 4096,
151
+ "max_models_per_tier": 8
152
+ }
153
+ }