Migration Guide: v2 → v3¶
This guide covers every breaking change between Director-AI v2.x and v3.x with before/after code.
1. Enterprise Imports (Lazy-Loading)¶
Enterprise modules now load lazily to avoid pulling heavy dependencies (redis, pyjwt, argon2-cffi, psycopg2) on import.
The director_ai.enterprise package loads only when accessed. If enterprise extras aren't installed, you get a clear ImportError with install instructions instead of a cryptic missing-module traceback.
2. CoherenceScorer Validation¶
CoherenceScorer now raises ValueError on invalid threshold combinations instead of silently clamping.
Fix: ensure soft_limit >= threshold in all call sites.
3. StreamingKernel Constructor¶
Two parameters renamed for clarity.
| v2 Parameter | v3 Parameter | Reason |
|---|---|---|
check_interval |
score_every_n |
Clarifies unit (tokens, not seconds) |
halt_on_fail |
halt_on_breach |
Aligns with threshold terminology |
4. Score Object Fields¶
ScoreResult.contradiction_score renamed to ScoreResult.h_logical and ScoreResult.retrieval_score renamed to ScoreResult.h_factual.
5. Configuration Profiles¶
v3 replaces scattered kwargs with DirectorConfig profiles.
Both styles work in v3 — kwargs are still accepted. But DirectorConfig enables serialization (YAML/JSON), validation, and reuse across scorer/kernel/agent.
6. New Features in v3¶
No migration needed — these are additive.
| Feature | Module | Guide |
|---|---|---|
review_batch() |
CoherenceScorer |
Benchmarks — Batch Coalescing |
| ONNX export | director_ai.core.backends.OnnxBackend |
ONNX Export |
| Rust FFI kernel | backfire-kernel crate |
Rust FFI |
| Hybrid LLM judge | CoherenceAgent(judge=...) |
Scoring |
| Config profiles | DirectorConfig |
Configuration |
| Bidirectional NLI | CoherenceScorer(bidirectional=True) |
Threshold Tuning |
| Local DeBERTa judge | CoherenceAgent(judge="local") |
Benchmarks |
Quick Checklist¶
- Update enterprise imports to
from director_ai.enterprise import ... - Ensure
soft_limit >= thresholdin allCoherenceScorercalls - Rename
check_interval→score_every_ninStreamingKernel - Rename
halt_on_fail→halt_on_breachinStreamingKernel - Rename
contradiction_score→h_logical,retrieval_score→h_factual - (Optional) Migrate to
DirectorConfigfor centralized configuration
Questions? Open an issue or check Troubleshooting.