DirectorConfig¶
Dataclass-based configuration with environment variable, YAML file, and named profile loaders. All fields have sensible defaults.
Loading Configuration¶
All fields map to DIRECTOR_<FIELD> env vars:
Profiles¶
| Profile | NLI | Threshold | Candidates | Metrics | Use Case |
|---|---|---|---|---|---|
fast |
Off | 0.5 | 1 | Off | Development, prototyping |
thorough |
On | 0.6 | 3 | On | Production default |
research |
On | 0.7 | 5 | On | Evaluation, benchmarking |
medical |
On | 0.30 | 3 | On | Healthcare (measured on PubMedQA) |
finance |
On | 0.30 | 3 | On | Financial services (measured on FinanceBench) |
legal |
On | 0.30 | 3 | On | Legal document review |
creative |
Off | 0.40 | 3 | Off | Creative writing (low halt rate) |
customer_support |
Off | 0.55 | 3 | Off | Support agents |
summarization |
On | 0.15 | 3 | On | Document summarization |
lite |
Off | 0.50 | 1 | Off | Zero-dependency fast path |
Building Components from Config¶
config = DirectorConfig.from_profile("thorough")
# Build a scorer with all config settings applied
scorer = config.build_scorer(store=my_store)
# Build a vector store from config
store = config.build_store()
Field Reference¶
Scoring¶
| Field | Type | Default | Description |
|---|---|---|---|
coherence_threshold |
float |
0.6 |
Minimum coherence to approve |
hard_limit |
float |
0.5 |
Safety kernel emergency stop |
soft_limit |
float |
0.6 |
Warning zone threshold |
use_nli |
bool |
False |
Enable DeBERTa NLI model |
nli_model |
str |
"yaxili96/FactCG-DeBERTa-v3-Large" |
HuggingFace model ID |
max_candidates |
int |
3 |
LLM candidates to generate |
history_window |
int |
5 |
Rolling history size |
scorer_backend |
str |
"deberta" |
deberta, onnx, minicheck, hybrid, lite, rust |
LLM Provider¶
| Field | Type | Default | Description |
|---|---|---|---|
llm_provider |
str |
"mock" |
mock, openai, anthropic, huggingface, local |
llm_api_url |
str |
"" |
API endpoint (for local provider) |
llm_api_key |
str |
"" |
API key (for cloud providers) |
llm_model |
str |
"" |
Model name |
llm_temperature |
float |
0.8 |
Sampling temperature |
llm_max_tokens |
int |
512 |
Maximum tokens per response |
LLM-as-Judge¶
Privacy
When enabled, user prompts and responses are sent to the configured external LLM. Do not enable in privacy-sensitive deployments without user consent.
| Field | Type | Default | Description |
|---|---|---|---|
llm_judge_enabled |
bool |
False |
Enable LLM escalation |
llm_judge_confidence_threshold |
float |
0.3 |
Softmax margin for escalation |
llm_judge_provider |
str |
"" |
"openai", "anthropic", or "local" |
llm_judge_model |
str |
"" |
Model name for judge |
privacy_mode |
bool |
False |
Redact PII before sending |
Vector Store¶
| Field | Type | Default | Description |
|---|---|---|---|
vector_backend |
str |
"memory" |
"memory" or "chroma" |
embedding_model |
str |
"BAAI/bge-large-en-v1.5" |
Embedding model ID |
chroma_collection |
str |
"director_ai" |
ChromaDB collection name |
chroma_persist_dir |
str |
"" |
Persistence directory (empty = in-memory) |
reranker_enabled |
bool |
True |
Enable cross-encoder reranking |
reranker_model |
str |
"cross-encoder/ms-marco-MiniLM-L-6-v2" |
Reranker model |
Server¶
| Field | Type | Default | Description |
|---|---|---|---|
server_host |
str |
"0.0.0.0" |
Bind address |
server_port |
int |
8080 |
Port |
server_workers |
int |
1 |
Uvicorn worker count |
cors_origins |
str |
"" |
CORS allowed origins |
metrics_enabled |
bool |
True |
Enable Prometheus metrics |
log_level |
str |
"INFO" |
Logging level |
log_json |
bool |
False |
Structured JSON logging |
Caching¶
| Field | Type | Default | Description |
|---|---|---|---|
cache_size |
int |
1024 |
LRU cache max entries |
cache_ttl |
float |
300.0 |
Cache entry TTL (seconds) |
redis_url |
str |
"" |
Redis URL for distributed caching |
Full API¶
director_ai.core.config.DirectorConfig
dataclass
¶
DirectorConfig(mode: str = 'auto', coherence_threshold: float = 0.6, hard_limit: float = 0.5, soft_limit: float = 0.6, use_nli: bool = False, nli_model: str = 'yaxili96/FactCG-DeBERTa-v3-Large', nli_max_length: int = 512, max_candidates: int = 3, history_window: int = 5, llm_provider: str = 'mock', llm_api_url: str = '', llm_api_key: str = '', llm_model: str = '', llm_temperature: float = 0.8, llm_max_tokens: int = 512, llm_judge_enabled: bool = False, llm_judge_confidence_threshold: float = 0.3, llm_judge_provider: str = '', llm_judge_model: str = '', llm_judge_local_model: str = '', privacy_mode: bool = False, scorer_backend: str = 'deberta', nli_devices: str = '', vector_backend: str = 'memory', embedding_model: str = 'BAAI/bge-large-en-v1.5', chroma_collection: str = 'director_ai', chroma_persist_dir: str = '', hybrid_retrieval: bool = True, reranker_enabled: bool = True, reranker_model: str = 'cross-encoder/ms-marco-MiniLM-L-6-v2', reranker_top_k_multiplier: int = 3, retrieval_abstention_threshold: float = 0.3, redis_url: str = '', redis_prefix: str = 'dai:', cache_size: int = 1024, cache_ttl: float = 300.0, server_host: str = '0.0.0.0', server_port: int = 8080, server_workers: int = 1, cors_origins: str = '', onnx_path: str = '', onnx_batch_size: int = 16, onnx_flush_timeout_ms: float = 10.0, batch_max_concurrency: int = 4, review_queue_enabled: bool = False, review_queue_max_batch: int = 32, review_queue_flush_timeout_ms: float = 10.0, metrics_enabled: bool = True, log_level: str = 'INFO', log_json: bool = False, otel_enabled: bool = False, audit_log_path: str = '', audit_postgres_url: str = '', tenant_routing: bool = False, rate_limit_enabled: bool = False, sanitize_inputs: bool = True, sanitizer_block_threshold: float = 0.8, redact_pii: bool = False, w_logic: float = 0.0, w_fact: float = 0.0, metrics_require_auth: bool = True, rate_limit_rpm: int = 0, rate_limit_strict: bool = False, api_keys: list[str] = list(), api_key_tenant_map: str = '', stats_backend: str = 'prometheus', stats_db_path: str = '~/.director-ai/stats.db', source_endpoint_enabled: bool = True, source_repository_url: str = 'https://github.com/anulum/director-ai', license_key: str = '', license_file: str = '', nli_fact_inner_agg: str = 'max', nli_fact_outer_agg: str = 'max', nli_logic_inner_agg: str = 'max', nli_logic_outer_agg: str = 'max', nli_premise_ratio: float = 0.4, nli_fact_retrieval_top_k: int = 3, nli_use_prompt_as_premise: bool = False, nli_summarization_baseline: float = 0.2, nli_claim_coverage_enabled: bool = True, nli_claim_support_threshold: float = 0.6, nli_claim_coverage_alpha: float = 0.4, adaptive_threshold_enabled: bool = True, threshold_summarization: float = 0.72, threshold_qa: float = 0.69, threshold_fact_check: float = 0.56, threshold_rag: float = 0.78, threshold_dialogue: float = 0.68, nli_chunk_overlap_ratio: float = 0.5, nli_qa_premise_ratio: float = 0.7, nli_confidence_weighted_agg: bool = True, lora_adapter_path: str = '', meta_classifier_path: str = '', grpc_max_message_mb: int = 4, grpc_deadline_seconds: float = 30.0, profile: str = 'default', extra: dict[str, str] = dict(), _REDACTED_FIELDS: frozenset[str] = frozenset({'llm_api_key', 'api_keys', 'api_key_tenant_map', 'audit_postgres_url', 'redis_url'}))
Central configuration for Director-Class AI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coherence_threshold
|
float — minimum coherence to approve (0.0-1.0).
|
|
0.6
|
hard_limit
|
float — safety kernel emergency stop threshold.
|
|
0.5
|
use_nli
|
bool — enable DeBERTa NLI model for logical divergence.
|
|
False
|
nli_model
|
str — HuggingFace model ID for NLI.
|
|
'yaxili96/FactCG-DeBERTa-v3-Large'
|
max_candidates
|
int — number of LLM candidates to generate.
|
|
3
|
history_window
|
int — scorer rolling history size.
|
|
5
|
llm_provider
|
str — LLM backend: mock, openai, anthropic,
|
huggingface, or local. |
'mock'
|
llm_api_url
|
str — API endpoint URL (for "local" provider).
|
|
''
|
llm_api_key
|
str — API key (for cloud providers).
|
|
''
|
llm_model
|
str — model name for cloud providers.
|
|
''
|
llm_temperature
|
float — sampling temperature.
|
|
0.8
|
llm_max_tokens
|
int — maximum tokens per response.
|
|
512
|
vector_backend
|
str — "memory" or "chroma".
|
|
'memory'
|
chroma_collection
|
str — ChromaDB collection name.
|
|
'director_ai'
|
chroma_persist_dir
|
str — ChromaDB persistence directory (None=in-memory).
|
|
''
|
onnx_path
|
str — directory with exported ONNX model (for scorer_backend="onnx").
|
|
''
|
server_host
|
str — FastAPI server bind address.
|
|
'0.0.0.0'
|
server_port
|
int — FastAPI server port.
|
|
8080
|
server_workers
|
int — Uvicorn worker count.
|
|
1
|
batch_max_concurrency
|
int — max concurrent batch requests.
|
|
4
|
metrics_enabled
|
bool — enable Prometheus-style metrics collection.
|
|
True
|
log_level
|
str — logging level.
|
|
'INFO'
|
log_json
|
bool — structured JSON logging.
|
|
False
|
from_env
classmethod
¶
Load configuration from environment variables.
Reads DIRECTOR_<FIELD> env vars (case-insensitive field matching).
Example: DIRECTOR_COHERENCE_THRESHOLD=0.7
from_yaml
classmethod
¶
Load configuration from a YAML file.
Falls back to JSON parsing if PyYAML is not installed.
from_profile
classmethod
¶
Load a predefined profile.
Profiles
"fast"— heuristic scoring only, no NLI model, low latency."thorough"— NLI + RAG scoring, higher accuracy."research"— NLI + RAG + reranker, all scoring modules enabled.
configure_logging
¶
Apply log_level and log_json settings to the DirectorAI logger hierarchy.
build_store
¶
Construct a VectorGroundTruthStore from config fields.
In general mode, returns a bare GroundTruthStore (no vector backend).
In grounded and auto modes, builds the full vector pipeline.
build_scorer
¶
Construct a CoherenceScorer wired to all relevant config fields.