dialectus-engine 0.3.1__tar.gz → 0.4.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 (85) hide show
  1. {dialectus_engine-0.3.1/dialectus_engine.egg-info → dialectus_engine-0.4.0}/PKG-INFO +119 -4
  2. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/README.md +118 -3
  3. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/__init__.py +1 -1
  4. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/config/settings.py +65 -3
  5. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/round_manager.py +4 -1
  6. dialectus_engine-0.4.0/dialectus/engine/models/anthropic/__init__.py +15 -0
  7. dialectus_engine-0.4.0/dialectus/engine/models/anthropic/anthropic_enhanced_model_info.py +68 -0
  8. dialectus_engine-0.4.0/dialectus/engine/models/anthropic/anthropic_model.py +101 -0
  9. dialectus_engine-0.4.0/dialectus/engine/models/anthropic/anthropic_model_filter.py +133 -0
  10. dialectus_engine-0.4.0/dialectus/engine/models/anthropic/anthropic_pricing.py +31 -0
  11. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/base_types.py +6 -1
  12. dialectus_engine-0.4.0/dialectus/engine/models/openai/__init__.py +14 -0
  13. dialectus_engine-0.4.0/dialectus/engine/models/openai/openai_enhanced_model_info.py +59 -0
  14. dialectus_engine-0.4.0/dialectus/engine/models/openai/openai_model.py +96 -0
  15. dialectus_engine-0.4.0/dialectus/engine/models/openai/openai_model_filter.py +108 -0
  16. dialectus_engine-0.4.0/dialectus/engine/models/openai/openai_pricing.py +31 -0
  17. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/providers/__init__.py +2 -0
  18. dialectus_engine-0.4.0/dialectus/engine/models/providers/anthropic_provider.py +202 -0
  19. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/providers/ollama_provider.py +62 -56
  20. dialectus_engine-0.4.0/dialectus/engine/models/providers/open_router_provider.py +306 -0
  21. dialectus_engine-0.4.0/dialectus/engine/models/providers/openai_compatible_provider.py +573 -0
  22. dialectus_engine-0.4.0/dialectus/engine/models/providers/openai_provider.py +174 -0
  23. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/providers/providers.py +4 -0
  24. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0/dialectus_engine.egg-info}/PKG-INFO +119 -4
  25. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus_engine.egg-info/SOURCES.txt +26 -0
  26. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/pyproject.toml +1 -1
  27. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/tests/test_config_settings.py +13 -5
  28. dialectus_engine-0.3.1/dialectus/engine/models/providers/open_router_provider.py +0 -795
  29. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/LICENSE +0 -0
  30. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/__init__.py +0 -0
  31. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/config/__init__.py +0 -0
  32. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/config/openrouter_filters.json +0 -0
  33. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/__init__.py +0 -0
  34. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/context_builder.py +0 -0
  35. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/engine.py +0 -0
  36. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/judge_coordinator.py +0 -0
  37. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/models.py +0 -0
  38. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/prompt_builder.py +0 -0
  39. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/response_handler.py +0 -0
  40. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/types.py +0 -0
  41. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/debate_engine/utils.py +0 -0
  42. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/formats/__init__.py +0 -0
  43. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/formats/base.py +0 -0
  44. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/formats/oxford.py +0 -0
  45. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/formats/parliamentary.py +0 -0
  46. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/formats/public_forum.py +0 -0
  47. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/formats/registry.py +0 -0
  48. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/formats/socratic.py +0 -0
  49. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/formats/topic_themes.py +0 -0
  50. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/judges/__init__.py +0 -0
  51. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/judges/ai_judge.py +0 -0
  52. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/judges/base.py +0 -0
  53. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/judges/ensemble_utils.py +0 -0
  54. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/judges/factory.py +0 -0
  55. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/__init__.py +0 -0
  56. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/cache_manager.py +0 -0
  57. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/manager.py +0 -0
  58. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/openrouter/openrouter_architecture.py +0 -0
  59. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/openrouter/openrouter_capability_extractor.py +0 -0
  60. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/openrouter/openrouter_enhanced_model_info.py +0 -0
  61. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/openrouter/openrouter_filter_config.py +0 -0
  62. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/openrouter/openrouter_model.py +0 -0
  63. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/openrouter/openrouter_model_filter.py +0 -0
  64. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/openrouter/openrouter_models_response.py +0 -0
  65. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/openrouter/openrouter_pricing.py +0 -0
  66. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/openrouter/openrouter_top_provider.py +0 -0
  67. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/providers/base_model_provider.py +0 -0
  68. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/providers/exceptions.py +0 -0
  69. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/models/providers/openrouter_generation_types.py +0 -0
  70. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/moderation/__init__.py +0 -0
  71. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/moderation/base_moderator.py +0 -0
  72. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/moderation/exceptions.py +0 -0
  73. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/moderation/llm_moderator.py +0 -0
  74. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/moderation/manager.py +0 -0
  75. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus/engine/moderation/openai_moderator.py +0 -0
  76. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus_engine.egg-info/dependency_links.txt +0 -0
  77. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus_engine.egg-info/requires.txt +0 -0
  78. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/dialectus_engine.egg-info/top_level.txt +0 -0
  79. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/setup.cfg +0 -0
  80. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/tests/test_cache_manager.py +0 -0
  81. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/tests/test_debate_models.py +0 -0
  82. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/tests/test_format_registry.py +0 -0
  83. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/tests/test_formats_base.py +0 -0
  84. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/tests/test_judges_factory.py +0 -0
  85. {dialectus_engine-0.3.1 → dialectus_engine-0.4.0}/tests/test_moderation_openai.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dialectus-engine
3
- Version: 0.3.1
3
+ Version: 0.4.0
4
4
  Summary: Dialectus AI debate engine framework
5
5
  Author: Dialectus AI
6
6
  License-Expression: MIT
@@ -43,14 +43,20 @@ A Python library for orchestrating AI-powered debates with multi-provider model
43
43
  ![License](https://img.shields.io/badge/license-MIT-green.svg)
44
44
  ![Status](https://img.shields.io/badge/status-Production%20Ready-brightgreen.svg)
45
45
 
46
+ > **Ready-to-Use CLI:** Want to run debates right away? Check out the [dialectus-cli](https://github.com/dialectus-ai/dialectus-cli) - a command-line interface that uses this engine to run debates locally with a beautiful terminal UI.
47
+
46
48
  ## Overview
47
49
 
48
50
  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.
49
51
 
52
+ **Applications using this engine:**
53
+ - **[dialectus-cli](https://github.com/dialectus-ai/dialectus-cli)** - Command-line interface with Rich terminal UI and SQLite storage
54
+ - **dialectus-web** - Web application with React frontend and FastAPI backend (private repository)
55
+
50
56
  ## Components
51
57
 
52
58
  - **Core Engine** (`debate_engine/`) - Main debate orchestration logic
53
- - **Models** (`models/`) - AI model provider integrations (Ollama, OpenRouter)
59
+ - **Models** (`models/`) - AI model provider integrations (Ollama, OpenRouter, Anthropic)
54
60
  - **Configuration** (`config/`) - System configuration management
55
61
  - **Judges** (`judges/`) - AI judge implementations with ensemble support
56
62
  - **Formats** (`formats/`) - Debate format definitions (Oxford, Parliamentary, Socratic, Public Forum)
@@ -170,7 +176,7 @@ cp debate_config.example.json debate_config.json
170
176
 
171
177
  Key configuration sections:
172
178
  - **Models**: Define debate participants with provider, personality, and parameters
173
- - **Providers**: Configure Ollama (local) and OpenRouter (cloud) settings
179
+ - **Providers**: Configure Ollama (local), OpenRouter (cloud), and Anthropic (cloud) settings
174
180
  - **Judging**: Set evaluation criteria and judge models
175
181
  - **Debate**: Default topic, format, and word limits
176
182
  - **Moderation** (optional): Content safety for user-provided topics
@@ -274,9 +280,11 @@ pip install -e ".[dev]"
274
280
  ### Multi-Provider Model Support
275
281
  - **Ollama**: Local model management with hardware optimization
276
282
  - **OpenRouter**: Cloud model access to 100+ models
277
- - **Async streaming**: Chunk-by-chunk response generation
283
+ - **Anthropic**: Direct access to Claude models (3.5 Sonnet, Haiku, Opus, etc.)
284
+ - **Async streaming**: Chunk-by-chunk response generation for all providers
278
285
  - **Auto-discovery**: Dynamic model listing from all configured providers
279
286
  - **Caching**: In-memory cache with TTL for model metadata
287
+ - **Cost tracking**: Token usage and cost calculation for cloud providers
280
288
 
281
289
  ### Debate Formats
282
290
  - **Oxford**: Classic opening/rebuttal/closing structure
@@ -375,3 +383,110 @@ except TopicRejectedError as e:
375
383
  ```
376
384
 
377
385
  For comprehensive moderation testing and setup instructions, see [MODERATION_TESTING.md](MODERATION_TESTING.md).
386
+
387
+ ## Provider Setup
388
+
389
+ ### Anthropic (Claude Models)
390
+
391
+ To use Anthropic's Claude models, you'll need an API key:
392
+
393
+ 1. **Get an API key**: Sign up at [console.anthropic.com](https://console.anthropic.com/)
394
+
395
+ 2. **Set your API key** (choose one method):
396
+
397
+ **Environment variable (recommended):**
398
+ ```bash
399
+ export ANTHROPIC_API_KEY="sk-ant-api03-..."
400
+ ```
401
+
402
+ **Or in `debate_config.json`:**
403
+ ```json
404
+ {
405
+ "system": {
406
+ "anthropic": {
407
+ "api_key": "sk-ant-api03-...",
408
+ "base_url": "https://api.anthropic.com/v1",
409
+ "max_retries": 3,
410
+ "timeout": 60
411
+ }
412
+ }
413
+ }
414
+ ```
415
+
416
+ 3. **Configure a model**:
417
+ ```json
418
+ {
419
+ "models": {
420
+ "model_a": {
421
+ "name": "claude-3-5-sonnet-20241022",
422
+ "provider": "anthropic",
423
+ "personality": "analytical",
424
+ "max_tokens": 300,
425
+ "temperature": 0.7
426
+ }
427
+ }
428
+ }
429
+ ```
430
+
431
+ **Available Claude models:**
432
+ - `claude-3-5-sonnet-20241022` - Latest, most intelligent (best for debates)
433
+ - `claude-3-5-haiku-20241022` - Fastest and most economical
434
+ - `claude-3-opus-20240229` - Most capable Claude 3 model
435
+ - `claude-3-sonnet-20240229` - Balanced performance
436
+ - `claude-3-haiku-20240307` - Budget-friendly option
437
+
438
+ ### OpenRouter
439
+
440
+ To use OpenRouter's model marketplace:
441
+
442
+ 1. **Get an API key**: Sign up at [openrouter.ai](https://openrouter.ai/)
443
+
444
+ 2. **Set your API key**:
445
+ ```bash
446
+ export OPENROUTER_API_KEY="sk-or-v1-..."
447
+ ```
448
+
449
+ 3. **Configure a model**:
450
+ ```json
451
+ {
452
+ "models": {
453
+ "model_a": {
454
+ "name": "anthropic/claude-3.5-sonnet",
455
+ "provider": "openrouter",
456
+ "personality": "analytical",
457
+ "max_tokens": 300,
458
+ "temperature": 0.7
459
+ }
460
+ }
461
+ }
462
+ ```
463
+
464
+ ### Ollama (Local Models)
465
+
466
+ To use local models via Ollama:
467
+
468
+ 1. **Install Ollama**: Download from [ollama.com](https://ollama.com/)
469
+
470
+ 2. **Pull models**:
471
+ ```bash
472
+ ollama pull llama3.2:3b
473
+ ollama pull qwen2.5:7b
474
+ ```
475
+
476
+ 3. **Configure**:
477
+ ```json
478
+ {
479
+ "models": {
480
+ "model_a": {
481
+ "name": "llama3.2:3b",
482
+ "provider": "ollama",
483
+ "personality": "analytical",
484
+ "max_tokens": 300,
485
+ "temperature": 0.7
486
+ }
487
+ },
488
+ "system": {
489
+ "ollama_base_url": "http://localhost:11434"
490
+ }
491
+ }
492
+ ```
@@ -10,14 +10,20 @@ A Python library for orchestrating AI-powered debates with multi-provider model
10
10
  ![License](https://img.shields.io/badge/license-MIT-green.svg)
11
11
  ![Status](https://img.shields.io/badge/status-Production%20Ready-brightgreen.svg)
12
12
 
13
+ > **Ready-to-Use CLI:** Want to run debates right away? Check out the [dialectus-cli](https://github.com/dialectus-ai/dialectus-cli) - a command-line interface that uses this engine to run debates locally with a beautiful terminal UI.
14
+
13
15
  ## Overview
14
16
 
15
17
  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
18
 
19
+ **Applications using this engine:**
20
+ - **[dialectus-cli](https://github.com/dialectus-ai/dialectus-cli)** - Command-line interface with Rich terminal UI and SQLite storage
21
+ - **dialectus-web** - Web application with React frontend and FastAPI backend (private repository)
22
+
17
23
  ## Components
18
24
 
19
25
  - **Core Engine** (`debate_engine/`) - Main debate orchestration logic
20
- - **Models** (`models/`) - AI model provider integrations (Ollama, OpenRouter)
26
+ - **Models** (`models/`) - AI model provider integrations (Ollama, OpenRouter, Anthropic)
21
27
  - **Configuration** (`config/`) - System configuration management
22
28
  - **Judges** (`judges/`) - AI judge implementations with ensemble support
23
29
  - **Formats** (`formats/`) - Debate format definitions (Oxford, Parliamentary, Socratic, Public Forum)
@@ -137,7 +143,7 @@ cp debate_config.example.json debate_config.json
137
143
 
138
144
  Key configuration sections:
139
145
  - **Models**: Define debate participants with provider, personality, and parameters
140
- - **Providers**: Configure Ollama (local) and OpenRouter (cloud) settings
146
+ - **Providers**: Configure Ollama (local), OpenRouter (cloud), and Anthropic (cloud) settings
141
147
  - **Judging**: Set evaluation criteria and judge models
142
148
  - **Debate**: Default topic, format, and word limits
143
149
  - **Moderation** (optional): Content safety for user-provided topics
@@ -241,9 +247,11 @@ pip install -e ".[dev]"
241
247
  ### Multi-Provider Model Support
242
248
  - **Ollama**: Local model management with hardware optimization
243
249
  - **OpenRouter**: Cloud model access to 100+ models
244
- - **Async streaming**: Chunk-by-chunk response generation
250
+ - **Anthropic**: Direct access to Claude models (3.5 Sonnet, Haiku, Opus, etc.)
251
+ - **Async streaming**: Chunk-by-chunk response generation for all providers
245
252
  - **Auto-discovery**: Dynamic model listing from all configured providers
246
253
  - **Caching**: In-memory cache with TTL for model metadata
254
+ - **Cost tracking**: Token usage and cost calculation for cloud providers
247
255
 
248
256
  ### Debate Formats
249
257
  - **Oxford**: Classic opening/rebuttal/closing structure
@@ -342,3 +350,110 @@ except TopicRejectedError as e:
342
350
  ```
343
351
 
344
352
  For comprehensive moderation testing and setup instructions, see [MODERATION_TESTING.md](MODERATION_TESTING.md).
353
+
354
+ ## Provider Setup
355
+
356
+ ### Anthropic (Claude Models)
357
+
358
+ To use Anthropic's Claude models, you'll need an API key:
359
+
360
+ 1. **Get an API key**: Sign up at [console.anthropic.com](https://console.anthropic.com/)
361
+
362
+ 2. **Set your API key** (choose one method):
363
+
364
+ **Environment variable (recommended):**
365
+ ```bash
366
+ export ANTHROPIC_API_KEY="sk-ant-api03-..."
367
+ ```
368
+
369
+ **Or in `debate_config.json`:**
370
+ ```json
371
+ {
372
+ "system": {
373
+ "anthropic": {
374
+ "api_key": "sk-ant-api03-...",
375
+ "base_url": "https://api.anthropic.com/v1",
376
+ "max_retries": 3,
377
+ "timeout": 60
378
+ }
379
+ }
380
+ }
381
+ ```
382
+
383
+ 3. **Configure a model**:
384
+ ```json
385
+ {
386
+ "models": {
387
+ "model_a": {
388
+ "name": "claude-3-5-sonnet-20241022",
389
+ "provider": "anthropic",
390
+ "personality": "analytical",
391
+ "max_tokens": 300,
392
+ "temperature": 0.7
393
+ }
394
+ }
395
+ }
396
+ ```
397
+
398
+ **Available Claude models:**
399
+ - `claude-3-5-sonnet-20241022` - Latest, most intelligent (best for debates)
400
+ - `claude-3-5-haiku-20241022` - Fastest and most economical
401
+ - `claude-3-opus-20240229` - Most capable Claude 3 model
402
+ - `claude-3-sonnet-20240229` - Balanced performance
403
+ - `claude-3-haiku-20240307` - Budget-friendly option
404
+
405
+ ### OpenRouter
406
+
407
+ To use OpenRouter's model marketplace:
408
+
409
+ 1. **Get an API key**: Sign up at [openrouter.ai](https://openrouter.ai/)
410
+
411
+ 2. **Set your API key**:
412
+ ```bash
413
+ export OPENROUTER_API_KEY="sk-or-v1-..."
414
+ ```
415
+
416
+ 3. **Configure a model**:
417
+ ```json
418
+ {
419
+ "models": {
420
+ "model_a": {
421
+ "name": "anthropic/claude-3.5-sonnet",
422
+ "provider": "openrouter",
423
+ "personality": "analytical",
424
+ "max_tokens": 300,
425
+ "temperature": 0.7
426
+ }
427
+ }
428
+ }
429
+ ```
430
+
431
+ ### Ollama (Local Models)
432
+
433
+ To use local models via Ollama:
434
+
435
+ 1. **Install Ollama**: Download from [ollama.com](https://ollama.com/)
436
+
437
+ 2. **Pull models**:
438
+ ```bash
439
+ ollama pull llama3.2:3b
440
+ ollama pull qwen2.5:7b
441
+ ```
442
+
443
+ 3. **Configure**:
444
+ ```json
445
+ {
446
+ "models": {
447
+ "model_a": {
448
+ "name": "llama3.2:3b",
449
+ "provider": "ollama",
450
+ "personality": "analytical",
451
+ "max_tokens": 300,
452
+ "temperature": 0.7
453
+ }
454
+ },
455
+ "system": {
456
+ "ollama_base_url": "http://localhost:11434"
457
+ }
458
+ }
459
+ ```
@@ -4,4 +4,4 @@ from pkgutil import extend_path
4
4
 
5
5
  __path__ = extend_path(__path__, __name__)
6
6
  __all__: list[str] = []
7
- __version__ = "0.3.1"
7
+ __version__ = "0.4.0"
@@ -44,7 +44,9 @@ class ModelConfig(BaseModel):
44
44
  @field_validator("provider")
45
45
  @classmethod
46
46
  def validate_provider(cls, v: str) -> str:
47
- return validate_provider_value(v, {"ollama", "openrouter"})
47
+ return validate_provider_value(
48
+ v, {"ollama", "openrouter", "anthropic", "openai"}
49
+ )
48
50
 
49
51
 
50
52
  class DebateConfig(BaseModel):
@@ -169,6 +171,42 @@ class OpenRouterConfig(BaseModel):
169
171
  timeout: int = Field(default=60, description="API request timeout in seconds")
170
172
 
171
173
 
174
+ class OpenAIConfig(BaseModel):
175
+ """OpenAI-specific configuration."""
176
+
177
+ api_key: str | None = Field(
178
+ default=None,
179
+ description=(
180
+ "OpenAI API key (can also be set via OPENAI_API_KEY environment variable)"
181
+ ),
182
+ )
183
+ base_url: str = Field(
184
+ default="https://api.openai.com/v1", description="OpenAI API base URL"
185
+ )
186
+ max_retries: int = Field(
187
+ default=3, description="Maximum number of API call retries"
188
+ )
189
+ timeout: int = Field(default=60, description="API request timeout in seconds")
190
+
191
+
192
+ class AnthropicConfig(BaseModel):
193
+ """Anthropic-specific configuration."""
194
+
195
+ api_key: str | None = Field(
196
+ default=None,
197
+ description=(
198
+ "Anthropic API key (can also be set via ANTHROPIC_API_KEY env var)"
199
+ ),
200
+ )
201
+ base_url: str = Field(
202
+ default="https://api.anthropic.com/v1", description="Anthropic API base URL"
203
+ )
204
+ max_retries: int = Field(
205
+ default=3, description="Maximum number of API call retries"
206
+ )
207
+ timeout: int = Field(default=60, description="API request timeout in seconds")
208
+
209
+
172
210
  class SystemConfig(BaseModel):
173
211
  """System-wide configuration."""
174
212
 
@@ -184,12 +222,18 @@ class SystemConfig(BaseModel):
184
222
  openrouter: OpenRouterConfig = Field(
185
223
  default_factory=OpenRouterConfig, description="OpenRouter-specific settings"
186
224
  )
225
+ openai: OpenAIConfig = Field(
226
+ default_factory=OpenAIConfig, description="OpenAI-specific settings"
227
+ )
228
+ anthropic: AnthropicConfig = Field(
229
+ default_factory=AnthropicConfig, description="Anthropic-specific settings"
230
+ )
187
231
 
188
232
  # System settings
189
233
  log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR"] = Field(default="INFO")
190
234
 
191
235
  # Topic generation settings
192
- debate_topic_source: Literal["ollama", "openrouter"] = Field(
236
+ debate_topic_source: Literal["ollama", "openrouter", "anthropic", "openai"] = Field(
193
237
  default="openrouter", description="Provider for topic generation model"
194
238
  )
195
239
  debate_topic_model: str = Field(
@@ -200,7 +244,9 @@ class SystemConfig(BaseModel):
200
244
  @field_validator("debate_topic_source")
201
245
  @classmethod
202
246
  def validate_topic_source(cls, v: str) -> str:
203
- return validate_provider_value(v, {"ollama", "openrouter"})
247
+ return validate_provider_value(
248
+ v, {"ollama", "openrouter", "anthropic", "openai"}
249
+ )
204
250
 
205
251
 
206
252
  class AppConfig(BaseModel):
@@ -326,6 +372,22 @@ def get_template_config() -> AppConfig:
326
372
  max_retries=3,
327
373
  timeout=60,
328
374
  ),
375
+ openai=OpenAIConfig(
376
+ # Set your OpenAI API key here or use
377
+ # OPENAI_API_KEY env var
378
+ api_key=None,
379
+ base_url="https://api.openai.com/v1",
380
+ max_retries=3,
381
+ timeout=60,
382
+ ),
383
+ anthropic=AnthropicConfig(
384
+ # Set your Anthropic API key here or use
385
+ # ANTHROPIC_API_KEY env var
386
+ api_key=None,
387
+ base_url="https://api.anthropic.com/v1",
388
+ max_retries=3,
389
+ timeout=60,
390
+ ),
329
391
  log_level="INFO",
330
392
  debate_topic_source="openrouter",
331
393
  debate_topic_model="anthropic/claude-3-haiku",
@@ -154,6 +154,9 @@ class RoundManager:
154
154
 
155
155
  # Call message_complete callback
156
156
  if message_callback:
157
+ # Convert metadata values to strings for MessageCompleteEventData
158
+ metadata_str = {k: str(v) for k, v in message.metadata.items()}
159
+
157
160
  complete_event = MessageCompleteEventData(
158
161
  message_id=message_id,
159
162
  speaker_id=message.speaker_id,
@@ -163,7 +166,7 @@ class RoundManager:
163
166
  content=message.content,
164
167
  timestamp=message.timestamp.isoformat(),
165
168
  word_count=len(message.content.split()),
166
- metadata=message.metadata,
169
+ metadata=metadata_str,
167
170
  cost=message.cost,
168
171
  generation_id=message.generation_id,
169
172
  )
@@ -0,0 +1,15 @@
1
+ """Anthropic model catalog and metadata."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .anthropic_enhanced_model_info import AnthropicEnhancedModelInfo
6
+ from .anthropic_model import AnthropicModel
7
+ from .anthropic_model_filter import AnthropicModelFilter
8
+ from .anthropic_pricing import AnthropicPricing
9
+
10
+ __all__ = [
11
+ "AnthropicModel",
12
+ "AnthropicPricing",
13
+ "AnthropicEnhancedModelInfo",
14
+ "AnthropicModelFilter",
15
+ ]
@@ -0,0 +1,68 @@
1
+ """Enhanced Anthropic model information."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Mapping
6
+ from typing import cast
7
+
8
+ from dialectus.engine.models.base_types import (
9
+ BaseEnhancedModelInfo,
10
+ ModelPricing,
11
+ ModelTier,
12
+ ModelWeightClass,
13
+ )
14
+
15
+ from .anthropic_model import AnthropicModel
16
+ from .anthropic_pricing import AnthropicPricing
17
+
18
+
19
+ class AnthropicEnhancedModelInfo(BaseEnhancedModelInfo):
20
+ """Enhanced Anthropic model information extending base class."""
21
+
22
+ def __init__(self, **data: object) -> None:
23
+ """Initialize enhanced model info, normalizing Anthropic-specific types."""
24
+ # Copy into a mutable dict for normalization
25
+ mutable_data = dict(data)
26
+ raw_model = mutable_data.pop("raw_model", None)
27
+
28
+ # Convert AnthropicPricing to ModelPricing
29
+ pricing_obj = mutable_data.get("pricing")
30
+ if isinstance(pricing_obj, AnthropicPricing):
31
+ mutable_data["pricing"] = ModelPricing(
32
+ prompt_cost_per_1k=pricing_obj.prompt_cost_per_1k,
33
+ completion_cost_per_1k=pricing_obj.completion_cost_per_1k,
34
+ is_free=pricing_obj.is_free,
35
+ currency="USD",
36
+ )
37
+ elif isinstance(pricing_obj, Mapping):
38
+ # From cache - validate into canonical model
39
+ mutable_data["pricing"] = ModelPricing.model_validate(pricing_obj)
40
+
41
+ # Convert string enums to proper enum types
42
+ weight_class = mutable_data.get("weight_class")
43
+ if isinstance(weight_class, str):
44
+ mutable_data["weight_class"] = ModelWeightClass(weight_class)
45
+
46
+ tier = mutable_data.get("tier")
47
+ if isinstance(tier, str):
48
+ mutable_data["tier"] = ModelTier(tier)
49
+
50
+ # Ensure source_info exists
51
+ source_info_obj = mutable_data.get("source_info")
52
+ if isinstance(source_info_obj, Mapping):
53
+ # Cast to suppress type checker - we know this is a Mapping[str, object] at runtime
54
+ source_info = dict(cast(Mapping[str, object], source_info_obj))
55
+ else:
56
+ source_info = {}
57
+ mutable_data["source_info"] = source_info
58
+
59
+ # Store raw model data if provided
60
+ if raw_model is not None and "anthropic_raw" not in source_info:
61
+ if isinstance(raw_model, AnthropicModel):
62
+ source_info["anthropic_raw"] = raw_model.model_dump()
63
+ else:
64
+ source_info["anthropic_raw"] = raw_model
65
+
66
+ # Call parent with normalized data
67
+ # Type checker can't verify runtime normalization, so we use type: ignore
68
+ super().__init__(**mutable_data) # type: ignore[arg-type]
@@ -0,0 +1,101 @@
1
+ """Anthropic model definition."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+ from .anthropic_pricing import AnthropicPricing
8
+
9
+
10
+ class AnthropicModel(BaseModel):
11
+ """Anthropic model information (curated/hardcoded for now)."""
12
+
13
+ id: str = Field(description="Model identifier")
14
+ name: str = Field(description="Human-readable model name")
15
+ description: str = Field(description="Model description")
16
+ context_length: int = Field(description="Maximum context window in tokens")
17
+ max_output_tokens: int = Field(description="Maximum output tokens per request")
18
+ pricing: AnthropicPricing = Field(description="Pricing information")
19
+ release_date: str = Field(description="Release date (YYYY-MM-DD format)")
20
+ is_latest: bool = Field(
21
+ default=False, description="Whether this is the latest version"
22
+ )
23
+ supports_vision: bool = Field(
24
+ default=False, description="Whether model supports vision input"
25
+ )
26
+
27
+
28
+ # Curated list of Anthropic models with current pricing (as of 2025)
29
+ # Source: https://www.anthropic.com/pricing
30
+ ANTHROPIC_MODELS: list[AnthropicModel] = [
31
+ AnthropicModel(
32
+ id="claude-3-5-sonnet-20241022",
33
+ name="Claude 3.5 Sonnet (2024-10-22)",
34
+ description="Most intelligent model - best for complex reasoning, coding, and nuanced analysis",
35
+ context_length=200000,
36
+ max_output_tokens=8192,
37
+ pricing=AnthropicPricing(
38
+ input_cost_per_mtok=3.00,
39
+ output_cost_per_mtok=15.00,
40
+ ),
41
+ release_date="2024-10-22",
42
+ is_latest=True,
43
+ supports_vision=True,
44
+ ),
45
+ AnthropicModel(
46
+ id="claude-3-5-haiku-20241022",
47
+ name="Claude 3.5 Haiku (2024-10-22)",
48
+ description="Fastest model - best for quick responses and high-throughput tasks",
49
+ context_length=200000,
50
+ max_output_tokens=8192,
51
+ pricing=AnthropicPricing(
52
+ input_cost_per_mtok=1.00,
53
+ output_cost_per_mtok=5.00,
54
+ ),
55
+ release_date="2024-10-22",
56
+ is_latest=True,
57
+ supports_vision=True,
58
+ ),
59
+ AnthropicModel(
60
+ id="claude-3-opus-20240229",
61
+ name="Claude 3 Opus (2024-02-29)",
62
+ description="Most capable Claude 3 model - powerful intelligence for complex tasks",
63
+ context_length=200000,
64
+ max_output_tokens=4096,
65
+ pricing=AnthropicPricing(
66
+ input_cost_per_mtok=15.00,
67
+ output_cost_per_mtok=75.00,
68
+ ),
69
+ release_date="2024-02-29",
70
+ is_latest=False,
71
+ supports_vision=True,
72
+ ),
73
+ AnthropicModel(
74
+ id="claude-3-sonnet-20240229",
75
+ name="Claude 3 Sonnet (2024-02-29)",
76
+ description="Balanced Claude 3 model - good performance and speed",
77
+ context_length=200000,
78
+ max_output_tokens=4096,
79
+ pricing=AnthropicPricing(
80
+ input_cost_per_mtok=3.00,
81
+ output_cost_per_mtok=15.00,
82
+ ),
83
+ release_date="2024-02-29",
84
+ is_latest=False,
85
+ supports_vision=True,
86
+ ),
87
+ AnthropicModel(
88
+ id="claude-3-haiku-20240307",
89
+ name="Claude 3 Haiku (2024-03-07)",
90
+ description="Fastest Claude 3 model - quick and efficient",
91
+ context_length=200000,
92
+ max_output_tokens=4096,
93
+ pricing=AnthropicPricing(
94
+ input_cost_per_mtok=0.25,
95
+ output_cost_per_mtok=1.25,
96
+ ),
97
+ release_date="2024-03-07",
98
+ is_latest=False,
99
+ supports_vision=True,
100
+ ),
101
+ ]